Driver Entry Points strategy(9E)
NAME
strategy - perform block I/O
SYNOPSIS
#include
#include
#include
#include
int prefixstrategy(struct buf *bp);
INTERFACE LEVEL
Architecture independent level 1 (DI/DKI). This entry point
is required for block devices.
PARAMETERS
bp Pointer to the buf(9S) structure.
DESCRIPTION
The strategy() routine is called indirectly (through
cbops(9S)) by the kernel to read and write blocks of data
on the block device. strategy() 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 stra-
tegy() routine's responsibility is to set up and initiate
the transfer.
In general, strategy() should not block. It can, however,
perform a kmemcachecreate(9F) with both the KMPUSHPAGE
and KMSLEP flags set, which might block, without causing
deadlock in low memory situations.
RETURN VALUES
The strategy() function must return 0. On an error condi-
tion, it should call bioerror(9F) to set bflags to the
proper error code, and call biodone(9F). Note that a partial
transfer is not considered to be an error.
SEE ALSO
ioctl(9E), read(9E), write(9E), biodone(9F), bioerror(9F),
buf(9S), cbops(9S), kmemcachecreate(9F)
Writing Device Drivers
SunOS 5.11 Last change: 6 Nov 2003 1
|