[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH XEN v5 13/23] tools: Refactor foreign memory mapping into libxenforeignmemory
Ian Campbell writes ("[PATCH XEN v5 13/23] tools: Refactor foreign memory mapping into libxenforeignmemory"): > libxenforeignmemory will provide a stable API and ABI for mapping > foreign domain memory (subject to appropriate privileges). > > The new library exposes an interface equivalent to > xc_map_foreign_memory_bulk, which all the other > xc_map_foreign_memory_* functions (which remain in libxc) are > implemented in terms of. ... > diff --git a/tools/libs/foreignmemory/include/xenforeignmemory.h > b/tools/libs/foreignmemory/include/xenforeignmemory.h > +/* > + * Return a handle onto the hypercall driver. Logs errors. > + */ > +xenforeignmemory_handle *xenforeignmemory_open(xentoollog_logger *logger, > + unsigned open_flags); `onto the foreign memory driver'. This file should probably say something about fork(). Perhaps just a refernce to the rules in the grant map driver. > +/* > + * Maps a range within one domain to a local address range. Mappings > + * should be unmapped with munmap and should follow the same rules as mmap > + * regarding page alignment. > + * > + * prot is as for mmap(2). > + * > + * Can partially succeed. When a page cannot be mapped, its respective > + * field in @err is set to the corresponding errno value. > + * > + * Returns NULL if no pages can be mapped. ... > +void *xenforeignmemory_map(xenforeignmemory_handle *fmem, uint32_t dom, > + int prot, const xen_pfn_t *arr, int *err, > + unsigned int num); If it returns NULL, will all of *err be filled with errno values ? Ie is all of err[] always written ? Does this function ever set errno ? I would write `int err_out[num]' in the prototype which is a bit clearer about the semantics. This API invites callers to fail to notice partial failures. How about permitting err==NULL to mean `on partial failure, unmap everything and return NULL setting errno' ? Ian. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |