handle block device input and output
void prefixstrategy (struct buf *bp);
entry point routine handles the data transfer
through the buffer cache that is used by block devices.
Block drivers must include a
routine to initiate the transfer,
validate the buffer header information,
and generate the device operations
required to start the data transfer.
pointer to a buf data structure.
The pointer is the address of an instance of
the buf data structure that is defined in
the <sys/buf.h> header file.
All information about the data transfer
is contained in this structure.
The pointer is also used to return status and error information
to the kernel and convey the information to the user.
routine should perform the following activities:
Get and validate the device number
Schedule block I/O requests
Call subordinate driver routines (if any)
to notify a controller than an I/O operation is waiting
If the device can only handle
one I/O operation at a time,
routine must cause the process to sleep
until the device is available.
a sequential access device such as a tape drive
should handle only one read/write operation at a time.
Handle any errors occurring during the read/write operation
Log device errors to the hard disk error log
If an error occurs,
b_error member of the buf structure
and OR the B_ERROR flag into the b_flags member.
The test should be for B_READ and ``not'' B_READ .
B_WRITE cannot be tested because it is not a flag,
it is 0.
You must also supply a
routine for the kernel to call
to output a message to the console and putbuf structure.
Context and synchronization
The driver can block but cannot do operations such as
that require access to
the requesting process's address space.
1, 2, 2mp, 3, 3mp, 4, 4mp, 5, 5mp, 6, 6mp
SVR5 DDI compatibility
entry point routine provides the same functionality
for DDI versions prior to DDI 8.
Beginning with DDI 8,
entry point routine for
both block and raw access I/O operations.
Drivers that contain a
routine must have a b in the second column of the
file to indicate that it is a block device.
The kernel expects a
routine for every block driver that is configured.
``Buffered I/O buffers, allocating'' in HDK Technical Reference
``Block device drivers'' in HDK Technical Reference
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 5 HDK - June 2005