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

[Xen-changelog] [xen-unstable] libxl: libxl__device_disk_local_attach return a new libxl_device_disk


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Wed, 30 May 2012 13:22:07 +0000
  • Delivery-date: Wed, 30 May 2012 13:22:15 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
# Date 1338305806 -3600
# Node ID 080b8e3f890fefff3fd7ffc9b119529810cfa46d
# Parent  a3d2d22c5f5548c12cf76f0105c760d609cc605e
libxl: libxl__device_disk_local_attach return a new libxl_device_disk

Introduce a new libxl_device_disk* parameter to
libxl__device_disk_local_attach, the parameter is allocated by the
caller. libxl__device_disk_local_attach is going to fill the new disk
with informations about the new locally attached disk.  The new
libxl_device_disk should be passed to libxl__device_disk_local_detach
afterwards.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r a3d2d22c5f55 -r 080b8e3f890f tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue May 29 16:36:45 2012 +0100
+++ b/tools/libxl/libxl.c       Tue May 29 16:36:46 2012 +0100
@@ -1735,13 +1735,24 @@ out:
     return ret;
 }
 
-char * libxl__device_disk_local_attach(libxl__gc *gc, libxl_device_disk *disk)
+char * libxl__device_disk_local_attach(libxl__gc *gc,
+        const libxl_device_disk *in_disk,
+        libxl_device_disk *disk)
 {
     libxl_ctx *ctx = gc->owner;
     char *dev = NULL;
     char *ret = NULL;
     int rc;
 
+    if (in_disk->pdev_path == NULL)
+        return NULL;
+
+    memcpy(disk, in_disk, sizeof(libxl_device_disk));
+    disk->pdev_path = libxl__strdup(gc, in_disk->pdev_path);
+    if (in_disk->script != NULL)
+        disk->script = libxl__strdup(gc, in_disk->script);
+    disk->vdev = NULL;
+
     rc = libxl__device_disk_setdefault(gc, disk);
     if (rc) goto out;
 
@@ -1779,8 +1790,7 @@ char * libxl__device_disk_local_attach(l
                            " attach a qdisk image if the format is not raw");
                 break;
             }
-            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "locally attaching qdisk %s\n",
-                       disk->pdev_path);
+            LOG(DEBUG, "locally attaching qdisk %s", in_disk->pdev_path);
             dev = disk->pdev_path;
             break;
         default:
diff -r a3d2d22c5f55 -r 080b8e3f890f tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c    Tue May 29 16:36:45 2012 +0100
+++ b/tools/libxl/libxl_bootloader.c    Tue May 29 16:36:46 2012 +0100
@@ -225,7 +225,7 @@ static void bootloader_cleanup(libxl__eg
     if (bl->outputdir) libxl__remove_directory(gc, bl->outputdir);
 
     if (bl->diskpath) {
-        libxl__device_disk_local_detach(gc, bl->disk);
+        libxl__device_disk_local_detach(gc, &bl->localdisk);
         free(bl->diskpath);
         bl->diskpath = 0;
     }
@@ -344,7 +344,7 @@ void libxl__bootloader_run(libxl__egc *e
         goto out;
     }
 
-    bl->diskpath = libxl__device_disk_local_attach(gc, bl->disk);
+    bl->diskpath = libxl__device_disk_local_attach(gc, bl->disk, 
&bl->localdisk);
     if (!bl->diskpath) {
         rc = ERROR_FAIL;
         goto out;
diff -r a3d2d22c5f55 -r 080b8e3f890f tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Tue May 29 16:36:45 2012 +0100
+++ b/tools/libxl/libxl_internal.h      Tue May 29 16:36:46 2012 +0100
@@ -1283,7 +1283,8 @@ _hidden void libxl__device_destroy_tapdi
  * a device.
  */
 _hidden char * libxl__device_disk_local_attach(libxl__gc *gc,
-        libxl_device_disk *disk);
+        const libxl_device_disk *in_disk,
+        libxl_device_disk *new_disk);
 _hidden int libxl__device_disk_local_detach(libxl__gc *gc,
         libxl_device_disk *disk);
 
@@ -1818,6 +1819,13 @@ struct libxl__bootloader_state {
     libxl__bootloader_console_callback *console_available;
     const libxl_domain_build_info *info;
     libxl_device_disk *disk;
+    /* Should be zeroed by caller on entry.  Will be filled in by
+     * bootloader machinery; represents the local attachment of the
+     * disk for the benefit of the bootloader.  Must be detached by
+     * the caller using libxl__device_disk_local_detach, but only
+     * after the domain's kernel and initramfs have been loaded into
+     * memory and the file references disposed of. */
+    libxl_device_disk localdisk;
     uint32_t domid;
     /* outputs:
      *  - caller must initialise kernel and ramdisk to point to file

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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