]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: make uuid_is_empty() usable for whole library
authorKarel Zak <kzak@redhat.com>
Thu, 13 Jun 2013 12:33:47 +0000 (14:33 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 13 Jun 2013 12:33:47 +0000 (14:33 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/blkidP.h
libblkid/src/probe.c
libblkid/src/superblocks/superblocks.c

index 7cc585932a2c2fc2b30816eaf7882083269db2de..1c0596832d4184aff94235dc71d9f55803945372 100644 (file)
@@ -518,6 +518,8 @@ extern int blkid_probe_set_magic(blkid_probe pr, blkid_loff_t offset,
 
 extern void blkid_unparse_uuid(const unsigned char *uuid, char *str, size_t len)
                        __attribute__((nonnull));
+extern int blkid_uuid_is_empty(const unsigned char *buf, size_t len);
+
 extern size_t blkid_rtrim_whitespace(unsigned char *str)
                        __attribute__((nonnull));
 extern size_t blkid_ltrim_whitespace(unsigned char *str)
index 954b08708c76e92d467a1650b90e9299e306cd54..d2b301d7f0242f955423a3c103e2ad29ff756150 100644 (file)
@@ -1637,6 +1637,16 @@ void blkid_unparse_uuid(const unsigned char *uuid, char *str, size_t len)
 }
 #endif
 
+/* like uuid_is_null() from libuuid, but works with arbitrary size of UUID */
+int blkid_uuid_is_empty(const unsigned char *buf, size_t len)
+{
+       size_t i;
+
+       for (i = 0; i < len; i++)
+               if (buf[i])
+                       return 0;
+       return 1;
+}
 
 /* Removes whitespace from the right-hand side of a string (trailing
  * whitespace).
index 03bcabc91347342599e08e36f83886d89c6e88b7..5f43b24861ed540372a200a6f84401d2be81bbfd 100644 (file)
@@ -617,17 +617,6 @@ int blkid_probe_set_utf8label(blkid_probe pr, unsigned char *label,
        return 0;
 }
 
-/* like uuid_is_null() from libuuid, but works with arbitrary size of UUID */
-static int uuid_is_empty(const unsigned char *buf, size_t len)
-{
-       size_t i;
-
-       for (i = 0; i < len; i++)
-               if (buf[i])
-                       return 0;
-       return 1;
-}
-
 int blkid_probe_sprintf_uuid(blkid_probe pr, unsigned char *uuid,
                                size_t len, const char *fmt, ...)
 {
@@ -638,7 +627,7 @@ int blkid_probe_sprintf_uuid(blkid_probe pr, unsigned char *uuid,
        if (len > BLKID_PROBVAL_BUFSIZ)
                len = BLKID_PROBVAL_BUFSIZ;
 
-       if (uuid_is_empty(uuid, len))
+       if (blkid_uuid_is_empty(uuid, len))
                return 0;
 
        if ((chn->flags & BLKID_SUBLKS_UUIDRAW) &&
@@ -703,7 +692,7 @@ int blkid_probe_set_uuid_as(blkid_probe pr, unsigned char *uuid, const char *nam
        struct blkid_chain *chn = blkid_probe_get_chain(pr);
        struct blkid_prval *v;
 
-       if (uuid_is_empty(uuid, 16))
+       if (blkid_uuid_is_empty(uuid, 16))
                return 0;
 
        if (!name) {