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

[Xen-changelog] [xen master] libxl: properly set default of discard_enable



commit 364c9ee0076d66498c1ae2b2c65833cbe433ceba
Author:     Olaf Hering <olaf@xxxxxxxxx>
AuthorDate: Tue Jun 17 10:44:40 2014 +0200
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Tue Jun 17 10:08:57 2014 +0100

    libxl: properly set default of discard_enable
    
    Initialze discard_enable properly. This avoids a crash if a
    libxl_device_disk with an uninitialized discard_enable is passed to
    device_disk_add. Up to now only xl initialized discard_enable in its
    config parser. External users of libxl, such as libvirt, do not need to
    provide a default value.
    
    Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/libxl.c       |    2 ++
 tools/libxl/libxlu_disk.c |    1 -
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 4b66afc..9054c3b 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -2025,6 +2025,8 @@ int libxl__device_disk_setdefault(libxl__gc *gc, 
libxl_device_disk *disk)
 {
     int rc;
 
+    libxl_defbool_setdefault(&disk->discard_enable, !!disk->readwrite);
+
     rc = libxl__resolve_domid(gc, disk->backend_domname, &disk->backend_domid);
     if (rc < 0) return rc;
 
diff --git a/tools/libxl/libxlu_disk.c b/tools/libxl/libxlu_disk.c
index 752a2c7..18fe386 100644
--- a/tools/libxl/libxlu_disk.c
+++ b/tools/libxl/libxlu_disk.c
@@ -79,7 +79,6 @@ int xlu_disk_parse(XLU_Config *cfg,
         if (!disk->pdev_path || !strcmp(disk->pdev_path, ""))
             disk->format = LIBXL_DISK_FORMAT_EMPTY;
     }
-    libxl_defbool_setdefault(&disk->discard_enable, !!disk->readwrite);
 
     if (!disk->vdev) {
         xlu__disk_err(&dpc,0, "no vdev specified");
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
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®.