STRATEGY(9E)STRATEGY(9E)NAMEstrategy - perform block I/O
int prefixstrategy(struct buf *bp);
Architecture independent level 1 (DDI/DKI). This entry point is
required for block devices.
Pointer to the buf(9S) structure.
The strategy() routine is called indirectly (through cb_ops(9S)) by the
kernel to read and write blocks of data on the block device. strat‐
egy() may also be called directly or indirectly to support the raw
character interface of a block device (read(9E), write(9E) and
ioctl(9E)). The strategy() routine's responsibility is to set up and
initiate the transfer.
In general, strategy() should not block. It can, however, perform a
kmem_cache_create(9F) with both the KM_PUSHPAGE and KM_SLEEP flags set,
which might block, without causing deadlock in low memory situations.
The strategy() function must return 0. On an error condition, it should
call bioerror(9F) to set b_flags to the proper error code, and call
biodone(9F). Note that a partial transfer is not considered to be an
SEE ALSOioctl(9E), read(9E), write(9E), biodone(9F), bioerror(9F), buf(9S),
Writing Device Drivers
Nov 6, 2003 STRATEGY(9E)