From: Wei Liu Date: Tue, 21 Feb 2017 14:52:46 +0000 (+0000) Subject: tools: move xl to a dedicated directory X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~2697 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5258ab0fcc67587d802e33bcc5bf89048d184a73;p=xen.git tools: move xl to a dedicated directory It makes clear distinction between the client (xl) and library (libxl), which should help design better APIs. This will also help reduce the code size in libxl directory. Signed-off-by: Wei Liu Acked-by: Ian Jackson --- diff --git a/.gitignore b/.gitignore index 7182fe8068..557b38e1b2 100644 --- a/.gitignore +++ b/.gitignore @@ -190,7 +190,6 @@ tools/libxl/ssdt* tools/libxl/testenum tools/libxl/testenum.c tools/libxl/tmp.* -tools/libxl/xl tools/misc/cpuperf/cpuperf-perfcntr tools/misc/cpuperf/cpuperf-xen tools/misc/xc_shadow @@ -381,6 +380,7 @@ tools/firmware/etherboot/ipxe/ tools/python/xen/lowlevel/xl/_pyxl_types.c tools/python/xen/lowlevel/xl/_pyxl_types.h tools/xenstore/xenstore-watch +tools/xl/xl docs/txt/misc/*.txt docs/txt/man/*.txt diff --git a/tools/Makefile b/tools/Makefile index e6c0cc594a..68633a413d 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -31,6 +31,7 @@ endif SUBDIRS-y += xenpmd SUBDIRS-y += libxl +SUBDIRS-y += xl SUBDIRS-y += helpers SUBDIRS-$(CONFIG_X86) += xenpaging SUBDIRS-$(CONFIG_X86) += debugger/gdbsx diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile index 0f642cc57a..f00d9ef355 100644 --- a/tools/libxl/Makefile +++ b/tools/libxl/Makefile @@ -178,16 +178,9 @@ LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o \ libxlu_disk_l.o libxlu_disk.o libxlu_vif.o libxlu_pci.o $(LIBXLU_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h -CLIENTS = xl testidl libxl-save-helper +$(TEST_PROG_OBJS) _libxl.api-for-check: CFLAGS += $(CFLAGS_libxentoollog) -CFLAGS_XL += $(CFLAGS_libxenlight) -CFLAGS_XL += -Wshadow - -XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o -$(XL_OBJS) $(TEST_PROG_OBJS) _libxl.api-for-check: \ - CFLAGS += $(CFLAGS_libxentoollog) -$(XL_OBJS): CFLAGS += $(CFLAGS_XL) -$(XL_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h # libxl_json.h needs it. +CLIENTS = testidl libxl-save-helper libxl_dom.o: CFLAGS += -I$(XEN_ROOT)/tools # include libacpi/x86.h libxl_x86_acpi.o: CFLAGS += -I$(XEN_ROOT)/tools @@ -207,7 +200,7 @@ all: $(CLIENTS) $(TEST_PROGS) $(PKG_CONFIG) \ libxenlight.so libxenlight.a libxlutil.so libxlutil.a \ $(AUTOSRCS) $(AUTOINCS) -$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS) \ +$(LIBXL_OBJS) $(LIBXLU_OBJS) $(SAVE_HELPER_OBJS) \ $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS): \ $(AUTOINCS) libxl.api-ok @@ -249,7 +242,7 @@ libxl_internal_json.h: _libxl_types_internal_json.h xl.h: _paths.h $(LIBXL_OBJS) $(LIBXL_TEST_OBJS) $(LIBXLU_OBJS) \ - $(XL_OBJS) $(TEST_PROG_OBJS) $(SAVE_HELPER_OBJS): libxl.h + $(TEST_PROG_OBJS) $(SAVE_HELPER_OBJS): libxl.h $(LIBXL_OBJS) $(LIBXL_TEST_OBJS): libxl_internal.h _libxl_type%.h _libxl_type%_json.h _libxl_type%_private.h _libxl_type%.c: libxl_type%.idl gentypes.py idl.py @@ -288,9 +281,6 @@ libxlutil.so.$(XLUMAJOR).$(XLUMINOR): $(LIBXLU_OBJS) libxenlight.so libxlutil.a: $(LIBXLU_OBJS) $(AR) rcs libxlutil.a $^ -xl: $(XL_OBJS) libxlutil.so libxenlight.so - $(CC) $(LDFLAGS) -o $@ $(XL_OBJS) $(LDLIBS_libxlutil) $(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -lyajl $(APPEND_LDFLAGS) - test_%: test_%.o test_common.o libxlutil.so libxenlight_test.so $(CC) $(LDFLAGS) -o $@ $^ $(filter-out %libxenlight.so, $(LDLIBS_libxenlight)) $(LDLIBS_libxentoollog) -lyajl $(APPEND_LDFLAGS) @@ -306,13 +296,10 @@ $(PKG_CONFIG): % : %.in Makefile .PHONY: install install: all - $(INSTALL_DIR) $(DESTDIR)$(sbindir) $(INSTALL_DIR) $(DESTDIR)$(libdir) $(INSTALL_DIR) $(DESTDIR)$(includedir) - $(INSTALL_DIR) $(DESTDIR)$(BASH_COMPLETION_DIR) $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) $(INSTALL_DIR) $(DESTDIR)$(PKG_INSTALLDIR) - $(INSTALL_PROG) xl $(DESTDIR)$(sbindir) $(INSTALL_PROG) libxl-save-helper $(DESTDIR)$(LIBEXEC_BIN) $(INSTALL_SHLIB) libxenlight.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir) $(SYMLINK_SHLIB) libxenlight.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenlight.so.$(MAJOR) @@ -323,7 +310,6 @@ install: all $(SYMLINK_SHLIB) libxlutil.so.$(XLUMAJOR) $(DESTDIR)$(libdir)/libxlutil.so $(INSTALL_DATA) libxlutil.a $(DESTDIR)$(libdir) $(INSTALL_DATA) libxl.h libxl_event.h libxl_json.h _libxl_types.h _libxl_types_json.h _libxl_list.h libxl_utils.h libxl_uuid.h libxlutil.h $(DESTDIR)$(includedir) - $(INSTALL_DATA) bash-completion $(DESTDIR)$(BASH_COMPLETION_DIR)/xl.sh $(INSTALL_DATA) xenlight.pc $(DESTDIR)$(PKG_INSTALLDIR) $(INSTALL_DATA) xlutil.pc $(DESTDIR)$(PKG_INSTALLDIR) diff --git a/tools/libxl/bash-completion b/tools/libxl/bash-completion deleted file mode 100644 index b7cd6b3992..0000000000 --- a/tools/libxl/bash-completion +++ /dev/null @@ -1,20 +0,0 @@ -# Copy this file to /etc/bash_completion.d/xl.sh - -_xl() -{ - local IFS=$'\n,' - - local cur opts xl - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - xl=xl - - if [[ $COMP_CWORD == 1 ]] ; then - opts=`${xl} help 2>/dev/null | sed '1,4d' | awk '/^ [^ ]/ {print $1}' | sed 's/$/ ,/g'` && COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - fi - - return 0 -} - -complete -F _xl -o nospace -o default xl diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c deleted file mode 100644 index a272258155..0000000000 --- a/tools/libxl/xl.c +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright (C) 2009 Citrix Ltd. - * Author Stefano Stabellini - * Author Vincent Hanquez - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; version 2.1 only. with the special - * exception on linking described in file LICENSE. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - */ - -#include "libxl_osdeps.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libxl.h" -#include "libxl_utils.h" -#include "libxlutil.h" -#include "xl.h" - -xentoollog_logger_stdiostream *logger; -int dryrun_only; -int force_execution; -int autoballoon = -1; -char *blkdev_start; -int run_hotplug_scripts = 1; -char *lockfile; -char *default_vifscript = NULL; -char *default_bridge = NULL; -char *default_gatewaydev = NULL; -char *default_vifbackend = NULL; -char *default_remus_netbufscript = NULL; -char *default_colo_proxy_script = NULL; -enum output_format default_output_format = OUTPUT_FORMAT_JSON; -int claim_mode = 1; -bool progress_use_cr = 0; - -xentoollog_level minmsglevel = minmsglevel_default; - -/* Get autoballoon option based on presence of dom0_mem Xen command - line option. */ -static int auto_autoballoon(void) -{ - const libxl_version_info *info; - regex_t regex; - int ret; - - info = libxl_get_version_info(ctx); - if (!info) - return 1; /* default to on */ - - ret = regcomp(®ex, - "(^| )dom0_mem=((|min:|max:)[0-9]+[bBkKmMgG]?,?)+($| )", - REG_NOSUB | REG_EXTENDED); - if (ret) - return 1; - - ret = regexec(®ex, info->commandline, 0, NULL, 0); - regfree(®ex); - return ret == REG_NOMATCH; -} - -static void parse_global_config(const char *configfile, - const char *configfile_data, - int configfile_len) -{ - long l; - XLU_Config *config; - int e; - const char *buf; - - config = xlu_cfg_init(stderr, configfile); - if (!config) { - fprintf(stderr, "Failed to allocate for configuration\n"); - exit(1); - } - - e = xlu_cfg_readdata(config, configfile_data, configfile_len); - if (e) { - fprintf(stderr, "Failed to parse config file: %s\n", strerror(e)); - exit(1); - } - - if (!xlu_cfg_get_string(config, "autoballoon", &buf, 0)) { - if (!strcmp(buf, "on") || !strcmp(buf, "1")) - autoballoon = 1; - else if (!strcmp(buf, "off") || !strcmp(buf, "0")) - autoballoon = 0; - else if (!strcmp(buf, "auto")) - autoballoon = -1; - else - fprintf(stderr, "invalid autoballoon option"); - } - if (autoballoon == -1) - autoballoon = auto_autoballoon(); - - if (!xlu_cfg_get_long (config, "run_hotplug_scripts", &l, 0)) - run_hotplug_scripts = l; - - if (!xlu_cfg_get_string (config, "lockfile", &buf, 0)) - lockfile = strdup(buf); - else { - lockfile = strdup(XL_LOCK_FILE); - } - - if (!lockfile) { - fprintf(stderr, "failed to allocate lockfile\n"); - exit(1); - } - - /* - * For global options that are related to a specific type of device - * we use the following nomenclature: - * - * .default.