tools: shave build yaks (part two)
PATCH 1/1 tools: shave build yaks (part two)
Version 2, much of the original series has been applied. This is the remainder.
Clean up a bunch of inconsistency, wierdness, cut-and-paste etc in the tools/ build system. All in all it's a bit of a grab bag of stuff I happened to notice as I was trawling
One specific useful thing which comes out of it is to isolate users of libxl from needing to know about libxenstore or libxenctrl.
PATCH 1/1 tools: Remove $(CFLAGS) from links lines
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1301568175 -3600
# Node ID f5ada9268c1a7b4128f63619d252395f014ef238 # Parent b56a21124c7f02979cf96b2404c6ecc0bc48e6f7
tools: Remove $(CFLAGS) from links lines.
The relevant variable in these circumstances is called $(LDFLAGS).
tools/blktap/drivers/Makefile +3 -3
@@ -48,16 +48,16 @@ BLKTAB-OBJS-$(CONFIG_Linux) += blktapctr all: $(IBIN) qcow-util blktapctrl: $(BLKTAB-OBJS-y) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_blktapctrl) + $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS_blktapctrl) tapdisk: tapdisk.o $(BLK-OBJS-y) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_img) + $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS_img) .PHONY: qcow-util qcow-util: img2qcow qcow2raw qcow-create img2qcow qcow2raw qcow-create: %: %.o $(BLK-OBJS-y) - $(CC) $(CFLAGS) $(LDFLAGS) -o $* $^ $(LDLIBS_img) + $(CC) $(LDFLAGS) -o $* $^ $(LDLIBS_img) install: all $(INSTALL_PROG) $(IBIN) $(QCOW_UTIL) $(VHD_UTIL) $(DESTDIR)$(SBINDIR)
tools/blktap/lib/Makefile +1 -1
@@ -42,7 +42,7 @@ clean: rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen TAGS libblktap.so.$(MAJOR).$(MINOR): $(OBJS_PIC) - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,$(SONAME) $(SHLIB_LDFLAGS) \ + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,$(SONAME) $(SHLIB_LDFLAGS) \ -o $@ $^ $(LDLIBS) ln -sf libblktap.so.$(MAJOR).$(MINOR) libblktap.so.$(MAJOR) ln -sf libblktap.so.$(MAJOR) libblktap.so
tools/blktap2/control/Makefile +2 -2
@@ -52,13 +52,13 @@ build: $(IBIN) $(LIB_STATIC) $(LIB_SHARE ln -sf $< $@ tap-ctl: tap-ctl.o $(LIBNAME).so - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ + $(CC) $(LDFLAGS) -o $@ $^ $(LIB_STATIC): $(CTL_OBJS) $(AR) r $@ $^ $(LIB_SHARED): $(CTL_PICS) - $(CC) $(CFLAGS) $(LDFLAGS) -fPIC -Wl,$(SONAME_LDFLAG) -Wl,$(LIBSONAME) $(SHLIB_LDFLAGS) -rdynamic $^ -o $@ + $(CC) $(LDFLAGS) -fPIC -Wl,$(SONAME_LDFLAG) -Wl,$(LIBSONAME) $(SHLIB_LDFLAGS) -rdynamic $^ -o $@ install: $(IBIN) $(LIB_STATIC) $(LIB_SHARED) $(INSTALL_DIR) -p $(DESTDIR)$(SBINDIR)
tools/blktap2/lvm/Makefile +1 -1
@@ -24,7 +24,7 @@ build: $(TEST) $(LVM-OBJS) install: all lvm-util: lvm-util.o - $(CC) $(CFLAGS) -DLVM_UTIL $(LDFLAGS) -o lvm-util lvm-util.c + $(CC) -DLVM_UTIL $(LDFLAGS) -o lvm-util lvm-util.c clean: rm -rf *.o *~ $(DEPS) $(IBIN)
tools/blktap2/vhd/Makefile +2 -2
@@ -31,10 +31,10 @@ LIBS_DEPENDS := lib/libvhd.so lib/vhd. $(LIBS_DEPENDS):subdirs-all vhd-util: vhd-util.o $(LIBS_DEPENDS) - $(CC) $(CFLAGS) $(LDFLAGS) -o vhd-util vhd-util.o $(LIBS) + $(CC) $(LDFLAGS) -o vhd-util vhd-util.o $(LIBS) vhd-update: vhd-update.o $(LIBS_DEPENDS) - $(CC) $(CFLAGS) $(LDFLAGS) -o vhd-update vhd-update.o $(LIBS) + $(CC) $(LDFLAGS) -o vhd-update vhd-update.o $(LIBS) install: all $(MAKE) subdirs-install
tools/blktap2/vhd/lib/Makefile +1 -1
@@ -52,7 +52,7 @@ all: build build: $(LIBVHD-BUILD) libvhd.a: $(LIB-OBJS) - $(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG),$(LIBVHD-SONAME) $(SHLIB_LDFLAGS) \ + $(CC) -Wl,$(SONAME_LDFLAG),$(LIBVHD-SONAME) $(SHLIB_LDFLAGS) \ $(LDFLAGS) -o libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $^ $(LIBS) ln -sf libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) libvhd.so.$(LIBVHD-MAJOR) ln -sf libvhd.so.$(LIBVHD-MAJOR) libvhd.so
tools/console/Makefile +2 -2
@@ -23,10 +23,10 @@ clean: $(RM) client/*.o daemon/*.o xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c)) - $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS) $(LDLIBS_xenconsoled) + $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsoled) xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c)) - $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS) $(LDLIBS_xenconsole) + $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsole) .PHONY: install install: $(BIN)
tools/debugger/kdd/Makefile +1 -1
@@ -10,7 +10,7 @@ OBJS := $(CFILES:.c=.o) all: kdd kdd: $(OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) + $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) .PHONY: clean clean:
tools/flask/libflask/Makefile +1 -1
@@ -53,6 +53,6 @@ libflask.so.$(MAJOR): libflask.so.$(MAJO ln -sf $< $@ libflask.so.$(MAJOR).$(MINOR): $(PIC_OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libflask.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LDLIBS_libxenctrl) + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libflask.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LDLIBS_libxenctrl) -include $(DEPS)
tools/flask/utils/Makefile +1 -1
@@ -19,7 +19,7 @@ CLIENTS_OBJS := $(patsubst flask-%,%.o,$ all: $(CLIENTS) $(CLIENTS): flask-%: %.o - $(CC) $(CFLAGS) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@ + $(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@ .PHONY: clean clean:
tools/libfsimage/Rules.mk +1 -1
@@ -24,7 +24,7 @@ fs-install: fs-all $(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR) $(FSLIB): $(PIC_OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) + $(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) clean distclean: rm -f $(PIC_OBJS) $(FSLIB) $(DEPS)
tools/libfsimage/common/Makefile +1 -1
@@ -37,7 +37,7 @@ libfsimage.so.$(MAJOR): libfsimage.so.$( ln -sf $< $@ libfsimage.so.$(MAJOR).$(MINOR): $(PIC_OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ -lpthread + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ -lpthread -include $(DEPS)
tools/libxc/Makefile +3 -3
@@ -156,7 +156,7 @@ libxenctrl.so.$(MAJOR): libxenctrl.so.$( ln -sf $< $@ libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(DLOPEN_LIBS) $(PTHREAD_LIBS) + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(DLOPEN_LIBS) $(PTHREAD_LIBS) # libxenguest
@@ -192,10 +192,10 @@ xc_dom_bzimageloader.opic: CFLAGS += $(c libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(call zlib-options,l) libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz $(LDLIBS_libxenctrl) $(PTHREAD_LIBS) + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz $(LDLIBS_libxenctrl) $(PTHREAD_LIBS) xenctrl_osdep_ENOSYS.so: $(OSDEP_PIC_OBJS) libxenctrl.so - $(CC) -g $(CFLAGS) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $(OSDEP_PIC_OBJS) $(LDLIBS_libxenctrl) + $(CC) -g $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $(OSDEP_PIC_OBJS) $(LDLIBS_libxenctrl) -include $(DEPS)
tools/libxen/Makefile +1 -1
@@ -44,7 +44,7 @@ libxenapi.so.$(MAJOR): libxenapi.so.$(MA ln -sf $< $@ libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ libxenapi.a: $(LIBXENAPI_OBJS) $(AR) rcs libxenapi.a $^
tools/libxen/Makefile.dist +1 -1
@@ -54,7 +54,7 @@ libxenapi.so.$(MAJOR): libxenapi.so.$(MA ln -sf $< $@ libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ libxenapi.a: $(LIBXENAPI_OBJS) $(AR) rcs libxenapi.a $^
tools/libxl/Makefile +2 -2
@@ -85,7 +85,7 @@ libxenlight.so.$(MAJOR): libxenlight.so. ln -sf $< $@ libxenlight.so.$(MAJOR).$(MINOR): $(LIBXL_OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXL_LIBS) + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXL_LIBS) libxenlight.a: $(LIBXL_OBJS) $(AR) rcs libxenlight.a $^
@@ -97,7 +97,7 @@ libxlutil.so.$(XLUMAJOR): libxlutil.so.$ ln -sf $< $@ libxlutil.so.$(XLUMAJOR).$(XLUMINOR): $(LIBXLU_OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxlutil.so.$(XLUMAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXLU_LIBS) + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxlutil.so.$(XLUMAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXLU_LIBS) libxlutil.a: $(LIBXLU_OBJS) $(AR) rcs libxlutil.a $^
tools/misc/Makefile +2 -2
@@ -58,9 +58,9 @@ clean: $(CC) -c $(CFLAGS) -o $@ $< xen-hvmctx xen-hvmcrash xenperf xenpm gtracestat xenlockprof xen-hptool xenwatchdogd: %: %.o Makefile - $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDLIBS_$*) + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_$*) gtraceview: %: %.o Makefile - $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(CURSES_LIBS) + $(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS) -include $(DEPS)
tools/ocaml/Makefile.rules +1 -1
@@ -84,7 +84,7 @@ endef define C_PROGRAM_template $(1): $(foreach obj,$($(1)_OBJS),$(obj).o) - $(call quiet-command, $(CC) $(CFLAGS) -o $$@ $$+,BIN,$$@) + $(call quiet-command, $(CC) $(LDFLAGS) -o $$@ $$+,BIN,$$@) endef -include .ocamldep.make
tools/tests/mce-test/tools/Makefile +1 -4
@@ -18,8 +18,5 @@ install: clean: $(RM) *.o xen-mceinj -%.o: %.c $(HDRS) Makefile - $(CC) -c $(CFLAGS) -o $@ $< - xen-mceinj: %: %.o Makefile - $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) + $(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore)
tools/tests/xen-access/Makefile +2 -5
@@ -25,10 +25,7 @@ clean: $(RM) *.o $(TARGETS) *~ $(DEPS) set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done -%.o: %.c Makefile - $(CC) -c $(CFLAGS) -o $@ $< +xen-access: %: %.o Makefile + $(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) -xen-access: %: %.o Makefile - $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) -# $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) -include $(DEPS)
tools/vtpm_manager/manager/Makefile +1 -1
@@ -29,7 +29,7 @@ mrproper: clean rm -f *~ $(BIN): $(OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@ + $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ # libraries LIBS += ../tcs/libTCS.a ../util/libTCGUtils.a ../crypto/libtcpaCrypto.a
tools/vtpm_manager/migration/Makefile +2 -2
@@ -33,10 +33,10 @@ mrproper: clean rm -f *~ $(BIND): $(OBJSD) - $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@ + $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ $(BINC): $(OBJSC) - $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@ + $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ # libraries LIBS += ../util/libTCGUtils.a
tools/xcutils/Makefile +5 -9
@@ -11,15 +11,14 @@ XEN_ROOT = $(CURDIR)/../.. include $(XEN_ROOT)/tools/Rules.mk - PROGRAMS = xc_restore xc_save readnotes lsevtchn CFLAGS += -Werror -CFLAGS_xc_restore := $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) -CFLAGS_xc_save := $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) -CFLAGS_readnotes := $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) -CFLAGS_lsevtchn := $(CFLAGS_libxenctrl) +CFLAGS_xc_restore.o := $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) +CFLAGS_xc_save.o := $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) +CFLAGS_readnotes.o := $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) +CFLAGS_lsevtchn.o := $(CFLAGS_libxenctrl) LDLIBS_xc_restore := $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) LDLIBS_xc_save := $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore)
@@ -32,11 +31,8 @@ all: build .PHONY: build build: $(PROGRAMS) -%.o: %.c - $(CC) $(CFLAGS) $(CFLAGS_$*) -c $^ -o $@ - $(PROGRAMS): %: %.o - $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_$*) -o $@ + $(CC) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_$*) -o $@ .PHONY: install install: build
tools/xenbackendd/Makefile +2 -2
@@ -35,7 +35,7 @@ clean: rm -f $(SBIN) $(DEPS) -%: %.c Makefile - $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS) +%: %.o Makefile + $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) -include $(DEPS)
tools/xenmon/Makefile +5 -4
@@ -40,9 +40,10 @@ clean: rm -f $(BIN) $(DEPS) -%: %.c Makefile - $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS) -xentrace_%: %.c Makefile - $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS) +%: %.o Makefile + $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) + +xentrace_%: %.o Makefile + $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) -include $(DEPS)
tools/xenpaging/Makefile +1 -1
@@ -19,7 +19,7 @@ IBINS = xenpaging all: $(IBINS) xenpaging: $(OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) + $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) install: all $(INSTALL_DIR) $(DESTDIR)/var/lib/xen/xenpaging
tools/xenpmd/Makefile +5 -4
@@ -1,8 +1,9 @@ XEN_ROOT=$(CURDIR)/../.. include $(XEN_ROOT)/tools/Rules.mk -CFLAGS += -Werror -CFLAGS += $(CFLAGS_libxenstore) +CFLAGS += -Werror +CFLAGS += $(CFLAGS_libxenstore) + LDLIBS += $(LDLIBS_libxenstore) BIN = xenpmd
@@ -19,7 +20,7 @@ install: all clean: $(RM) -f $(BIN) $(DEPS) -%: %.c Makefile - $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS) +%: %.o Makefile + $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) -include $(DEPS)
tools/xenstat/libxenstat/Makefile +1 -10
@@ -50,18 +50,9 @@ all: $(LIB) $(SHLIB) $(SHLIB_LINKS) $(RANLIB) $@ $(SHLIB): $(OBJECTS-y) - $(CC) $(CFLAGS) $(LDFLAGS) $(SONAME_FLAGS) $(SHLIB_LDFLAGS) -o $@ \ + $(CC) $(LDFLAGS) $(SONAME_FLAGS) $(SHLIB_LDFLAGS) -o $@ \ $(OBJECTS-y) $(LDLIBS-y) -src/xenstat.o: src/xenstat.c src/xenstat.h src/xenstat_priv.h - $(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $< - -src/xenstat_linux.o: src/xenstat_linux.c src/xenstat_priv.h - $(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $< - -src/xenstat_solaris.o: src/xenstat_solaris.c src/xenstat_priv.h - $(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $< - src/libxenstat.so.$(MAJOR): $(SHLIB) $(MAKE_LINK) $(<F) $@
tools/xenstore/Makefile +5 -5
@@ -47,19 +47,19 @@ CFLAGS += -DHAVE_DTRACE=1 endif xenstored: $(XENSTORED_OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS_libxenctrl) $(SOCKET_LIBS) -o $@ + $(CC) $(LDFLAGS) $^ $(LDLIBS_libxenctrl) $(SOCKET_LIBS) -o $@ $(CLIENTS): xenstore ln -f xenstore $@ xenstore: xenstore_client.o $(LIBXENSTORE) - $(CC) $(CFLAGS) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@ + $(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@ xenstore-control: xenstore_control.o $(LIBXENSTORE) - $(CC) $(CFLAGS) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@ + $(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@ xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o - $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ + $(CC) $(LDFLAGS) $^ -o $@ libxenstore.so: libxenstore.so.$(MAJOR) ln -sf $< $@
@@ -69,7 +69,7 @@ libxenstore.so.$(MAJOR): libxenstore.so. xs.opic: CFLAGS += -DUSE_PTHREAD libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread libxenstore.a: xs.o xs_lib.o $(AR) rcs $@ $^
tools/xentrace/Makefile +6 -6
@@ -1,9 +1,9 @@ XEN_ROOT=$(CURDIR)/../.. include $(XEN_ROOT)/tools/Rules.mk -CFLAGS += -Werror +CFLAGS += -Werror -CFLAGS += $(CFLAGS_libxenctrl) +CFLAGS += $(CFLAGS_libxenctrl) LDLIBS += $(LDLIBS_libxenctrl) HDRS = $(wildcard *.h)
@@ -49,10 +49,10 @@ install: build clean: $(RM) *.a *.so *.o *.rpm $(BIN) $(LIBBIN) $(DEPS) -%: %.c $(HDRS) Makefile - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS) -xentrace_%: %.c $(HDRS) Makefile - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS) +%: %.o $(HDRS) Makefile + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) +xentrace_%: %.o $(HDRS) Makefile + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) -include $(DEPS)
PATCH 1/1 libxl: do not expose libxenctrl/libxenstore headers via libxl.h
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1301568853 -3600
# Node ID f968b14db03fcd7c42125b2ef9bc28c424959b2a
# Parent f5ada9268c1a7b4128f63619d252395f014ef238
libxl: do not expose libxenctrl/libxenstore headers via libxl.h
This completely removes libxenstore from libxl users' view.
xl still needs libxenctrl directly due to the direct use of the xentoollog functionality but it is not exposed to the indirect linkage anymore.
tools/Rules.mk +1 -1
@@ -49,7 +49,7 @@ LDLIBS_libblktapctl = SHLIB_libblktapctl = endif -CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(CFLAGS_xeninclude) +CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude) LDLIBS_libxenlight = -L$(XEN_XENLIGHT) $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl) -lxenlight SHLIB_libxenlight = -Wl,-rpath-link=$(XEN_XENLIGHT)
tools/libxl/Makefile +5 -1
@@ -13,7 +13,6 @@ XLUMINOR = 0 CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations CFLAGS += -I. -fPIC -CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) ifeq ($(CONFIG_Linux),y) LIBUUID_LIBS += -luuid
@@ -38,13 +37,18 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_c libxl_internal.o libxl_utils.o libxl_uuid.o $(LIBXL_OBJS-y) LIBXL_OBJS += _libxl_types.o +$(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) + AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o +$(LIBXLU_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h CLIENTS = xl XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o +$(XL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h +$(XL_OBJS): CFLAGS += $(CFLAGS_libxenlight) .PHONY: all all: $(CLIENTS) libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
tools/libxl/libxl.c +11 -2
@@ -41,15 +41,22 @@#define STRINGIFY (x) #x#define TOSTRING (x) STRINGIFY(x) -int libxl_ctx_init (libxl_ctx *ctx,int version,xentoollog_logger *lg) +int libxl_ctx_alloc (libxl_ctx **pctx,int version,xentoollog_logger * lg) { +libxl_ctx *ctx;struct stat stat_buf;if (version !=LIBXL_VERSION )return ERROR_VERSION ; + + ctx =malloc (sizeof (*ctx)); +if (!ctx) { +LIBXL__LOG_ERRNO (ctx,LIBXL__LOG_ERROR ,"Failed to allocate context\n" ); +return ERROR_NOMEM ; + } +memset (ctx,0 ,sizeof (libxl_ctx)); ctx->lg = lg; -memset (&ctx->version_info,0 ,sizeof (libxl_version_info));if (stat (XENSTORE_PID_FILE , &stat_buf) !=0 ) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Is xenstore daemon running?\n"
@@ -73,6 +80,8 @@ int libxl_ctx_init(libxl_ctx *ctx, int vxc_interface_close (ctx->xch);return ERROR_FAIL ; } + + *pctx = ctx;return 0 ; }
tools/libxl/libxl.h +9 -14
@@ -124,13 +124,18 @@#ifndef LIBXL_H #define LIBXL_H +#include <stdbool.h> #include <stdint.h> #include <stdarg.h> +#include <errno.h> #include <netinet/in.h> -#include <xenctrl.h> -#include <xs.h> #include <sys/wait.h> /* for pid_t */ +#include <xentoollog.h> + +#include <xen/sched.h> +#include <xen/sysctl.h> +#include "libxl_uuid.h" typedef uint8_t libxl_mac [6 ];
@@ -216,17 +221,7 @@ void libxl_cpuid_destroy(libxl_cpuid_pol#include "_libxl_types.h" -typedef struct { -xentoollog_logger *lg; -xc_interface *xch; -struct xs_handle *xsh; - -/* for callers who reap children willy-nilly; caller must only -* set this after libxl_init and before any other call - or -* may leave them untouched */ -int (*waitpid_instead)(pid_t pid,int *status,int flags); -libxl_version_info version_info; -}libxl_ctx ; +typedef struct libxl__ctx libxl_ctx ;const libxl_version_info *libxl_get_version_info (libxl_ctx *ctx);
@@ -283,7 +278,7 @@ typedef struct { } libxl_domain_config;/* context functions */ -int libxl_ctx_init (libxl_ctx *ctx,int version,xentoollog_logger *); +int libxl_ctx_alloc (libxl_ctx **pctx,int version,xentoollog_logger *lg);int libxl_ctx_free (libxl_ctx *ctx);int libxl_ctx_postfork (libxl_ctx *ctx);
tools/libxl/libxl_internal.h +11 -0
@@ -82,6 +82,17 @@ _hidden void libxl__log(libxl_ctx *ctx,/* these functions preserve errno (saving and restoring) */ +struct libxl__ctx { +xentoollog_logger *lg; +xc_interface *xch; +struct xs_handle *xsh; + +/* for callers who reap children willy-nilly; caller must only +* set this after libxl_init and before any other call - or +* may leave them untouched */ +int (*waitpid_instead)(pid_t pid,int *status,int flags); +libxl_version_info version_info; +}; typedef enum { DEVICE_VIF = 1,
tools/libxl/libxlu_cfg.c +1 -0
@@ -1,3 +1,4 @@ +#include <limits.h> #include "libxlu_internal.h" #include "libxlu_cfg_y.h"
tools/libxl/xl.c +4 -3
@@ -26,6 +26,7 @@#include <fcntl.h> #include <ctype.h> #include <inttypes.h> +#include <xenctrl.h> #include "libxl.h" #include "libxl_utils.h"
@@ -111,7 +112,7 @@ int main(int argc, char **argv) logger =xtl_createlogger_stdiostream (stderr, minmsglevel,0 );if (!logger)exit (1 ); -if (libxl_ctx_init (&ctx,LIBXL_VERSION , (xentoollog_logger *)logger)) { +if (libxl_ctx_alloc (&ctx,LIBXL_VERSION , (xentoollog_logger *)logger)) {fprintf (stderr,"cannot init xl context\n" );exit (1 ); }
@@ -123,7 +124,7 @@ int main(int argc, char **argv)exit (1 ); } - ret =libxl_read_file_contents (&ctx, config_file, + ret =libxl_read_file_contents (ctx, config_file, &config_data, &config_len);if (ret) fprintf(stderr, "Failed to read config file: %s: %s\n",
@@ -147,7 +148,7 @@ int main(int argc, char **argv) ret =1 ; } -libxl_ctx_free (&ctx); +libxl_ctx_free (ctx);xtl_logger_destroy ((xentoollog_logger *)logger);return ret;
tools/libxl/xl.h +1 -1
@@ -95,7 +95,7 @@ extern int cmdtable_len;/* Look up a command in the table, allowing unambiguous truncation */ struct cmd_spec *cmdtable_lookup (const char *s); -extern libxl_ctx ctx; +extern libxl_ctx *ctx;extern xentoollog_logger_stdiostream *logger;/* global options */
tools/libxl/xl_cmdimpl.c +195 -194
1,338 lines not on this page · raw message
tools/ocaml/libs/xl/xl_stubs.c +24 -24
192 lines not on this page · raw message
tools/python/setup.py +1 -1
@@ -83,7 +83,7 @@ netlink = Extension("netlink", xl = Extension("xl", extra_compile_args = extra_compile_args, - include_dirs = [ PATH_XEN, PATH_LIBXL, PATH_LIBXC, PATH_XENSTORE, "xen/lowlevel/xl" ], + include_dirs = [ PATH_XEN, PATH_LIBXL, PATH_LIBXC, "xen/lowlevel/xl" ], library_dirs = [ PATH_LIBXL ], libraries = [ "xenlight" ], depends = [ PATH_LIBXL + "/libxenlight.so" ],
tools/python/xen/lowlevel/xl/xl.c +16 -16
@@ -370,7 +370,7 @@ PyObject *attrib__struct_in_addr_get(strtypedef struct {PyObject_HEAD ; -libxl_ctx ctx; +libxl_ctx *ctx;xentoollog_logger_stdiostream *logger;xentoollog_level minmsglevel; }XlObject ;
@@ -381,7 +381,7 @@ static PyObject *pyxl_list_domains(XlObjPyObject *list;int nr_dom, i; - info =libxl_list_domain (&self->ctx, &nr_dom); + info =libxl_list_domain (self->ctx, &nr_dom);if (NULL == info )return PyList_New (0 );
@@ -416,7 +416,7 @@ static PyObject *pyxl_domid_to_name(XlObif ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; - domname =libxl_domid_to_name (&self->ctx, domid); + domname =libxl_domid_to_name (self->ctx, domid); ret =PyString_FromString (domname);free (domname);
@@ -428,7 +428,7 @@ static PyObject *pyxl_domain_shutdown(Xlint domid, req =0 ;if ( !PyArg_ParseTuple (args,"i|i" , &domid, &req) )return NULL ; -if (libxl_domain_shutdown (&self->ctx, domid, req) ) { +if (libxl_domain_shutdown (self->ctx, domid, req) ) {PyErr_SetString (xl_error_obj,"cannot shutdown domain" );return NULL ; }
@@ -441,7 +441,7 @@ static PyObject *pyxl_domain_destroy(XlOint domid, force =1 ;if ( !PyArg_ParseTuple (args,"i|i" , &domid, &force) )return NULL ; -if (libxl_domain_destroy (&self->ctx, domid, force) ) { +if (libxl_domain_destroy (self->ctx, domid, force) ) {PyErr_SetString (xl_error_obj,"cannot destroy domain" );return NULL ; }
@@ -454,7 +454,7 @@ static PyObject *pyxl_domain_pause(XlObjint domid;if ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; -if (libxl_domain_pause (&self->ctx, domid) ) { +if (libxl_domain_pause (self->ctx, domid) ) {PyErr_SetString (xl_error_obj,"cannot pause domain" );return NULL ; }
@@ -467,7 +467,7 @@ static PyObject *pyxl_domain_unpause(XlOint domid;if ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; -if (libxl_domain_unpause (&self->ctx, domid) ) { +if (libxl_domain_unpause (self->ctx, domid) ) {PyErr_SetString (xl_error_obj,"cannot unpause domain" );return NULL ; }
@@ -481,7 +481,7 @@ static PyObject *pyxl_domain_rename(XlObint domid;if ( !PyArg_ParseTuple (args,"is|s" , &domid, &new_name, &old_name) )return NULL ; -if (libxl_domain_rename (&self->ctx, domid, old_name, new_name) ) { +if (libxl_domain_rename (self->ctx, domid, old_name, new_name) ) {PyErr_SetString (xl_error_obj,"cannot rename domain" );return NULL ; }
@@ -501,7 +501,7 @@ static PyObject *pyxl_pci_add(XlObject *return NULL ; } pci = (Py_device_pci *)obj; -if (libxl_device_pci_add (&self->ctx, domid, &pci->obj) ) { +if (libxl_device_pci_add (self->ctx, domid, &pci->obj) ) {PyErr_SetString (xl_error_obj,"cannot add pci device" );return NULL ; }
@@ -522,7 +522,7 @@ static PyObject *pyxl_pci_del(XlObject *return NULL ; } pci = (Py_device_pci *)obj; -if (libxl_device_pci_remove (&self->ctx, domid, &pci->obj, force) ) { +if (libxl_device_pci_remove (self->ctx, domid, &pci->obj, force) ) {PyErr_SetString (xl_error_obj,"cannot remove pci device" );return NULL ; }
@@ -544,7 +544,7 @@ static PyObject *pyxl_pci_parse(XlObjectreturn NULL ; } -if (libxl_device_pci_parse_bdf (&self->ctx, &pci->obj, str) ) { +if (libxl_device_pci_parse_bdf (self->ctx, &pci->obj, str) ) {PyErr_SetString (xl_error_obj,"cannot parse pci device spec (BDF)" );Py_DECREF (pci);return NULL ;
@@ -559,7 +559,7 @@ static PyObject *pyxl_pci_list_assignablPyObject *list;int nr_dev, i; -if (libxl_device_pci_list_assignable (&self->ctx, &dev, &nr_dev) ) { +if (libxl_device_pci_list_assignable (self->ctx, &dev, &nr_dev) ) {PyErr_SetString (xl_error_obj,"Cannot list assignable devices" );return NULL ; }
@@ -595,7 +595,7 @@ static PyObject *pyxl_pci_list(XlObjectif ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; -if (libxl_device_pci_list_assigned (&self->ctx, &dev, domid, &nr_dev) ) { +if (libxl_device_pci_list_assigned (self->ctx, &dev, domid, &nr_dev) ) {PyErr_SetString (xl_error_obj,"Cannot list assignable devices" );return NULL ; }
@@ -663,7 +663,7 @@ static PyObject *PyXl_new(PyTypeObject *if (self ==NULL )return NULL ; -memset (&self->ctx,0 ,sizeof (self->ctx)); + self->ctx =NULL ; self->logger =NULL ; self->minmsglevel =XTL_PROGRESS ;
@@ -679,7 +679,7 @@ PyXl_init(XlObject *self, PyObject *argsreturn -1 ; } -if (libxl_ctx_init (&self->ctx,LIBXL_VERSION , +if (libxl_ctx_alloc (&self->ctx,LIBXL_VERSION , (xentoollog_logger *)self->logger) ) {PyErr_SetString (xl_error_obj,"cannot init xl context" );return -1 ;
@@ -690,7 +690,7 @@ PyXl_init(XlObject *self, PyObject *argsstatic void PyXl_dealloc (XlObject *self) { -libxl_ctx_free (&self->ctx); +libxl_ctx_free (self->ctx);if ( self->logger )xtl_logger_destroy ((xentoollog_logger *)self->logger);
Re: [PATCH 2 of 4] libxl: do not expose libxenctrl/libxenstore headers via libxl.h
Ian Campbell writes ("[Xen-devel] [PATCH 2 of 4] libxl: do not expose libxenctrl/libxenstore headers via libxl.h"):
Quoted 1 line
libxl: do not expose libxenctrl/libxenstore headers via
libxl.h
I'm afraid this one doesn't apply any more:
Hunk #1 FAILED at 124.
1 out of 3 hunks FAILED -- saving rejects to file tools/libxl/libxl.h.rej
Ian.
Re: [PATCH 2 of 4] libxl: do not expose libxenctrl/libxenstore headers via libxl.h
Quoted 9 lines · Ian Jackson
Ian Campbell writes ("[Xen-devel] [PATCH 2 of 4] libxl: do not expose libxenctrl/libxenstore headers via
libxl.h"):Quoted 1 line
libxl: do not expose libxenctrl/libxenstore headers via
libxl.hI'm afraid this one doesn't apply any more:
Hunk #1 FAILED at 124.
1 out of 3 hunks FAILED -- saving rejects to filetools/libxl/libxl.h.rejIan.
It conflicted with "libxl: use system include for libxl_uuid.h". Refreshed version below.
Since this touches a lot of lines of xl_cmdimpl.c this patch may be particularly prone to breakage, fortunately of the easy to fix mechanically kind (add a & to the ctx).
If you want I'm happy to coordinate a suitable window in the flow of patches with you.
8<-------------------------------------
# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1301663079 -3600
# Node ID f92a4b0f40dfcc471d1ec58fb35f4a5f2581bea2
# Parent b65de5ce62025524cbd47be345a445361affb2b1
libxl: do not expose libxenctrl/libxenstore headers via libxl.h
This completely removes libxenstore from libxl users' view.
xl still needs libxenctrl directly due to the direct use of the xentoollog functionality but it is not exposed to the indirect linkage anymore.
tools/Rules.mk +1 -1
@@ -49,7 +49,7 @@ LDLIBS_libblktapctl = SHLIB_libblktapctl = endif -CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(CFLAGS_xeninclude) +CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude) LDLIBS_libxenlight = -L$(XEN_XENLIGHT) $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl) -lxenlight SHLIB_libxenlight = -Wl,-rpath-link=$(XEN_XENLIGHT)
tools/libxl/Makefile +5 -1
@@ -13,7 +13,6 @@ XLUMINOR = 0 CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations CFLAGS += -I. -fPIC -CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) ifeq ($(CONFIG_Linux),y) LIBUUID_LIBS += -luuid
@@ -38,13 +37,18 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_c libxl_internal.o libxl_utils.o libxl_uuid.o $(LIBXL_OBJS-y) LIBXL_OBJS += _libxl_types.o +$(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) + AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o +$(LIBXLU_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h CLIENTS = xl XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o +$(XL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h +$(XL_OBJS): CFLAGS += $(CFLAGS_libxenlight) .PHONY: all all: $(CLIENTS) libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
tools/libxl/libxl.c +11 -2
@@ -41,15 +41,22 @@#define STRINGIFY (x) #x#define TOSTRING (x) STRINGIFY(x) -int libxl_ctx_init (libxl_ctx *ctx,int version,xentoollog_logger *lg) +int libxl_ctx_alloc (libxl_ctx **pctx,int version,xentoollog_logger * lg) { +libxl_ctx *ctx;struct stat stat_buf;if (version !=LIBXL_VERSION )return ERROR_VERSION ; + + ctx =malloc (sizeof (*ctx)); +if (!ctx) { +LIBXL__LOG_ERRNO (ctx,LIBXL__LOG_ERROR ,"Failed to allocate context\n" ); +return ERROR_NOMEM ; + } +memset (ctx,0 ,sizeof (libxl_ctx)); ctx->lg = lg; -memset (&ctx->version_info,0 ,sizeof (libxl_version_info));if (stat (XENSTORE_PID_FILE , &stat_buf) !=0 ) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Is xenstore daemon running?\n"
@@ -73,6 +80,8 @@ int libxl_ctx_init(libxl_ctx *ctx, int vxc_interface_close (ctx->xch);return ERROR_FAIL ; } + + *pctx = ctx;return 0 ; }
tools/libxl/libxl.h +9 -14
@@ -124,13 +124,18 @@#ifndef LIBXL_H #define LIBXL_H +#include <stdbool.h> #include <stdint.h> #include <stdarg.h> +#include <errno.h> #include <netinet/in.h> -#include <xenctrl.h> -#include <xs.h> #include <sys/wait.h> /* for pid_t */ +#include <xentoollog.h> + +#include <xen/sched.h> +#include <xen/sysctl.h> +#include <libxl_uuid.h> typedef uint8_t libxl_mac [6 ];
@@ -216,17 +221,7 @@ void libxl_cpuid_destroy(libxl_cpuid_pol#include "_libxl_types.h" -typedef struct { -xentoollog_logger *lg; -xc_interface *xch; -struct xs_handle *xsh; - -/* for callers who reap children willy-nilly; caller must only -* set this after libxl_init and before any other call - or -* may leave them untouched */ -int (*waitpid_instead)(pid_t pid,int *status,int flags); -libxl_version_info version_info; -}libxl_ctx ; +typedef struct libxl__ctx libxl_ctx ;const libxl_version_info *libxl_get_version_info (libxl_ctx *ctx);
@@ -283,7 +278,7 @@ typedef struct { } libxl_domain_config;/* context functions */ -int libxl_ctx_init (libxl_ctx *ctx,int version,xentoollog_logger *); +int libxl_ctx_alloc (libxl_ctx **pctx,int version,xentoollog_logger *lg);int libxl_ctx_free (libxl_ctx *ctx);int libxl_ctx_postfork (libxl_ctx *ctx);
tools/libxl/libxl_internal.h +11 -0
@@ -82,6 +82,17 @@ _hidden void libxl__log(libxl_ctx *ctx,/* these functions preserve errno (saving and restoring) */ +struct libxl__ctx { +xentoollog_logger *lg; +xc_interface *xch; +struct xs_handle *xsh; + +/* for callers who reap children willy-nilly; caller must only +* set this after libxl_init and before any other call - or +* may leave them untouched */ +int (*waitpid_instead)(pid_t pid,int *status,int flags); +libxl_version_info version_info; +}; typedef enum { DEVICE_VIF = 1,
tools/libxl/libxlu_cfg.c +1 -0
@@ -1,3 +1,4 @@ +#include <limits.h> #include "libxlu_internal.h" #include "libxlu_cfg_y.h"
tools/libxl/xl.c +4 -3
@@ -26,6 +26,7 @@#include <fcntl.h> #include <ctype.h> #include <inttypes.h> +#include <xenctrl.h> #include "libxl.h" #include "libxl_utils.h"
@@ -111,7 +112,7 @@ int main(int argc, char **argv) logger =xtl_createlogger_stdiostream (stderr, minmsglevel,0 );if (!logger)exit (1 ); -if (libxl_ctx_init (&ctx,LIBXL_VERSION , (xentoollog_logger *)logger)) { +if (libxl_ctx_alloc (&ctx,LIBXL_VERSION , (xentoollog_logger *)logger)) {fprintf (stderr,"cannot init xl context\n" );exit (1 ); }
@@ -123,7 +124,7 @@ int main(int argc, char **argv)exit (1 ); } - ret =libxl_read_file_contents (&ctx, config_file, + ret =libxl_read_file_contents (ctx, config_file, &config_data, &config_len);if (ret) fprintf(stderr, "Failed to read config file: %s: %s\n",
@@ -147,7 +148,7 @@ int main(int argc, char **argv) ret =1 ; } -libxl_ctx_free (&ctx); +libxl_ctx_free (ctx);xtl_logger_destroy ((xentoollog_logger *)logger);return ret;
tools/libxl/xl.h +1 -1
@@ -95,7 +95,7 @@ extern int cmdtable_len;/* Look up a command in the table, allowing unambiguous truncation */ struct cmd_spec *cmdtable_lookup (const char *s); -extern libxl_ctx ctx; +extern libxl_ctx *ctx;extern xentoollog_logger_stdiostream *logger;/* global options */
tools/libxl/xl_cmdimpl.c +195 -194
1,338 lines not on this page · raw message
tools/ocaml/libs/xl/xl_stubs.c +24 -24
192 lines not on this page · raw message
tools/python/setup.py +1 -1
@@ -83,7 +83,7 @@ netlink = Extension("netlink", xl = Extension("xl", extra_compile_args = extra_compile_args, - include_dirs = [ PATH_XEN, PATH_LIBXL, PATH_LIBXC, PATH_XENSTORE, "xen/lowlevel/xl" ], + include_dirs = [ PATH_XEN, PATH_LIBXL, PATH_LIBXC, "xen/lowlevel/xl" ], library_dirs = [ PATH_LIBXL ], libraries = [ "xenlight" ], depends = [ PATH_LIBXL + "/libxenlight.so" ],
tools/python/xen/lowlevel/xl/xl.c +16 -16
@@ -370,7 +370,7 @@ PyObject *attrib__struct_in_addr_get(strtypedef struct {PyObject_HEAD ; -libxl_ctx ctx; +libxl_ctx *ctx;xentoollog_logger_stdiostream *logger;xentoollog_level minmsglevel; }XlObject ;
@@ -381,7 +381,7 @@ static PyObject *pyxl_list_domains(XlObjPyObject *list;int nr_dom, i; - info =libxl_list_domain (&self->ctx, &nr_dom); + info =libxl_list_domain (self->ctx, &nr_dom);if (NULL == info )return PyList_New (0 );
@@ -416,7 +416,7 @@ static PyObject *pyxl_domid_to_name(XlObif ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; - domname =libxl_domid_to_name (&self->ctx, domid); + domname =libxl_domid_to_name (self->ctx, domid); ret =PyString_FromString (domname);free (domname);
@@ -428,7 +428,7 @@ static PyObject *pyxl_domain_shutdown(Xlint domid, req =0 ;if ( !PyArg_ParseTuple (args,"i|i" , &domid, &req) )return NULL ; -if (libxl_domain_shutdown (&self->ctx, domid, req) ) { +if (libxl_domain_shutdown (self->ctx, domid, req) ) {PyErr_SetString (xl_error_obj,"cannot shutdown domain" );return NULL ; }
@@ -441,7 +441,7 @@ static PyObject *pyxl_domain_destroy(XlOint domid, force =1 ;if ( !PyArg_ParseTuple (args,"i|i" , &domid, &force) )return NULL ; -if (libxl_domain_destroy (&self->ctx, domid, force) ) { +if (libxl_domain_destroy (self->ctx, domid, force) ) {PyErr_SetString (xl_error_obj,"cannot destroy domain" );return NULL ; }
@@ -454,7 +454,7 @@ static PyObject *pyxl_domain_pause(XlObjint domid;if ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; -if (libxl_domain_pause (&self->ctx, domid) ) { +if (libxl_domain_pause (self->ctx, domid) ) {PyErr_SetString (xl_error_obj,"cannot pause domain" );return NULL ; }
@@ -467,7 +467,7 @@ static PyObject *pyxl_domain_unpause(XlOint domid;if ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; -if (libxl_domain_unpause (&self->ctx, domid) ) { +if (libxl_domain_unpause (self->ctx, domid) ) {PyErr_SetString (xl_error_obj,"cannot unpause domain" );return NULL ; }
@@ -481,7 +481,7 @@ static PyObject *pyxl_domain_rename(XlObint domid;if ( !PyArg_ParseTuple (args,"is|s" , &domid, &new_name, &old_name) )return NULL ; -if (libxl_domain_rename (&self->ctx, domid, old_name, new_name) ) { +if (libxl_domain_rename (self->ctx, domid, old_name, new_name) ) {PyErr_SetString (xl_error_obj,"cannot rename domain" );return NULL ; }
@@ -501,7 +501,7 @@ static PyObject *pyxl_pci_add(XlObject *return NULL ; } pci = (Py_device_pci *)obj; -if (libxl_device_pci_add (&self->ctx, domid, &pci->obj) ) { +if (libxl_device_pci_add (self->ctx, domid, &pci->obj) ) {PyErr_SetString (xl_error_obj,"cannot add pci device" );return NULL ; }
@@ -522,7 +522,7 @@ static PyObject *pyxl_pci_del(XlObject *return NULL ; } pci = (Py_device_pci *)obj; -if (libxl_device_pci_remove (&self->ctx, domid, &pci->obj, force) ) { +if (libxl_device_pci_remove (self->ctx, domid, &pci->obj, force) ) {PyErr_SetString (xl_error_obj,"cannot remove pci device" );return NULL ; }
@@ -544,7 +544,7 @@ static PyObject *pyxl_pci_parse(XlObjectreturn NULL ; } -if (libxl_device_pci_parse_bdf (&self->ctx, &pci->obj, str) ) { +if (libxl_device_pci_parse_bdf (self->ctx, &pci->obj, str) ) {PyErr_SetString (xl_error_obj,"cannot parse pci device spec (BDF)" );Py_DECREF (pci);return NULL ;
@@ -559,7 +559,7 @@ static PyObject *pyxl_pci_list_assignablPyObject *list;int nr_dev, i; -if (libxl_device_pci_list_assignable (&self->ctx, &dev, &nr_dev) ) { +if (libxl_device_pci_list_assignable (self->ctx, &dev, &nr_dev) ) {PyErr_SetString (xl_error_obj,"Cannot list assignable devices" );return NULL ; }
@@ -595,7 +595,7 @@ static PyObject *pyxl_pci_list(XlObjectif ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; -if (libxl_device_pci_list_assigned (&self->ctx, &dev, domid, &nr_dev) ) { +if (libxl_device_pci_list_assigned (self->ctx, &dev, domid, &nr_dev) ) {PyErr_SetString (xl_error_obj,"Cannot list assignable devices" );return NULL ; }
@@ -663,7 +663,7 @@ static PyObject *PyXl_new(PyTypeObject *if (self ==NULL )return NULL ; -memset (&self->ctx,0 ,sizeof (self->ctx)); + self->ctx =NULL ; self->logger =NULL ; self->minmsglevel =XTL_PROGRESS ;
@@ -679,7 +679,7 @@ PyXl_init(XlObject *self, PyObject *argsreturn -1 ; } -if (libxl_ctx_init (&self->ctx,LIBXL_VERSION , +if (libxl_ctx_alloc (&self->ctx,LIBXL_VERSION , (xentoollog_logger *)self->logger) ) {PyErr_SetString (xl_error_obj,"cannot init xl context" );return -1 ;
@@ -690,7 +690,7 @@ PyXl_init(XlObject *self, PyObject *argsstatic void PyXl_dealloc (XlObject *self) { -libxl_ctx_free (&self->ctx); +libxl_ctx_free (self->ctx);if ( self->logger )xtl_logger_destroy ((xentoollog_logger *)self->logger);
Re: [PATCH 2 of 4] libxl: do not expose libxenctrl/libxenstore headers via libxl.h
Quoted 14 lines · Ian Campbell
Quoted 9 lines · Ian Jackson
Ian Campbell writes ("[Xen-devel] [PATCH 2 of 4] libxl: do not expose libxenctrl/libxenstore headers via
libxl.h"):Quoted 1 line
libxl: do not expose libxenctrl/libxenstore headers via
libxl.hI'm afraid this one doesn't apply any more:
Hunk #1 FAILED at 124.
1 out of 3 hunks FAILED -- saving rejects to filetools/libxl/libxl.h.rejIan.
It conflicted with "libxl: use system include for
libxl_uuid.h". Refreshed version below.
Quoted 6 lines
Since this touches a lot of lines of
xl_cmdimpl.cthis patch may be particularly prone to breakage, fortunately of the easy to fix mechanically kind (add a & to the ctx).If you want I'm happy to coordinate a suitable window in the flow of patches with you.
Darn, somehow I missed build testing the tools/ocaml tree. Updated version below
8<-------------------------------------
# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1301666596 -3600
# Node ID ab8fc27358d068294e1f07473060c6b276f747c9
# Parent b65de5ce62025524cbd47be345a445361affb2b1
libxl: do not expose libxenctrl/libxenstore headers via libxl.h
This completely removes libxenstore from libxl users' view.
xl still needs libxenctrl directly due to the direct use of the xentoollog functionality but it is not exposed to the indirect linkage anymore.
tools/Rules.mk +1 -1
@@ -49,7 +49,7 @@ LDLIBS_libblktapctl = SHLIB_libblktapctl = endif -CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(CFLAGS_xeninclude) +CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude) LDLIBS_libxenlight = -L$(XEN_XENLIGHT) $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl) -lxenlight SHLIB_libxenlight = -Wl,-rpath-link=$(XEN_XENLIGHT)
tools/libxl/Makefile +5 -1
@@ -13,7 +13,6 @@ XLUMINOR = 0 CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations CFLAGS += -I. -fPIC -CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) ifeq ($(CONFIG_Linux),y) LIBUUID_LIBS += -luuid
@@ -38,13 +37,18 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_c libxl_internal.o libxl_utils.o libxl_uuid.o $(LIBXL_OBJS-y) LIBXL_OBJS += _libxl_types.o +$(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) + AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o +$(LIBXLU_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h CLIENTS = xl XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o +$(XL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h +$(XL_OBJS): CFLAGS += $(CFLAGS_libxenlight) .PHONY: all all: $(CLIENTS) libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
tools/libxl/libxl.c +11 -2
@@ -41,15 +41,22 @@#define STRINGIFY (x) #x#define TOSTRING (x) STRINGIFY(x) -int libxl_ctx_init (libxl_ctx *ctx,int version,xentoollog_logger *lg) +int libxl_ctx_alloc (libxl_ctx **pctx,int version,xentoollog_logger * lg) { +libxl_ctx *ctx;struct stat stat_buf;if (version !=LIBXL_VERSION )return ERROR_VERSION ; + + ctx =malloc (sizeof (*ctx)); +if (!ctx) { +LIBXL__LOG_ERRNO (ctx,LIBXL__LOG_ERROR ,"Failed to allocate context\n" ); +return ERROR_NOMEM ; + } +memset (ctx,0 ,sizeof (libxl_ctx)); ctx->lg = lg; -memset (&ctx->version_info,0 ,sizeof (libxl_version_info));if (stat (XENSTORE_PID_FILE , &stat_buf) !=0 ) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Is xenstore daemon running?\n"
@@ -73,6 +80,8 @@ int libxl_ctx_init(libxl_ctx *ctx, int vxc_interface_close (ctx->xch);return ERROR_FAIL ; } + + *pctx = ctx;return 0 ; }
tools/libxl/libxl.h +9 -14
@@ -124,13 +124,18 @@#ifndef LIBXL_H #define LIBXL_H +#include <stdbool.h> #include <stdint.h> #include <stdarg.h> +#include <errno.h> #include <netinet/in.h> -#include <xenctrl.h> -#include <xs.h> #include <sys/wait.h> /* for pid_t */ +#include <xentoollog.h> + +#include <xen/sched.h> +#include <xen/sysctl.h> +#include <libxl_uuid.h> typedef uint8_t libxl_mac [6 ];
@@ -216,17 +221,7 @@ void libxl_cpuid_destroy(libxl_cpuid_pol#include "_libxl_types.h" -typedef struct { -xentoollog_logger *lg; -xc_interface *xch; -struct xs_handle *xsh; - -/* for callers who reap children willy-nilly; caller must only -* set this after libxl_init and before any other call - or -* may leave them untouched */ -int (*waitpid_instead)(pid_t pid,int *status,int flags); -libxl_version_info version_info; -}libxl_ctx ; +typedef struct libxl__ctx libxl_ctx ;const libxl_version_info *libxl_get_version_info (libxl_ctx *ctx);
@@ -283,7 +278,7 @@ typedef struct { } libxl_domain_config;/* context functions */ -int libxl_ctx_init (libxl_ctx *ctx,int version,xentoollog_logger *); +int libxl_ctx_alloc (libxl_ctx **pctx,int version,xentoollog_logger *lg);int libxl_ctx_free (libxl_ctx *ctx);int libxl_ctx_postfork (libxl_ctx *ctx);
tools/libxl/libxl_internal.h +11 -0
@@ -82,6 +82,17 @@ _hidden void libxl__log(libxl_ctx *ctx,/* these functions preserve errno (saving and restoring) */ +struct libxl__ctx { +xentoollog_logger *lg; +xc_interface *xch; +struct xs_handle *xsh; + +/* for callers who reap children willy-nilly; caller must only +* set this after libxl_init and before any other call - or +* may leave them untouched */ +int (*waitpid_instead)(pid_t pid,int *status,int flags); +libxl_version_info version_info; +}; typedef enum { DEVICE_VIF = 1,
tools/libxl/libxlu_cfg.c +1 -0
@@ -1,3 +1,4 @@ +#include <limits.h> #include "libxlu_internal.h" #include "libxlu_cfg_y.h"
tools/libxl/xl.c +4 -3
@@ -26,6 +26,7 @@#include <fcntl.h> #include <ctype.h> #include <inttypes.h> +#include <xenctrl.h> #include "libxl.h" #include "libxl_utils.h"
@@ -111,7 +112,7 @@ int main(int argc, char **argv) logger =xtl_createlogger_stdiostream (stderr, minmsglevel,0 );if (!logger)exit (1 ); -if (libxl_ctx_init (&ctx,LIBXL_VERSION , (xentoollog_logger *)logger)) { +if (libxl_ctx_alloc (&ctx,LIBXL_VERSION , (xentoollog_logger *)logger)) {fprintf (stderr,"cannot init xl context\n" );exit (1 ); }
@@ -123,7 +124,7 @@ int main(int argc, char **argv)exit (1 ); } - ret =libxl_read_file_contents (&ctx, config_file, + ret =libxl_read_file_contents (ctx, config_file, &config_data, &config_len);if (ret) fprintf(stderr, "Failed to read config file: %s: %s\n",
@@ -147,7 +148,7 @@ int main(int argc, char **argv) ret =1 ; } -libxl_ctx_free (&ctx); +libxl_ctx_free (ctx);xtl_logger_destroy ((xentoollog_logger *)logger);return ret;
tools/libxl/xl.h +1 -1
@@ -95,7 +95,7 @@ extern int cmdtable_len;/* Look up a command in the table, allowing unambiguous truncation */ struct cmd_spec *cmdtable_lookup (const char *s); -extern libxl_ctx ctx; +extern libxl_ctx *ctx;extern xentoollog_logger_stdiostream *logger;/* global options */
tools/libxl/xl_cmdimpl.c +195 -194
1,338 lines not on this page · raw message
tools/ocaml/libs/xl/xl_stubs.c +25 -25
200 lines not on this page · raw message
tools/python/setup.py +1 -1
@@ -83,7 +83,7 @@ netlink = Extension("netlink", xl = Extension("xl", extra_compile_args = extra_compile_args, - include_dirs = [ PATH_XEN, PATH_LIBXL, PATH_LIBXC, PATH_XENSTORE, "xen/lowlevel/xl" ], + include_dirs = [ PATH_XEN, PATH_LIBXL, PATH_LIBXC, "xen/lowlevel/xl" ], library_dirs = [ PATH_LIBXL ], libraries = [ "xenlight" ], depends = [ PATH_LIBXL + "/libxenlight.so" ],
tools/python/xen/lowlevel/xl/xl.c +16 -16
@@ -370,7 +370,7 @@ PyObject *attrib__struct_in_addr_get(strtypedef struct {PyObject_HEAD ; -libxl_ctx ctx; +libxl_ctx *ctx;xentoollog_logger_stdiostream *logger;xentoollog_level minmsglevel; }XlObject ;
@@ -381,7 +381,7 @@ static PyObject *pyxl_list_domains(XlObjPyObject *list;int nr_dom, i; - info =libxl_list_domain (&self->ctx, &nr_dom); + info =libxl_list_domain (self->ctx, &nr_dom);if (NULL == info )return PyList_New (0 );
@@ -416,7 +416,7 @@ static PyObject *pyxl_domid_to_name(XlObif ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; - domname =libxl_domid_to_name (&self->ctx, domid); + domname =libxl_domid_to_name (self->ctx, domid); ret =PyString_FromString (domname);free (domname);
@@ -428,7 +428,7 @@ static PyObject *pyxl_domain_shutdown(Xlint domid, req =0 ;if ( !PyArg_ParseTuple (args,"i|i" , &domid, &req) )return NULL ; -if (libxl_domain_shutdown (&self->ctx, domid, req) ) { +if (libxl_domain_shutdown (self->ctx, domid, req) ) {PyErr_SetString (xl_error_obj,"cannot shutdown domain" );return NULL ; }
@@ -441,7 +441,7 @@ static PyObject *pyxl_domain_destroy(XlOint domid, force =1 ;if ( !PyArg_ParseTuple (args,"i|i" , &domid, &force) )return NULL ; -if (libxl_domain_destroy (&self->ctx, domid, force) ) { +if (libxl_domain_destroy (self->ctx, domid, force) ) {PyErr_SetString (xl_error_obj,"cannot destroy domain" );return NULL ; }
@@ -454,7 +454,7 @@ static PyObject *pyxl_domain_pause(XlObjint domid;if ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; -if (libxl_domain_pause (&self->ctx, domid) ) { +if (libxl_domain_pause (self->ctx, domid) ) {PyErr_SetString (xl_error_obj,"cannot pause domain" );return NULL ; }
@@ -467,7 +467,7 @@ static PyObject *pyxl_domain_unpause(XlOint domid;if ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; -if (libxl_domain_unpause (&self->ctx, domid) ) { +if (libxl_domain_unpause (self->ctx, domid) ) {PyErr_SetString (xl_error_obj,"cannot unpause domain" );return NULL ; }
@@ -481,7 +481,7 @@ static PyObject *pyxl_domain_rename(XlObint domid;if ( !PyArg_ParseTuple (args,"is|s" , &domid, &new_name, &old_name) )return NULL ; -if (libxl_domain_rename (&self->ctx, domid, old_name, new_name) ) { +if (libxl_domain_rename (self->ctx, domid, old_name, new_name) ) {PyErr_SetString (xl_error_obj,"cannot rename domain" );return NULL ; }
@@ -501,7 +501,7 @@ static PyObject *pyxl_pci_add(XlObject *return NULL ; } pci = (Py_device_pci *)obj; -if (libxl_device_pci_add (&self->ctx, domid, &pci->obj) ) { +if (libxl_device_pci_add (self->ctx, domid, &pci->obj) ) {PyErr_SetString (xl_error_obj,"cannot add pci device" );return NULL ; }
@@ -522,7 +522,7 @@ static PyObject *pyxl_pci_del(XlObject *return NULL ; } pci = (Py_device_pci *)obj; -if (libxl_device_pci_remove (&self->ctx, domid, &pci->obj, force) ) { +if (libxl_device_pci_remove (self->ctx, domid, &pci->obj, force) ) {PyErr_SetString (xl_error_obj,"cannot remove pci device" );return NULL ; }
@@ -544,7 +544,7 @@ static PyObject *pyxl_pci_parse(XlObjectreturn NULL ; } -if (libxl_device_pci_parse_bdf (&self->ctx, &pci->obj, str) ) { +if (libxl_device_pci_parse_bdf (self->ctx, &pci->obj, str) ) {PyErr_SetString (xl_error_obj,"cannot parse pci device spec (BDF)" );Py_DECREF (pci);return NULL ;
@@ -559,7 +559,7 @@ static PyObject *pyxl_pci_list_assignablPyObject *list;int nr_dev, i; -if (libxl_device_pci_list_assignable (&self->ctx, &dev, &nr_dev) ) { +if (libxl_device_pci_list_assignable (self->ctx, &dev, &nr_dev) ) {PyErr_SetString (xl_error_obj,"Cannot list assignable devices" );return NULL ; }
@@ -595,7 +595,7 @@ static PyObject *pyxl_pci_list(XlObjectif ( !PyArg_ParseTuple (args,"i" , &domid) )return NULL ; -if (libxl_device_pci_list_assigned (&self->ctx, &dev, domid, &nr_dev) ) { +if (libxl_device_pci_list_assigned (self->ctx, &dev, domid, &nr_dev) ) {PyErr_SetString (xl_error_obj,"Cannot list assignable devices" );return NULL ; }
@@ -663,7 +663,7 @@ static PyObject *PyXl_new(PyTypeObject *if (self ==NULL )return NULL ; -memset (&self->ctx,0 ,sizeof (self->ctx)); + self->ctx =NULL ; self->logger =NULL ; self->minmsglevel =XTL_PROGRESS ;
@@ -679,7 +679,7 @@ PyXl_init(XlObject *self, PyObject *argsreturn -1 ; } -if (libxl_ctx_init (&self->ctx,LIBXL_VERSION , +if (libxl_ctx_alloc (&self->ctx,LIBXL_VERSION , (xentoollog_logger *)self->logger) ) {PyErr_SetString (xl_error_obj,"cannot init xl context" );return -1 ;
@@ -690,7 +690,7 @@ PyXl_init(XlObject *self, PyObject *argsstatic void PyXl_dealloc (XlObject *self) { -libxl_ctx_free (&self->ctx); +libxl_ctx_free (self->ctx);if ( self->logger )xtl_logger_destroy ((xentoollog_logger *)self->logger);
PATCH 1/1 tools: remove pattern matched linking rules
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1301568860 -3600
# Node ID 25e25665f03db5012283e4dc5957d6aa69a30ddf # Parent f968b14db03fcd7c42125b2ef9bc28c424959b2a
tools: remove pattern matched linking rules
Most subdirs only build a single tool to start with and those which build multiple tools often have different linkage requirements.
tools/debugger/xenitp/Makefile +3 -24
@@ -5,14 +5,7 @@ include $(XEN_ROOT)/tools/Rules.mk CFLAGS += $(CFLAGS_libxenctrl) -HDRS = $(wildcard *.h) -OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) - -BIN = LIBBIN = -SCRIPTS = -MAN1 = $(wildcard *.1) -MAN8 = $(wildcard *.8) ifeq ($(XEN_TARGET_ARCH),ia64) LIBBIN += xenitp
@@ -22,32 +15,18 @@ endif all: build .PHONY: build -build: $(BIN) $(LIBBIN) +build: $(LIBBIN) .PHONY: install install: build - $(INSTALL_DIR) $(DESTDIR)$(BINDIR) [ -z "$(LIBBIN)" ] || $(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR) - $(INSTALL_DIR) $(DESTDIR)$(MAN1DIR) - $(INSTALL_DIR) $(DESTDIR)$(MAN8DIR) - if [ "x$(SCRIPTS)" != "x" ]; then \ - $(INSTALL_PROG) $(BIN) $(SCRIPTS) $(DESTDIR)$(BINDIR); \ - fi [ -z "$(LIBBIN)" ] || $(INSTALL_PROG) $(LIBBIN) $(DESTDIR)$(PRIVATE_BINDIR) - if [ "x$(MAN1)" != "x" ]; then \ - $(INSTALL_DATA) $(MAN1) $(DESTDIR)$(MAN1DIR); \ - fi - if [ "x$(MAN1)" != "x" ]; then \ - $(INSTALL_DATA) $(MAN8) $(DESTDIR)$(MAN8DIR); \ - fi .PHONY: clean clean: - $(RM) *.a *.so *.o *.rpm $(BIN) $(LIBBIN) - -%: %.c $(HDRS) Makefile - $(CC) $(CFLAGS) -o $@ $< $(LDLIBS_libxenctrl) + $(RM) *.a *.so *.o *.rpm $(LIBBIN) XENITP_OBJS=xenitp.o ia64-dis.o ia64-opc.o cpu-ia64-opc.o + xenitp: $(XENITP_OBJS) $(CC) $(CFLAGS) -o $@ $(XENITP_OBJS) $(LDLIBS_libxenctrl)
tools/flask/utils/Makefile +7 -4
@@ -18,7 +18,13 @@ CLIENTS_OBJS := $(patsubst flask-%,%.o,$ .PHONY: all all: $(CLIENTS) -$(CLIENTS): flask-%: %.o +flask-loadpolicy: loadpolicy.o + $(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@ + +flask-setenforce: setenforce.o + $(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@ + +flask-getenforce: getenforce.o $(CC) $(LDFLAGS) $< $(LDLIBS) -L$(LIBFLASK_ROOT) -lflask $(LDLIBS_libxenctrl) -o $@ .PHONY: clean
@@ -41,6 +47,3 @@ install: all $(INSTALL_PROG) $(CLIENTS) $(DESTDIR)$(SBINDIR) -include $(DEPS) - -# never delete any intermediate files. -.SECONDARY:
tools/misc/Makefile +23 -13
@@ -13,14 +13,6 @@ TARGETS-$(CONFIG_X86) += xen-detect xen- TARGETS-$(CONFIG_MIGRATE) += xen-hptool TARGETS := $(TARGETS-y) -LDLIBS_xenperf := $(LDLIBS_libxenctrl) -LDLIBS_xenpm := $(LDLIBS_libxenctrl) -LDLIBS_xenlockprof := $(LDLIBS_libxenctrl) -LDLIBS_xenwatchdogd := $(LDLIBS_libxenctrl) -LDLIBS_xen-hvmctx := $(LDLIBS_libxenctrl) -LDLIBS_xen-hvmcrash := $(LDLIBS_libxenctrl) -LDLIBS_xen-hptool := $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) - SUBDIRS-$(CONFIG_LOMOUNT) += lomount SUBDIRS-$(CONFIG_MINITERM) += miniterm SUBDIRS := $(SUBDIRS-y)
@@ -54,13 +46,31 @@ clean: $(RM) *.o $(TARGETS) *~ $(DEPS) set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done -%.o: %.c $(HDRS) Makefile - $(CC) -c $(CFLAGS) -o $@ $< +xen-hvmctx: xen-hvmctx.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) -xen-hvmctx xen-hvmcrash xenperf xenpm gtracestat xenlockprof xen-hptool xenwatchdogd: %: %.o Makefile - $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_$*) +xen-hvmcrash: xen-hvmcrash.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) -gtraceview: %: %.o Makefile +xenperf: xenperf.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) + +xenpm: xenpm.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) + +gtracestat: gtracestat.o + $(CC) $(LDFLAGS) -o $@ $< + +xenlockprof: xenlockprof.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) + +xen-hptool: xen-hptool.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) + +xenwatchdogd: xenwatchdogd.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) + +gtraceview: gtraceview.o $(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS) -include $(DEPS)
tools/misc/lomount/Makefile +3 -7
@@ -3,16 +3,11 @@ include $(XEN_ROOT)/tools/Rules.mk CFLAGS += -Werror -HDRS = $(wildcard *.h) -OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) - -BIN = lomount - .PHONY: all all: build .PHONY: build -build: $(BIN) +build: lomount .PHONY: install install install-recurse: build
@@ -22,6 +17,7 @@ install install-recurse: build clean: $(RM) *.a *.so *.o *.rpm $(BIN) -%: %.c $(HDRS) Makefile +lomount: lomount.o $(CC) $(CFLAGS) -o $@ $< +-include $(DEPS)
tools/tests/mce-test/tools/Makefile +4 -5
@@ -2,21 +2,20 @@ XEN_ROOT=$(CURDIR)/../../../.. include $(XEN_ROOT)/tools/Rules.mk CFLAGS += -Werror - CFLAGS += $(CFLAGS_libxenctrl) +CFLAGS += $(CFLAGS_libxenguest) +CFLAGS += $(CFLAGS_libxenstore) CFLAGS += $(CFLAGS_xeninclude) -HDRS = $(wildcard *.h) - .PHONY: all all: xen-mceinj install: - cp xen-mceinj /usr/sbin/ + $(INSTALL_PROG) xen-mceinj $(DESTDIR)$(SBINDIR) .PHONY: clean clean: $(RM) *.o xen-mceinj -xen-mceinj: %: %.o Makefile +xen-mceinj: xen-mceinj.o Makefile $(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore)
tools/tests/xen-access/Makefile +3 -7
@@ -4,28 +4,24 @@ include $(XEN_ROOT)/tools/Rules.mk CFLAGS += -Werror CFLAGS += $(CFLAGS_libxenctrl) +CFLAGS += $(CFLAGS_libxenguest) CFLAGS += $(CFLAGS_xeninclude) TARGETS-y := TARGETS-$(CONFIG_X86) += xen-access TARGETS := $(TARGETS-y) -SUBDIRS-y := -SUBDIRS := $(SUBDIRS-y) - .PHONY: all all: build .PHONY: build build: $(TARGETS) - set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d; done .PHONY: clean clean: $(RM) *.o $(TARGETS) *~ $(DEPS) - set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done -xen-access: %: %.o Makefile - $(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) +xen-access: xen-access.o Makefile + $(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) -include $(DEPS)
tools/xcutils/Makefile +11 -7
@@ -20,19 +20,23 @@ CFLAGS_xc_save.o := $(CFLAGS_libxenct CFLAGS_readnotes.o := $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) CFLAGS_lsevtchn.o := $(CFLAGS_libxenctrl) -LDLIBS_xc_restore := $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) -LDLIBS_xc_save := $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) -LDLIBS_readnotes := $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) -LDLIBS_lsevtchn := $(LDLIBS_libxenctrl) - .PHONY: all all: build .PHONY: build build: $(PROGRAMS) -$(PROGRAMS): %: %.o - $(CC) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_$*) -o $@ +xc_restore: xc_restore.o + $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) + +xc_save: xc_save.o + $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) + +readnotes: readnotes.o + $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) + +lsevtchn: lsevtchn.o + $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) .PHONY: install install: build
tools/xenbackendd/Makefile +3 -6
@@ -17,13 +17,11 @@ CFLAGS += $(CFLAGS_libxenstore) CPPFLAGS += -DXEN_SCRIPT_DIR="\"$(XEN_SCRIPT_DIR)\"" LDLIBS += $(LDLIBS_libxenstore) -SBIN = xenbackendd - .PHONY: all all: build .PHONY: build -build: $(SBIN) +build: xenbackendd .PHONY: install install: build
@@ -32,10 +30,9 @@ install: build .PHONY: clean clean: - rm -f $(SBIN) $(DEPS) + rm -f $(DEPS) - -%: %.o Makefile +xenbackendd: xenbackendd.o $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) -include $(DEPS)
tools/xenmon/Makefile +4 -6
@@ -17,14 +17,13 @@ CFLAGS += -Werror CFLAGS += $(CFLAGS_libxenctrl) LDLIBS += $(LDLIBS_libxenctrl) -BIN = xentrace_setmask xenbaked SCRIPTS = xenmon.py .PHONY: all all: build .PHONY: build -build: $(BIN) +build: xentrace_setmask xenbaked .PHONY: install install: build
@@ -37,13 +36,12 @@ install: build .PHONY: clean clean: - rm -f $(BIN) $(DEPS) + rm -f $(DEPS) - -%: %.o Makefile +xenbaked: xenbaked.o Makefile $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) -xentrace_%: %.o Makefile +xentrace_setmask: setmask.o Makefile $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) -include $(DEPS)
tools/xenpmd/Makefile +4 -6
@@ -6,21 +6,19 @@ CFLAGS += $(CFLAGS_libxenstore) LDLIBS += $(LDLIBS_libxenstore) -BIN = xenpmd - .PHONY: all -all: $(BIN) +all: xenpmd .PHONY: install install: all $(INSTALL_DIR) $(DESTDIR)$(SBINDIR) - $(INSTALL_PROG) $(BIN) $(DESTDIR)$(SBINDIR) + $(INSTALL_PROG) xenpmd $(DESTDIR)$(SBINDIR) .PHONY: clean clean: - $(RM) -f $(BIN) $(DEPS) + $(RM) -f xenpmd $(DEPS) -%: %.o Makefile +xenpmd: xenpmd.o Makefile $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) -include $(DEPS)
tools/xentrace/Makefile +7 -18
@@ -6,27 +6,12 @@ CFLAGS += -Werror CFLAGS += $(CFLAGS_libxenctrl) LDLIBS += $(LDLIBS_libxenctrl) -HDRS = $(wildcard *.h) -OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) - BIN = xentrace xentrace_setsize -LIBBIN = +LIBBIN = xenctx SCRIPTS = xentrace_format MAN1 = $(wildcard *.1) MAN8 = $(wildcard *.8) -ifeq ($(XEN_TARGET_ARCH),x86_32) -LIBBIN += xenctx -endif - -ifeq ($(XEN_TARGET_ARCH),x86_64) -LIBBIN += xenctx -endif - -ifeq ($(XEN_TARGET_ARCH),ia64) -LIBBIN += xenctx -endif - .PHONY: all all: build
@@ -49,9 +34,13 @@ install: build clean: $(RM) *.a *.so *.o *.rpm $(BIN) $(LIBBIN) $(DEPS) -%: %.o $(HDRS) Makefile +xentrace: xentrace.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) -xentrace_%: %.o $(HDRS) Makefile + +xenctx: xenctx.o + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) + +xentrace_setsize: setsize.o $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) -include $(DEPS)
PATCH 1/1 tools: remove some .o and binary files on clean
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1301568860 -3600
# Node ID dcc9d9a5fb46bf4f2e08fcda78526b18367f8b8b # Parent 25e25665f03db5012283e4dc5957d6aa69a30ddf
tools: remove some .o and binary files on clean
tools/xenmon/Makefile +3 -1
@@ -36,7 +36,9 @@ install: build .PHONY: clean clean: - rm -f $(DEPS) + $(RM) -f $(DEPS) + $(RM) -f xenbaked xenbaked.o + $(RM) -f xentrace_setmake setmask.o xenbaked: xenbaked.o Makefile $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
tools/xenpmd/Makefile +1 -1
@@ -16,7 +16,7 @@ install: all .PHONY: clean clean: - $(RM) -f xenpmd $(DEPS) + $(RM) -f xenpmd xenpmd.o $(DEPS) xenpmd: xenpmd.o Makefile $(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
Re: [PATCH 4 of 4] tools: remove some .o and binary files on clean
Ian Campbell writes ("[Xen-devel] [PATCH 4 of 4] tools: remove some .o and binary files on clean"):
Quoted 1 line
tools: remove some .o and binary files on clean
Tahnks, I've acked and applied 1, 3 and 4. I see 4 was a repost of one I was complaining about earlier, and it applied fine after 1.
Ian.