debuggers.hg

view tools/libxl/Makefile @ 22855:1d1eec7e1fb4

xl: Perform minimal validation of virtual disk file while parsing config file

This patch performs some very basic validation on the virtual disk
file passed through the config file. This validation ensures that we
don't go too far with the initialization like spawn qemu and more
while there could be some potentially fundamental issues.

[ Patch fixed up to work with PHYSTYPE_EMPTY 22808:6ec61438713a -iwj ]

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Kamala Narasimhan <kamala.narasimhan@gmail.com>
date Tue Jan 25 18:09:49 2011 +0000 (2011-01-25)
parents ca75ceb02221
children
line source
1 #
2 # tools/libxl/Makefile
3 #
5 XEN_ROOT = ../..
6 include $(XEN_ROOT)/tools/Rules.mk
8 MAJOR = 1.0
9 MINOR = 0
11 XLUMAJOR = 1.0
12 XLUMINOR = 0
14 CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations
15 CFLAGS += -I. -fPIC
16 CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
18 LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(UTIL_LIBS)
19 ifeq ($(CONFIG_Linux),y)
20 LIBS += -luuid
21 endif
23 LIBXL_OBJS-y = osdeps.o libxl_paths.o libxl_bootloader.o flexarray.o
24 ifeq ($(LIBXL_BLKTAP),y)
25 LIBXL_OBJS-y += libxl_blktap2.o
26 else
27 LIBXL_OBJS-y += libxl_noblktap2.o
28 endif
29 LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o
30 LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o
32 LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
33 libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
34 libxl_internal.o libxl_utils.o $(LIBXL_OBJS-y)
35 LIBXL_OBJS += _libxl_types.o
37 AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h
38 AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c
39 LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o
41 CLIENTS = xl
43 XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o
45 .PHONY: all
46 all: $(CLIENTS) libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
47 $(AUTOSRCS) $(AUTOINCS)
49 $(LIBXLU_OBJS): $(AUTOINCS)
51 %.c %.h: %.y
52 @rm -f $*.[ch]
53 $(BISON) --output=$*.c $<
55 %.c %.h: %.l
56 @rm -f $*.[ch]
57 $(FLEX) --header-file=$*.h --outfile=$*.c $<
59 genpath-target = $(call buildmakevars2file,_libxl_paths.h.tmp)
60 $(eval $(genpath-target))
62 _libxl_paths.h: genpath
63 sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" $@.tmp >$@.2.tmp
64 if ! cmp $@.2.tmp $@; then mv -f $@.2.tmp $@; fi
66 libxl_paths.c: _libxl_paths.h
68 libxl.h: _libxl_types.h
70 $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS): libxl.h
72 _libxl_%.h _libxl_%.c: libxl.idl gen%.py libxl%.py
73 $(PYTHON) gen$*.py libxl.idl __libxl_$*.h __libxl_$*.c
74 mv __libxl_$*.h _libxl_$*.h
75 mv __libxl_$*.c _libxl_$*.c
77 libxenlight.so: libxenlight.so.$(MAJOR)
78 ln -sf $< $@
80 libxenlight.so.$(MAJOR): libxenlight.so.$(MAJOR).$(MINOR)
81 ln -sf $< $@
83 libxenlight.so.$(MAJOR).$(MINOR): $(LIBXL_OBJS)
84 $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
86 libxenlight.a: $(LIBXL_OBJS)
87 $(AR) rcs libxenlight.a $^
89 libxlutil.so: libxlutil.so.$(XLUMAJOR)
90 ln -sf $< $@
92 libxlutil.so.$(XLUMAJOR): libxlutil.so.$(XLUMAJOR).$(XLUMINOR)
93 ln -sf $< $@
95 libxlutil.so.$(XLUMAJOR).$(XLUMINOR): $(LIBXLU_OBJS)
96 $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxlutil.so.$(XLUMAJOR) $(SHLIB_LDFLAGS) -o $@ $^
98 libxlutil.a: $(LIBXLU_OBJS)
99 $(AR) rcs libxlutil.a $^
101 $(CLIENTS): $(XL_OBJS) libxlutil.so libxenlight.so
102 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
104 .PHONY: install
105 install: all
106 $(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
107 $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
108 $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)
109 $(INSTALL_DIR) $(DESTDIR)$(BASH_COMPLETION_DIR)
110 $(INSTALL_PROG) xl $(DESTDIR)$(SBINDIR)
111 $(INSTALL_PROG) libxenlight.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
112 ln -sf libxenlight.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenlight.so.$(MAJOR)
113 ln -sf libxenlight.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenlight.so
114 $(INSTALL_DATA) libxenlight.a $(DESTDIR)$(LIBDIR)
115 $(INSTALL_PROG) libxlutil.so.$(XLUMAJOR).$(XLUMINOR) $(DESTDIR)$(LIBDIR)
116 ln -sf libxlutil.so.$(XLUMAJOR).$(XLUMINOR) $(DESTDIR)$(LIBDIR)/libxlutil.so.$(XLUMAJOR)
117 ln -sf libxlutil.so.$(XLUMAJOR) $(DESTDIR)$(LIBDIR)/libxlutil.so
118 $(INSTALL_DATA) libxlutil.a $(DESTDIR)$(LIBDIR)
119 $(INSTALL_DATA) libxl.h _libxl_types.h libxl_uuid.h $(DESTDIR)$(INCLUDEDIR)
120 $(INSTALL_DATA) bash-completion $(DESTDIR)$(BASH_COMPLETION_DIR)/xl.sh
122 .PHONY: clean
123 clean:
124 $(RM) -f _*.h *.o *.so* *.a $(CLIENTS) $(DEPS)
125 $(RM) -f _*.c *.pyc _libxl_paths.*.tmp
126 # $(RM) -f $(AUTOSRCS) $(AUTOINCS)
128 distclean: clean
130 -include $(DEPS)