DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5

uiobuf(D3)


uiobuf -- set buffer address type to BA_UIO for a specified uio structure

Synopsis

   #include <sys/types.h>
   #include <sys/buf.h>
   #include <sys/uio.h>
   #include <sys/ddi.h>
   

buf_t *uiobuf(buf_t *bp, uio_t *uiop);

Description

uiobuf( ) sets a buf(D4) buffer's addrtype member to BA_UIO for a specified uio(D4) structure.

Arguments


bp
pointer to the buf(D4) structure as returned by the getrbuf(D3) function. If bp is NULL, uiobuf( ) allocates a new buffer as if the getrbuf( ) function had been called.

uiop
pointer to the uio(D4) structure.

Return values

If bp is non-NULL, uiobuf( ) cannot fail and always returns the bp parameter.

If bp is NULL, then on success, uiobuf( ) returns the address of the newly allocated buffer header or NULL on failure.

Usage

uiobuf( ) is used in ioctl(D2) entry point routines that need to access data through DMA or as a kernel virtual location. These are indicated by the value of the b_addrtype member of the buf structure, which is set to BA_SCGTH for DMA and to BA_KVIRT for kernel virtual.

To do this, the driver's ioctl(D2) entry point routine does the following:

  1. Populate a uio(D4) structure that points to the desired user data buffer.

  2. Call uiobuf( ) to associate this user data buffer with a buf(D4) structure.

  3. Call the buf_breakup(D3) function with this buf_t and a bcb(D4) structure that describes the desired non-BA_UIO address type(s).
The driver function specified to buf_breakup( ) is then called, with the data in the appropriate form.

Drivers that want to use the uio(D4) structure directly do not need to use this function, but can use the uiomove(D3), ureadc(D3), and/or uwritec(D3) functions.

Context and synchronization

If bp is non-NULL, all contexts.

If bp is NULL, blockable context only.

Hardware applicability

All

Version applicability

ddi: 8, 8mp

Differences between versions

References

buf(D4), buf_breakup(D3), ioctl(D2), uio(D4) uiomove(D3), ureadc(D3), uwritec(D3)


19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005