Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: July 2017



bp_mapin - allocate virtual address space


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

void bp_mapin(struct buf *bp);

Interface Level

Architecture independent level 1 (DDI/DKI).



Pointer to the buffer header structure.


The bp_mapin() function makes buffer data accessible to a driver by mapping the data into a contiguous kernel virtual address region. After bp_mapin(), the mapped buffer is accessible via the bp—>b_un.b_addr field of the buf(9S) structure.

If bp_mapin() is unable to establish a mapping, it returns without allocating space and no mapping is performed.

Any resources associated with establishing the mapping are deallocated by the bp_mapout(9F) function.


The bp_mapin() function can be called from user and kernel contexts.

See Also

bioaligned(9F), bp_mapout(9F), buf(9S)

Writing Device Drivers for Oracle Solaris 11.3


Because bp_mapin() does not keep a reference count, bp_mapout() will wipe out any kernel mapping, including mappings that a layer above the device driver might still rely on. See bp_mapout(9F) for details.

When a driver needs to look directly at buffer data, it should call bp_mapin() without conditioning the call on other aspects of the buf(9S) structure like b_flags.

To check alignment of buffer memory, it may be more efficient for a driver to use bioaligned(9F) instead of bp_mapin().