package xen-gnt
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Gnt.Gnttab
Source
A connection to the grant device, needed for mapping/unmapping
Open a connection to the grant device. This must be done before any calls to map or unmap.
Close a connection to the grant device. Any future calls to map or unmap will fail.
type grant = {
domid : int;
(*foreign domain who is exporting memory
*)ref : gntref;
(*id which identifies the specific export in the foreign domain
*)
}
A foreign domain must explicitly "grant" us memory and send us the "reference". The pair of (foreign domain id, reference) uniquely identifies the block of memory. This pair ("grant") is transmitted to us out-of-band, usually either via xenstore during device setup or via a shared memory ring structure.
map_exn if grant writable
creates a single mapping from grant
that will be writable if writable
is true
.
Like the above but wraps the result in an option instead of raising an exception.
mapv_exn if grants writable
creates a single contiguous mapping from a list of grants that will be writable if writable
is true
. Note the grant list can involve grants from multiple domains. If the mapping fails (because at least one grant fails to be mapped), then all grants are unmapped.
Like the above but wraps the result in an option instead of raising an exception.
Unmap a single mapping (which may involve multiple grants). Throws a Failure if unsuccessful.
with_gnttab f
opens an interface to gnttab, passes it to f, then returns the result of f (or re-raises any exceptions) ensuring that the gnttab interface is closed before returning.