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

[Xen-devel] [PATCH 11 of 26 V3] libxl: disk: use _init/_setdefault



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1330000276 0
# Node ID 17abebd7ba97185f6dce327b6c29b3e380d55d20
# Parent  35c5df3275f9d09e63f07e1d04d4a08232c4154e
libxl: disk: use _init/_setdefault

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

diff -r 35c5df3275f9 -r 17abebd7ba97 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu Feb 23 12:31:16 2012 +0000
+++ b/tools/libxl/libxl.c       Thu Feb 23 12:31:16 2012 +0000
@@ -1186,10 +1186,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,
@@ -1241,10 +1250,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);
@@ -1396,7 +1402,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);
@@ -1440,7 +1446,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) {
@@ -1604,7 +1610,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 35c5df3275f9 -r 17abebd7ba97 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Thu Feb 23 12:31:16 2012 +0000
+++ b/tools/libxl/libxl.h       Thu Feb 23 12:31:16 2012 +0000
@@ -498,7 +498,7 @@ void libxl_vminfo_list_free(libxl_vminfo
  */
 
 /* 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 35c5df3275f9 -r 17abebd7ba97 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Thu Feb 23 12:31:16 2012 +0000
+++ b/tools/libxl/libxl_create.c        Thu Feb 23 12:31:16 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 35c5df3275f9 -r 17abebd7ba97 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Thu Feb 23 12:31:16 2012 +0000
+++ b/tools/libxl/libxl_internal.h      Thu Feb 23 12:31:16 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 35c5df3275f9 -r 17abebd7ba97 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu Feb 23 12:31:16 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Thu Feb 23 12:31:16 2012 +0000
@@ -383,7 +383,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@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®.