[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 29/29] xl: merge xl_cmdimpl.c into xl.c
After splitting out all the meaty bits, xl_cmdimpl.c doesn't contain much. Merge the rest into xl.c and delete the file. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/xl/Makefile | 2 +- tools/xl/xl.c | 58 +++++++++++++++++++++++++++ tools/xl/xl_cmdimpl.c | 107 -------------------------------------------------- 3 files changed, 59 insertions(+), 108 deletions(-) delete mode 100644 tools/xl/xl_cmdimpl.c diff --git a/tools/xl/Makefile b/tools/xl/Makefile index 8c30fdcf9e..7b73e1b574 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -15,7 +15,7 @@ LDFLAGS += $(PTHREAD_LDFLAGS) CFLAGS_XL += $(CFLAGS_libxenlight) CFLAGS_XL += -Wshadow -XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.o +XL_OBJS = xl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cd.o xl_mem.o diff --git a/tools/xl/xl.c b/tools/xl/xl.c index 32346ad7a5..02179a6229 100644 --- a/tools/xl/xl.c +++ b/tools/xl/xl.c @@ -48,6 +48,15 @@ bool progress_use_cr = 0; xentoollog_level minmsglevel = minmsglevel_default; +int logfile = 2; + +/* every libxl action in xl uses this same libxl context */ +libxl_ctx *ctx; + +xlchild children[child_max]; + +const char *common_domname; + /* Get autoballoon option based on presence of dom0_mem Xen command line option. */ static int auto_autoballoon(void) @@ -370,6 +379,55 @@ int main(int argc, char **argv) return ret; } +int child_report(xlchildnum child) +{ + int status; + pid_t got = xl_waitpid(child, &status, 0); + if (got < 0) { + fprintf(stderr, "xl: warning, failed to waitpid for %s: %s\n", + children[child].description, strerror(errno)); + return ERROR_FAIL; + } else if (status) { + xl_report_child_exitstatus(XTL_ERROR, child, got, status); + return ERROR_FAIL; + } else { + return 0; + } +} + +void help(const char *command) +{ + int i; + struct cmd_spec *cmd; + + if (!command || !strcmp(command, "help")) { + printf("Usage xl [-vfN] <subcommand> [args]\n\n"); + printf("xl full list of subcommands:\n\n"); + for (i = 0; i < cmdtable_len; i++) { + printf(" %-19s ", cmd_table[i].cmd_name); + if (strlen(cmd_table[i].cmd_name) > 19) + printf("\n %-19s ", ""); + printf("%s\n", cmd_table[i].cmd_desc); + } + } else { + cmd = cmdtable_lookup(command); + if (cmd) { + printf("Usage: xl [-v%s%s] %s %s\n\n%s.\n\n", + cmd->modifies ? "f" : "", + cmd->can_dryrun ? "N" : "", + cmd->cmd_name, + cmd->cmd_usage, + cmd->cmd_desc); + if (cmd->cmd_option) + printf("Options:\n\n%s\n", cmd->cmd_option); + } + else { + printf("command \"%s\" not implemented\n", command); + } + } +} + + /* * Local variables: * mode: C diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c deleted file mode 100644 index bd7f8edb0a..0000000000 --- a/tools/xl/xl_cmdimpl.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2009-2017 Citrix Ltd and other contributors - * - * 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. - */ - -#define _GNU_SOURCE - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <time.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/time.h> -#include <fcntl.h> -#include <signal.h> -#include <sys/socket.h> -#include <sys/select.h> -#include <sys/utsname.h> /* for utsname in xl info */ -#include <xentoollog.h> -#include <ctype.h> -#include <inttypes.h> -#include <limits.h> -#include <xen/hvm/e820.h> - -#include <libxl.h> -#include <libxl_utils.h> -#include <libxl_json.h> -#include <libxlutil.h> -#include "xl.h" -#include "xl_utils.h" -#include "xl_parse.h" - -int logfile = 2; - -/* every libxl action in xl uses this same libxl context */ -libxl_ctx *ctx; - -xlchild children[child_max]; - -const char *common_domname; - -int child_report(xlchildnum child) -{ - int status; - pid_t got = xl_waitpid(child, &status, 0); - if (got < 0) { - fprintf(stderr, "xl: warning, failed to waitpid for %s: %s\n", - children[child].description, strerror(errno)); - return ERROR_FAIL; - } else if (status) { - xl_report_child_exitstatus(XTL_ERROR, child, got, status); - return ERROR_FAIL; - } else { - return 0; - } -} - -void help(const char *command) -{ - int i; - struct cmd_spec *cmd; - - if (!command || !strcmp(command, "help")) { - printf("Usage xl [-vfN] <subcommand> [args]\n\n"); - printf("xl full list of subcommands:\n\n"); - for (i = 0; i < cmdtable_len; i++) { - printf(" %-19s ", cmd_table[i].cmd_name); - if (strlen(cmd_table[i].cmd_name) > 19) - printf("\n %-19s ", ""); - printf("%s\n", cmd_table[i].cmd_desc); - } - } else { - cmd = cmdtable_lookup(command); - if (cmd) { - printf("Usage: xl [-v%s%s] %s %s\n\n%s.\n\n", - cmd->modifies ? "f" : "", - cmd->can_dryrun ? "N" : "", - cmd->cmd_name, - cmd->cmd_usage, - cmd->cmd_desc); - if (cmd->cmd_option) - printf("Options:\n\n%s\n", cmd->cmd_option); - } - else { - printf("command \"%s\" not implemented\n", command); - } - } -} - -/* - * Local variables: - * mode: C - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - */ -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |