Whamcloud - gitweb
mke2fs: Fix compile warning message
[tools/e2fsprogs.git] / lib / e2p / uuid.c
index 82462e8..0bf8f82 100644 (file)
@@ -3,7 +3,10 @@
  */
 
 #include <stdio.h>
-#include <linux/types.h>
+#include <string.h>
+#include <ext2fs/ext2_types.h>
+
+#include "e2p.h"
 
 struct uuid {
        __u32   time_low;
@@ -20,7 +23,7 @@ int e2p_is_null_uuid(void *uu)
        int     i;
 
        for (i=0, cp = uu; i < 16; i++)
-               if (*cp)
+               if (*cp++)
                        return 0;
        return 1;
 }
@@ -39,7 +42,7 @@ static void e2p_unpack_uuid(void *in, struct uuid *uu)
        tmp = *ptr++;
        tmp = (tmp << 8) | *ptr++;
        uu->time_mid = tmp;
-       
+
        tmp = *ptr++;
        tmp = (tmp << 8) | *ptr++;
        uu->time_hi_and_version = tmp;
@@ -63,3 +66,14 @@ void e2p_uuid_to_str(void *uu, char *out)
                uuid.node[0], uuid.node[1], uuid.node[2],
                uuid.node[3], uuid.node[4], uuid.node[5]);
 }
+
+const char *e2p_uuid2str(void *uu)
+{
+       static char buf[80];
+
+       if (e2p_is_null_uuid(uu))
+               return "<none>";
+       e2p_uuid_to_str(uu, buf);
+       return buf;
+}
+