FreeBSD/sys/dev/xen/blkback/blkback.c
/**
 * Given a page index and 512b sector offset within that page, calculate
 * an offset into the local psuedo-physical address space used to map a
 * front-end's request data into a request.
 *
 * \param reqlist The request list structure whose pseudo-physical region
 *                will be accessed.
 * \param pagenr  The page index used to compute the pseudo-physical offset.
 * \param sector  The 512b sector index used to compute the page relative
 *                pseudo-physical offset.
 *
 * \return  The computed global pseudo-phsyical address.
 *
 * Depending on configuration, this will either be a local bounce buffer
 * or a pointer to the memory mapped in from the front-end domain for
 * this request.
 */
Given a page index and 512b sector offset within that page, calculate
an offset into the local psuedo-physical address space used to map a
front-end's request data into a request.

\param reqlist The request list structure whose pseudo-physical region
will be accessed.
\param pagenr  The page index used to compute the pseudo-physical offset.
\param sector  The 512b sector index used to compute the page relative
pseudo-physical offset.

\return  The computed global pseudo-phsyical address.

Depending on configuration, this will either be a local bounce buffer
or a pointer to the memory mapped in from the front-end domain for
this request.
Given a page index and 512b sector offset within that page calculate an offset into the local psuedo - physical address space used to map a front - end ' s request data into a request . \ param reqlist The request list structure whose pseudo - physical region will be accessed . \ param pagenr The page index used to compute the pseudo - physical offset . \ param sector The 512b sector index used to compute the page relative pseudo - physical offset . \ return The computed global pseudo - phsyical address . Depending on configuration this will either be a local bounce buffer or a pointer to the memory mapped in from the front - end domain for this request .
static inline uintptr_t
xbb_get_gntaddr(struct xbb_xen_reqlist *reqlist, int pagenr, int sector)
{
	struct xbb_softc *xbb;
	xbb = reqlist->xbb;
	return ((uintptr_t)(xbb->gnt_base_addr +
		(uintptr_t)(reqlist->kva - xbb->kva) +
		(PAGE_SIZE * pagenr) + (sector << 9)));
}
static inline uintptr_t xbb_get_gntaddr ( struct xbb_xen_reqlist * reqlist , int pagenr , int sector ) { struct xbb_softc * xbb ; xbb = reqlist -> xbb ; return ( ( uintptr_t ) ( xbb -> gnt_base_addr + ( uintptr_t ) ( reqlist -> kva - xbb -> kva ) + ( PAGE_SIZE * pagenr ) + ( sector << 9 ) ) ) ; }
Given a page index and 512b sector offset within that page, calculate
 an offset into the local psuedo-physical address space used to map a
 front-end's request data into a request.
Given a page index and 512b sector offset within that page calculate an offset into the local psuedo - physical address space used to map a front - end ' s request data into a request .