Block I/O Completion Routines
As seen in the previous section, after processing a block-centric I/O request, you must inform the kernel with:
#include <sys/bio.h> void biodone(struct bio *bp); void biofinish(struct bio *bp, struct devstat *stat, int error);
The biodone
function tells the kernel that the block-centric I/O request bp
has been serviced successfully.
The biofinish
function is identical to biodone
, except that it sets bp
to return the error code error
(that is to say, biofinish
can tell the kernel that bp
was invalid, successful, or unsuccessful).
Note
Typically, the stat
argument is set to NULL
. For more on struct devstat
, see the devstat(9)
manual page (though it’s somewhat antiquated).
Get FreeBSD Device Drivers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.