From patchwork Tue Feb 21 15:51:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9584959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D0443600C1 for ; Tue, 21 Feb 2017 15:54:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCB2928304 for ; Tue, 21 Feb 2017 15:54:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0CD128613; Tue, 21 Feb 2017 15:54:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A2FED28304 for ; Tue, 21 Feb 2017 15:54:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgCjD-0001TW-Sy; Tue, 21 Feb 2017 15:51:47 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgCjD-0001T9-2C for xen-devel@lists.xenproject.org; Tue, 21 Feb 2017 15:51:47 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 73/41-13524-2126CA85; Tue, 21 Feb 2017 15:51:46 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEIsWRWlGSWpSXmKPExsXitHSDva5g0po IgynHLSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyWg48ZC76YVTz59YC9gXGeQRcjJ4eEgL/E nI6PrCA2m4CyxM/OXjYQW0RAT6LpwHPGLkYuDmaBpYwSPyetZAdJCAvYSPTc/MwEYrMIqEqs6 5gI1sArYCHx50gvO8RQeYldbRfBhnIKWEr8vD4DzBYCqjk18x+UrSDRMf0YE0SvoMTJmU9YQG xmAQmJgy9eME9g5J2FJDULSWoBI9MqRo3i1KKy1CJdQ0O9pKLM9IyS3MTMHF1DAzO93NTi4sT 01JzEpGK95PzcTYzA8GEAgh2Mn5YFHGKU5GBSEuXNtlwTIcSXlJ9SmZFYnBFfVJqTWnyIUYaD Q0mCly8RKCdYlJqeWpGWmQMMZJi0BAePkgivSAJQmre4IDG3ODMdInWKUZfj1I3TL5mEWPLy8 1KlxHmVQWYIgBRllObBjYBF1SVGWSlhXkago4R4ClKLcjNLUOVfMYpzMCoJ894FWcWTmVcCt+ kV0BFMQEfc9FgJckRJIkJKqoGxf2qSef2Um/sXVpc5ZE9yTeLZMfNrQGLGg0NuH21u+C1q2n7 /dU5n9Wz/w8pbo1VLrAv3ay1KWLFxbcxeuxOLbnvI2svJKyefCZjyYnXktXnFS21LdbvWurdm 5bfuXaMo/fVlUxHL6fUTGy1dNZTOdoe1rZmlwbi2w+TJh+br56v870wRzBJSYinOSDTUYi4qT gQAV4R5JKUCAAA= X-Env-Sender: prvs=218e6436c=wei.liu2@citrix.com X-Msg-Ref: server-10.tower-21.messagelabs.com!1487692303!52171168!2 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29084 invoked from network); 21 Feb 2017 15:51:45 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-10.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 21 Feb 2017 15:51:45 -0000 X-IronPort-AV: E=Sophos;i="5.35,190,1484006400"; d="scan'208";a="417508685" From: Wei Liu To: Xen-devel Date: Tue, 21 Feb 2017 15:51:42 +0000 Message-ID: <20170221155142.17288-3-wei.liu2@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170221155142.17288-1-wei.liu2@citrix.com> References: <20170221155142.17288-1-wei.liu2@citrix.com> MIME-Version: 1.0 Cc: yi.y.sun@linux.intel.com, Ian Jackson , Wei Liu , zhangchen.fnst@cn.fujitsu.com, haozhong.zhang@intel.com Subject: [Xen-devel] [PATCH 2/2] tools: move xl to a dedicated directory X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- .gitignore | 2 +- tools/libxl/Makefile | 22 ++++--------------- tools/xl/Makefile | 43 +++++++++++++++++++++++++++++++++++++ tools/{libxl => xl}/bash-completion | 0 tools/{libxl => xl}/xl.c | 0 tools/{libxl => xl}/xl.h | 0 tools/{libxl => xl}/xl_cmdimpl.c | 0 tools/{libxl => xl}/xl_cmdtable.c | 0 tools/{libxl => xl}/xl_sxp.c | 0 9 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 tools/xl/Makefile rename tools/{libxl => xl}/bash-completion (100%) rename tools/{libxl => xl}/xl.c (100%) rename tools/{libxl => xl}/xl.h (100%) rename tools/{libxl => xl}/xl_cmdimpl.c (100%) rename tools/{libxl => xl}/xl_cmdtable.c (100%) rename tools/{libxl => xl}/xl_sxp.c (100%) diff --git a/.gitignore b/.gitignore index c8d56d1bdb..a785006e44 100644 --- a/.gitignore +++ b/.gitignore @@ -189,7 +189,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 @@ -380,6 +379,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/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/xl/Makefile b/tools/xl/Makefile new file mode 100644 index 0000000000..32dff40584 --- /dev/null +++ b/tools/xl/Makefile @@ -0,0 +1,43 @@ +# +# tools/xl/Makefile +# + +XEN_ROOT = $(CURDIR)/../.. +include $(XEN_ROOT)/tools/Rules.mk + +CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations \ + -Wno-declaration-after-statement -Wformat-nonliteral +CFLAGS += -I. -fPIC + +CFLAGS += $(PTHREAD_CFLAGS) +LDFLAGS += $(PTHREAD_LDFLAGS) + +CFLAGS_XL += $(CFLAGS_libxenlight) +CFLAGS_XL += -Wshadow + +XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o +$(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog) +$(XL_OBJS): CFLAGS += $(CFLAGS_XL) +$(XL_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h # libxl_json.h needs it. + +.PHONY: all +all: xl + +xl: $(XL_OBJS) + $(CC) $(LDFLAGS) -o $@ $(XL_OBJS) $(LDLIBS_libxlutil) $(LDLIBS_libxenlight) $(LDLIBS_libxentoollog) -lyajl $(APPEND_LDFLAGS) + +.PHONY: install +install: all + $(INSTALL_DIR) $(DESTDIR)$(sbindir) + $(INSTALL_DIR) $(DESTDIR)$(BASH_COMPLETION_DIR) + $(INSTALL_PROG) xl $(DESTDIR)$(sbindir) + $(INSTALL_DATA) bash-completion $(DESTDIR)$(BASH_COMPLETION_DIR)/xl.sh + +.PHONY: clean +clean: + $(RM) -f *.o xl $(DEPS) + +distclean: clean + + +-include $(DEPS) diff --git a/tools/libxl/bash-completion b/tools/xl/bash-completion similarity index 100% rename from tools/libxl/bash-completion rename to tools/xl/bash-completion diff --git a/tools/libxl/xl.c b/tools/xl/xl.c similarity index 100% rename from tools/libxl/xl.c rename to tools/xl/xl.c diff --git a/tools/libxl/xl.h b/tools/xl/xl.h similarity index 100% rename from tools/libxl/xl.h rename to tools/xl/xl.h diff --git a/tools/libxl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c similarity index 100% rename from tools/libxl/xl_cmdimpl.c rename to tools/xl/xl_cmdimpl.c diff --git a/tools/libxl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c similarity index 100% rename from tools/libxl/xl_cmdtable.c rename to tools/xl/xl_cmdtable.c diff --git a/tools/libxl/xl_sxp.c b/tools/xl/xl_sxp.c similarity index 100% rename from tools/libxl/xl_sxp.c rename to tools/xl/xl_sxp.c