Re: [Xen-devel] [PATCH XEN v4 13/23] tools: Refactor foreign memory mapping into libxenforeignmemory

2015-10-29 Thread Wei Liu
On Wed, Oct 21, 2015 at 04:23:20PM +0100, Ian Campbell wrote:
> 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.
> 
> Upon request (via #define XC_WANT_COMPAT_MAP_FOREIGN_API) libxenctrl
> will provide a compat API for the old names. This is used by qemu-xen
> and qemu-trad as well as various in tree things (which required
> de-dupping various #includes in some too to get the #define before the
> first).
> 
> Signed-off-by: Ian Campbell 

Acked-by: Wei Liu 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH XEN v4 13/23] tools: Refactor foreign memory mapping into libxenforeignmemory

2015-10-21 Thread Ian Campbell
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.

Upon request (via #define XC_WANT_COMPAT_MAP_FOREIGN_API) libxenctrl
will provide a compat API for the old names. This is used by qemu-xen
and qemu-trad as well as various in tree things (which required
de-dupping various #includes in some too to get the #define before the
first).

Signed-off-by: Ian Campbell 
---
Must be applied with:
  - "qemu-xen-traditional: qemu-xen-traditional: Add
libxenforeignmemory to rpath-link" and a corresponding QEMU_TAG
update folded here.
  - "mini-os: mini-os: Include libxenforeignmemory with libxc" and a
corresponding bump to MINIOS_UPSTREAM_REVISION folded in here.
---
 .gitignore |  2 +
 stubdom/Makefile   | 20 -
 tools/Makefile |  2 +
 tools/Rules.mk | 11 ++-
 tools/console/daemon/utils.c   |  1 -
 tools/console/daemon/utils.h   |  1 +
 tools/libs/Makefile|  1 +
 tools/libs/foreignmemory/Makefile  | 67 +++
 tools/libs/foreignmemory/compat.c  | 72 
 tools/libs/foreignmemory/core.c| 68 
 .../foreignmemory/freebsd.c}   | 33 +++-
 .../libs/foreignmemory/include/xenforeignmemory.h  | 71 
 tools/libs/foreignmemory/libxenforeignmemory.map   |  7 ++
 .../foreignmemory/linux.c} | 70 +++-
 tools/libs/foreignmemory/minios.c  | 62 ++
 tools/libs/foreignmemory/netbsd.c  | 95 ++
 tools/libs/foreignmemory/private.h | 47 +++
 tools/libs/foreignmemory/solaris.c | 94 +
 tools/libxc/Makefile   |  8 +-
 tools/libxc/include/xenctrl.h  | 26 --
 tools/libxc/include/xenctrl_compat.h   | 36 
 tools/libxc/xc_foreign_memory.c| 49 +--
 tools/libxc/xc_minios.c| 29 ---
 tools/libxc/xc_netbsd.c| 73 -
 tools/libxc/xc_private.c   | 13 +--
 tools/libxc/xc_private.h   | 11 ++-
 tools/libxc/xc_solaris.c   | 73 -
 tools/libxc/xc_sr_restore.c|  4 +-
 tools/libxc/xc_sr_save.c   |  4 +-
 tools/libxc/xc_vm_event.c  | 10 ++-
 tools/libxc/xg_private.h   |  3 +-
 tools/libxl/libxl_internal.h   |  1 +
 tools/misc/xen-mfndump.c   |  1 +
 tools/ocaml/libs/xc/xenctrl_stubs.c|  1 +
 tools/python/xen/lowlevel/xc/xc.c  |  2 +-
 tools/xenmon/xenbaked.c|  1 +
 tools/xenpaging/pagein.c   |  1 -
 tools/xenpaging/xenpaging.c|  1 -
 tools/xenpaging/xenpaging.h|  2 +
 tools/xenstore/xenstored_core.c|  1 -
 tools/xenstore/xenstored_core.h|  1 +
 tools/xentrace/xenctx.c|  3 +-
 tools/xentrace/xentrace.c  |  1 +
 43 files changed, 740 insertions(+), 339 deletions(-)
 create mode 100644 tools/libs/foreignmemory/Makefile
 create mode 100644 tools/libs/foreignmemory/compat.c
 create mode 100644 tools/libs/foreignmemory/core.c
 rename tools/{libxc/xc_freebsd_osdep.c => libs/foreignmemory/freebsd.c} (76%)
 create mode 100644 tools/libs/foreignmemory/include/xenforeignmemory.h
 create mode 100644 tools/libs/foreignmemory/libxenforeignmemory.map
 rename tools/{libxc/xc_linux_osdep.c => libs/foreignmemory/linux.c} (83%)
 create mode 100644 tools/libs/foreignmemory/minios.c
 create mode 100644 tools/libs/foreignmemory/netbsd.c
 create mode 100644 tools/libs/foreignmemory/private.h
 create mode 100644 tools/libs/foreignmemory/solaris.c

diff --git a/.gitignore b/.gitignore
index 2899852..2549337 100644
--- a/.gitignore
+++ b/.gitignore
@@ -62,6 +62,7 @@ stubdom/libxentoollog-*
 stubdom/libxenevtchn-*
 stubdom/libxengnttab-*
 stubdom/libxencall-*
+stubdom/libxenforeignmemory-*
 stubdom/libxc-*
 stubdom/lwip-*
 stubdom/mini-os-*
@@ -92,6 +93,7 @@ tools/libs/toollog/headers.chk
 tools/libs/evtchn/headers.chk
 tools/libs/gnttab/headers.chk
 tools/libs/call/headers.chk
+tools/libs/foreignmemory/headers.chk
 tools/blktap2/daemon/blktapctrl
 tools/blktap2/drivers/img2qcow
 tools/blktap2/drivers/lock-util
d