From 3d6a119de8157987fd50b46391b2b94dbdb77894 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 26 Jun 2007 22:19:38 +0000 Subject: [PATCH] Rename UUID functions --- ChangeLog | 5 +++++ qemud/conf.c | 8 ++++---- qemud/uuid.c | 16 ++++++++-------- qemud/uuid.h | 14 ++++++++------ 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3e1f55a9b5..e96aa33a2f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jun 26 18:10:00 EST 2007 Daniel P. Berrange + + * qemud/conf.c, qemud/uuid.c, qemud/uuid.h: Rename the + UUID functions to not include QEMU in name. + Tue Jun 26 18:10:00 EST 2007 Daniel P. Berrange * qemud/conf.c, qemud/conf.h, qemud/dispatch.c, qemud/driver.c, diff --git a/qemud/conf.c b/qemud/conf.c index 4c78c7c779..812b654f5a 100644 --- a/qemud/conf.c +++ b/qemud/conf.c @@ -823,12 +823,12 @@ static struct qemud_vm_def *qemudParseXML(struct qemud_driver *driver, if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL) || (obj->stringval[0] == 0)) { int err; - if ((err = qemudGenerateUUID(def->uuid))) { + if ((err = virUUIDGenerate(def->uuid))) { qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Failed to generate UUID: %s", strerror(err)); goto error; } - } else if (qemudParseUUID((const char *)obj->stringval, def->uuid) < 0) { + } else if (virUUIDParse((const char *)obj->stringval, def->uuid) < 0) { qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed uuid element"); goto error; } @@ -1936,12 +1936,12 @@ static struct qemud_network_def *qemudParseNetworkXML(struct qemud_driver *drive if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL) || (obj->stringval[0] == 0)) { int err; - if ((err = qemudGenerateUUID(def->uuid))) { + if ((err = virUUIDGenerate(def->uuid))) { qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Failed to generate UUID: %s", strerror(err)); goto error; } - } else if (qemudParseUUID((const char *)obj->stringval, def->uuid) < 0) { + } else if (virUUIDParse((const char *)obj->stringval, def->uuid) < 0) { qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed uuid element"); goto error; } diff --git a/qemud/uuid.c b/qemud/uuid.c index 8b19512caf..f1877d8502 100644 --- a/qemud/uuid.c +++ b/qemud/uuid.c @@ -35,8 +35,8 @@ #include "internal.h" static int -qemudGenerateRandomBytes(unsigned char *buf, - int buflen) +virUUIDGenerateRandomBytes(unsigned char *buf, + int buflen) { int fd; @@ -63,8 +63,8 @@ qemudGenerateRandomBytes(unsigned char *buf, } static int -qemudGeneratePseudoRandomBytes(unsigned char *buf, - int buflen) +virUUIDGeneratePseudoRandomBytes(unsigned char *buf, + int buflen) { srand(time(NULL)); while (buflen > 0) { @@ -76,20 +76,20 @@ qemudGeneratePseudoRandomBytes(unsigned char *buf, } int -qemudGenerateUUID(unsigned char *uuid) +virUUIDGenerate(unsigned char *uuid) { int err; - if ((err = qemudGenerateRandomBytes(uuid, QEMUD_UUID_RAW_LEN))) + if ((err = virUUIDGenerateRandomBytes(uuid, VIR_UUID_RAW_LEN))) qemudLog(QEMUD_WARN, "Falling back to pseudorandom UUID, " "failed to generate random bytes: %s", strerror(err)); - return qemudGeneratePseudoRandomBytes(uuid, QEMUD_UUID_RAW_LEN); + return virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_RAW_LEN); } int -qemudParseUUID(const char *uuid, unsigned char *rawuuid) { +virUUIDParse(const char *uuid, unsigned char *rawuuid) { const char *cur; int i; diff --git a/qemud/uuid.h b/qemud/uuid.h index 286a83b52d..65a39010b3 100644 --- a/qemud/uuid.h +++ b/qemud/uuid.h @@ -19,12 +19,14 @@ * Mark McLoughlin */ -#ifndef __QEMUD_UUID_H__ -#define __QEMUD_UUID_H__ +#ifndef __VIR_UUID_H__ +#define __VIR_UUID_H__ -int qemudGenerateUUID(unsigned char *uuid); +#define VIR_UUID_RAW_LEN 16 -int qemudParseUUID (const char *uuid, - unsigned char *rawuuid); +int virUUIDGenerate(unsigned char *uuid); -#endif /* __QEMUD_UUID_H__ */ +int virUUIDParse(const char *uuid, + unsigned char *rawuuid); + +#endif /* __VIR_UUID_H__ */