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

[libvirt] [PATCH 25/28] Rename uuid.{c,h} to viruuid.{c,h}



From: "Daniel P. Berrange" <berrange redhat com>

---
 daemon/libvirtd.c                    |   4 +-
 daemon/remote.c                      |   2 +-
 src/Makefile.am                      |   2 +-
 src/conf/capabilities.c              |   2 +-
 src/conf/device_conf.c               |   2 +-
 src/conf/domain_audit.c              |   2 +-
 src/conf/domain_conf.c               |   2 +-
 src/conf/interface_conf.c            |   2 +-
 src/conf/network_conf.c              |   2 +-
 src/conf/node_device_conf.c          |   2 +-
 src/conf/nwfilter_conf.c             |   2 +-
 src/conf/secret_conf.c               |   2 +-
 src/conf/snapshot_conf.c             |   2 +-
 src/conf/storage_conf.c              |   2 +-
 src/conf/storage_encryption_conf.c   |   2 +-
 src/datatypes.c                      |   2 +-
 src/esx/esx_device_monitor.c         |   2 +-
 src/esx/esx_driver.c                 |   2 +-
 src/esx/esx_interface_driver.c       |   2 +-
 src/esx/esx_network_driver.c         |   2 +-
 src/esx/esx_nwfilter_driver.c        |   2 +-
 src/esx/esx_secret_driver.c          |   2 +-
 src/esx/esx_storage_backend_iscsi.c  |   2 +-
 src/esx/esx_storage_backend_vmfs.c   |   2 +-
 src/esx/esx_storage_driver.c         |   2 +-
 src/esx/esx_util.c                   |   2 +-
 src/esx/esx_vi.c                     |   2 +-
 src/esx/esx_vi_methods.c             |   2 +-
 src/hyperv/hyperv_device_monitor.c   |   2 +-
 src/hyperv/hyperv_driver.c           |   2 +-
 src/hyperv/hyperv_interface_driver.c |   2 +-
 src/hyperv/hyperv_network_driver.c   |   2 +-
 src/hyperv/hyperv_nwfilter_driver.c  |   2 +-
 src/hyperv/hyperv_secret_driver.c    |   2 +-
 src/hyperv/hyperv_storage_driver.c   |   2 +-
 src/hyperv/hyperv_util.c             |   2 +-
 src/hyperv/hyperv_wmi.c              |   2 +-
 src/libvirt.c                        |   2 +-
 src/libxl/libxl_conf.c               |   2 +-
 src/libxl/libxl_driver.c             |   2 +-
 src/locking/domain_lock.c            |   2 +-
 src/locking/lock_daemon.c            |   2 +-
 src/locking/lock_driver_lockd.c      |   2 +-
 src/locking/lock_driver_nop.c        |   2 +-
 src/locking/lock_manager.c           |   2 +-
 src/lxc/lxc_conf.c                   |   2 +-
 src/lxc/lxc_container.c              |   2 +-
 src/lxc/lxc_driver.c                 |   2 +-
 src/network/bridge_driver.c          |   2 +-
 src/node_device/node_device_hal.c    |   2 +-
 src/node_device/node_device_udev.c   |   2 +-
 src/openvz/openvz_conf.c             |   2 +-
 src/phyp/phyp_driver.c               |   2 +-
 src/qemu/qemu_command.c              |   2 +-
 src/qemu/qemu_conf.c                 |   2 +-
 src/qemu/qemu_domain.c               |   2 +-
 src/qemu/qemu_driver.c               |   2 +-
 src/qemu/qemu_migration.c            |   2 +-
 src/qemu/qemu_process.c              |   2 +-
 src/secret/secret_driver.c           |   2 +-
 src/security/security_apparmor.c     |   2 +-
 src/security/virt-aa-helper.c        |   2 +-
 src/storage/storage_backend.c        |   2 +-
 src/storage/storage_backend_rbd.c    |   2 +-
 src/test/test_driver.c               |   2 +-
 src/uml/uml_conf.c                   |   2 +-
 src/uml/uml_driver.c                 |   2 +-
 src/util/uuid.c                      | 313 -----------------------------------
 src/util/uuid.h                      |  41 -----
 src/util/virnetdevmacvlan.c          |   2 +-
 src/util/virnetdevvportprofile.h     |   2 +-
 src/util/viruuid.c                   | 313 +++++++++++++++++++++++++++++++++++
 src/util/viruuid.h                   |  41 +++++
 src/vbox/vbox_tmpl.c                 |   2 +-
 src/vmware/vmware_conf.c             |   2 +-
 src/vmware/vmware_driver.c           |   2 +-
 src/vmx/vmx.c                        |   2 +-
 src/xen/xen_driver.c                 |   2 +-
 src/xen/xen_inotify.c                |   2 +-
 src/xen/xend_internal.c              |   2 +-
 src/xen/xm_internal.c                |   2 +-
 src/xen/xs_internal.c                |   2 +-
 src/xenapi/xenapi_driver.c           |   2 +-
 src/xenapi/xenapi_utils.c            |   2 +-
 src/xenxs/xen_sxpr.c                 |   2 +-
 src/xenxs/xen_xm.c                   |   2 +-
 86 files changed, 437 insertions(+), 437 deletions(-)
 delete mode 100644 src/util/uuid.c
 delete mode 100644 src/util/uuid.h
 create mode 100644 src/util/viruuid.c
 create mode 100644 src/util/viruuid.h

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index edc899e..560746f 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -44,7 +44,7 @@
 #include "libvirtd-config.h"
 
 #include "virutil.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "remote_driver.h"
 #include "viralloc.h"
 #include "virconf.h"
@@ -53,7 +53,7 @@
 #include "remote.h"
 #include "remote_driver.h"
 #include "virhooks.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "viraudit.h"
 #include "locking/lock_manager.h"
 
diff --git a/daemon/remote.c b/daemon/remote.c
index 0b5a3db..1a054d5 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -37,7 +37,7 @@
 #include "virlog.h"
 #include "virutil.h"
 #include "stream.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "libvirt/libvirt-qemu.h"
 #include "vircommand.h"
 #include "intprops.h"
diff --git a/src/Makefile.am b/src/Makefile.am
index 1303edd..dd5a1bd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -53,7 +53,6 @@ augeastest_DATA =
 # These files are not related to driver APIs. Simply generic
 # helper APIs for various purposes
 UTIL_SOURCES =							\
-		util/uuid.c util/uuid.h				\
 		util/viralloc.c util/viralloc.h			\
 		util/viratomic.h util/viratomic.c		\
 		util/viraudit.c util/viraudit.h			\
@@ -115,6 +114,7 @@ UTIL_SOURCES =							\
 		util/virusb.c util/virusb.h			\
 		util/viruri.h util/viruri.c			\
 		util/virutil.c util/virutil.h			\
+		util/viruuid.c util/viruuid.h			\
 		$(NULL)
 
 EXTRA_DIST += $(srcdir)/util/virkeymaps.h $(srcdir)/util/keymaps.csv \
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index e46a594..f6badcc 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -29,7 +29,7 @@
 #include "virbuffer.h"
 #include "viralloc.h"
 #include "virutil.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "cpu_conf.h"
 #include "virterror_internal.h"
 
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 4efafc4..ecfaf30 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -25,7 +25,7 @@
 #include "datatypes.h"
 #include "viralloc.h"
 #include "xml.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virutil.h"
 #include "virbuffer.h"
 #include "device_conf.h"
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index c275f71..b4b2649 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -28,7 +28,7 @@
 
 #include "domain_audit.h"
 #include "viraudit.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virlog.h"
 #include "viralloc.h"
 
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ab1fe2a..2943fe3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -37,7 +37,7 @@
 #include "viralloc.h"
 #include "verify.h"
 #include "xml.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virutil.h"
 #include "virbuffer.h"
 #include "virlog.h"
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index e4b088a..6a53bda 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -29,7 +29,7 @@
 
 #include "viralloc.h"
 #include "xml.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virutil.h"
 #include "virbuffer.h"
 
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 42f3593..01a6f2e 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -39,7 +39,7 @@
 #include "netdev_vlan_conf.h"
 #include "viralloc.h"
 #include "xml.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virutil.h"
 #include "virbuffer.h"
 #include "c-ctype.h"
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 12819c8..67d743e 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -35,7 +35,7 @@
 #include "xml.h"
 #include "virutil.h"
 #include "virbuffer.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virpci.h"
 #include "virrandom.h"
 
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 09a9d1c..810de6c 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -38,7 +38,7 @@
 
 #include "internal.h"
 
-#include "uuid.h"
+#include "viruuid.h"
 #include "viralloc.h"
 #include "virterror_internal.h"
 #include "datatypes.h"
diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
index a65cf92..2abb95a 100644
--- a/src/conf/secret_conf.c
+++ b/src/conf/secret_conf.c
@@ -31,7 +31,7 @@
 #include "virterror_internal.h"
 #include "virutil.h"
 #include "xml.h"
-#include "uuid.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_SECRET
 
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 810d2bf..3ad74d6 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -43,7 +43,7 @@
 #include "snapshot_conf.h"
 #include "virstoragefile.h"
 #include "virutil.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virfile.h"
 #include "virterror_internal.h"
 #include "xml.h"
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 38bb471..4239e49 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -39,7 +39,7 @@
 #include "virstoragefile.h"
 
 #include "xml.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virbuffer.h"
 #include "virutil.h"
 #include "viralloc.h"
diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c
index 139c37c..8ea54fa 100644
--- a/src/conf/storage_encryption_conf.c
+++ b/src/conf/storage_encryption_conf.c
@@ -34,7 +34,7 @@
 #include "virutil.h"
 #include "xml.h"
 #include "virterror_internal.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
diff --git a/src/datatypes.c b/src/datatypes.c
index 07aefcc..038c47d 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -26,7 +26,7 @@
 #include "virterror_internal.h"
 #include "virlog.h"
 #include "viralloc.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/esx/esx_device_monitor.c b/src/esx/esx_device_monitor.c
index 7cc6ac0..f6c85ba 100644
--- a/src/esx/esx_device_monitor.c
+++ b/src/esx/esx_device_monitor.c
@@ -28,7 +28,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "esx_private.h"
 #include "esx_device_monitor.h"
 #include "esx_vi.h"
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 2c0297c..4ce3a3d 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -31,7 +31,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "vmx.h"
 #include "virtypedparam.h"
 #include "esx_driver.h"
diff --git a/src/esx/esx_interface_driver.c b/src/esx/esx_interface_driver.c
index 524886f..53c179b 100644
--- a/src/esx/esx_interface_driver.c
+++ b/src/esx/esx_interface_driver.c
@@ -28,7 +28,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "interface_conf.h"
 #include "virsocketaddr.h"
 #include "esx_private.h"
diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c
index 0fc2603..48763d4 100644
--- a/src/esx/esx_network_driver.c
+++ b/src/esx/esx_network_driver.c
@@ -29,7 +29,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "network_conf.h"
 #include "esx_private.h"
 #include "esx_network_driver.h"
diff --git a/src/esx/esx_nwfilter_driver.c b/src/esx/esx_nwfilter_driver.c
index ecee0fb..c59929c 100644
--- a/src/esx/esx_nwfilter_driver.c
+++ b/src/esx/esx_nwfilter_driver.c
@@ -28,7 +28,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "esx_private.h"
 #include "esx_nwfilter_driver.h"
 #include "esx_vi.h"
diff --git a/src/esx/esx_secret_driver.c b/src/esx/esx_secret_driver.c
index 722d3f7..92cbb14 100644
--- a/src/esx/esx_secret_driver.c
+++ b/src/esx/esx_secret_driver.c
@@ -27,7 +27,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "esx_private.h"
 #include "esx_secret_driver.h"
 #include "esx_vi.h"
diff --git a/src/esx/esx_storage_backend_iscsi.c b/src/esx/esx_storage_backend_iscsi.c
index 3c3ab7d..e09fa55 100644
--- a/src/esx/esx_storage_backend_iscsi.c
+++ b/src/esx/esx_storage_backend_iscsi.c
@@ -31,7 +31,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "storage_conf.h"
 #include "virstoragefile.h"
 #include "esx_storage_backend_iscsi.h"
diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backend_vmfs.c
index c57e070..f965b4f 100644
--- a/src/esx/esx_storage_backend_vmfs.c
+++ b/src/esx/esx_storage_backend_vmfs.c
@@ -34,7 +34,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "storage_conf.h"
 #include "virstoragefile.h"
 #include "esx_storage_backend_vmfs.h"
diff --git a/src/esx/esx_storage_driver.c b/src/esx/esx_storage_driver.c
index 1324469..5fb4e1f 100644
--- a/src/esx/esx_storage_driver.c
+++ b/src/esx/esx_storage_driver.c
@@ -25,7 +25,7 @@
 
 #include <config.h>
 
-#include "uuid.h"
+#include "viruuid.h"
 #include "viralloc.h"
 #include "storage_conf.h"
 #include "esx_private.h"
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index 9b2e576..4d2019b 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -31,7 +31,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "vmx.h"
 #include "esx_private.h"
 #include "esx_util.h"
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 2cc8002..92ac8f8 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -30,7 +30,7 @@
 #include "viralloc.h"
 #include "virlog.h"
 #include "virutil.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "vmx.h"
 #include "xml.h"
 #include "esx_vi.h"
diff --git a/src/esx/esx_vi_methods.c b/src/esx/esx_vi_methods.c
index 7ffca559..2279e62 100644
--- a/src/esx/esx_vi_methods.c
+++ b/src/esx/esx_vi_methods.c
@@ -26,7 +26,7 @@
 #include "virbuffer.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "esx_vi_methods.h"
 #include "esx_util.h"
 
diff --git a/src/hyperv/hyperv_device_monitor.c b/src/hyperv/hyperv_device_monitor.c
index 10d559f..43ee1fc 100644
--- a/src/hyperv/hyperv_device_monitor.c
+++ b/src/hyperv/hyperv_device_monitor.c
@@ -29,7 +29,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "hyperv_device_monitor.h"
 
 #define VIR_FROM_THIS VIR_FROM_HYPERV
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index d777bd8..601a85a 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -30,7 +30,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "hyperv_driver.h"
 #include "hyperv_interface_driver.h"
 #include "hyperv_network_driver.h"
diff --git a/src/hyperv/hyperv_interface_driver.c b/src/hyperv/hyperv_interface_driver.c
index af37de3..7dd6912 100644
--- a/src/hyperv/hyperv_interface_driver.c
+++ b/src/hyperv/hyperv_interface_driver.c
@@ -29,7 +29,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "hyperv_interface_driver.h"
 
 #define VIR_FROM_THIS VIR_FROM_HYPERV
diff --git a/src/hyperv/hyperv_network_driver.c b/src/hyperv/hyperv_network_driver.c
index cafc956..f34a451 100644
--- a/src/hyperv/hyperv_network_driver.c
+++ b/src/hyperv/hyperv_network_driver.c
@@ -29,7 +29,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "hyperv_network_driver.h"
 
 #define VIR_FROM_THIS VIR_FROM_HYPERV
diff --git a/src/hyperv/hyperv_nwfilter_driver.c b/src/hyperv/hyperv_nwfilter_driver.c
index 46c57b7..c6125ec 100644
--- a/src/hyperv/hyperv_nwfilter_driver.c
+++ b/src/hyperv/hyperv_nwfilter_driver.c
@@ -29,7 +29,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "hyperv_nwfilter_driver.h"
 
 #define VIR_FROM_THIS VIR_FROM_HYPERV
diff --git a/src/hyperv/hyperv_secret_driver.c b/src/hyperv/hyperv_secret_driver.c
index ea8fa7e..b830e4e 100644
--- a/src/hyperv/hyperv_secret_driver.c
+++ b/src/hyperv/hyperv_secret_driver.c
@@ -29,7 +29,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "hyperv_secret_driver.h"
 
 #define VIR_FROM_THIS VIR_FROM_HYPERV
diff --git a/src/hyperv/hyperv_storage_driver.c b/src/hyperv/hyperv_storage_driver.c
index 7549801..38385a0 100644
--- a/src/hyperv/hyperv_storage_driver.c
+++ b/src/hyperv/hyperv_storage_driver.c
@@ -29,7 +29,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "hyperv_storage_driver.h"
 
 #define VIR_FROM_THIS VIR_FROM_HYPERV
diff --git a/src/hyperv/hyperv_util.c b/src/hyperv/hyperv_util.c
index 69a57c6..9bc5b81 100644
--- a/src/hyperv/hyperv_util.c
+++ b/src/hyperv/hyperv_util.c
@@ -27,7 +27,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "hyperv_private.h"
 #include "hyperv_util.h"
 
diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
index f4afdce..e029028 100644
--- a/src/hyperv/hyperv_wmi.c
+++ b/src/hyperv/hyperv_wmi.c
@@ -30,7 +30,7 @@
 #include "virlog.h"
 #include "viralloc.h"
 #include "virutil.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virbuffer.h"
 #include "hyperv_private.h"
 #include "hyperv_wmi.h"
diff --git a/src/libvirt.c b/src/libvirt.c
index 5654d53..e06b643 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -50,7 +50,7 @@
 #include "datatypes.h"
 #include "driver.h"
 
-#include "uuid.h"
+#include "viruuid.h"
 #include "viralloc.h"
 #include "configmake.h"
 #include "intprops.h"
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index eb6738c..aad1374 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -38,7 +38,7 @@
 #include "virfile.h"
 #include "virstring.h"
 #include "viralloc.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "capabilities.h"
 #include "libxl_driver.h"
 #include "libxl_conf.h"
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index af74ebc..76afe34 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -38,7 +38,7 @@
 #include "datatypes.h"
 #include "virfile.h"
 #include "viralloc.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "vircommand.h"
 #include "libxl.h"
 #include "libxl_driver.h"
diff --git a/src/locking/domain_lock.c b/src/locking/domain_lock.c
index 0ae9750..0354e26 100644
--- a/src/locking/domain_lock.c
+++ b/src/locking/domain_lock.c
@@ -23,7 +23,7 @@
 
 #include "domain_lock.h"
 #include "viralloc.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virterror_internal.h"
 #include "virlog.h"
 
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index df9923e..a445b2e 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -44,7 +44,7 @@
 #include "rpc/virnetserver.h"
 #include "virrandom.h"
 #include "virhash.h"
-#include "uuid.h"
+#include "viruuid.h"
 
 #include "locking/lock_daemon_dispatch.h"
 #include "locking/lock_protocol.h"
diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c
index 547db85..9c7ce6d 100644
--- a/src/locking/lock_driver_lockd.c
+++ b/src/locking/lock_driver_lockd.c
@@ -25,7 +25,7 @@
 #include "virconf.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virutil.h"
 #include "virfile.h"
 #include "virterror_internal.h"
diff --git a/src/locking/lock_driver_nop.c b/src/locking/lock_driver_nop.c
index cf0f49a..e8e9917 100644
--- a/src/locking/lock_driver_nop.c
+++ b/src/locking/lock_driver_nop.c
@@ -24,7 +24,7 @@
 #include "lock_driver_nop.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 
 
 static int virLockManagerNopInit(unsigned int version ATTRIBUTE_UNUSED,
diff --git a/src/locking/lock_manager.c b/src/locking/lock_manager.c
index d73e184..1b88838 100644
--- a/src/locking/lock_manager.c
+++ b/src/locking/lock_manager.c
@@ -27,7 +27,7 @@
 #include "virlog.h"
 #include "virutil.h"
 #include "viralloc.h"
-#include "uuid.h"
+#include "viruuid.h"
 
 #if HAVE_DLFCN_H
 # include <dlfcn.h>
diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c
index 043630a..36c49d0 100644
--- a/src/lxc/lxc_conf.c
+++ b/src/lxc/lxc_conf.c
@@ -34,7 +34,7 @@
 #include "virconf.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "configmake.h"
 #include "lxc_container.h"
 #include "virnodesuspend.h"
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 050a4c1..57c432a 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -59,7 +59,7 @@
 #include "virutil.h"
 #include "viralloc.h"
 #include "virnetdevveth.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virfile.h"
 #include "vircommand.h"
 #include "virnetdev.h"
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index e513b76..42c6f80 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -48,7 +48,7 @@
 #include "virnetdevbridge.h"
 #include "virnetdevveth.h"
 #include "nodeinfo.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virstatslinux.h"
 #include "virhooks.h"
 #include "virfile.h"
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index dbbd49c..953e571 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -55,7 +55,7 @@
 #include "virutil.h"
 #include "vircommand.h"
 #include "viralloc.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "viriptables.h"
 #include "virlog.h"
 #include "virdnsmasq.h"
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index 257a363..8ee816b 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -34,7 +34,7 @@
 #include "driver.h"
 #include "datatypes.h"
 #include "viralloc.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virpci.h"
 #include "virlog.h"
 #include "node_device_driver.h"
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index d350955..61e5a0e 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -34,7 +34,7 @@
 #include "datatypes.h"
 #include "virlog.h"
 #include "viralloc.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virutil.h"
 #include "virbuffer.h"
 #include "virpci.h"
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index b0c9c5f..35f5c97 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -46,7 +46,7 @@
 #include "virterror_internal.h"
 #include "openvz_conf.h"
 #include "openvz_util.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virbuffer.h"
 #include "viralloc.h"
 #include "virutil.h"
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 25b96b4..cd1911e 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -53,7 +53,7 @@
 #include "driver.h"
 #include "libvirt/libvirt.h"
 #include "virterror_internal.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "domain_conf.h"
 #include "storage_conf.h"
 #include "nodeinfo.h"
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 23ccffe..79e5faa 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -33,7 +33,7 @@
 #include "virterror_internal.h"
 #include "virutil.h"
 #include "virfile.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "c-ctype.h"
 #include "domain_nwfilter.h"
 #include "domain_audit.h"
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index be88d77..8d05b4c 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -40,7 +40,7 @@
 #include "qemu_command.h"
 #include "qemu_capabilities.h"
 #include "qemu_bridge_filter.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virbuffer.h"
 #include "virconf.h"
 #include "virutil.h"
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 3e1081a..46b7656 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -32,7 +32,7 @@
 #include "virterror_internal.h"
 #include "c-ctype.h"
 #include "cpu/cpu.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virfile.h"
 #include "domain_event.h"
 #include "virtime.h"
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 15b773b..3821d74 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -68,7 +68,7 @@
 #include "virstatslinux.h"
 #include "capabilities.h"
 #include "viralloc.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "domain_conf.h"
 #include "domain_audit.h"
 #include "node_device_conf.h"
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 1e83e3c..afe2374 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -43,7 +43,7 @@
 #include "virfile.h"
 #include "datatypes.h"
 #include "fdstream.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virtime.h"
 #include "locking/domain_lock.h"
 #include "rpc/virnetsocket.h"
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d4eaa9e..5ffc5a5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -64,7 +64,7 @@
 #include "domain_nwfilter.h"
 #include "locking/domain_lock.h"
 #include "network/bridge_driver.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virprocess.h"
 #include "virtime.h"
 #include "virnetdevtap.h"
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 8dfd921..1784fea 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -38,7 +38,7 @@
 #include "secret_driver.h"
 #include "virthread.h"
 #include "virutil.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virterror_internal.h"
 #include "virfile.h"
 #include "configmake.h"
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 4027cdf..ee96bac 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -42,7 +42,7 @@
 #include "viralloc.h"
 #include "virterror_internal.h"
 #include "datatypes.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virpci.h"
 #include "virusb.h"
 #include "virfile.h"
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 5cfa3ff..3c15226 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -49,7 +49,7 @@
 #include "security_apparmor.h"
 #include "domain_conf.h"
 #include "xml.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virusb.h"
 #include "virpci.h"
 #include "virfile.h"
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 29272f1..f98a7c0 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -51,7 +51,7 @@
 #include "viralloc.h"
 #include "internal.h"
 #include "secret_conf.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virstoragefile.h"
 #include "storage_backend.h"
 #include "virlog.h"
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index ffa3234..7dc46b0 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -29,7 +29,7 @@
 #include "viralloc.h"
 #include "virlog.h"
 #include "base64.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "rados/librados.h"
 #include "rbd/librbd.h"
 
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index da76367..1a85eb3 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -37,7 +37,7 @@
 #include "test_driver.h"
 #include "virbuffer.h"
 #include "virutil.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "capabilities.h"
 #include "viralloc.h"
 #include "network_conf.h"
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index b2057e8..bfc0600 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -36,7 +36,7 @@
 #include <sys/utsname.h>
 
 #include "uml_conf.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virbuffer.h"
 #include "virconf.h"
 #include "virutil.h"
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 05fb7f2..448d292 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -52,7 +52,7 @@
 #include "virstatslinux.h"
 #include "capabilities.h"
 #include "viralloc.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "domain_conf.h"
 #include "domain_audit.h"
 #include "datatypes.h"
diff --git a/src/util/uuid.c b/src/util/uuid.c
deleted file mode 100644
index 57cfaa6..0000000
--- a/src/util/uuid.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * Authors:
- *     Mark McLoughlin <markmc redhat com>
- */
-
-#include <config.h>
-
-#include "uuid.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "c-ctype.h"
-#include "internal.h"
-#include "virutil.h"
-#include "virterror_internal.h"
-#include "virlog.h"
-#include "viralloc.h"
-#include "virfile.h"
-#include "virrandom.h"
-
-#ifndef ENODATA
-# define ENODATA EIO
-#endif
-
-static unsigned char host_uuid[VIR_UUID_BUFLEN];
-
-static int
-virUUIDGenerateRandomBytes(unsigned char *buf,
-                           int buflen)
-{
-    int fd;
-
-    if ((fd = open("/dev/urandom", O_RDONLY)) < 0)
-        return errno;
-
-    while (buflen > 0) {
-        int n;
-
-        if ((n = read(fd, buf, buflen)) <= 0) {
-            if (errno == EINTR)
-                continue;
-            VIR_FORCE_CLOSE(fd);
-            return n < 0 ? errno : ENODATA;
-        }
-
-        buf += n;
-        buflen -= n;
-    }
-
-    VIR_FORCE_CLOSE(fd);
-
-    return 0;
-}
-
-static int
-virUUIDGeneratePseudoRandomBytes(unsigned char *buf,
-                                 int buflen)
-{
-    while (buflen > 0) {
-        *buf++ = virRandomBits(8);
-        buflen--;
-    }
-
-    return 0;
-}
-
-/**
- * virUUIDGenerate:
- * @uuid: array of VIR_UUID_BUFLEN bytes to store the new UUID
- *
- * Generates a randomized unique identifier.
- *
- * Returns 0 in case of success and -1 in case of failure
- */
-int
-virUUIDGenerate(unsigned char *uuid)
-{
-    int err;
-
-    if (uuid == NULL)
-        return -1;
-
-    if ((err = virUUIDGenerateRandomBytes(uuid, VIR_UUID_BUFLEN))) {
-        char ebuf[1024];
-        VIR_WARN("Falling back to pseudorandom UUID,"
-                 " failed to generate random bytes: %s",
-                 virStrerror(err, ebuf, sizeof(ebuf)));
-        err = virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_BUFLEN);
-    }
-
-    return err;
-}
-
-/**
- * virUUIDParse:
- * @uuidstr: zero terminated string representation of the UUID
- * @uuid: array of VIR_UUID_BUFLEN bytes to store the raw UUID
- *
- * Parses the external string representation, allowing spaces and '-'
- * character in the sequence, and storing the result as a raw UUID
- *
- * Returns 0 in case of success and -1 in case of error.
- */
-int
-virUUIDParse(const char *uuidstr, unsigned char *uuid) {
-    const char *cur;
-    int i;
-
-    /*
-     * do a liberal scan allowing '-' and ' ' anywhere between character
-     * pairs, and surrounding whitespace, as long as there are exactly
-     * 32 hexadecimal digits the end.
-     */
-    cur = uuidstr;
-    while (c_isspace(*cur))
-        cur++;
-
-    for (i = 0;i < VIR_UUID_BUFLEN;) {
-        uuid[i] = 0;
-        if (*cur == 0)
-            goto error;
-        if ((*cur == '-') || (*cur == ' ')) {
-            cur++;
-            continue;
-        }
-        if (!c_isxdigit(*cur))
-            goto error;
-        uuid[i] = virHexToBin(*cur);
-        uuid[i] *= 16;
-        cur++;
-        if (*cur == 0)
-            goto error;
-        if (!c_isxdigit(*cur))
-            goto error;
-        uuid[i] += virHexToBin(*cur);
-        i++;
-        cur++;
-    }
-
-    while (*cur) {
-        if (!c_isspace(*cur))
-            goto error;
-        cur++;
-    }
-
-    return 0;
-
- error:
-    return -1;
-}
-
-/**
- * virUUIDFormat:
- * @uuid: array of VIR_UUID_RAW_LEN bytes to store the raw UUID
- * @uuidstr: array of VIR_UUID_STRING_BUFLEN bytes to store the
- * string representation of the UUID in. The resulting string
- * will be NULL terminated.
- *
- * Converts the raw UUID into printable format, with embedded '-'
- *
- * Returns a pointer to the resulting character string.
- */
-const char *
-virUUIDFormat(const unsigned char *uuid, char *uuidstr)
-{
-    snprintf(uuidstr, VIR_UUID_STRING_BUFLEN,
-             "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-             uuid[0], uuid[1], uuid[2], uuid[3],
-             uuid[4], uuid[5], uuid[6], uuid[7],
-             uuid[8], uuid[9], uuid[10], uuid[11],
-             uuid[12], uuid[13], uuid[14], uuid[15]);
-    uuidstr[VIR_UUID_STRING_BUFLEN-1] = '\0';
-    return uuidstr;
-}
-
-
-
-/**
- * virUUIDIsValid
- *
- * @uuid: The UUID to test
- *
- * Do some basic tests to check whether the given UUID is
- * valid as a host UUID.
- * Basic tests:
- *  - Not all of the digits may be equal
- */
-int
-virUUIDIsValid(unsigned char *uuid)
-{
-    unsigned int i, ctr = 1;
-    unsigned char c;
-
-    if (!uuid)
-        return 0;
-
-    c = uuid[0];
-
-    for (i = 1; i < VIR_UUID_BUFLEN; i++)
-        if (uuid[i] == c)
-            ctr++;
-
-    return ctr != VIR_UUID_BUFLEN;
-}
-
-static int
-getDMISystemUUID(char *uuid, int len)
-{
-    unsigned int i = 0;
-    const char *paths[] = {
-        "/sys/devices/virtual/dmi/id/product_uuid",
-        "/sys/class/dmi/id/product_uuid",
-        NULL
-    };
-
-    while (paths[i]) {
-        int fd = open(paths[i], O_RDONLY);
-        if (fd >= 0) {
-            if (saferead(fd, uuid, len - 1) == len - 1) {
-                uuid[len - 1] = '\0';
-                VIR_FORCE_CLOSE(fd);
-                return 0;
-            }
-            VIR_FORCE_CLOSE(fd);
-        }
-        i++;
-    }
-
-    return -1;
-}
-
-
-/**
- * setHostUUID
- *
- * @host_uuid: UUID that the host is supposed to have
- *
- * Set the UUID of the host if it hasn't been set, yet
- * Returns 0 in case of success, an error code in case of error.
- */
-int
-virSetHostUUIDStr(const char *uuid)
-{
-    int rc;
-    char dmiuuid[VIR_UUID_STRING_BUFLEN];
-
-    if (virUUIDIsValid(host_uuid))
-        return EEXIST;
-
-    if (!uuid) {
-        memset(dmiuuid, 0, sizeof(dmiuuid));
-        if (!getDMISystemUUID(dmiuuid, sizeof(dmiuuid))) {
-            if (!virUUIDParse(dmiuuid, host_uuid))
-                return 0;
-        }
-
-        if (!virUUIDIsValid(host_uuid))
-            return virUUIDGenerate(host_uuid);
-    } else {
-        rc = virUUIDParse(uuid, host_uuid);
-        if (rc)
-            return rc;
-        if (!virUUIDIsValid(host_uuid))
-            return EINVAL;
-    }
-
-    return 0;
-}
-
-/**
- * getHostUUID:
- *
- * @host_uuid: memory to store the host_uuid into
- *
- * Get the UUID of the host. Returns 0 in case of success,
- * an error code otherwise.
- * Returns 0 in case of success, an error code in case of error.
- */
-int virGetHostUUID(unsigned char *uuid)
-{
-    int ret = 0;
-
-    if (!virUUIDIsValid(host_uuid))
-        ret = virSetHostUUIDStr(NULL);
-
-    memcpy(uuid, host_uuid, sizeof(host_uuid));
-
-    return ret;
-}
diff --git a/src/util/uuid.h b/src/util/uuid.h
deleted file mode 100644
index d90fd2e..0000000
--- a/src/util/uuid.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2007, 2011, 2012 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * Authors:
- *     Mark McLoughlin <markmc redhat com>
- */
-
-#ifndef __VIR_UUID_H__
-# define __VIR_UUID_H__
-
-# include "internal.h"
-
-int virSetHostUUIDStr(const char *host_uuid);
-int virGetHostUUID(unsigned char *host_uuid) ATTRIBUTE_NONNULL(1);
-
-int virUUIDIsValid(unsigned char *uuid);
-
-int virUUIDGenerate(unsigned char *uuid);
-
-int virUUIDParse(const char *uuidstr,
-                 unsigned char *uuid)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
-
-const char *virUUIDFormat(const unsigned char *uuid,
-                          char *uuidstr) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-
-#endif /* __VIR_UUID_H__ */
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 953d76b..720a48a 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -58,7 +58,7 @@ VIR_ENUM_IMPL(virNetDevMacVLanMode, VIR_NETDEV_MACVLAN_MODE_LAST,
 
 # include "viralloc.h"
 # include "virlog.h"
-# include "uuid.h"
+# include "viruuid.h"
 # include "virfile.h"
 # include "virnetlink.h"
 # include "virnetdev.h"
diff --git a/src/util/virnetdevvportprofile.h b/src/util/virnetdevvportprofile.h
index cc106b8..940c0e9 100644
--- a/src/util/virnetdevvportprofile.h
+++ b/src/util/virnetdevvportprofile.h
@@ -24,7 +24,7 @@
 # define __VIR_NETDEV_VPORT_PROFILE_H__
 
 # include "internal.h"
-# include "uuid.h"
+# include "viruuid.h"
 # include "virutil.h"
 # include "virmacaddr.h"
 
diff --git a/src/util/viruuid.c b/src/util/viruuid.c
new file mode 100644
index 0000000..f4eb331
--- /dev/null
+++ b/src/util/viruuid.c
@@ -0,0 +1,313 @@
+/*
+ * Copyright (C) 2007-2012 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *     Mark McLoughlin <markmc redhat com>
+ */
+
+#include <config.h>
+
+#include "viruuid.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "c-ctype.h"
+#include "internal.h"
+#include "virutil.h"
+#include "virterror_internal.h"
+#include "virlog.h"
+#include "viralloc.h"
+#include "virfile.h"
+#include "virrandom.h"
+
+#ifndef ENODATA
+# define ENODATA EIO
+#endif
+
+static unsigned char host_uuid[VIR_UUID_BUFLEN];
+
+static int
+virUUIDGenerateRandomBytes(unsigned char *buf,
+                           int buflen)
+{
+    int fd;
+
+    if ((fd = open("/dev/urandom", O_RDONLY)) < 0)
+        return errno;
+
+    while (buflen > 0) {
+        int n;
+
+        if ((n = read(fd, buf, buflen)) <= 0) {
+            if (errno == EINTR)
+                continue;
+            VIR_FORCE_CLOSE(fd);
+            return n < 0 ? errno : ENODATA;
+        }
+
+        buf += n;
+        buflen -= n;
+    }
+
+    VIR_FORCE_CLOSE(fd);
+
+    return 0;
+}
+
+static int
+virUUIDGeneratePseudoRandomBytes(unsigned char *buf,
+                                 int buflen)
+{
+    while (buflen > 0) {
+        *buf++ = virRandomBits(8);
+        buflen--;
+    }
+
+    return 0;
+}
+
+/**
+ * virUUIDGenerate:
+ * @uuid: array of VIR_UUID_BUFLEN bytes to store the new UUID
+ *
+ * Generates a randomized unique identifier.
+ *
+ * Returns 0 in case of success and -1 in case of failure
+ */
+int
+virUUIDGenerate(unsigned char *uuid)
+{
+    int err;
+
+    if (uuid == NULL)
+        return -1;
+
+    if ((err = virUUIDGenerateRandomBytes(uuid, VIR_UUID_BUFLEN))) {
+        char ebuf[1024];
+        VIR_WARN("Falling back to pseudorandom UUID,"
+                 " failed to generate random bytes: %s",
+                 virStrerror(err, ebuf, sizeof(ebuf)));
+        err = virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_BUFLEN);
+    }
+
+    return err;
+}
+
+/**
+ * virUUIDParse:
+ * @uuidstr: zero terminated string representation of the UUID
+ * @uuid: array of VIR_UUID_BUFLEN bytes to store the raw UUID
+ *
+ * Parses the external string representation, allowing spaces and '-'
+ * character in the sequence, and storing the result as a raw UUID
+ *
+ * Returns 0 in case of success and -1 in case of error.
+ */
+int
+virUUIDParse(const char *uuidstr, unsigned char *uuid) {
+    const char *cur;
+    int i;
+
+    /*
+     * do a liberal scan allowing '-' and ' ' anywhere between character
+     * pairs, and surrounding whitespace, as long as there are exactly
+     * 32 hexadecimal digits the end.
+     */
+    cur = uuidstr;
+    while (c_isspace(*cur))
+        cur++;
+
+    for (i = 0;i < VIR_UUID_BUFLEN;) {
+        uuid[i] = 0;
+        if (*cur == 0)
+            goto error;
+        if ((*cur == '-') || (*cur == ' ')) {
+            cur++;
+            continue;
+        }
+        if (!c_isxdigit(*cur))
+            goto error;
+        uuid[i] = virHexToBin(*cur);
+        uuid[i] *= 16;
+        cur++;
+        if (*cur == 0)
+            goto error;
+        if (!c_isxdigit(*cur))
+            goto error;
+        uuid[i] += virHexToBin(*cur);
+        i++;
+        cur++;
+    }
+
+    while (*cur) {
+        if (!c_isspace(*cur))
+            goto error;
+        cur++;
+    }
+
+    return 0;
+
+ error:
+    return -1;
+}
+
+/**
+ * virUUIDFormat:
+ * @uuid: array of VIR_UUID_RAW_LEN bytes to store the raw UUID
+ * @uuidstr: array of VIR_UUID_STRING_BUFLEN bytes to store the
+ * string representation of the UUID in. The resulting string
+ * will be NULL terminated.
+ *
+ * Converts the raw UUID into printable format, with embedded '-'
+ *
+ * Returns a pointer to the resulting character string.
+ */
+const char *
+virUUIDFormat(const unsigned char *uuid, char *uuidstr)
+{
+    snprintf(uuidstr, VIR_UUID_STRING_BUFLEN,
+             "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+             uuid[0], uuid[1], uuid[2], uuid[3],
+             uuid[4], uuid[5], uuid[6], uuid[7],
+             uuid[8], uuid[9], uuid[10], uuid[11],
+             uuid[12], uuid[13], uuid[14], uuid[15]);
+    uuidstr[VIR_UUID_STRING_BUFLEN-1] = '\0';
+    return uuidstr;
+}
+
+
+
+/**
+ * virUUIDIsValid
+ *
+ * @uuid: The UUID to test
+ *
+ * Do some basic tests to check whether the given UUID is
+ * valid as a host UUID.
+ * Basic tests:
+ *  - Not all of the digits may be equal
+ */
+int
+virUUIDIsValid(unsigned char *uuid)
+{
+    unsigned int i, ctr = 1;
+    unsigned char c;
+
+    if (!uuid)
+        return 0;
+
+    c = uuid[0];
+
+    for (i = 1; i < VIR_UUID_BUFLEN; i++)
+        if (uuid[i] == c)
+            ctr++;
+
+    return ctr != VIR_UUID_BUFLEN;
+}
+
+static int
+getDMISystemUUID(char *uuid, int len)
+{
+    unsigned int i = 0;
+    const char *paths[] = {
+        "/sys/devices/virtual/dmi/id/product_uuid",
+        "/sys/class/dmi/id/product_uuid",
+        NULL
+    };
+
+    while (paths[i]) {
+        int fd = open(paths[i], O_RDONLY);
+        if (fd >= 0) {
+            if (saferead(fd, uuid, len - 1) == len - 1) {
+                uuid[len - 1] = '\0';
+                VIR_FORCE_CLOSE(fd);
+                return 0;
+            }
+            VIR_FORCE_CLOSE(fd);
+        }
+        i++;
+    }
+
+    return -1;
+}
+
+
+/**
+ * setHostUUID
+ *
+ * @host_uuid: UUID that the host is supposed to have
+ *
+ * Set the UUID of the host if it hasn't been set, yet
+ * Returns 0 in case of success, an error code in case of error.
+ */
+int
+virSetHostUUIDStr(const char *uuid)
+{
+    int rc;
+    char dmiuuid[VIR_UUID_STRING_BUFLEN];
+
+    if (virUUIDIsValid(host_uuid))
+        return EEXIST;
+
+    if (!uuid) {
+        memset(dmiuuid, 0, sizeof(dmiuuid));
+        if (!getDMISystemUUID(dmiuuid, sizeof(dmiuuid))) {
+            if (!virUUIDParse(dmiuuid, host_uuid))
+                return 0;
+        }
+
+        if (!virUUIDIsValid(host_uuid))
+            return virUUIDGenerate(host_uuid);
+    } else {
+        rc = virUUIDParse(uuid, host_uuid);
+        if (rc)
+            return rc;
+        if (!virUUIDIsValid(host_uuid))
+            return EINVAL;
+    }
+
+    return 0;
+}
+
+/**
+ * getHostUUID:
+ *
+ * @host_uuid: memory to store the host_uuid into
+ *
+ * Get the UUID of the host. Returns 0 in case of success,
+ * an error code otherwise.
+ * Returns 0 in case of success, an error code in case of error.
+ */
+int virGetHostUUID(unsigned char *uuid)
+{
+    int ret = 0;
+
+    if (!virUUIDIsValid(host_uuid))
+        ret = virSetHostUUIDStr(NULL);
+
+    memcpy(uuid, host_uuid, sizeof(host_uuid));
+
+    return ret;
+}
diff --git a/src/util/viruuid.h b/src/util/viruuid.h
new file mode 100644
index 0000000..d90fd2e
--- /dev/null
+++ b/src/util/viruuid.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2007, 2011, 2012 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *     Mark McLoughlin <markmc redhat com>
+ */
+
+#ifndef __VIR_UUID_H__
+# define __VIR_UUID_H__
+
+# include "internal.h"
+
+int virSetHostUUIDStr(const char *host_uuid);
+int virGetHostUUID(unsigned char *host_uuid) ATTRIBUTE_NONNULL(1);
+
+int virUUIDIsValid(unsigned char *uuid);
+
+int virUUIDGenerate(unsigned char *uuid);
+
+int virUUIDParse(const char *uuidstr,
+                 unsigned char *uuid)
+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+
+const char *virUUIDFormat(const unsigned char *uuid,
+                          char *uuidstr) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+
+#endif /* __VIR_UUID_H__ */
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 923ff04..5cac7bb 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -49,7 +49,7 @@
 #include "domain_event.h"
 #include "storage_conf.h"
 #include "virstoragefile.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "viralloc.h"
 #include "nodeinfo.h"
 #include "virlog.h"
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 7cf9bcc..22a085d 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -30,7 +30,7 @@
 #include "viralloc.h"
 #include "nodeinfo.h"
 #include "virfile.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virterror_internal.h"
 #include "vmx.h"
 
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 12195bf..67cdc88 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -29,7 +29,7 @@
 #include "virfile.h"
 #include "viralloc.h"
 #include "virutil.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "vircommand.h"
 #include "vmx.h"
 #include "vmware_conf.h"
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 90496ce..d57a14f 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -30,7 +30,7 @@
 #include "virconf.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "vmx.h"
 #include "viruri.h"
 
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 2b8496c..4cbe827 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -58,7 +58,7 @@
 #include "viralloc.h"
 #include "node_device_conf.h"
 #include "virpci.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "fdstream.h"
 #include "virfile.h"
 #include "viruri.h"
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index 35a625c..4cce25a 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -37,7 +37,7 @@
 #include "xen_inotify.h"
 #include "xend_internal.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virfile.h"
 
 #include "xm_internal.h" /* for xenXMDomainConfigParse */
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 7ffc5bb..120e237 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -38,7 +38,7 @@
 #include "virsexpr.h"
 #include "xen_sxpr.h"
 #include "virbuffer.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "xen_driver.h"
 #include "xen_hypervisor.h"
 #include "xs_internal.h" /* To extract VNC port & Serial console TTY */
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index e3206eb..0806e77 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -44,7 +44,7 @@
 #include "xen_xm.h"
 #include "virhash.h"
 #include "virbuffer.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index e414966..20332df 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -46,7 +46,7 @@
 #include "driver.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "xen_driver.h"
 #include "xs_internal.h"
 #include "xen_hypervisor.h"
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 04b24ab..df5625e 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -32,7 +32,7 @@
 #include "datatypes.h"
 #include "virauth.h"
 #include "virutil.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "viralloc.h"
 #include "virbuffer.h"
 #include "viruri.h"
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index 15be403..5c53b69 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -30,7 +30,7 @@
 #include "virterror_internal.h"
 #include "datatypes.h"
 #include "virutil.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "viralloc.h"
 #include "virbuffer.h"
 #include "virlog.h"
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index b28c538..b83ac58 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -31,7 +31,7 @@
 #include "virconf.h"
 #include "viralloc.h"
 #include "verify.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virlog.h"
 #include "count-one-bits.h"
 #include "xenxs_private.h"
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 007036b..bbf35d8 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -30,7 +30,7 @@
 #include "virconf.h"
 #include "viralloc.h"
 #include "verify.h"
-#include "uuid.h"
+#include "viruuid.h"
 #include "virsexpr.h"
 #include "count-one-bits.h"
 #include "xenxs_private.h"
-- 
1.7.11.7


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