void clrbuf(struct buf bp);
bp->b_un.b_wordsfor the number of bytes specified in
bp->b_bcount. clrbuf also sets
bp->b_residto zero (0).
b_residare members in the buf structure that is defined in the <sys/buf.h> header file.
routine to get a buffer before calling clrbuf. The
geteblk routine assigns a value to
b_bcount. clrbuf must be used to ensure that the
buffer is cleared as geteblk does not clear the
buffer. The standard way to call clrbuf is as follows:
bp = geteblk(); /* Get a buffer */ clrbuf(bp); /* Clear it */If your driver is using a non-standard buffering scheme that is managed with buf headers, ensure that
b_bcountis set to a value the same as, or less than, the size of the buffer. If
b_bcountis set to a value larger than the current buffer size, data may be destroyed.
b_bcountis set to SBUFSIZE by the geteblk( ) function. SBUFSIZE is defined in <sys/param.h> and varies according to system buffer size.