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

[Xen-changelog] [xen-unstable] tools/libxl: move uuid wrapper functions out of line.



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1300899356 0
# Node ID d9faf0aa975534e98cedfb16ea5756a1e8283a3e
# Parent  219b4d41c87876e589f3083f5094dc2187e4b0a4
tools/libxl: move uuid wrapper functions out of line.

This isolates users of libxenlight from the need to know about the
different OS schemes for UUIDs, in particular the linkage
requirements.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 219b4d41c878 -r d9faf0aa9755 tools/libxl/Makefile
--- a/tools/libxl/Makefile      Wed Mar 23 15:56:46 2011 +0000
+++ b/tools/libxl/Makefile      Wed Mar 23 16:55:56 2011 +0000
@@ -35,7 +35,7 @@
 
 LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
                        libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
-                       libxl_internal.o libxl_utils.o $(LIBXL_OBJS-y)
+                       libxl_internal.o libxl_utils.o libxl_uuid.o 
$(LIBXL_OBJS-y)
 LIBXL_OBJS += _libxl_types.o
 
 AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h
diff -r 219b4d41c878 -r d9faf0aa9755 tools/libxl/libxl_uuid.h
--- a/tools/libxl/libxl_uuid.h  Wed Mar 23 15:56:46 2011 +0000
+++ b/tools/libxl/libxl_uuid.h  Wed Mar 23 16:55:56 2011 +0000
@@ -24,6 +24,7 @@
 #if defined(__linux__)
 
 #include <uuid/uuid.h>
+#include <stdint.h>
 
 typedef struct {
     uuid_t uuid;
@@ -31,41 +32,6 @@
 
 #define LIBXL_UUID_BYTES(arg) LIBXL__UUID_BYTES(((uint8_t *)arg.uuid))
 
-static inline int libxl_uuid_is_nil(libxl_uuid *uuid)
-{
-     return uuid_is_null(uuid->uuid);
-}
-
-static inline void libxl_uuid_generate(libxl_uuid *uuid)
-{
-     uuid_generate(uuid->uuid);
-}
-
-static inline int libxl_uuid_from_string(libxl_uuid *uuid, const char *in)
-{
-     return uuid_parse(in, uuid->uuid);
-}
-
-static inline void libxl_uuid_copy(libxl_uuid *dst, libxl_uuid *src)
-{
-     uuid_copy(dst->uuid, src->uuid);
-}
-
-static inline void libxl_uuid_clear(libxl_uuid *uuid)
-{
-     uuid_clear(uuid->uuid);
-}
-
-static inline int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2)
-{
-     return uuid_compare(uuid1->uuid, uuid2->uuid);
-}
-
-static inline uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid)
-{
-    return uuid->uuid;
-}
-
 #elif defined(__NetBSD__)
 
 #include <uuid.h>
@@ -80,55 +46,18 @@
     uint8_t uuid[16];
 } libxl_uuid;
 
-static inline int libxl_uuid_is_nil(libxl_uuid *uuid)
-{
-    uint32_t status;
-    return uuid_is_nil((uuid_t *)uuid->uuid, &status);
-}
-
-static inline void libxl_uuid_generate(libxl_uuid *uuid)
-{
-    uint32_t status;
-    uuid_create((uuid_t *)uuid->uuid, &status);
-    assert(status == uuid_s_ok);
-}
-
-#define LIBXL__UUID_PTRS(uuid) &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]
-static inline int libxl_uuid_from_string(libxl_uuid *uuid, const char *in)
-{
-    if ( sscanf(in, LIBXL_UUID_FMT, LIBXL__UUID_PTRS(uuid->uuid)) != 
sizeof(uuid->uuid) )
-        return -1;
-    return 0;
-}
-#undef LIBXL__UUID_PTRS
-
-static inline void libxl_uuid_copy(libxl_uuid *dst, libxl_uuid *src)
-{
-     memcpy(dst->uuid, src->uuid, sizeof(dst->uuid));
-}
-
-static inline void libxl_uuid_clear(libxl_uuid *uuid)
-{
-     memset(uuid->uuid, 0, sizeof(uuid->uuid));
-}
-
-static inline int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2)
-{
-     return memcmp(uuid1->uuid, uuid2->uuid, sizeof(uuid1->uuid));
-}
-
-static inline uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid)
-{
-    return uuid->uuid;
-}
-
 #else
 
 #error "Please update libxl_uuid.h for your OS"
 
 #endif
 
+int libxl_uuid_is_nil(libxl_uuid *uuid);
+void libxl_uuid_generate(libxl_uuid *uuid);
+int libxl_uuid_from_string(libxl_uuid *uuid, const char *in);
+void libxl_uuid_copy(libxl_uuid *dst, libxl_uuid *src);
+void libxl_uuid_clear(libxl_uuid *uuid);
+int libxl_uuid_compare(libxl_uuid *uuid1, libxl_uuid *uuid2);
+uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid);
+
 #endif /* __LIBXL_UUID_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.