'\"macro stdmacro
.if n .pH ddi_dki.getrbuf @(#)getrbuf	40.6 of 10/10/89
.\" Copyright 1989 AT&T
.de IX
.ie '\\n(.z'' .tm .Index: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9	\\n%
.el \\!.IX \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
..
.nr X
.if \nX=0 .ds x} getrbuf D3DK "" "DDI/DKI" "\&"
.if \nX=1 .ds x} getrbuf D3DK "" "DDI/DKI"
.if \nX=2 .ds x} getrbuf D3DK "" "\&"
.if \nX=3 .ds x} getrbuf "" "" "\&"
.TH \*(x}
.IX "\f4getrbuf\fP(D3DK)"
.SH NAME
\f4getrbuf\f1 \- get a raw buffer header 
.IX "buffer header"
.SH SYNOPSIS
.nf
.na
\f4#include <sys/buf.h>
#include <sys/kmem.h>
#include <sys/ddi.h>
.sp 0.5
struct buf *getrbuf(long \f2sleepflag\f4);\f1
.ad
.fi
.SH ARGUMENT
.RS 0n 10
.IP "\f2sleepflag\f1" 10n
Indicates whether driver should sleep for free space.
.RE
.SH DESCRIPTION
\f4getrbuf\f1 
allocates the space for a buffer header to the caller.  It is used in
cases where a block driver is performing raw (character interface) I/O
and needs to set up a buffer header that is not associated with the
buffer cache.
.P
\f4getrbuf\f1 calls \f4kmem_alloc\f1(D3DK) to perform the memory
allocation.  \f4kmem_alloc\f1 requires the information included in the
\f2sleepflag\f1 argument.  If \f2sleepflag\f1 is set to
\f4KM_SLEEP\f1, the driver may sleep until the space is freed up.  If
\f2sleepflag\f1 is set to  \f4KM_NOSLEEP\f1, the driver will not
sleep.  In either case, a pointer to the allocated space is returned or
\f4NULL\f1 to indicate that no space was available.
.SH RETURN VALUE
A pointer to the allocated buffer header, or \f4NULL\f1 if no space is
available.
.SH LEVEL
Base or Interrupt (must not sleep if calling from interrupt routine)
.SH SEE ALSO
.na
\f4freerbuf\f1(D3DK),
\f4kmem_alloc\f1(D3DK),
\f4kmem_free\f1(D3DK)
.ad
