BUF_LOCK - General: Locks the specified I/O buffer
struct buf *bp );
Specifies a pointer to a buf structure.
The BUF_LOCK routine locks the specified I/O buffer. The
routine masks all disk and tape controller interrupts (by
calling the splbio routine). It sets the mutual exclusion
buffer lock member, b_lock, of the specified buf structure
The BUF_LOCK routine then sets the b_flags member of the
specified buf structure pointer to B_BUSY to indicate that
this buffer is being used. Finally, BUF_LOCK resets the
CPU priority level (by calling the splx routine).
You should design in your kernel modules to hold the I/O
buffer lock for as short a period of time as possible to
allow maximum concurrency. You should also release the I/O
buffer lock by calling the BUF_UNLOCK routine before
returning from the module's entry point.
[ Back ]