[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Xen 4.2 Release Plan / TODO



On Thu, 2012-04-12 at 08:35 +0100, Ian Campbell wrote:
> > ]   /* common paths */
> > ]   const char *libxl_sbindir_path(void);
> > ]   const char *libxl_bindir_path(void);
> > ]   const char *libxl_libexec_path(void);
> > ]   const char *libxl_libdir_path(void);
> > ]   const char *libxl_sharedir_path(void);
> > ]   const char *libxl_private_bindir_path(void);
> > ]   const char *libxl_xenfirmwaredir_path(void);
> > ]   const char *libxl_xen_config_dir_path(void);
> > ]   const char *libxl_xen_script_dir_path(void);
> > ]   const char *libxl_lock_dir_path(void);
> > ]   const char *libxl_run_dir_path(void);
> > ]   const char *libxl_xenpaging_dir_path(void);
> > 
> > Surely these should be private ?
> 
> As far as I can grep, yes. 

All but two it turns out. Not sure about those. The following patch
moves the rest.

libxl_lock_dir_path seems like it ought to be part of xl not libxl, or
at a stretch libxlu.

config_dir_path is only actually used by xl but an argument could be
made that it is more generally useful?

8<-----------------------------------------------

# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1334218378 -3600
# Node ID 14cac8170e122115ef090cb390775b8c356ae643
# Parent  86b4ff3e201dc81c76ac91f8a9f134669294b3ba
libxl: make most libxl_FOO_path() functions internal.

Only libxl_xen_config_dir_path and libxl_lock_dir_path are used outside the
library. Also bindir, sbindir, sharedir and xenpagingdir appeared to be
completely unused so nuke them.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 86b4ff3e201d -r 14cac8170e12 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu Apr 12 09:02:05 2012 +0100
+++ b/tools/libxl/libxl.c       Thu Apr 12 09:12:58 2012 +0100
@@ -1126,7 +1126,7 @@ out:
 int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, 
libxl_console_type type)
 {
     GC_INIT(ctx);
-    char *p = libxl__sprintf(gc, "%s/xenconsole", libxl_private_bindir_path());
+    char *p = libxl__sprintf(gc, "%s/xenconsole", 
libxl__private_bindir_path());
     char *domid_s = libxl__sprintf(gc, "%d", domid);
     char *cons_num_s = libxl__sprintf(gc, "%d", cons_num);
     char *cons_type_s;
@@ -1767,7 +1767,7 @@ int libxl__device_nic_setdefault(libxl__
         if (!nic->bridge) return ERROR_NOMEM;
     }
     if ( !nic->script && asprintf(&nic->script, "%s/vif-bridge",
-                                  libxl_xen_script_dir_path()) < 0 )
+                                  libxl__xen_script_dir_path()) < 0 )
         return ERROR_FAIL;
     if (!nic->nictype)
         nic->nictype = LIBXL_NIC_TYPE_IOEMU;
@@ -1837,7 +1837,7 @@ int libxl_device_nic_add(libxl_ctx *ctx,
         flexarray_append(back, "script");
         flexarray_append(back, nic->script[0]=='/' ? nic->script
                          : libxl__sprintf(gc, "%s/%s",
-                                          libxl_xen_script_dir_path(),
+                                          libxl__xen_script_dir_path(),
                                           nic->script));
     }
 
diff -r 86b4ff3e201d -r 14cac8170e12 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Thu Apr 12 09:02:05 2012 +0100
+++ b/tools/libxl/libxl.h       Thu Apr 12 09:12:58 2012 +0100
@@ -787,18 +787,8 @@ int libxl_flask_setenforce(libxl_ctx *ct
 int libxl_flask_loadpolicy(libxl_ctx *ctx, void *policy, uint32_t size);
 
 /* common paths */
-const char *libxl_sbindir_path(void);
-const char *libxl_bindir_path(void);
-const char *libxl_libexec_path(void);
-const char *libxl_libdir_path(void);
-const char *libxl_sharedir_path(void);
-const char *libxl_private_bindir_path(void);
-const char *libxl_xenfirmwaredir_path(void);
 const char *libxl_xen_config_dir_path(void);
-const char *libxl_xen_script_dir_path(void);
 const char *libxl_lock_dir_path(void);
-const char *libxl_run_dir_path(void);
-const char *libxl_xenpaging_dir_path(void);
 
 /* misc */
 
diff -r 86b4ff3e201d -r 14cac8170e12 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Thu Apr 12 09:02:05 2012 +0100
+++ b/tools/libxl/libxl_dm.c    Thu Apr 12 09:12:58 2012 +0100
@@ -24,7 +24,7 @@ static const char *libxl_tapif_script(li
 #ifdef __linux__
     return libxl__strdup(gc, "no");
 #else
-    return libxl__sprintf(gc, "%s/qemu-ifup", libxl_xen_script_dir_path());
+    return libxl__sprintf(gc, "%s/qemu-ifup", libxl__xen_script_dir_path());
 #endif
 }
 
@@ -47,10 +47,10 @@ const char *libxl__domain_device_model(l
     } else {
         switch (info->device_model_version) {
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-            dm = libxl__abs_path(gc, "qemu-dm", libxl_libexec_path());
+            dm = libxl__abs_path(gc, "qemu-dm", libxl__libexec_path());
             break;
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-            dm = libxl__abs_path(gc, "qemu-system-i386", libxl_libexec_path());
+            dm = libxl__abs_path(gc, "qemu-system-i386", 
libxl__libexec_path());
             break;
         default:
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
@@ -337,7 +337,7 @@ static char ** libxl__build_device_model
     flexarray_append(dm_args,
                      libxl__sprintf(gc, "socket,id=libxl-cmd,"
                                     "path=%s/qmp-libxl-%d,server,nowait",
-                                    libxl_run_dir_path(), guest_domid));
+                                    libxl__run_dir_path(), guest_domid));
 
     flexarray_append(dm_args, "-mon");
     flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
@@ -708,7 +708,7 @@ static int libxl__create_stubdom(libxl__
     dm_config.b_info.target_memkb = dm_config.b_info.max_memkb;
 
     dm_config.b_info.u.pv.kernel.path = libxl__abs_path(gc, "ioemu-stubdom.gz",
-                                              libxl_xenfirmwaredir_path());
+                                              libxl__xenfirmwaredir_path());
     dm_config.b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", guest_domid);
     dm_config.b_info.u.pv.ramdisk.path = "";
     dm_config.b_info.u.pv.features = "";
diff -r 86b4ff3e201d -r 14cac8170e12 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Thu Apr 12 09:02:05 2012 +0100
+++ b/tools/libxl/libxl_dom.c   Thu Apr 12 09:12:58 2012 +0100
@@ -349,7 +349,7 @@ static const char *libxl__domain_firmwar
             break;
         }
     }
-    return libxl__abs_path(gc, firmware, libxl_xenfirmwaredir_path());
+    return libxl__abs_path(gc, firmware, libxl__xenfirmwaredir_path());
 }
 
 int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
diff -r 86b4ff3e201d -r 14cac8170e12 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Thu Apr 12 09:02:05 2012 +0100
+++ b/tools/libxl/libxl_internal.h      Thu Apr 12 09:12:58 2012 +0100
@@ -1374,6 +1374,14 @@ int libxl__carefd_close(libxl__carefd*);
 /* You may pass NULL in which case the answer is -1. */
 int libxl__carefd_fd(const libxl__carefd*);
 
+/* common paths */
+_hidden const char *libxl__libexec_path(void);
+_hidden const char *libxl__private_bindir_path(void);
+_hidden const char *libxl__xenfirmwaredir_path(void);
+_hidden const char *libxl__xen_config_dir_path(void);
+_hidden const char *libxl__xen_script_dir_path(void);
+_hidden const char *libxl__lock_dir_path(void);
+_hidden const char *libxl__run_dir_path(void);
 
 /*
  * Convenience macros.
diff -r 86b4ff3e201d -r 14cac8170e12 tools/libxl/libxl_paths.c
--- a/tools/libxl/libxl_paths.c Thu Apr 12 09:02:05 2012 +0100
+++ b/tools/libxl/libxl_paths.c Thu Apr 12 09:12:58 2012 +0100
@@ -15,37 +15,17 @@
 #include "libxl_osdeps.h" /* must come before any other headers */
 #include "libxl_internal.h"
 
-const char *libxl_sbindir_path(void)
-{
-    return SBINDIR;
-}
-
-const char *libxl_bindir_path(void)
-{
-    return BINDIR;
-}
-
-const char *libxl_libexec_path(void)
+const char *libxl__libexec_path(void)
 {
     return LIBEXEC;
 }
 
-const char *libxl_libdir_path(void)
-{
-    return LIBDIR;
-}
-
-const char *libxl_sharedir_path(void)
-{
-    return SHAREDIR;
-}
-
-const char *libxl_private_bindir_path(void)
+const char *libxl__private_bindir_path(void)
 {
     return PRIVATE_BINDIR;
 }
 
-const char *libxl_xenfirmwaredir_path(void)
+const char *libxl__xenfirmwaredir_path(void)
 {
     return XENFIRMWAREDIR;
 }
@@ -55,7 +35,7 @@ const char *libxl_xen_config_dir_path(vo
     return XEN_CONFIG_DIR;
 }
 
-const char *libxl_xen_script_dir_path(void)
+const char *libxl__xen_script_dir_path(void)
 {
     return XEN_SCRIPT_DIR;
 }
@@ -65,16 +45,11 @@ const char *libxl_lock_dir_path(void)
     return XEN_LOCK_DIR;
 }
 
-const char *libxl_run_dir_path(void)
+const char *libxl__run_dir_path(void)
 {
     return XEN_RUN_DIR;
 }
 
-const char *libxl_xenpaging_dir_path(void)
-{
-    return XEN_PAGING_DIR;
-}
-
 /*
  * Local variables:
  * mode: C
diff -r 86b4ff3e201d -r 14cac8170e12 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c   Thu Apr 12 09:02:05 2012 +0100
+++ b/tools/libxl/libxl_qmp.c   Thu Apr 12 09:12:58 2012 +0100
@@ -633,7 +633,7 @@ libxl__qmp_handler *libxl__qmp_initializ
     qmp = qmp_init_handler(gc, domid);
 
     qmp_socket = libxl__sprintf(gc, "%s/qmp-libxl-%d",
-                                libxl_run_dir_path(), domid);
+                                libxl__run_dir_path(), domid);
     if ((ret = qmp_open(qmp, qmp_socket, QMP_SOCKET_CONNECT_TIMEOUT)) < 0) {
         LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR, "Connection error");
         qmp_free_handler(qmp);
@@ -671,7 +671,7 @@ void libxl__qmp_cleanup(libxl__gc *gc, u
     char *qmp_socket;
 
     qmp_socket = libxl__sprintf(gc, "%s/qmp-libxl-%d",
-                                libxl_run_dir_path(), domid);
+                                libxl__run_dir_path(), domid);
     if (unlink(qmp_socket) == -1) {
         if (errno != ENOENT) {
             LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.