package xen-gnt

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Gnt.GnttabSource

Sourcetype interface

A connection to the grant device, needed for mapping/unmapping

Sourceval interface_open : unit -> interface

Open a connection to the grant device. This must be done before any calls to map or unmap.

Sourceval interface_close : interface -> unit

Close a connection to the grant device. Any future calls to map or unmap will fail.

Sourcetype grant = {
  1. domid : int;
    (*

    foreign domain who is exporting memory

    *)
  2. 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.

Sourcemodule Local_mapping : sig ... end
Sourceval map_exn : interface -> grant -> bool -> Local_mapping.t

map_exn if grant writable creates a single mapping from grant that will be writable if writable is true.

Sourceval map : interface -> grant -> bool -> Local_mapping.t option

Like the above but wraps the result in an option instead of raising an exception.

Sourceval mapv_exn : interface -> grant list -> bool -> Local_mapping.t

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.

Sourceval mapv : interface -> grant list -> bool -> Local_mapping.t option

Like the above but wraps the result in an option instead of raising an exception.

Sourceval unmap_exn : interface -> Local_mapping.t -> unit

Unmap a single mapping (which may involve multiple grants). Throws a Failure if unsuccessful.

Sourceval with_gnttab : (interface -> 'a) -> 'a

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.

Sourceval with_mapping : interface -> grant -> bool -> (Local_mapping.t option -> 'a Lwt.t) -> 'a Lwt.t

with_mapping if grant writable f maps grant and calls f on the result.

OCaml

Innovation. Community. Security.