Re: PATCH 7/9: Rename uuid functions

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

 



The UUID functions in qemud/uuid.c have qemud_ in the name. They will be
moved into the main src/ directory and so deserve a more generic name.
This patch makes them use virUUID as a prefix. No functional change.

 conf.c |    8 ++++----
 uuid.c |   16 ++++++++--------
 uuid.h |   12 ++++++------
 3 files changed, 18 insertions(+), 18 deletions(-)

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
diff -r cfa5910f18ba qemud/conf.c
--- a/qemud/conf.c	Sun Jun 17 22:11:17 2007 -0400
+++ b/qemud/conf.c	Sun Jun 17 22:11:26 2007 -0400
@@ -792,12 +792,12 @@ static struct qemud_vm_def *qemudParseXM
     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;
     }
@@ -1905,12 +1905,12 @@ static struct qemud_network_def *qemudPa
     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 -r cfa5910f18ba qemud/uuid.c
--- a/qemud/uuid.c	Sun Jun 17 22:11:17 2007 -0400
+++ b/qemud/uuid.c	Sun Jun 17 22:11:26 2007 -0400
@@ -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 *
 }
 
 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 
 }
 
 int
-qemudGenerateUUID(unsigned char *uuid)
+virUUIDGenerate(unsigned char *uuid)
 {
     int err;
 
-    if ((err = qemudGenerateRandomBytes(uuid, QEMUD_UUID_RAW_LEN)))
+    if ((err = virUUIDGenerateRandomBytes(uuid, QEMUD_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, QEMUD_UUID_RAW_LEN);
 }
 
 int
-qemudParseUUID(const char *uuid, unsigned char *rawuuid) {
+virUUIDParse(const char *uuid, unsigned char *rawuuid) {
     const char *cur;
     int i;
 
diff -r cfa5910f18ba qemud/uuid.h
--- a/qemud/uuid.h	Sun Jun 17 22:11:17 2007 -0400
+++ b/qemud/uuid.h	Sun Jun 17 22:11:26 2007 -0400
@@ -19,12 +19,12 @@
  *     Mark McLoughlin <markmc@xxxxxxxxxx>
  */
 
-#ifndef __QEMUD_UUID_H__
-#define __QEMUD_UUID_H__
+#ifndef __VIR_UUID_H__
+#define __VIR_UUID_H__
 
-int qemudGenerateUUID(unsigned char *uuid);
+int virUUIDGenerate(unsigned char *uuid);
 
-int qemudParseUUID   (const char *uuid,
-		      unsigned char *rawuuid);
+int virUUIDParse(const char *uuid,
+		 unsigned char *rawuuid);
 
-#endif /* __QEMUD_UUID_H__ */
+#endif /* __VIR_UUID_H__ */

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]