Re: [Xen-devel] [PATCH XEN v4 08/23] tools/libxc: Remove osdep indirection for privcmd

2015-10-29 Thread Wei Liu
On Wed, Oct 21, 2015 at 04:23:15PM +0100, Ian Campbell wrote:
> The alternative backend (a xen-api/xapi shim) is no longer around and
> so this stuff is now just baggage which is getting in the way of
> refactoring libxenctrl.
> 
> Nested virt probably suffices for this use case now.
> 
> This was the last component of the osdep infrastructure, so all the
> dynamic loading etc stuff all falls away too.
> 
> As part of this I was forced to investigate the twisty
> xc_map_foreign_* maze, which I have added to the
> toolstack-library-apis doc in the hopes of doing something sensible.
> 
> NetBSD and Solaris now call xc_map_foreign_bulk_compat directly from
> their xc_map_foreign_bulk, which could have been achieved by using
> some ifdefs around a renamed function. This will fall out in the wash
> when these functions move to their own library.
> 
> Signed-off-by: Ian Campbell 
> Acked-by: David Scott 
> Cc: David Scott 

Acked-by: Wei Liu 

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


[Xen-devel] [PATCH XEN v4 08/23] tools/libxc: Remove osdep indirection for privcmd

2015-10-21 Thread Ian Campbell
The alternative backend (a xen-api/xapi shim) is no longer around and
so this stuff is now just baggage which is getting in the way of
refactoring libxenctrl.

Nested virt probably suffices for this use case now.

This was the last component of the osdep infrastructure, so all the
dynamic loading etc stuff all falls away too.

As part of this I was forced to investigate the twisty
xc_map_foreign_* maze, which I have added to the
toolstack-library-apis doc in the hopes of doing something sensible.

NetBSD and Solaris now call xc_map_foreign_bulk_compat directly from
their xc_map_foreign_bulk, which could have been achieved by using
some ifdefs around a renamed function. This will fall out in the wash
when these functions move to their own library.

Signed-off-by: Ian Campbell 
Acked-by: David Scott 
Cc: David Scott 
---
 config/FreeBSD.mk   |   2 -
 config/NetBSD.mk|   3 -
 config/NetBSDRump.mk|   1 -
 config/StdGNU.mk|   1 -
 config/SunOS.mk |   1 -
 tools/libxc/Makefile|  27 ++
 tools/libxc/include/xenctrl.h   |   9 --
 tools/libxc/include/xenctrlosdep.h  | 133 ---
 tools/libxc/xc_foreign_memory.c |  31 +--
 tools/libxc/xc_freebsd_osdep.c  | 100 ++---
 tools/libxc/xc_hcall_buf.c  |   6 +-
 tools/libxc/xc_linux_osdep.c|  88 ++
 tools/libxc/xc_minios.c |  82 +
 tools/libxc/xc_netbsd.c |  90 +++
 tools/libxc/xc_private.c| 174 ++--
 tools/libxc/xc_private.h|  19 ++--
 tools/libxc/xc_solaris.c|  90 +++
 tools/libxc/xenctrl_osdep_ENOSYS.c  | 123 -
 tools/ocaml/libs/xc/xenctrl.ml  |   2 -
 tools/ocaml/libs/xc/xenctrl.mli |   1 -
 tools/ocaml/libs/xc/xenctrl_stubs.c |   7 --
 tools/ocaml/xenstored/domains.ml|   6 +-
 tools/ocaml/xenstored/xenstored.ml  |   5 +-
 23 files changed, 178 insertions(+), 823 deletions(-)
 delete mode 100644 tools/libxc/include/xenctrlosdep.h
 delete mode 100644 tools/libxc/xenctrl_osdep_ENOSYS.c

diff --git a/config/FreeBSD.mk b/config/FreeBSD.mk
index 5a13d607..bb3a5d0 100644
--- a/config/FreeBSD.mk
+++ b/config/FreeBSD.mk
@@ -1,6 +1,4 @@
 include $(XEN_ROOT)/config/StdGNU.mk
 
-DLOPEN_LIBS =
-
 # No wget on FreeBSD base system
 WGET = ftp
diff --git a/config/NetBSD.mk b/config/NetBSD.mk
index 21318d6..cf766e5 100644
--- a/config/NetBSD.mk
+++ b/config/NetBSD.mk
@@ -1,6 +1,3 @@
 include $(XEN_ROOT)/config/StdGNU.mk
 
-# Override settings for this OS
-DLOPEN_LIBS =
-
 WGET = ftp
diff --git a/config/NetBSDRump.mk b/config/NetBSDRump.mk
index 2a87218..74755a1 100644
--- a/config/NetBSDRump.mk
+++ b/config/NetBSDRump.mk
@@ -1,6 +1,5 @@
 include $(XEN_ROOT)/config/StdGNU.mk
 
-DLOPEN_LIBS =
 PTHREAD_LIBS =
 
 WGET = ftp
diff --git a/config/StdGNU.mk b/config/StdGNU.mk
index 129d5c8..39d36b2 100644
--- a/config/StdGNU.mk
+++ b/config/StdGNU.mk
@@ -31,7 +31,6 @@ DEBUG_DIR ?= /usr/lib/debug
 
 SOCKET_LIBS =
 UTIL_LIBS = -lutil
-DLOPEN_LIBS = -ldl
 
 SONAME_LDFLAG = -soname
 SHLIB_LDFLAGS = -shared
diff --git a/config/SunOS.mk b/config/SunOS.mk
index db5e898..86a384d 100644
--- a/config/SunOS.mk
+++ b/config/SunOS.mk
@@ -27,7 +27,6 @@ SunOS_LIBDIR_x86_64 = /usr/sfw/lib/amd64
 SOCKET_LIBS = -lsocket
 PTHREAD_LIBS = -lpthread
 UTIL_LIBS =
-DLOPEN_LIBS = -ldl
 
 SONAME_LDFLAG = -h
 SHLIB_LDFLAGS = -R $(SunOS_LIBDIR) -shared
diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile
index 33d18db..3305fdd 100644
--- a/tools/libxc/Makefile
+++ b/tools/libxc/Makefile
@@ -101,8 +101,6 @@ GUEST_SRCS-y += 
xc_dom_decompress_unsafe_lzo1x.c
 GUEST_SRCS-y += xc_dom_decompress_unsafe_xz.c
 endif
 
-OSDEP_SRCS-y += xenctrl_osdep_ENOSYS.c
-
 -include $(XEN_TARGET_ARCH)/Makefile
 
 CFLAGS   += -Werror -Wmissing-prototypes
@@ -121,11 +119,8 @@ CTRL_PIC_OBJS := $(patsubst %.c,%.opic,$(CTRL_SRCS-y))
 GUEST_LIB_OBJS := $(patsubst %.c,%.o,$(GUEST_SRCS-y))
 GUEST_PIC_OBJS := $(patsubst %.c,%.opic,$(GUEST_SRCS-y))
 
-OSDEP_LIB_OBJS := $(patsubst %.c,%.o,$(OSDEP_SRCS-y))
-OSDEP_PIC_OBJS := $(patsubst %.c,%.opic,$(OSDEP_SRCS-y))
-
-$(CTRL_LIB_OBJS) $(GUEST_LIB_OBJS) $(OSDEP_LIB_OBJS) \
-$(CTRL_PIC_OBJS) $(GUEST_PIC_OBJS) $(OSDEP_PIC_OBJS) : CFLAGS += -include 
$(XEN_ROOT)/tools/config.h
+$(CTRL_LIB_OBJS) $(GUEST_LIB_OBJS) \
+$(CTRL_PIC_OBJS) $(GUEST_PIC_OBJS): CFLAGS += -include 
$(XEN_ROOT)/tools/config.h
 
 $(CTRL_LIB_OBJS) $(CTRL_PIC_OBJS): CFLAGS += $(CFLAGS_libxengnttab) 
$(CFLAGS_libxengntshr)
 
@@ -139,17 +134,13 @@ ifneq ($(nosharedlibs),y)
 LIB += libxenguest.so libxenguest.so.$(MAJOR) libxenguest.so.$(MAJOR).$(MINOR)
 endif
 
-ifneq ($(nosharedlibs),y)
-LIB += xenctrl_osdep_ENOSYS.so
-endif
-
 genpath-target = $(call buildmakevars2header,_paths.h)
 $(eval $(genpath-target))
 
 xc_private.h: _pa