]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
uuidparse: use uuid type definitions from libuuid header
authorSami Kerola <kerolasa@iki.fi>
Sun, 22 Nov 2020 20:48:38 +0000 (20:48 +0000)
committerSami Kerola <kerolasa@iki.fi>
Mon, 28 Dec 2020 09:53:12 +0000 (09:53 +0000)
While on it add missing UUID_TYPE_DCE_NIL to the header.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
libuuid/src/uuid.h
misc-utils/uuidparse.c

index b90c88836cc6cef04a62b80776ad34d461f34b72..d1c07a4e118aaa49e7a6a289582afc3291f5130b 100644 (file)
@@ -53,6 +53,7 @@ typedef unsigned char uuid_t[16];
 #define UUID_VARIANT_MASK     0x7
 
 /* UUID Type definitions */
+#define UUID_TYPE_DCE_NIL    0
 #define UUID_TYPE_DCE_TIME   1
 #define UUID_TYPE_DCE_SECURITY 2
 #define UUID_TYPE_DCE_MD5    3
index f069803e8753cd57adb1afa8bec7c28b8d833eca..2dc6dfb3763bad9e00c563fdc5056e6531b52f3b 100644 (file)
@@ -192,25 +192,25 @@ static void fill_table_row(struct libscols_table *tb, char const *const uuid)
                                break;
                        }
                        switch (type) {
-                       case 0:
+                       case UUID_TYPE_DCE_NIL:
                                if (uuid_is_null(buf))
                                        str = xstrdup(_("nil"));
                                else
                                        str = xstrdup(_("unknown"));
                                break;
-                       case 1:
+                       case UUID_TYPE_DCE_TIME:
                                str = xstrdup(_("time-based"));
                                break;
-                       case 2:
+                       case UUID_TYPE_DCE_SECURITY:
                                str = xstrdup("DCE");
                                break;
-                       case 3:
+                       case UUID_TYPE_DCE_MD5:
                                str = xstrdup(_("name-based"));
                                break;
-                       case 4:
+                       case UUID_TYPE_DCE_RANDOM:
                                str = xstrdup(_("random"));
                                break;
-                       case 5:
+                       case UUID_TYPE_DCE_SHA1:
                                str = xstrdup(_("sha1-based"));
                                break;
                        default:
@@ -222,7 +222,7 @@ static void fill_table_row(struct libscols_table *tb, char const *const uuid)
                                str = xstrdup(_("invalid"));
                                break;
                        }
-                       if (variant == UUID_VARIANT_DCE && type == 1) {
+                       if (variant == UUID_VARIANT_DCE && type == UUID_TYPE_DCE_TIME) {
                                struct timeval tv;
                                char date_buf[ISO_BUFSIZ];