.TH "buf" "" "" "Internal Data Structure"
.PC "Buffer cache"
.B "#include <sys/buf.h>"
.PP
.II "buffer cache"
A
.I "buffer cache"
is an area of memory that holds data being written to
or read from a device.
The kernel gives each block-special device its own buffer cache.
The kernel, in turn,
assigns to each buffer cache a copy of the structure
.BR BUF ,
which the kernel uses to manipulate that buffer cache.
It is defined in header file
.BR <sys/buf.h> ,
and contains the following fields:
.IP \fBb_dev\fR 1.0i
This is a
.B dev_t
structure that describes the device being buffered.
.II major()
.II minor()
Use kernel macros
.B major()
and
.B minor()
to translate this structure into the device's major and minor numbers.
.IS \fBb_bno\fR
This gives the number of the starting block.
.IS \fBb_req\fR
This is the type of I/O requested, either
.B BREAD
or
.BR BWRITE .
.IS \fBb_count\fR
This gives the number of bytes to read or write.
.IS \fBb_resid\fR
This gives the number of bytes that remain to be transferred.
Zero indicates that all data transferred correctly, i.e., that
an error did not occur.
.IS \fBb_paddr\fR
This gives the system global (DMA) address for the data.
.IS \fBb_vaddr\fR
This field gives the virtual (non-DMA) address for the data.
.PP
See file
.B <sys/buf.h>
for full details on this structure.
.SH "See Also"
.B
internal data structures
.R
