Factor libxenbuild out of libxenctrl
PATCH 2/2 Factor libxenbuild out of libxenctrl
This patch moves the building, save, and restore code to a seperate library (libxenbuild). This hasn't been done in a very clean way (since the header dependencies are pretty nightmarish in libxc right now) but this is something we can start from.
I haven't tested with IA64, hopefully that build doesn't break. This patch depends on the previous patch submitted.
Regards,
Anthony Liguori
# HG changeset patch
# User Anthony Liguori <[email protected]>
# Node ID e6db3830c47d620bac83feb9755eb14f5f57068c
# Parent 54370eeeb3311db2bcacfc797766a5993a079b4c
This patch breaks the building/save/restore code out into a separate library libxenbuild. It also updates the tools accordingly.
The build process isn't all that pretty right.
tools/libxc/Makefile +40 -15
@@ -19,22 +19,24 @@ SRCS += xc_domain.c SRCS += xc_evtchn.c SRCS += xc_gnttab.c -SRCS += xc_load_bin.c -SRCS += xc_load_elf.c -SRCS += xc_linux_build.c SRCS += xc_misc.c SRCS += xc_physdev.c SRCS += xc_private.c +SRCS += xc_ptrace.c +SRCS += xc_ptrace_core.c + ifeq ($(XEN_TARGET_ARCH),ia64) SRCS += xc_ia64_stubs.c -else -SRCS += xc_load_aout9.c -SRCS += xc_linux_restore.c -SRCS += xc_linux_save.c -SRCS += xc_vmx_build.c -SRCS += xc_ptrace.c -SRCS += xc_ptrace_core.c endif + +BUILD_SRCS := xc_load_aout9.c +BUILD_SRCS += xc_load_bin.c +BUILD_SRCS += xc_load_elf.c +BUILD_SRCS += xc_linux_build.c +BUILD_SRCS += xc_linux_restore.c +BUILD_SRCS += xc_linux_save.c +BUILD_SRCS += xc_vmx_build.c +BUILD_SRCS += xc_build_private.c CFLAGS += -Wall CFLAGS += -Werror
@@ -48,8 +50,14 @@ LIB_OBJS := $(patsubst %.c,%.o,$(SRCS)) PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS)) -LIB := libxenctrl.a libxenctrl-pic.a +LIB_BUILD_OBJS := $(patsubst %.c,%.o,$(BUILD_SRCS)) +PIC_BUILD_OBJS := $(patsubst %.c,%.opic,$(BUILD_SRCS)) + +LIB := libxenctrl.a LIB += libxenctrl.so libxenctrl.so.$(MAJOR) libxenctrl.so.$(MAJOR).$(MINOR) + +LIB += libxenbuild.a +LIB += libxenbuild.so libxenbuild.so.$(MAJOR) libxenbuild.so.$(MAJOR).$(MINOR) all: build build: check-for-zlib mk-symlinks
@@ -83,6 +91,11 @@ ln -sf libxenctrl.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so $(INSTALL_DATA) xenctrl.h $(DESTDIR)/usr/include/xen + $(INSTALL_PROG) libxenbuild.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR) + $(INSTALL_DATA) libxenbuild.a $(DESTDIR)/usr/$(LIBDIR) + ln -sf libxenbuild.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenbuild.so.$(MAJOR) + ln -sf libxenbuild.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenbuild.so + .PHONY: TAGS clean rpm install all TAGS:
@@ -100,10 +113,9 @@ mv staging/i386/*.rpm . rm -rf staging +# libxenctrl + libxenctrl.a: $(LIB_OBJS) - $(AR) rc $@ $^ - -libxenctrl-pic.a: $(PIC_OBJS) $(AR) rc $@ $^ libxenctrl.so: libxenctrl.so.$(MAJOR)
@@ -112,6 +124,19 @@ ln -sf $< $@ libxenctrl.so.$(MAJOR).$(MINOR): $(PIC_OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenctrl.so.$(MAJOR) -shared -o $@ $^ -lz + $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenctrl.so.$(MAJOR) -shared -o $@ $^ + +# libxenbuild + +libxenbuild.a: $(LIB_BUILD_OBJS) + $(AR) rc $@ $^ + +libxenbuild.so: libxenbuild.so.$(MAJOR) + ln -sf $< $@ +libxenbuild.so.$(MAJOR): libxenbuild.so.$(MAJOR).$(MINOR) + ln -sf $< $@ + +libxenbuild.so.$(MAJOR).$(MINOR): $(PIC_BUILD_OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenbuild.so.$(MAJOR) -shared -o $@ $^ -lz -lxenctrl -include $(DEPS)
tools/libxc/xc_linux_build.c +1 -1
@@ -2,7 +2,7 @@* xc_linux_build.c */ -#include "xc_private.h" +#include "xc_build_private.h" #if defined(__i386__)#define ELFSIZE 32
tools/libxc/xc_linux_restore.c +1 -1
@@ -6,7 +6,7 @@* Copyright (c) 2003, K A Fraser. */ -#include "xc_private.h" +#include "xc_build_private.h" #include <xen/linux/suspend.h> #define MAX_BATCH_SIZE 1024
tools/libxc/xc_linux_save.c +1 -1
@@ -8,7 +8,7 @@#include <inttypes.h> #include <sys/time.h> -#include "xc_private.h" +#include "xc_build_private.h" #include <xen/linux/suspend.h> #include <xen/io/domain_controller.h> #include <time.h>
tools/libxc/xc_private.c +0 -47
53 lines not on this page · raw message
tools/libxc/xc_private.h +3 -4
@@ -1,6 +1,6 @@ -#ifndef __XC_PRIVATE_H__ -#define __XC_PRIVATE_H__ +#ifndef XC_PRIVATE_H +#define XC_PRIVATE_H #include <unistd.h> #include <stdio.h>
@@ -15,6 +15,7 @@#include <string.h> #include "xenctrl.h" +#include "xenbuild.h" #include <xen/linux/privcmd.h>
@@ -316,8 +317,6 @@unsigned long xc_get_filesz (int fd); -char *xc_read_kernel_image (const char *filename,unsigned long *size); -void xc_map_memcpy (unsigned long dst,char *src,unsigned long size,int xch,u32 dom,unsigned long *parray,unsigned long vstart);
tools/libxc/xc_vmx_build.c +1 -1
@@ -3,7 +3,7 @@*/ #include <stddef.h> -#include "xc_private.h" +#include "xc_build_private.h" #define ELFSIZE 32#include "xc_elf.h" #include <stdlib.h>
tools/libxc/xenctrl.h +3 -60
78 lines not on this page · raw message
tools/python/setup.py +1 -1
@@ -17,7 +17,7 @@ XEN_ROOT + "/tools/xenstore", ] -libraries = [ "xenctrl", "xenstore" ] +libraries = [ "xenctrl", "xenbuild", "xenstore" ] xc = Extension("xc", extra_compile_args = extra_compile_args,
tools/xcutils/Makefile +1 -1
@@ -30,7 +30,7 @@ PROGRAMS = xc_restore xc_save -LDLIBS = -L$(XEN_LIBXC) -lxenctrl +LDLIBS = -L$(XEN_LIBXC) -lxenbuild .PHONY: all all: build
tools/xcutils/xc_restore.c +1 -1
@@ -11,7 +11,7 @@#include <stdio.h> #include <err.h> -#include <xenctrl.h> +#include <xenbuild.h> int main (int argc,char **argv)
tools/xcutils/xc_save.c +1 -1
@@ -11,7 +11,7 @@#include <stdio.h> #include <err.h> -#include <xenctrl.h> +#include <xenbuild.h> int main (int argc,char **argv)
tools/libxc/xc_build_private.c new file +56 -0
56 lines not on this page · raw message
tools/libxc/xc_build_private.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef XC_BUILD_PRIVATE_H +#define XC_BUILD_PRIVATE_H + +#include "xc_private.h" + +char *xc_read_kernel_image (const char *filename,unsigned long *size); + +#endif +
tools/libxc/xenbuild.c new file +11 -0
@@ -0,0 +1,11 @@ +/****************************************************************************** +* xenctrl.h +* +* A library for low-level access to the Xen control interfaces. +* +* Copyright (c) 2003-2004, K A Fraser. +*/ + +#ifndef __XC_H__ +#define __XC_H__ +
tools/libxc/xenbuild.h new file +69 -0
69 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 4 lines · Anthony Liguori
This patch moves the building, save, and restore code to a seperate library (libxenbuild). This hasn't been done in a very clean way (since the header dependencies are pretty nightmarish in libxc right now) but this is something we can start from.
I've applied this and done a first pass at cleaning it up some more, moving a few more things into libxenguest and exporting a few additional functions from libxenctrl which were static inline in xc_private.h before.
christian
Quoted 7 lines
I haven't tested with IA64, hopefully that build doesn't break. This patch depends on the previous patch submitted.
Regards,
Anthony Liguori
Quoted 12 lines · Christian Limpach
Quoted 3 lines · Anthony Liguori
This patch moves the building, save, and restore code to a seperate library (libxenbuild). This hasn't been done in a very clean way (since the header dependencies are pretty nightmarish in libxc right now) but this is something we can start from.
I've applied this and done a first pass at cleaning it up some more, moving a few more things into libxenguest and exporting a few additional functions from libxenctrl which were static inline in
xc_private.hbefore.
Thanks Christian!
Sorry, I had a brain slip and named it xenbuild instead of xenguest :-) I know there is a bunch more cleanup to do but I wanted to get something to start with.
Regards,
Anthony Liguori
Quoted 16 lines
christian
Quoted 7 lines
I haven't tested with IA64, hopefully that build doesn't break. This patch depends on the previous patch submitted.
Regards,
Anthony Liguori