[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 REPOST 04/12] tools/libxenforeignmemory: add support for resource mapping
On Tue, Aug 22, 2017 at 03:50:58PM +0100, Paul Durrant wrote: > diff --git a/tools/libs/foreignmemory/include/xenforeignmemory.h > b/tools/libs/foreignmemory/include/xenforeignmemory.h > index f4814c390f..e56eb3c4d4 100644 > --- a/tools/libs/foreignmemory/include/xenforeignmemory.h > +++ b/tools/libs/foreignmemory/include/xenforeignmemory.h > @@ -138,6 +138,45 @@ int xenforeignmemory_unmap(xenforeignmemory_handle *fmem, > int xenforeignmemory_restrict(xenforeignmemory_handle *fmem, > domid_t domid); > > +typedef struct xenforeignmemory_resource_handle > xenforeignmemory_resource_handle; > + > +/** > + * This function maps a guest resource. > + * > + * @parm fmem handle to the open foreignmemory interface > + * @parm domid the domain id > + * @parm type the resource type > + * @parm id the type-specific resource identifier > + * @parm frame base frame index within the resource > + * @parm nr_frames number of frames to map > + * @parm paddr pointer to an address passed through to mmap(2) > + * @parm prot passed through to mmap(2) > + * @parm flags passed through to mmap(2) Passing mmap flags directly can be troublesome, POSIX only defines MAP_SHARED and MAP_PRIVATE, the rest is OS-specific AFAIK. So we either limit this to POSIX only flags (and enforce it), or we replace it with some xenforeignmemory specific flags that each OS can map to it's equivalents. > --- a/tools/libs/foreignmemory/private.h > +++ b/tools/libs/foreignmemory/private.h > @@ -42,6 +42,36 @@ void *compat_mapforeign_batch(xenforeignmem_handle *fmem, > uint32_t dom, > xen_pfn_t *arr, int num); > #endif > > +struct xenforeignmemory_resource_handle { > + domid_t domid; > + unsigned int type; > + unsigned int id; > + unsigned long frame; > + unsigned long nr_frames; > + void *addr; > + int prot; > + int flags; > +}; > + > +#ifndef __linux__ The common practice in libxenforeign seems to be to add those dummy handlers to each OS-specific file (see osdep_xenforeignmemory_restrict for example) instead of doing it in the header file. Roger. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |