Sets up addressability in the current process context.
#include <sys/adspace.h>
int xm_mapin (dp, baddr, count, eaddr)
struct xmem *dp;caddr_t baddr;
size_t count;
caddr_t *eaddr;
The xm_mapin kernel service sets up addressability in the current process context to the address space indicated by the cross memory descriptor pointed to by the dp parameter for the addresses [baddr, baddr + count - 1].
This service is created specifically for Client File Systems, or others who need to setup addressability to an address space defined by an xmem descriptor.
If the requested mapping spans a segment boundary, no mapping will be performed, and a return code of EAGAIN is returned to indicate that individual calls to the xm_mapin kernel service are necessary to map the portions of the buffer in each segment. The xm_mapin kernel service must be called again with the original baddr and a count indicating the number of bytes to the next segment. (The number of bytes to the next segment boundary can be obtained using the xm_maxmap kernel service.) This will provide an effective address to use for accessing this portion of the buffer. Then, iteratively, xm_mapin must be called with the segment boundary address (previous baddr + count), and a new count indicating the remainder of the buffer or the next segment boundary, whichever is smaller. This will provide another effective address to use for accessing the next portion of the buffer.
Each address set up by the xm_mapin kernel service must be undone with the xm_det kernel service when it is no longer needed because the xm_mapin kernel service currently uses the vm_att kernel service.
Item | Description |
---|---|
dp | Points to the cross memory descriptor. |
baddr | Points to the virtual buffer. |
count | Specifies the length of the virtual buffer to map. |
eaddr | Points to where the effective address to access the data buffer is returned. |
Item | Description |
---|---|
0 | Successful. (Reference Parameter eaddr contains the address to use) |
XMEM_FAIL | Invalid cross memory descriptor. |
EAGAIN | Segment boundary crossing encountered. Caller should make separate xm_mapin calls to map each segments worth. |
The xm_mapin kernel service can be called from the process or interrupt environments.