mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +00:00
Rename UUID functions
This commit is contained in:
parent
b63f8cc9f9
commit
3d6a119de8
@ -1,3 +1,8 @@
|
||||
Tue Jun 26 18:10:00 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* 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 <berrange@redhat.com>
|
||||
|
||||
* qemud/conf.c, qemud/conf.h, qemud/dispatch.c, qemud/driver.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;
|
||||
}
|
||||
|
16
qemud/uuid.c
16
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;
|
||||
|
||||
|
14
qemud/uuid.h
14
qemud/uuid.h
@ -19,12 +19,14 @@
|
||||
* Mark McLoughlin <markmc@redhat.com>
|
||||
*/
|
||||
|
||||
#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__ */
|
||||
|
Loading…
Reference in New Issue
Block a user