DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SCO OpenServer

clrbuf(D3oddi)


clrbuf -- zero a block I/O buffer

Synopsis

#include <sys/buf.h>

void clrbuf(struct buf *bp);

Description

The clrbuf routine zeroes a buffer previously allocated with the geteblk(D3oddi) function.

Arguments


bp
Pointer to a buffer header, returned by the geteblk(D3oddi) function.

Return values

None.

Usage

clrbuf( ) zeroes the data pointed to by the address in bp->b_un.b_words for the number of bytes specified in bp->b_bcount. clrbuf also sets bp->b_resid to zero (0). b_words, b_bcount, and b_resid are members in the buf structure that is defined in the <sys/buf.h> header file.

Call the geteblk(D3oddi) 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_bcount is set to a value the same as, or less than, the size of the buffer. If b_bcount is set to a value larger than the current buffer size, data may be destroyed. b_bcount is set to SBUFSIZE by the geteblk( ) function. SBUFSIZE is defined in <sys/param.h> and varies according to system buffer size.

Context and synchronization

Non-blockable, interrupt, user, or blockable context.

Hardware applicability

All

Version applicability

oddi: 1, 2, 2mp, 3, 3mp, 4, 4mp, 5, 5mp, 6, 6mp

SVR5 DDI compatibility

clrbuf(D3) is the DDI equivalent for this function. Note that, for DDI drivers, the virtual memory that is zeroed by clrbuf( ) must first be allocated with the bp_mapin(D3) function.

References

geteblk(D3oddi)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 5 HDK - June 2005