path: root/include
diff options
authorPrzemyslaw Marczak <>2014-04-02 10:20:03 +0200
committerTom Rini <>2014-04-02 15:44:40 -0400
commitd718ded056eefb6239bd2e0a57b7f6d99c6e9e4b (patch)
tree8bca8bbb10a74b782dc34a2f1b773bb6afa50e75 /include
parenta96a0e6153e3d9071c1a4516bf3e94c4cd96c77c (diff)
lib: uuid: code refactor for proper maintain between uuid bin and string
Changes in lib/uuid.c to: - uuid_str_to_bin() - uuid_bin_to_str() New parameter is added to specify input/output string format in listed functions This change allows easy recognize which UUID type is or should be stored in given string array. Binary data of UUID and GUID is always stored in big endian, only string representations are different as follows. String byte: 0 36 String char: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx string UUID: be be be be be string GUID: le le le be be This patch also updates functions calls and declarations in a whole code. Signed-off-by: Przemyslaw Marczak <> Cc: Stephen Warren <> Cc: Lukasz Majewski <> Cc:
Diffstat (limited to 'include')
2 files changed, 22 insertions, 3 deletions
diff --git a/include/common.h b/include/common.h
index c48c696f67..cbd3c9e043 100644
--- a/include/common.h
+++ b/include/common.h
@@ -822,9 +822,7 @@ void udelay (unsigned long);
void mdelay(unsigned long);
/* lib/uuid.c */
-void uuid_bin_to_str(unsigned char *uuid, char *str);
-int uuid_str_to_bin(char *uuid, unsigned char *out);
-int uuid_str_valid(const char *uuid);
+#include <uuid.h>
/* lib/vsprintf.c */
#include <vsprintf.h>
diff --git a/include/uuid.h b/include/uuid.h
new file mode 100644
index 0000000000..e8feeed7a5
--- /dev/null
+++ b/include/uuid.h
@@ -0,0 +1,21 @@
+ * Copyright (C) 2014 Samsung Electronics
+ * Przemyslaw Marczak <>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+#ifndef __UUID_H__
+#define __UUID_H__
+enum {
+#define UUID_STR_LEN 36
+#define UUID_BIN_LEN 16
+int uuid_str_valid(const char *uuid);
+int uuid_str_to_bin(char *uuid_str, unsigned char *uuid_bin, int str_format);
+void uuid_bin_to_str(unsigned char *uuid_bin, char *uuid_str, int str_format);
OpenPOWER on IntegriCloud