]> err.no Git - util-linux/commitdiff
libblkid: move filter macros to header file
authorKarel Zak <kzak@redhat.com>
Tue, 15 Sep 2009 18:51:30 +0000 (20:51 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 16 Sep 2009 07:46:52 +0000 (09:46 +0200)
 * move blkid_bmp_* macros to blkidP.h
 * add blkid_bmp_nbytes() -- returns size of bitmap in bytes
 * add blkid_bmp_nwords() -- returns size of bitmap in words
                             (rename from blkid_bmp_size())

Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/blkid/src/blkidP.h
shlibs/blkid/src/probe.c

index 4ad76bd1e5416b92691b8bb1ad6c095ff441bd46..9c6578cf4f5b69c10b106c84a485ca4b15238787 100644 (file)
@@ -340,6 +340,27 @@ extern int blkid_probe_set_uuid_as(blkid_probe pr, unsigned char *uuid, const ch
 
 extern void blkid_unparse_uuid(const unsigned char *uuid, char *str, size_t len);
 
+/* filter bitmap macros */
+#define blkid_bmp_wordsize             (8 * sizeof(unsigned long))
+#define blkid_bmp_idx_bit(item)                (1UL << ((item) % blkid_bmp_wordsize))
+#define blkid_bmp_idx_byte(item)       ((item) / blkid_bmp_wordsize)
+
+#define blkid_bmp_set_item(bmp, item)  \
+               ((bmp)[ blkid_bmp_idx_byte(item) ] |= blkid_bmp_idx_bit(item))
+
+#define blkid_bmp_unset_item(bmp, item)        \
+               ((bmp)[ bmp_idx_byte(item) ] &= ~bmp_idx_bit(item))
+
+#define blkid_bmp_get_item(bmp, item)  \
+               ((bmp)[ blkid_bmp_idx_byte(item) ] & blkid_bmp_idx_bit(item))
+
+#define blkid_bmp_nwords(max_items) \
+               (((max_items) + blkid_bmp_wordsize) / blkid_bmp_wordsize)
+
+#define blkid_bmp_nbytes(max_items) \
+               (blkid_bmp_nwords(max_items) * sizeof(unsigned long))
+
+/* encode.c */
 extern size_t blkid_encode_to_utf8(int enc, unsigned char *dest, size_t len,
                        const unsigned char *src, size_t count);
 
index b9d67add49d7cdd2fde2c69ae52f67458bb57d58..a578366b0586634a4d77422e781a09847191c070 100644 (file)
@@ -100,26 +100,8 @@ static const struct blkid_idinfo *idinfos[] =
 # define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 #endif
 
-/* filter bitmap macros */
-#define blkid_bmp_wordsize             (8 * sizeof(unsigned long))
-#define blkid_bmp_idx_bit(item)                (1UL << ((item) % blkid_bmp_wordsize))
-#define blkid_bmp_idx_byte(item)       ((item) / blkid_bmp_wordsize)
-
-#define blkid_bmp_set_item(bmp, item)  \
-               ((bmp)[ blkid_bmp_idx_byte(item) ] |= blkid_bmp_idx_bit(item))
-
-#define blkid_bmp_unset_item(bmp, item)        \
-               ((bmp)[ bmp_idx_byte(item) ] &= ~bmp_idx_bit(item))
-
-#define blkid_bmp_get_item(bmp, item)  \
-               ((bmp)[ blkid_bmp_idx_byte(item) ] & blkid_bmp_idx_bit(item))
-
-#define blkid_bmp_size(max_items) \
-               (((max_items) + blkid_bmp_wordsize) / blkid_bmp_wordsize)
-
 #define BLKID_FLTR_ITEMS       ARRAY_SIZE(idinfos)
-#define BLKID_FLTR_SIZE                blkid_bmp_size(BLKID_FLTR_ITEMS)
-
+#define BLKID_FLTR_SIZE                blkid_bmp_nwords(BLKID_FLTR_ITEMS)
 
 static int blkid_probe_set_usage(blkid_probe pr, int usage);