From: Ian Campbell Date: Tue, 27 Jul 2010 15:59:14 +0000 (+0100) Subject: xl: Add function to generate random uuid and use it. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~11726 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8595964bd0f44a31b71e77b737b93ae6b57447e1;p=xen.git xl: Add function to generate random uuid and use it. Signed-off-by: Ian Campbell --- diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index ec8f25f18a..847682a5c4 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -211,15 +211,19 @@ static void init_build_info(libxl_domain_build_info *b_info, libxl_domain_create } } +static void random_uuid(uint8_t *uuid) +{ + int i; + for (i = 0; i < 16; i++) + uuid[i] = rand(); +} + static void init_dm_info(libxl_device_model_info *dm_info, libxl_domain_create_info *c_info, libxl_domain_build_info *b_info) { - int i; memset(dm_info, '\0', sizeof(*dm_info)); - for (i = 0; i < 16; i++) { - dm_info->uuid[i] = rand(); - } + random_uuid(&dm_info->uuid[0]); dm_info->dom_name = c_info->name; dm_info->device_model = "qemu-dm"; @@ -493,7 +497,7 @@ static void parse_config_data(const char *configfile_filename_report, XLU_ConfigList *vbds, *nics, *pcis, *cvfbs, *net2s; int pci_power_mgmt = 0; int pci_msitranslate = 1; - int i, e; + int e; config= xlu_cfg_init(stderr, configfile_filename_report); if (!config) { @@ -521,9 +525,7 @@ static void parse_config_data(const char *configfile_filename_report, c_info->name = strdup(buf); else c_info->name = "test"; - for (i = 0; i < 16; i++) { - c_info->uuid[i] = rand(); - } + random_uuid(&c_info->uuid[0]); if (!xlu_cfg_get_long(config, "oos", &l)) c_info->oos = l;