WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxl: add a specific UUID type.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: add a specific UUID type.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 05 Aug 2010 01:35:37 -0700
Delivery-date: Thu, 05 Aug 2010 01:38:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
# Date 1280941688 -3600
# Node ID d0469b04527751f75b7f5749d59d5fc8759b1561
# Parent  756d770ef5990bee77116a6a1c769024ea75c272
libxl: add a specific UUID type.

Slightly less error prone and also more amenable to autogeneration.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c      |    2 +-
 tools/libxl/libxl.h      |   16 +++++++++-------
 tools/libxl/libxl_dom.c  |    2 +-
 tools/libxl/xl_cmdimpl.c |   12 ++++++------
 4 files changed, 17 insertions(+), 15 deletions(-)

diff -r 756d770ef599 -r d0469b045277 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed Aug 04 16:00:13 2010 +0100
+++ b/tools/libxl/libxl.c       Wed Aug 04 18:08:08 2010 +0100
@@ -410,7 +410,7 @@ int libxl_domain_resume(libxl_ctx *ctx, 
  * Does not modify info so that it may be reused.
  */
 int libxl_domain_preserve(libxl_ctx *ctx, uint32_t domid,
-                          libxl_domain_create_info *info, const char 
*name_suffix, uint8_t new_uuid[16])
+                          libxl_domain_create_info *info, const char 
*name_suffix, libxl_uuid new_uuid)
 {
     struct xs_permissions roperm[2];
     xs_transaction_t t;
diff -r 756d770ef599 -r d0469b045277 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Wed Aug 04 16:00:13 2010 +0100
+++ b/tools/libxl/libxl.h       Wed Aug 04 18:08:08 2010 +0100
@@ -22,8 +22,10 @@
 #include <xs.h>
 #include <sys/wait.h> /* for pid_t */
 
-typedef struct {
-    uint8_t uuid[16];
+typedef uint8_t libxl_uuid[16];
+
+typedef struct {
+    libxl_uuid uuid;
     uint32_t domid;
     uint8_t running:1;
     uint8_t blocked:1;
@@ -50,7 +52,7 @@ typedef struct {
 } libxl_poolinfo;
 
 typedef struct {
-    uint8_t uuid[16];
+    libxl_uuid uuid;
     uint32_t domid;
 } libxl_vminfo;
 
@@ -93,7 +95,7 @@ typedef struct {
     bool oos;
     int ssidref;
     char *name;
-    uint8_t uuid[16];
+    libxl_uuid uuid;
     char **xsdata;
     char **platformdata;
     uint32_t poolid;
@@ -173,7 +175,7 @@ typedef enum {
 
 typedef struct {
     int domid;
-    uint8_t uuid[16]; /* this is use only with stubdom, and must be different 
from the domain uuid */
+    libxl_uuid uuid; /* this is use only with stubdom, and must be different 
from the domain uuid */
     char *dom_name;
     char *device_model;
     char *saved_state;
@@ -338,7 +340,7 @@ int libxl_domain_resume(libxl_ctx *ctx, 
 int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid);
 int libxl_domain_shutdown(libxl_ctx *ctx, uint32_t domid, int req);
 int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force);
-int libxl_domain_preserve(libxl_ctx *ctx, uint32_t domid, 
libxl_domain_create_info *info, const char *name_suffix, uint8_t new_uuid[16]);
+int libxl_domain_preserve(libxl_ctx *ctx, uint32_t domid, 
libxl_domain_create_info *info, const char *name_suffix, libxl_uuid new_uuid);
 
 int libxl_file_reference_map(libxl_ctx *ctx, libxl_file_reference *f);
 int libxl_file_reference_unmap(libxl_ctx *ctx, libxl_file_reference *f);
@@ -360,7 +362,7 @@ int libxl_run_bootloader(libxl_ctx *ctx,
                          libxl_device_disk *disk,
                          uint32_t domid);
 
-char *libxl_uuid2string(libxl_ctx *ctx, const uint8_t uuid[16]);
+char *libxl_uuid2string(libxl_ctx *ctx, const libxl_uuid uuid);
   /* 0 means ERROR_ENOMEM, which we have logged */
 
 /* events handling */
diff -r 756d770ef599 -r d0469b045277 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Wed Aug 04 16:00:13 2010 +0100
+++ b/tools/libxl/libxl_dom.c   Wed Aug 04 18:08:08 2010 +0100
@@ -427,7 +427,7 @@ int save_device_model(libxl_ctx *ctx, ui
     return 0;
 }
 
-char *libxl_uuid2string(libxl_ctx *ctx, const uint8_t uuid[16]) {
+char *libxl_uuid2string(libxl_ctx *ctx, const libxl_uuid uuid) {
     char *s = string_of_uuid(ctx, uuid);
     if (!s) XL_LOG(ctx, XL_LOG_ERROR, "cannot allocate for uuid");
     return s;
diff -r 756d770ef599 -r d0469b045277 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Wed Aug 04 16:00:13 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Wed Aug 04 18:08:08 2010 +0100
@@ -265,11 +265,11 @@ static void init_build_info(libxl_domain
     }
 }
 
-static void random_uuid(uint8_t *uuid)
+static void random_uuid(libxl_uuid *uuid)
 {
     int i;
     for (i = 0; i < 16; i++)
-        uuid[i] = rand();
+        (*uuid)[i] = rand();
 }
 
 static void init_dm_info(libxl_device_model_info *dm_info,
@@ -277,7 +277,7 @@ static void init_dm_info(libxl_device_mo
 {
     memset(dm_info, '\0', sizeof(*dm_info));
 
-    random_uuid(&dm_info->uuid[0]);
+    random_uuid(&dm_info->uuid);
 
     dm_info->dom_name = c_info->name;
     dm_info->device_model = "qemu-dm";
@@ -586,7 +586,7 @@ static void parse_config_data(const char
         c_info->name = strdup(buf);
     else
         c_info->name = "test";
-    random_uuid(&c_info->uuid[0]);
+    random_uuid(&c_info->uuid);
 
     if (!xlu_cfg_get_long(config, "oos", &l))
         c_info->oos = l;
@@ -1155,7 +1155,7 @@ static int preserve_domain(libxl_ctx *ct
     struct tm tm;
     char stime[24];
 
-    uint8_t new_uuid[16];
+    libxl_uuid new_uuid;
 
     int rc;
 
@@ -1176,7 +1176,7 @@ static int preserve_domain(libxl_ctx *ct
         return 0;
     }
 
-    random_uuid(&new_uuid[0]);
+    random_uuid(&new_uuid);
 
     LOG("Preserving domain %d %s with suffix%s", domid, d_config->c_info.name, 
stime);
     rc = libxl_domain_preserve(ctx, domid, &d_config->c_info, stime, new_uuid);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: add a specific UUID type., Xen patchbot-unstable <=