FreeBSD/sys/dev/xen/blkback/blkback.c
/**
 * Allocate per-request data structures given request size and number
 * information negotiated with the front-end.
 *
 * \param xbb  Per-instance xbb configuration structure.
 */
Allocate per-request data structures given request size and number
information negotiated with the front-end.

\param xbb  Per-instance xbb configuration structure.
Allocate per - request data structures given request size and number information negotiated with the front - end . \ param xbb Per - instance xbb configuration structure .
static int
xbb_alloc_requests(struct xbb_softc *xbb)
{
	struct xbb_xen_req *req;
	struct xbb_xen_req *last_req;
	xbb->requests = malloc(xbb->max_requests * sizeof(*xbb->requests),
			       M_XENBLOCKBACK, M_NOWAIT|M_ZERO);
	if (xbb->requests == NULL) {
		xenbus_dev_fatal(xbb->dev, ENOMEM, 
				  "Unable to allocate request structures");
		return (ENOMEM);
	}
	req      = xbb->requests;
	last_req = &xbb->requests[xbb->max_requests - 1];
	STAILQ_INIT(&xbb->request_free_stailq);
	while (req <= last_req) {
		STAILQ_INSERT_TAIL(&xbb->request_free_stailq, req, links);
		req++;
	}
	return (0);
}
static int xbb_alloc_requests ( struct xbb_softc * xbb ) { struct xbb_xen_req * req ; struct xbb_xen_req * last_req ; xbb -> requests = malloc ( xbb -> max_requests * sizeof ( * xbb -> requests ) , M_XENBLOCKBACK , M_NOWAIT | M_ZERO ) ; if ( xbb -> requests == NULL ) { xenbus_dev_fatal ( xbb -> dev , ENOMEM , " " ) ; return ( ENOMEM ) ; } req = xbb -> requests ; last_req = & xbb -> requests [ xbb -> max_requests - 1 ] ; STAILQ_INIT ( & xbb -> request_free_stailq ) ; while ( req <= last_req ) { STAILQ_INSERT_TAIL ( & xbb -> request_free_stailq , req , links ) ; req ++ ; } return ( 0 ) ; }
Allocate per-request data structures given request size and number
 information negotiated with the front-end.
Allocate per - request data structures given request size and number information negotiated with the front - end .
/*
	 * Allocate request book keeping datastructures.
	 */