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

[Xen-devel] [PATCH 08 of 23] libxl: disk: use _init/_setdefault



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1329148132 0
# Node ID 575cccbd3dc1c74cafb319fe82998c5fa619b428
# Parent  2fef3eddec04dd3a56d651d15adcd1f72a201a1e
libxl: disk: use _init/_setdefault

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

diff -r 2fef3eddec04 -r 575cccbd3dc1 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Mon Feb 13 15:48:52 2012 +0000
+++ b/tools/libxl/libxl.c       Mon Feb 13 15:48:52 2012 +0000
@@ -1185,10 +1185,19 @@ int libxl_vncviewer_exec(libxl_ctx *ctx,
 
 
/******************************************************************************/
 
-int libxl_device_disk_init(libxl_ctx *ctx, libxl_device_disk *disk)
+void libxl_device_disk_init(libxl_device_disk *disk)
 {
     memset(disk, 0x00, sizeof(libxl_device_disk));
-    return 0;
+}
+
+int libxl__device_disk_setdefault(libxl__gc *gc, libxl_device_disk *disk)
+{
+    int rc;
+
+    rc = libxl__device_disk_set_backend(gc, disk);
+    if (rc) return rc;
+
+    return rc;
 }
 
 static int libxl__device_from_disk(libxl__gc *gc, uint32_t domid,
@@ -1240,10 +1249,7 @@ int libxl_device_disk_add(libxl_ctx *ctx
     libxl__device device;
     int major, minor, rc;
 
-    rc = libxl__device_disk_set_backend(gc, disk);
-    if (rc) goto out;
-
-    rc = libxl__device_disk_set_backend(gc, disk);
+    rc = libxl__device_disk_setdefault(gc, disk);
     if (rc) goto out;
 
     front = flexarray_make(16, 1);
@@ -1395,7 +1401,7 @@ static void libxl__device_disk_from_xs_b
     unsigned int len;
     char *tmp;
 
-    libxl_device_disk_init(ctx, disk);
+    libxl_device_disk_init(disk);
 
     tmp = xs_read(ctx->xsh, XBT_NULL,
                   libxl__sprintf(gc, "%s/params", be_path), &len);
@@ -1439,7 +1445,7 @@ int libxl_devid_to_device_disk(libxl_ctx
     char *dompath, *path;
     int rc = ERROR_FAIL;
 
-    libxl_device_disk_init(ctx, disk);
+    libxl_device_disk_init(disk);
 
     dompath = libxl__xs_get_dompath(gc, domid);
     if (!dompath) {
@@ -1603,7 +1609,7 @@ char * libxl_device_disk_local_attach(li
     char *ret = NULL;
     int rc;
 
-    rc = libxl__device_disk_set_backend(gc, disk);
+    rc = libxl__device_disk_setdefault(gc, disk);
     if (rc) goto out;
 
     switch (disk->backend) {
diff -r 2fef3eddec04 -r 575cccbd3dc1 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Mon Feb 13 15:48:52 2012 +0000
+++ b/tools/libxl/libxl.h       Mon Feb 13 15:48:52 2012 +0000
@@ -502,7 +502,7 @@ libxl_vminfo * libxl_list_vm(libxl_ctx *
  */
 
 /* Disks */
-int libxl_device_disk_init(libxl_ctx *ctx, libxl_device_disk *disk);
+void libxl_device_disk_init(libxl_device_disk *disk);
 int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk 
*disk);
 int libxl_device_disk_remove(libxl_ctx *ctx, uint32_t domid,
                              libxl_device_disk *disk,
diff -r 2fef3eddec04 -r 575cccbd3dc1 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Mon Feb 13 15:48:52 2012 +0000
+++ b/tools/libxl/libxl_create.c        Mon Feb 13 15:48:52 2012 +0000
@@ -535,7 +535,7 @@ static int do_domain_create(libxl__gc *g
     if (ret) goto error_out;
 
     for (i = 0; i < d_config->num_disks; i++) {
-        ret = libxl__device_disk_set_backend(gc, &d_config->disks[i]);
+        ret = libxl__device_disk_setdefault(gc, &d_config->disks[i]);
         if (ret) goto error_out;
     }
 
diff -r 2fef3eddec04 -r 575cccbd3dc1 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Mon Feb 13 15:48:52 2012 +0000
+++ b/tools/libxl/libxl_internal.h      Mon Feb 13 15:48:52 2012 +0000
@@ -191,6 +191,8 @@ _hidden int libxl__domain_create_info_se
                                         libxl_domain_create_info *c_info);
 _hidden int libxl__domain_build_info_setdefault(libxl__gc *gc,
                                         libxl_domain_build_info *b_info);
+_hidden int libxl__device_disk_setdefault(libxl__gc *gc,
+                                          libxl_device_disk *disk);
 
 struct libxl__evgen_domain_death {
     uint32_t domid;
diff -r 2fef3eddec04 -r 575cccbd3dc1 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Mon Feb 13 15:48:52 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Mon Feb 13 15:48:52 2012 +0000
@@ -384,7 +384,7 @@ static void parse_disk_config_multistrin
 {
     int e;
 
-    libxl_device_disk_init(ctx, disk);
+    libxl_device_disk_init(disk);
 
     if (!*config) {
         *config = xlu_cfg_init(stderr, "command line");

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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