Skip to contentSkip to conversation

Refactor xl code

PATCH In review Wei Liu 2 participants 76 messages Feb 24, 2017 – Feb 28, 2017

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

cover Refactor xl code

xl_cmdimpl.c has become prohibitively large (almost 10k lines in one single file). Try to split it up into multiple files according to the functionality of the code.

I will run a full osstest flight before merging. Send the first version out as quick as possible to gather feedback because I know other people are also touching this area of code.

Further improvements are certainly desired, for example we should probably give functions better names, but this series is already very long, so let's save that for another day.

Wei Liu (29):
xl: remove accidentally committed hunk from Makefile
xl: update copyright information
xl: remove inclusion of libxl_osdeps.h
xl: use <> variant to include Xen tools library headers
xl: generate _paths.h
xl: remove trailing spaces in xl_cmdimpl.c
xl: lift a bunch of macros to xl_utils.h
xl: move some helper functions to xl_utils.c
xl: split out tmem related code to xl_tmem.c
xl: split out xl_parse.[ch]
xl: split out cpupool related code
xl: split out flask related code
xl: split out vtpm related code
xl: split out block related code
xl: split out network related code
xl: split out usb related code
xl: split out scheduler related code
xl: split out pci related code
xl: split out vcpu related code
xl: split out cd related code
xl: split out memory related code
xl: split out psr related code
xl: split out functions to print out information
xl: split out vnc and console related code
xl: split out miscellaneous functions
xl: split out vm lifecycle control functions
xl: split out save/restore related code
xl: split out migration related code
xl: merge xl_cmdimpl.c into xl.c

 .gitignore                |    1 +
 tools/xl/Makefile         |   19 +-
 tools/xl/xl.c             |   70 +-
 tools/xl/xl.h             |   77 +-
 tools/xl/xl_block.c       |  129 +
 tools/xl/xl_cd.c          |  114 +
 tools/xl/xl_cmdimpl.c     | 9642 ---------------------------------------------
 tools/xl/xl_cmdtable.c    |    4 +-
 tools/xl/xl_console.c     |  130 +
 tools/xl/xl_cpupool.c     |  624 +++
 tools/xl/xl_flask.c       |  153 +
 tools/xl/xl_info.c        |  925 +++++
 tools/xl/xl_mem.c         |  167 +
 tools/xl/xl_migrate.c     |  754 ++++
 tools/xl/xl_misc.c        |  355 ++
 tools/xl/xl_nic.c         |  172 +
 tools/xl/xl_parse.c       | 2052 ++++++++++
 tools/xl/xl_parse.h       |   65 +
 tools/xl/xl_pci.c         |  278 ++
 tools/xl/xl_psr.c         |  567 +++
 tools/xl/xl_saverestore.c |  273 ++
 tools/xl/xl_sched.c       |  888 +++++
 tools/xl/xl_sxp.c         |   10 +-
 tools/xl/xl_tmem.c        |  251 ++
 tools/xl/xl_usb.c         |  222 ++
 tools/xl/xl_utils.c       |  328 ++
 tools/xl/xl_utils.h       |  157 +
 tools/xl/xl_vcpu.c        |  337 ++
 tools/xl/xl_vmcontrol.c   | 1225 ++++++
 tools/xl/xl_vtpm.c        |  153 +
 30 files changed, 10474 insertions(+), 9668 deletions(-)
 create mode 100644 tools/xl/xl_block.c
 create mode 100644 tools/xl/xl_cd.c
 delete mode 100644 tools/xl/xl_cmdimpl.c
 create mode 100644 tools/xl/xl_console.c
 create mode 100644 tools/xl/xl_cpupool.c
 create mode 100644 tools/xl/xl_flask.c
 create mode 100644 tools/xl/xl_info.c
 create mode 100644 tools/xl/xl_mem.c
 create mode 100644 tools/xl/xl_migrate.c
 create mode 100644 tools/xl/xl_misc.c
 create mode 100644 tools/xl/xl_nic.c
 create mode 100644 tools/xl/xl_parse.c
 create mode 100644 tools/xl/xl_parse.h
 create mode 100644 tools/xl/xl_pci.c
 create mode 100644 tools/xl/xl_psr.c
 create mode 100644 tools/xl/xl_saverestore.c
 create mode 100644 tools/xl/xl_sched.c
 create mode 100644 tools/xl/xl_tmem.c
 create mode 100644 tools/xl/xl_usb.c
 create mode 100644 tools/xl/xl_utils.c
 create mode 100644 tools/xl/xl_utils.h
 create mode 100644 tools/xl/xl_vcpu.c
 create mode 100644 tools/xl/xl_vmcontrol.c
 create mode 100644 tools/xl/xl_vtpm.c
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#1 lore raw

PATCH 1/29 xl: remove accidentally committed hunk from Makefile

It was never intended to be committed. Lucky the high level Makefile was correct so it didn't cause us problem when building xl.

---
 tools/xl/Makefile | 6 ------
 1 file changed, 6 deletions(-)
tools/xl/Makefile +0 -6
index d4b862c9b9..32dff40584 100644
@@ -20,12 +20,6 @@ $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
 $(XL_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h # libxl_json.h needs it.
 
-# libxenlight should be built before building xl
-.PHONY: libxl
-libxl:
-	$(MAKE) -C $(XEN_ROOT)/tools/libxl
-$(XL_OBJS): libxl
-
 .PHONY: all
 all: xl
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 1/29
#2 lore raw

Re: [PATCH 01/29] xl: remove accidentally committed hunk from Makefile

Wei Liu writes ("[PATCH 01/29] xl: remove accidentally committed hunk from Makefile"):

Quoted 2 lines

It was never intended to be committed. Lucky the high level Makefile was correct so it didn't cause us problem when building xl.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#3 lore raw

PATCH 2/29 xl: update copyright information

In reply to Wei Liu
---
 tools/xl/xl.c          | 4 +---
 tools/xl/xl.h          | 2 +-
 tools/xl/xl_cmdimpl.c  | 4 +---
 tools/xl/xl_cmdtable.c | 2 +-
 tools/xl/xl_sxp.c      | 4 +---
 5 files changed, 5 insertions(+), 11 deletions(-)
tools/xl/xl.c +1 -3
index a272258155..4bc9648b71 100644
@@ -1,7 +1,5 @@
 /*
- * Copyright (C) 2009      Citrix Ltd.
- * Author Stefano Stabellini <[email protected]>
- * Author Vincent Hanquez <[email protected]>
+ * 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
tools/xl/xl.h +1 -1
index 0a8c8133cf..84dd2a9265 100644
@@ -1,5 +1,5 @@
 /*
- * Author Yang Hongyang <[email protected]>
+ * 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
tools/xl/xl_cmdimpl.c +1 -3
index 0add5dcc5e..a83739942c 100644
@@ -1,7 +1,5 @@
 /*
- * Copyright (C) 2009      Citrix Ltd.
- * Author Stefano Stabellini <[email protected]>
- * Author Vincent Hanquez <[email protected]>
+ * 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
tools/xl/xl_cmdtable.c +1 -1
index 588d5d9604..ddcd6c2423 100644
@@ -1,5 +1,5 @@
 /*
- * Author Yang Hongyang <[email protected]>
+ * 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
tools/xl/xl_sxp.c +1 -3
index a8c127b439..b67c0ae999 100644
@@ -1,7 +1,5 @@
 /*
- * Copyright (C) 2009      Citrix Ltd.
- * Author Stefano Stabellini <[email protected]>
- * Author Vincent Hanquez <[email protected]>
+ * 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
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#5 lore raw

PATCH 3/29 xl: remove inclusion of libxl_osdeps.h

In reply to Wei Liu

There is no reason for a client to include a private header from libxl. Remove the inclusion and define _GNU_SOURCE for {v,}asprintf in xl_cmdimpl.c.

---
 tools/xl/xl.c         | 2 --
 tools/xl/xl_cmdimpl.c | 2 +-
 tools/xl/xl_sxp.c     | 2 --
 3 files changed, 1 insertion(+), 5 deletions(-)
tools/xl/xl.c +0 -2
index 4bc9648b71..5eab2c31c4 100644
@@ -12,8 +12,6 @@
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
tools/xl/xl_cmdimpl.c +1 -1
index a83739942c..4dfcbe61ca 100644
@@ -12,7 +12,7 @@
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
+#define _GNU_SOURCE
 
 #include <stdio.h>
 #include <stdlib.h>
tools/xl/xl_sxp.c +0 -2
index b67c0ae999..9ced6f17be 100644
@@ -16,8 +16,6 @@
  * Legacy SXP output handling
  */
 
-#include "libxl_osdeps.h"
-
 #include <stdlib.h>
 #include <inttypes.h>
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 3/29
#6 lore raw

Re: [PATCH 03/29] xl: remove inclusion of libxl_osdeps.h

Wei Liu writes ("[PATCH 03/29] xl: remove inclusion of libxl_osdeps.h"):

Quoted 3 lines

There is no reason for a client to include a private header from libxl. Remove the inclusion and define _GNU_SOURCE for {v,}asprintf in xl_cmdimpl.c.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#7 lore raw

PATCH 4/29 xl: use <> variant to include Xen tools library headers

In reply to Wei Liu

They should be treated like any other libraries installed on the build host. Compiler options are set correctly to point to their locations.

---
 tools/xl/xl.c          | 6 +++---
 tools/xl/xl.h          | 2 +-
 tools/xl/xl_cmdimpl.c  | 8 ++++----
 tools/xl/xl_cmdtable.c | 2 +-
 tools/xl/xl_sxp.c      | 4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)
tools/xl/xl.c +3 -3
index 5eab2c31c4..32346ad7a5 100644
@@ -24,9 +24,9 @@
 #include <inttypes.h>
 #include <regex.h>
 
-#include "libxl.h"
-#include "libxl_utils.h"
-#include "libxlutil.h"
+#include <libxl.h>
+#include <libxl_utils.h>
+#include <libxlutil.h>
 #include "xl.h"
 
 xentoollog_logger_stdiostream *logger;
tools/xl/xl.h +1 -1
index 84dd2a9265..a8b6264c59 100644
@@ -18,7 +18,7 @@
 #include <assert.h>
 
 #include "_paths.h"
-#include "xentoollog.h"
+#include <xentoollog.h>
 
 struct cmd_spec {
     char *cmd_name;
tools/xl/xl_cmdimpl.c +4 -4
index 4dfcbe61ca..9901011008 100644
@@ -34,10 +34,10 @@
 #include <limits.h>
 #include <xen/hvm/e820.h>
 
-#include "libxl.h"
-#include "libxl_utils.h"
-#include "libxl_json.h"
-#include "libxlutil.h"
+#include <libxl.h>
+#include <libxl_utils.h>
+#include <libxl_json.h>
+#include <libxlutil.h>
 #include "xl.h"
 
 /* For calls which return an errno on failure */
tools/xl/xl_cmdtable.c +1 -1
index ddcd6c2423..1219b3309d 100644
@@ -14,7 +14,7 @@
 
 #include <string.h>
 
-#include "libxl.h"
+#include <libxl.h>
 #include "xl.h"
 
 struct cmd_spec cmd_table[] = {
tools/xl/xl_sxp.c +2 -2
index 9ced6f17be..e738bf2465 100644
@@ -19,8 +19,8 @@
 #include <stdlib.h>
 #include <inttypes.h>
 
-#include "libxl.h"
-#include "libxl_utils.h"
+#include <libxl.h>
+#include <libxl_utils.h>
 #include "xl.h"
 
 /* In general you should not add new output to this function since it
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 4/29
#8 lore raw

Re: [PATCH 04/29] xl: use <> variant to include Xen tools library headers

Wei Liu writes ("[PATCH 04/29] xl: use <> variant to include Xen tools library headers"):

Quoted 2 lines

They should be treated like any other libraries installed on the build host. Compiler options are set correctly to point to their locations.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#9 lore raw

PATCH 5/29 xl: generate _paths.h

In reply to Wei Liu

It is included by xl.h. Previously it was using _paths.h from some other place. We'd better generate one for xl as well.

---
 .gitignore        | 1 +
 tools/xl/Makefile | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
.gitignore +1 -0
index 557b38e1b2..3713b1e2a6 100644
@@ -380,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/_paths.h
 tools/xl/xl
 
 docs/txt/misc/*.txt
tools/xl/Makefile +6 -1
index 32dff40584..7106009d66 100644
@@ -20,6 +20,11 @@ $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
 $(XL_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h # libxl_json.h needs it.
 
+genpath-target = $(call buildmakevars2header,_paths.h)
+$(eval $(genpath-target))
+
+$(XL_OBJS): _paths.h
+
 .PHONY: all
 all: xl
 
@@ -35,7 +40,7 @@ install: all
 
 .PHONY: clean
 clean:
-	$(RM) -f *.o xl $(DEPS)
+	$(RM) -f *.o xl _paths.h $(DEPS)
 
 distclean: clean
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#11 lore raw

PATCH 6/29 xl: remove trailing spaces in xl_cmdimpl.c

In reply to Wei Liu
---
 tools/xl/xl_cmdimpl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/xl/xl_cmdimpl.c +2 -2
index 9901011008..1d7cf8ffa8 100644
@@ -6732,7 +6732,7 @@ static int sched_vcpu_output(libxl_scheduler sched,
     return 0;
 }
 
-/* 
+/*
  * <nothing>             : List all domain params and sched params from all pools
  * -d [domid]            : List domain params for domain
  * -d [domid] [params]   : Set domain params for domain
@@ -8374,7 +8374,7 @@ int main_cpupoolcreate(int argc, char **argv)
     }
     /* We made it! */
     rc = EXIT_SUCCESS;
-   
+
 out_cfg:
     xlu_cfg_destroy(config);
 out:
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#13 lore raw

PATCH 7/29 xl: lift a bunch of macros to xl_utils.h

In reply to Wei Liu

We're going to split xl_cmdimpl.c into multiple files. Lift the commonly used macros to xl_utils.h.

---
 tools/xl/xl_cmdimpl.c | 104 +---------------------------------------
 tools/xl/xl_utils.h   | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 130 insertions(+), 103 deletions(-)
 create mode 100644 tools/xl/xl_utils.h
tools/xl/xl_cmdimpl.c +1 -103
index 1d7cf8ffa8..d9d947827d 100644
@@ -39,42 +39,7 @@
 #include <libxl_json.h>
 #include <libxlutil.h>
 #include "xl.h"
-
-/* For calls which return an errno on failure */
-#define CHK_ERRNOVAL( call ) ({                                         \
-        int chk_errnoval = (call);                                      \
-        if (chk_errnoval < 0)                                           \
-            abort();                                                    \
-        else if (chk_errnoval > 0) {                                    \
-            fprintf(stderr,"xl: fatal error: %s:%d: %s: %s\n",          \
-                    __FILE__,__LINE__, strerror(chk_errnoval), #call);  \
-            exit(EXIT_FAILURE);                                         \
-        }                                                               \
-    })
-
-/* For calls which return -1 and set errno on failure */
-#define CHK_SYSCALL( call ) ({                                          \
-        if ((call) == -1) {                                             \
-            fprintf(stderr,"xl: fatal error: %s:%d: %s: %s\n",          \
-                    __FILE__,__LINE__, strerror(errno), #call);         \
-            exit(EXIT_FAILURE);                                         \
-        }                                                               \
-    })
-
-#define MUST( call ) ({                                                 \
-        int must_rc = (call);                                           \
-        if (must_rc < 0) {                                                  \
-            fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: %s\n",       \
-                    __FILE__,__LINE__, must_rc, #call);                 \
-            exit(EXIT_FAILURE);                                         \
-        }                                                               \
-    })
-
-#define STR_HAS_PREFIX( a, b )  \
-    ( strncmp(a, b, strlen(b)) == 0 )
-#define STR_SKIP_PREFIX( a, b ) \
-    ( STR_HAS_PREFIX(a, b) ? ((a) += strlen(b), 1) : 0 )
-
+#include "xl_utils.h"
 
 int logfile = 2;
 
@@ -83,7 +48,6 @@ libxl_ctx *ctx;
 
 xlchild children[child_max];
 
-#define INVALID_DOMID ~0
 static const char *common_domname;
 static int fd_lock = -1;
 
@@ -349,8 +313,6 @@ static char *xstrdup(const char *x)
 #define ARRAY_EXTEND_INIT_NODEVID(array,count,initfn) \
     ARRAY_EXTEND_INIT__CORE((array),(count),(initfn), /* nothing */ )
 
-#define LOG(_f, _a...)   dolog(__FILE__, __LINE__, __func__, _f "\n", ##_a)
-
 static void dolog(const char *file, int line, const char *func, char *fmt, ...)
      __attribute__((format(printf,4,5)));
 
@@ -3332,10 +3294,6 @@ static int64_t parse_mem_size_kb(const char *mem)
     return kbytes;
 }
 
-/* Must be last in list */
-#define COMMON_LONG_OPTS {"help", 0, 0, 'h'}, \
-                         {0, 0, 0, 0}
-
 /*
  * Callers should use SWITCH_FOREACH_OPT in preference to calling this
  * directly.
@@ -3378,66 +3336,6 @@ static int def_getopt(int argc, char * const argv[],
     return -1;
 }
 
-/*
- * Wraps def_getopt into a convenient loop+switch to process all
- * arguments. This macro is intended to be called from main_XXX().
- *
- *   SWITCH_FOREACH_OPT(int *opt, "OPTS",
- *                      const struct option *longopts,
- *                      const char *commandname,
- *                      int num_opts_req) { ...
- *
- * opt:               pointer to an int variable, holds the current option
- *                    during processing.
- * OPTS:              short options, as per getopt_long(3)'s optstring argument.
- *                    do not include "h"; will be provided automatically
- * longopts:          long options, as per getopt_long(3)'s longopts argument.
- *                    May be null.
- * commandname:       name of this command, for usage string.
- * num_required_opts: number of non-option command line parameters
- *                    which are required.
- *
- * In addition the calling context is expected to contain variables
- * "argc" and "argv" in the conventional C-style:
- *   main(int argc, char **argv)
- * manner.
- *
- * Callers should treat SWITCH_FOREACH_OPT as they would a switch
- * statement over the value of `opt`. Each option given in `opts` (or
- * `lopts`) should be handled by a case statement as if it were inside
- * a switch statement.
- *
- * In addition to the options provided in opts the macro will handle
- * the "help" option and enforce a minimum number of non-option
- * command line pearameters as follows:
- *  -- if the user passes a -h or --help option. help will be printed,
- *     and the macro will cause the process to exit with code 0.
- *  -- if the user does not provided `num_required_opts` non-option
- *     arguments, the macro will cause the process to exit with code 2.
- *
- * Example:
- *
- * int main_foo(int argc, char **argv) {
- *     int opt;
- *
- *     SWITCH_FOREACH_OPT(opt, "blah", NULL, "foo", 0) {
- *      case 'b':
- *          ... handle b option...
- *          break;
- *      case 'l':
- *          ... handle l option ...
- *          break;
- *      case etc etc...
- *      }
- *      ... do something useful with the options ...
- * }
- */
-#define SWITCH_FOREACH_OPT(opt, opts, longopts,                         \
-                           commandname, num_required_opts)              \
-    while (((opt) = def_getopt(argc, argv, "h" opts, (longopts),          \
-                                (commandname), (num_required_opts))) != -1) \
-        switch (opt)
-
 static int set_memory_max(uint32_t domid, const char *mem)
 {
     int64_t memorykb;
tools/xl/xl_utils.h new file +129 -0

129 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#15 lore raw

PATCH 8/29 xl: move some helper functions to xl_utils.c

In reply to Wei Liu

Move some commonly used functions to a new file. Prepend "x" to function names to stick to consistent naming scheme.

---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cmdimpl.c | 343 +++++++++-----------------------------------------
 tools/xl/xl_utils.c   | 258 +++++++++++++++++++++++++++++++++++++
 tools/xl/xl_utils.h   |  33 ++++-
 4 files changed, 351 insertions(+), 285 deletions(-)
 create mode 100644 tools/xl/xl_utils.c
tools/xl/Makefile +1 -1
index 7106009d66..2f740b4789 100644
@@ -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_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.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.
tools/xl/xl_cmdimpl.c +62 -281

745 lines not on this page · raw message

tools/xl/xl_utils.c new file +258 -0

258 lines not on this page · raw message

tools/xl/xl_utils.h +30 -3
index ebb9305b7c..2786f7c3cd 100644
@@ -15,6 +15,8 @@
 #ifndef XL_UTILS_H
 #define XL_UTILS_H
 
+#include <getopt.h>
+
 /* For calls which return an errno on failure */
 #define CHK_ERRNOVAL( call ) ({                                         \
         int chk_errnoval = (call);                                      \
@@ -55,7 +57,7 @@
 #define LOG(_f, _a...)   dolog(__FILE__, __LINE__, __func__, _f "\n", ##_a)
 
 /*
- * Wraps def_getopt into a convenient loop+switch to process all
+ * Wraps xdef_getopt into a convenient loop+switch to process all
  * arguments. This macro is intended to be called from main_XXX().
  *
  *   SWITCH_FOREACH_OPT(int *opt, "OPTS",
@@ -110,14 +112,39 @@
  */
 #define SWITCH_FOREACH_OPT(opt, opts, longopts,                         \
                            commandname, num_required_opts)              \
-    while (((opt) = def_getopt(argc, argv, "h" opts, (longopts),        \
-                               (commandname), (num_required_opts))) != -1) \
+    while (((opt) = xdef_getopt(argc, argv, "h" opts, (longopts),       \
+                                (commandname), (num_required_opts))) != -1) \
         switch (opt)
 
 /* Must be last in list */
 #define COMMON_LONG_OPTS {"help", 0, 0, 'h'}, \
                          {0, 0, 0, 0}
 
+int xdef_getopt(int argc, char * const argv[],
+                const char *optstring,
+                const struct option *longopts,
+                const char* helpstr, int reqargs);
+
+void dolog(const char *file, int line, const char *func, char *fmt, ...)
+	__attribute__((format(printf,4,5)));
+
+void xvasprintf(char **strp, const char *fmt, va_list ap)
+	__attribute__((format(printf,2,0)));
+
+void xasprintf(char **strp, const char *fmt, ...)
+	__attribute__((format(printf,2,3)));
+
+void *xmalloc(size_t sz);
+void *xcalloc(size_t n, size_t sz);
+void *xrealloc(void *ptr, size_t sz);
+char *xstrdup(const char *x);
+void xstring_realloc_append(char **accumulate, const char *more);
+
+void xflush_stream(FILE *fh);
+uint32_t xfind_domain(const char *p) __attribute__((warn_unused_result));
+
+void print_bitmap(uint8_t *map, int maplen, FILE *stream);
+
 #endif /* XL_UTILS_H */
 
 /*
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#16 lore raw

Re: [PATCH 08/29] xl: move some helper functions to xl_utils.c

Wei Liu writes ("[PATCH 08/29] xl: move some helper functions to xl_utils.c"):

Quoted 2 lines

Move some commonly used functions to a new file. Prepend "x" to function names to stick to consistent naming scheme.

The xfoo' naming scheme is a reference to xmalloc' et al, which conventionally crash the program on failure.

I don't think you need to add this to every function in xl. It is applicable only when there is an existing function which returns an error code, which is wrapped by one which never fails.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#17 lore raw

PATCH 1/1 xl: move some helper functions to xl_utils.c

Move some commonly used functions to a new file.

find_domain requires access to global variable common_domname. Make that non-static.

No functional change.

---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cmdimpl.c | 221 +-----------------------------------------
 tools/xl/xl_utils.c   | 258 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/xl/xl_utils.h   |  27 ++++++
 4 files changed, 287 insertions(+), 221 deletions(-)
 create mode 100644 tools/xl/xl_utils.c
tools/xl/Makefile +1 -1
index 7106009d66..2f740b4789 100644
@@ -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_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o xl_utils.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.
tools/xl/xl_cmdimpl.c +1 -220

275 lines not on this page · raw message

tools/xl/xl_utils.c new file +258 -0

258 lines not on this page · raw message

tools/xl/xl_utils.h +27 -0
index ebb9305b7c..a2cf138523 100644
@@ -15,6 +15,8 @@
 #ifndef XL_UTILS_H
 #define XL_UTILS_H
 
+#include <getopt.h>
+
 /* For calls which return an errno on failure */
 #define CHK_ERRNOVAL( call ) ({                                         \
         int chk_errnoval = (call);                                      \
@@ -118,6 +120,31 @@
 #define COMMON_LONG_OPTS {"help", 0, 0, 'h'}, \
                          {0, 0, 0, 0}
 
+int def_getopt(int argc, char * const argv[],
+               const char *optstring,
+               const struct option *longopts,
+               const char* helpstr, int reqargs);
+
+void dolog(const char *file, int line, const char *func, char *fmt, ...)
+	__attribute__((format(printf,4,5)));
+
+void xvasprintf(char **strp, const char *fmt, va_list ap)
+	__attribute__((format(printf,2,0)));
+
+void xasprintf(char **strp, const char *fmt, ...)
+	__attribute__((format(printf,2,3)));
+
+void *xmalloc(size_t sz);
+void *xcalloc(size_t n, size_t sz);
+void *xrealloc(void *ptr, size_t sz);
+char *xstrdup(const char *x);
+void string_realloc_append(char **accumulate, const char *more);
+
+void flush_stream(FILE *fh);
+uint32_t find_domain(const char *p) __attribute__((warn_unused_result));
+
+void print_bitmap(uint8_t *map, int maplen, FILE *stream);
+
 #endif /* XL_UTILS_H */
 
 /*
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#19 lore raw

PATCH 9/29 xl: split out tmem related code to xl_tmem.c

In reply to Wei Liu
---
 tools/xl/Makefile     |   2 +
 tools/xl/xl_cmdimpl.c | 229 ---------------------------------------------
 tools/xl/xl_tmem.c    | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 253 insertions(+), 229 deletions(-)
 create mode 100644 tools/xl/xl_tmem.c
tools/xl/Makefile +2 -0
index 2f740b4789..f5df366e0a 100644
@@ -16,6 +16,8 @@ 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_tmem.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.
tools/xl/xl_cmdimpl.c +0 -229

235 lines not on this page · raw message

tools/xl/xl_tmem.c new file +251 -0

251 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#21 lore raw

PATCH 10/29 xl: split out xl_parse.[ch]

In reply to Wei Liu

Move all parsing code into xl_parse.c. Export the ones needed in xl_parse.h.

Some notable changes other than code movement:
1. rename cpurange_parse to parse_cpurange;
2. provide a function to return shutdown action name.

---
 tools/xl/Makefile     |    2 +-
 tools/xl/xl_cmdimpl.c | 2353 ++++---------------------------------------------
 tools/xl/xl_parse.c   | 2052 ++++++++++++++++++++++++++++++++++++++++++
 tools/xl/xl_parse.h   |   65 ++
 4 files changed, 2288 insertions(+), 2184 deletions(-)
 create mode 100644 tools/xl/xl_parse.c
 create mode 100644 tools/xl/xl_parse.h
tools/xl/Makefile +1 -1
index f5df366e0a..d7f7f01549 100644
@@ -16,7 +16,7 @@ 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_tmem.o
+XL_OBJS += xl_tmem.o xl_parse.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +170 -2183

2,460 lines not on this page · raw message

tools/xl/xl_parse.c new file +2052 -0

532 lines not on this page · raw message

tools/xl/xl_parse.h new file +65 -0

65 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Part of the diff is not shown here. View the raw message.

#22 lore raw

Re: [PATCH 10/29] xl: split out xl_parse.[ch]

Wei Liu writes ("[PATCH 10/29] xl: split out xl_parse.[ch]"):

Quoted 3 lines

Some notable changes other than code movement:
1. rename cpurange_parse to parse_cpurange;
2. provide a function to return shutdown action name.

Can you split that out so that I can review it separately from the code motion ?

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#23 lore raw

PATCH 1/3 xl: rename cpurange_parse to parse_cpurange

We want to consistently prefix functions to parse input with "parse_".

No functional change.

---
 tools/xl/xl_cmdimpl.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
tools/xl/xl_cmdimpl.c +8 -8
index 2721af317b..86c70f5a22 100644
@@ -697,7 +697,7 @@ static int update_cpumap_range(const char *str, libxl_bitmap *cpumap)
  * single cpus or as eintire NUMA nodes) and turns it into the
  * corresponding libxl_bitmap (in cpumap).
  */
-static int cpurange_parse(const char *cpu, libxl_bitmap *cpumap)
+static int parse_cpurange(const char *cpu, libxl_bitmap *cpumap)
 {
     char *ptr, *saveptr = NULL, *buf = xstrdup(cpu);
     int rc = 0;
@@ -808,7 +808,7 @@ static void parse_vcpu_affinity(libxl_domain_build_info *b_info,
                 exit(EXIT_FAILURE);
             }
 
-            if (cpurange_parse(buf, &vcpu_affinity_array[j]))
+            if (parse_cpurange(buf, &vcpu_affinity_array[j]))
                 exit(EXIT_FAILURE);
 
             j++;
@@ -825,7 +825,7 @@ static void parse_vcpu_affinity(libxl_domain_build_info *b_info,
             exit(EXIT_FAILURE);
         }
 
-        if (cpurange_parse(buf, &vcpu_affinity_array[0]))
+        if (parse_cpurange(buf, &vcpu_affinity_array[0]))
             exit(EXIT_FAILURE);
 
         for (i = 1; i < b_info->max_vcpus; i++) {
@@ -5522,7 +5522,7 @@ int main_vcpupin(int argc, char **argv)
      */
     if (!strcmp(hard_str, "-"))
         hard = NULL;
-    else if (cpurange_parse(hard_str, hard))
+    else if (parse_cpurange(hard_str, hard))
         goto out;
     /*
      * Soft affinity is handled similarly. Only difference: we also want
@@ -5530,7 +5530,7 @@ int main_vcpupin(int argc, char **argv)
      */
     if (argc <= optind+3 || !strcmp(soft_str, "-"))
         soft = NULL;
-    else if (cpurange_parse(soft_str, soft))
+    else if (parse_cpurange(soft_str, soft))
         goto out;
 
     if (dryrun_only) {
@@ -7793,7 +7793,7 @@ int main_cpupoolcreate(int argc, char **argv)
             n_cpus++;
         }
     } else if (!xlu_cfg_get_string(config, "cpus", &buf, 0)) {
-        if (cpurange_parse(buf, &cpumap))
+        if (parse_cpurange(buf, &cpumap))
             goto out_cfg;
 
         n_cpus = 0;
@@ -7974,7 +7974,7 @@ int main_cpupoolcpuadd(int argc, char **argv)
     }
 
     pool = argv[optind++];
-    if (cpurange_parse(argv[optind], &cpumap))
+    if (parse_cpurange(argv[optind], &cpumap))
         goto out;
 
     if (libxl_cpupool_qualifier_to_cpupoolid(ctx, pool, &poolid, NULL) ||
@@ -8012,7 +8012,7 @@ int main_cpupoolcpuremove(int argc, char **argv)
     }
 
     pool = argv[optind++];
-    if (cpurange_parse(argv[optind], &cpumap))
+    if (parse_cpurange(argv[optind], &cpumap))
         goto out;
 
     if (libxl_cpupool_qualifier_to_cpupoolid(ctx, pool, &poolid, NULL) ||
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#24 lore raw

PATCH 2/3 xl: introduce a function to get shutdown action name

The array to map libxl_shutdown_action_to_shutdown to string is going to be moved to a dedicated file.

Provide a function to do the translation so that we don't need to make the array globally visible.

---
 tools/xl/xl_cmdimpl.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tools/xl/xl_cmdimpl.c +6 -1
index 86c70f5a22..d027d53a3f 100644
@@ -101,6 +101,11 @@ static const char *action_on_shutdown_names[] = {
     [LIBXL_ACTION_ON_SHUTDOWN_SOFT_RESET] = "soft-reset",
 };
 
+static const char *get_action_on_shutdown_name(libxl_action_on_shutdown a)
+{
+    return action_on_shutdown_names[a];
+}
+
 /* Optional data, in order:
  *   4 bytes uint32_t  config file size
  *   n bytes           config file in Unix text file format
@@ -2442,7 +2447,7 @@ static domain_restart_type handle_domain_death(uint32_t *r_domid,
 
     LOG("Action for shutdown reason code %d is %s",
         event->u.domain_shutdown.shutdown_reason,
-        action_on_shutdown_names[action]);
+        get_action_on_shutdown_name(action));
 
     if (action == LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY || action == LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_RESTART) {
         char *corefile;
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#26 lore raw

PATCH 3/3 xl: split out xl_parse.[ch]

In reply to Wei Liu

Move all parsing code into xl_parse.c. Export the ones needed in xl_parse.h.

---
 tools/xl/Makefile     |    2 +-
 tools/xl/xl_cmdimpl.c | 2346 ++++---------------------------------------------
 tools/xl/xl_parse.c   | 2052 ++++++++++++++++++++++++++++++++++++++++++
 tools/xl/xl_parse.h   |   65 ++
 4 files changed, 2282 insertions(+), 2183 deletions(-)
 create mode 100644 tools/xl/xl_parse.c
 create mode 100644 tools/xl/xl_parse.h
tools/xl/Makefile +1 -1
index f5df366e0a..d7f7f01549 100644
@@ -16,7 +16,7 @@ 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_tmem.o
+XL_OBJS += xl_tmem.o xl_parse.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +164 -2182

2,417 lines not on this page · raw message

tools/xl/xl_parse.c new file +2052 -0

575 lines not on this page · raw message

tools/xl/xl_parse.h new file +65 -0

65 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Part of the diff is not shown here. View the raw message.

author
#29 lore raw

PATCH 11/29 xl: split out cpupool related code

In reply to Wei Liu
---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cmdimpl.c | 592 -----------------------------------------------
 tools/xl/xl_cpupool.c | 624 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 625 insertions(+), 593 deletions(-)
 create mode 100644 tools/xl/xl_cpupool.c
tools/xl/Makefile +1 -1
index d7f7f01549..0ff7ef9bfe 100644
@@ -16,7 +16,7 @@ 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_tmem.o xl_parse.o
+XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +0 -592

598 lines not on this page · raw message

tools/xl/xl_cpupool.c new file +624 -0

624 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#31 lore raw

PATCH 12/29 xl: split out flask related code

In reply to Wei Liu
---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cmdimpl.c | 119 ---------------------------------------
 tools/xl/xl_flask.c   | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 154 insertions(+), 120 deletions(-)
 create mode 100644 tools/xl/xl_flask.c
tools/xl/Makefile +1 -1
index 0ff7ef9bfe..df0b5dd5cf 100644
@@ -16,7 +16,7 @@ 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_tmem.o xl_parse.o xl_cpupool.o
+XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +0 -119

125 lines not on this page · raw message

tools/xl/xl_flask.c new file +153 -0

153 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#33 lore raw

PATCH 13/29 xl: split out vtpm related code

In reply to Wei Liu
---
 tools/xl/Makefile     |   1 +
 tools/xl/xl_cmdimpl.c | 122 ----------------------------------------
 tools/xl/xl_vtpm.c    | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 154 insertions(+), 122 deletions(-)
 create mode 100644 tools/xl/xl_vtpm.c
tools/xl/Makefile +1 -0
index df0b5dd5cf..b31ec052c1 100644
@@ -17,6 +17,7 @@ CFLAGS_XL += -Wshadow
 
 XL_OBJS = xl.o xl_cmdimpl.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_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +0 -122

128 lines not on this page · raw message

tools/xl/xl_vtpm.c new file +153 -0

153 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#35 lore raw

PATCH 14/29 xl: split out block related code

In reply to Wei Liu
---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_block.c   | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/xl/xl_cmdimpl.c |  99 --------------------------------------
 3 files changed, 130 insertions(+), 100 deletions(-)
 create mode 100644 tools/xl/xl_block.c
tools/xl/Makefile +1 -1
index b31ec052c1..331ae21293 100644
@@ -17,7 +17,7 @@ CFLAGS_XL += -Wshadow
 
 XL_OBJS = xl.o xl_cmdimpl.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_OBJS += xl_vtpm.o xl_block.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_block.c new file +129 -0

129 lines not on this page · raw message

tools/xl/xl_cmdimpl.c +0 -99

105 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#37 lore raw

PATCH 15/29 xl: split out network related code

In reply to Wei Liu
---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cmdimpl.c | 140 ----------------------------------------
 tools/xl/xl_nic.c     | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 173 insertions(+), 141 deletions(-)
 create mode 100644 tools/xl/xl_nic.c
tools/xl/Makefile +1 -1
index 331ae21293..c2f2ca38f4 100644
@@ -17,7 +17,7 @@ CFLAGS_XL += -Wshadow
 
 XL_OBJS = xl.o xl_cmdimpl.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_OBJS += xl_vtpm.o xl_block.o xl_nic.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +0 -140

152 lines not on this page · raw message

tools/xl/xl_nic.c new file +172 -0

172 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#39 lore raw

PATCH 16/29 xl: split out usb related code

In reply to Wei Liu
---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cmdimpl.c | 190 ------------------------------------------
 tools/xl/xl_usb.c     | 222 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 223 insertions(+), 191 deletions(-)
 create mode 100644 tools/xl/xl_usb.c
tools/xl/Makefile +1 -1
index c2f2ca38f4..45ddc255f5 100644
@@ -17,7 +17,7 @@ CFLAGS_XL += -Wshadow
 
 XL_OBJS = xl.o xl_cmdimpl.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_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +0 -190

196 lines not on this page · raw message

tools/xl/xl_usb.c new file +222 -0

222 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#41 lore raw

PATCH 17/29 xl: split out scheduler related code

In reply to Wei Liu
---
 tools/xl/Makefile     |   1 +
 tools/xl/xl_cmdimpl.c | 856 ------------------------------------------------
 tools/xl/xl_sched.c   | 888 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 889 insertions(+), 856 deletions(-)
 create mode 100644 tools/xl/xl_sched.c
tools/xl/Makefile +1 -0
index 45ddc255f5..8aa294d5a0 100644
@@ -18,6 +18,7 @@ CFLAGS_XL += -Wshadow
 XL_OBJS = xl.o xl_cmdimpl.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_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +0 -856

862 lines not on this page · raw message

tools/xl/xl_sched.c new file +888 -0

888 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 17/29
#42 lore raw

Re: [PATCH 17/29] xl: split out scheduler related code

Wei Liu writes ("[PATCH 17/29] xl: split out scheduler related code"):

Quoted 1 line

BTW, for all of these code motion patches: it would be nice if the comment said `code motion only, apart from the obvious Makefile change' or something.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#43 lore raw

PATCH 18/29 xl: split out pci related code

In reply to Wei Liu
---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cmdimpl.c | 247 --------------------------------------------
 tools/xl/xl_pci.c     | 278 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 279 insertions(+), 248 deletions(-)
 create mode 100644 tools/xl/xl_pci.c
tools/xl/Makefile +1 -1
index 8aa294d5a0..0af1e92b65 100644
@@ -18,7 +18,7 @@ CFLAGS_XL += -Wshadow
 XL_OBJS = xl.o xl_cmdimpl.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_OBJS += xl_sched.o xl_pci.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +0 -247

253 lines not on this page · raw message

tools/xl/xl_pci.c new file +278 -0

278 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#45 lore raw

PATCH 19/29 xl: split out vcpu related code

In reply to Wei Liu
---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cmdimpl.c | 306 ---------------------------------------------
 tools/xl/xl_vcpu.c    | 337 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 338 insertions(+), 307 deletions(-)
 create mode 100644 tools/xl/xl_vcpu.c
tools/xl/Makefile +1 -1
index 0af1e92b65..e6e8cef710 100644
@@ -18,7 +18,7 @@ CFLAGS_XL += -Wshadow
 XL_OBJS = xl.o xl_cmdimpl.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_OBJS += xl_sched.o xl_pci.o xl_vcpu.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +0 -306

312 lines not on this page · raw message

tools/xl/xl_vcpu.c new file +337 -0

337 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#47 lore raw

PATCH 20/29 xl: split out cd related code

In reply to Wei Liu
---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cd.c      | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/xl/xl_cmdimpl.c |  80 -----------------------------------
 3 files changed, 115 insertions(+), 81 deletions(-)
 create mode 100644 tools/xl/xl_cd.c
tools/xl/Makefile +1 -1
index e6e8cef710..89cf9069e0 100644
@@ -18,7 +18,7 @@ CFLAGS_XL += -Wshadow
 XL_OBJS = xl.o xl_cmdimpl.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_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cd.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cd.c new file +114 -0

114 lines not on this page · raw message

tools/xl/xl_cmdimpl.c +0 -80

86 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#48 lore raw

Re: [PATCH 20/29] xl: split out cd related code

Wei Liu writes ("[PATCH 20/29] xl: split out cd related code"):

Quoted 4 lines
---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cd.c      | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++

Would you mind calling this libxl_cdrom.c' rather than _cd' ? The latter makes me think of chdir...

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#49 lore raw

Re: [PATCH 20/29] xl: split out cd related code

Quoted 8 lines · Ian Jackson

Wei Liu writes ("[PATCH 20/29] xl: split out cd related code"):

Quoted 4 lines
---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cd.c      | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++

Would you mind calling this libxl_cdrom.c' rather than _cd' ? The latter makes me think of chdir...

Can I have your ack if I rename it to libxl_cdrom.c?

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#50 lore raw

Re: [PATCH 20/29] xl: split out cd related code

Wei Liu writes ("Re: [PATCH 20/29] xl: split out cd related code"):

Quoted 11 lines · Ian Jackson
Quoted 8 lines

Wei Liu writes ("[PATCH 20/29] xl: split out cd related code"):

Quoted 4 lines
---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cd.c      | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++

Would you mind calling this libxl_cdrom.c' rather than _cd' ? The latter makes me think of chdir...

Can I have your ack if I rename it to libxl_cdrom.c?

Yes, indeed, that was the only reason I didn't ack it.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#51 lore raw

Re: [PATCH 20/29] xl: split out cd related code

Quoted 8 lines · Ian Jackson

Wei Liu writes ("Re: [PATCH 20/29] xl: split out cd related code"):

Quoted 7 lines · Ian Jackson
Quoted 6 lines

Wei Liu writes ("[PATCH 20/29] xl: split out cd related code"):

Quoted 4 lines
---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cd.c      | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Would you mind calling this libxl_cdrom.c' rather than _cd' ? The latter makes me think of chdir...

Can I have your ack if I rename it to libxl_cdrom.c?

Yes, indeed, that was the only reason I didn't ack it.

Thanks. I want to avoid reposting as much as possible because this series is really long and tedious.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#52 lore raw

Re: [PATCH 20/29] xl: split out cd related code

Wei Liu writes ("Re: [PATCH 20/29] xl: split out cd related code"):

Quoted 5 lines · Ian Jackson
Quoted 1 line

Yes, indeed, that was the only reason I didn't ack it.

Thanks. I want to avoid reposting as much as possible because this series is really long and tedious.

Indeed!

There were about three other patches that I had small comments on. If you want to repost just those, that would be fine by me.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#53 lore raw

Re: [PATCH 20/29] xl: split out cd related code

Quoted 4 lines · Ian Jackson

Wei Liu writes ("Re: [PATCH 20/29] xl: split out cd related code"):

Quoted 3 lines · Ian Jackson
Quoted 1 line

Yes, indeed, that was the only reason I didn't ack it.

Quoted 8 lines
Quoted 2 lines

Thanks. I want to avoid reposting as much as possible because this series is really long and tedious.

Indeed!

There were about three other patches that I had small comments on. If you want to repost just those, that would be fine by me.

Sure.

Quoted 1 line

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#54 lore raw

PATCH 21/29 xl: split out memory related code

In reply to Wei Liu
---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cmdimpl.c | 136 ----------------------------------------
 tools/xl/xl_mem.c     | 167 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 168 insertions(+), 137 deletions(-)
 create mode 100644 tools/xl/xl_mem.c
tools/xl/Makefile +1 -1
index 89cf9069e0..964da8e705 100644
@@ -18,7 +18,7 @@ CFLAGS_XL += -Wshadow
 XL_OBJS = xl.o xl_cmdimpl.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_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cd.o xl_mem.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +0 -136

148 lines not on this page · raw message

tools/xl/xl_mem.c new file +167 -0

167 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#56 lore raw

PATCH 22/29 xl: split out psr related code

In reply to Wei Liu
---
 tools/xl/Makefile     |   1 +
 tools/xl/xl_cmdimpl.c | 533 -----------------------------------------------
 tools/xl/xl_psr.c     | 567 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 568 insertions(+), 533 deletions(-)
 create mode 100644 tools/xl/xl_psr.c
tools/xl/Makefile +1 -0
index 964da8e705..fdb64fed1d 100644
@@ -19,6 +19,7 @@ XL_OBJS = xl.o xl_cmdimpl.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
+XL_OBJS += xl_psr.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +0 -533

539 lines not on this page · raw message

tools/xl/xl_psr.c new file +567 -0

567 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#58 lore raw

PATCH 23/29 xl: split out functions to print out information

In reply to Wei Liu
---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cmdimpl.c | 883 +----------------------------------------------
 tools/xl/xl_info.c    | 925 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 929 insertions(+), 881 deletions(-)
 create mode 100644 tools/xl/xl_info.c
tools/xl/Makefile +1 -1
index fdb64fed1d..c51106e49e 100644
@@ -19,7 +19,7 @@ XL_OBJS = xl.o xl_cmdimpl.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
-XL_OBJS += xl_psr.o
+XL_OBJS += xl_psr.o xl_info.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +3 -880

925 lines not on this page · raw message

tools/xl/xl_info.c new file +925 -0

925 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#60 lore raw

PATCH 24/29 xl: split out vnc and console related code

In reply to Wei Liu

The new file also contains code for channel, which is just a console in disguise.

Replace the call to vncviewer() with libxl_vncviewer_exec() directly in main_vncviewer.

---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cmdimpl.c |  98 -------------------------------------
 tools/xl/xl_console.c | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 131 insertions(+), 99 deletions(-)
 create mode 100644 tools/xl/xl_console.c
tools/xl/Makefile +1 -1
index c51106e49e..b49e2cdcab 100644
@@ -19,7 +19,7 @@ XL_OBJS = xl.o xl_cmdimpl.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
-XL_OBJS += xl_psr.o xl_info.o
+XL_OBJS += xl_psr.o xl_info.o xl_console.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +0 -98

110 lines not on this page · raw message

tools/xl/xl_console.c new file +130 -0

130 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#61 lore raw

Re: [PATCH 24/29] xl: split out vnc and console related code

Wei Liu writes ("[PATCH 24/29] xl: split out vnc and console related code"):

Quoted 5 lines

The new file also contains code for channel, which is just a console in disguise.

Replace the call to vncviewer() with libxl_vncviewer_exec() directly in main_vncviewer.

Again, please separate out the non-code-motion change.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#62 lore raw

PATCH 1/2 xl: call libxl_vncviewer_exec in main_vncviewer

We will need to move main_vncviewer to a different file where it has no access to the helper vncviewer.

Call libxl_vncviewer_exec directly.

---
 tools/xl/xl_cmdimpl.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tools/xl/xl_cmdimpl.c +4 -3
index 26fd4ab0f5..a42b972d60 100644
@@ -1120,9 +1120,10 @@ int main_vncviewer(int argc, char **argv)
 
     domid = find_domain(argv[optind]);
 
-    if (vncviewer(domid, autopass))
-        return EXIT_FAILURE;
-    return EXIT_SUCCESS;
+    libxl_vncviewer_exec(ctx, domid, autopass);
+    fprintf(stderr, "Unable to execute vncviewer\n");
+
+    return EXIT_FAILURE;
 }
 
 static void pause_domain(uint32_t domid)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#63 lore raw

PATCH 2/2 xl: split out vnc and console related code

The new file also contains code for channel, which is just a console in disguise.

Replace the call to vncviewer() with libxl_vncviewer_exec() directly in main_vncviewer.

---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cmdimpl.c |  99 --------------------------------------
 tools/xl/xl_console.c | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 131 insertions(+), 100 deletions(-)
 create mode 100644 tools/xl/xl_console.c
tools/xl/Makefile +1 -1
index bc8cfb3de9..7375d2bfda 100644
@@ -19,7 +19,7 @@ XL_OBJS = xl.o xl_cmdimpl.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_cdrom.o xl_mem.o
-XL_OBJS += xl_psr.o xl_info.o
+XL_OBJS += xl_psr.o xl_info.o xl_console.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +0 -99

111 lines not on this page · raw message

tools/xl/xl_console.c new file +130 -0

130 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 2/2
#64 lore raw

Re: [PATCH 2/2] xl: split out vnc and console related code

Wei Liu writes ("[PATCH 2/2] xl: split out vnc and console related code"):

Quoted 2 lines

The new file also contains code for channel, which is just a console in disguise.

Good. Except that...

Quoted 2 lines

Replace the call to vncviewer() with libxl_vncviewer_exec() directly in main_vncviewer.

... you forgot to remove this from the commit message.

With that change,

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v1 1/2
#65 lore raw

Re: [PATCH 1/2] xl: call libxl_vncviewer_exec in main_vncviewer

In reply to Wei Liu

Wei Liu writes ("[PATCH 1/2] xl: call libxl_vncviewer_exec in main_vncviewer"):

Quoted 2 lines

We will need to move main_vncviewer to a different file where it has no access to the helper vncviewer.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#66 lore raw

PATCH 25/29 xl: split out miscellaneous functions

In reply to Wei Liu

A collections of functions that don't warrant their own files.

Moving main_devd there requires lifting do_daemonize to xl_utils.c.

---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cmdimpl.c | 390 --------------------------------------------------
 tools/xl/xl_misc.c    | 355 +++++++++++++++++++++++++++++++++++++++++++++
 tools/xl/xl_utils.c   |  70 +++++++++
 tools/xl/xl_utils.h   |   1 +
 5 files changed, 427 insertions(+), 391 deletions(-)
 create mode 100644 tools/xl/xl_misc.c
tools/xl/Makefile +1 -1
index b49e2cdcab..3e8361b121 100644
@@ -19,7 +19,7 @@ XL_OBJS = xl.o xl_cmdimpl.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
-XL_OBJS += xl_psr.o xl_info.o xl_console.o
+XL_OBJS += xl_psr.o xl_info.o xl_console.o xl_misc.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +0 -390

420 lines not on this page · raw message

tools/xl/xl_misc.c new file +355 -0

355 lines not on this page · raw message

tools/xl/xl_utils.c +70 -0

84 lines not on this page · raw message

tools/xl/xl_utils.h +1 -0
index 2786f7c3cd..a159287f5e 100644
@@ -145,6 +145,7 @@ uint32_t xfind_domain(const char *p) __attribute__((warn_unused_result));
 
 void print_bitmap(uint8_t *map, int maplen, FILE *stream);
 
+int do_daemonize(char *name, const char *pidfile);
 #endif /* XL_UTILS_H */
 
 /*
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#68 lore raw

PATCH 26/29 xl: split out vm lifecycle control functions

In reply to Wei Liu

Including create, reboot, shutdown, pause, unpause and destroy.

Lift a bunch of core data structures and function declarations to xl.h because they are needed in both xl_cmdimpl.c and xl_vmcontrol.c.

---
 tools/xl/Makefile       |    1 +
 tools/xl/xl.h           |   67 +++
 tools/xl/xl_cmdimpl.c   | 1243 -----------------------------------------------
 tools/xl/xl_vmcontrol.c | 1225 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1293 insertions(+), 1243 deletions(-)
 create mode 100644 tools/xl/xl_vmcontrol.c
tools/xl/Makefile +1 -0
index 3e8361b121..0f966684be 100644
@@ -20,6 +20,7 @@ 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
 XL_OBJS += xl_psr.o xl_info.o xl_console.o xl_misc.o
+XL_OBJS += xl_vmcontrol.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl.h +67 -0

73 lines not on this page · raw message

tools/xl/xl_cmdimpl.c +0 -1243

1,267 lines not on this page · raw message

tools/xl/xl_vmcontrol.c new file +1225 -0

1,225 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 26/29
#69 lore raw

Re: [PATCH 26/29] xl: split out vm lifecycle control functions

Wei Liu writes ("[PATCH 26/29] xl: split out vm lifecycle control functions"):

Quoted 4 lines

Including create, reboot, shutdown, pause, unpause and destroy.

Lift a bunch of core data structures and function declarations to xl.h because they are needed in both xl_cmdimpl.c and xl_vmcontrol.c.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#70 lore raw

PATCH 27/29 xl: split out save/restore related code

In reply to Wei Liu

Add some function declarations to xl.h because they are now needed in multiple files.

---
 tools/xl/Makefile         |   2 +-
 tools/xl/xl.h             |   6 +
 tools/xl/xl_cmdimpl.c     | 227 --------------------------------------
 tools/xl/xl_saverestore.c | 273 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 280 insertions(+), 228 deletions(-)
 create mode 100644 tools/xl/xl_saverestore.c
tools/xl/Makefile +1 -1
index 0f966684be..9982b936c4 100644
@@ -20,7 +20,7 @@ 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
 XL_OBJS += xl_psr.o xl_info.o xl_console.o xl_misc.o
-XL_OBJS += xl_vmcontrol.o
+XL_OBJS += xl_vmcontrol.o xl_saverestore.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl.h +6 -0
index 62d010076b..65b89ce717 100644
@@ -96,6 +96,12 @@ struct save_file_header {
 
 #define SAVEFILE_BYTEORDER_VALUE ((uint32_t)0x01020304UL)
 
+void save_domain_core_begin(uint32_t domid,
+                            const char *override_config_file,
+                            uint8_t **config_data_r,
+                            int *config_len_r);
+void save_domain_core_writeconfig(int fd, const char *source,
+                                  const uint8_t *config_data, int config_len);
 
 /*
  * The xl process should always return either EXIT_SUCCESS or
tools/xl/xl_cmdimpl.c +0 -227

245 lines not on this page · raw message

tools/xl/xl_saverestore.c new file +273 -0

273 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#72 lore raw

PATCH 28/29 xl: split out migration related code

In reply to Wei Liu

Include COLO / Remus code because they are built on top of the existing migration protocol.

---
 tools/xl/Makefile     |   2 +-
 tools/xl/xl_cmdimpl.c | 715 -----------------------------------------------
 tools/xl/xl_migrate.c | 754 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 755 insertions(+), 716 deletions(-)
 create mode 100644 tools/xl/xl_migrate.c
tools/xl/Makefile +1 -1
index 9982b936c4..8c30fdcf9e 100644
@@ -20,7 +20,7 @@ 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
 XL_OBJS += xl_psr.o xl_info.o xl_console.o xl_misc.o
-XL_OBJS += xl_vmcontrol.o xl_saverestore.o
+XL_OBJS += xl_vmcontrol.o xl_saverestore.o xl_migrate.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl_cmdimpl.c +0 -715

721 lines not on this page · raw message

tools/xl/xl_migrate.c new file +754 -0

754 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#74 lore raw

PATCH 29/29 xl: merge xl_cmdimpl.c into xl.c

In reply to Wei Liu

After splitting out all the meaty bits, xl_cmdimpl.c doesn't contain much. Merge the rest into xl.c and delete the file.

---
 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
tools/xl/Makefile +1 -1
index 8c30fdcf9e..7b73e1b574 100644
@@ -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
tools/xl/xl.c +58 -0

70 lines not on this page · raw message

tools/xl/xl_cmdimpl.c deleted +0 -107

107 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel