Whamcloud - gitweb
libext2fs: delete unused "handle" variable
[tools/e2fsprogs.git] / lib / e2p / uuid.c
index 1dbfc59..a102092 100644 (file)
@@ -1,10 +1,16 @@
 /*
  * uuid.c -- utility routines for manipulating UUID's.
+ *
+ * %Begin-Header%
+ * This file may be redistributed under the terms of the GNU Library
+ * General Public License, version 2.
+ * %End-Header%
  */
 
+#include "config.h"
 #include <stdio.h>
 #include <string.h>
-#include <asm/types.h>
+#include <ext2fs/ext2_types.h>
 
 #include "e2p.h"
 
@@ -23,7 +29,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;
 }
@@ -42,7 +48,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;
@@ -66,3 +72,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;
+}
+