Whamcloud - gitweb
Update for release of e2fsprogs 1.36.
[tools/e2fsprogs.git] / lib / blkid / blkidP.h
index 423e7de..1bb9490 100644 (file)
 
 #include <blkid/list.h>
 
+#ifdef __GNUC__
+#define __BLKID_ATTR(x) __attribute__(x)
+#else
+#define __BLKID_ATTR(x)
+#endif
+
+
 /*
  * This describes the attributes of a specific device.
  * We can traverse all of the tags by bid_tags (linking to the tag bit_names).
@@ -36,14 +43,12 @@ struct blkid_struct_dev
        int                     bid_pri;        /* Device priority */
        dev_t                   bid_devno;      /* Device major/minor number */
        time_t                  bid_time;       /* Last update time of device */
-       unsigned int            bid_id;         /* Unique cache id for device */
        unsigned int            bid_flags;      /* Device status bitflags */
        char                    *bid_label;     /* Shortcut to device LABEL */
        char                    *bid_uuid;      /* Shortcut to binary UUID */
 };
 
 #define BLKID_BID_FL_VERIFIED  0x0001  /* Device data validated from disk */
-#define BLKID_BID_FL_MTYPE     0x0002  /* Device has multiple type matches */
 #define BLKID_BID_FL_INVALID   0x0004  /* Device is invalid */
 
 /*
@@ -88,7 +93,7 @@ struct blkid_struct_cache
        struct list_head        bic_devs;       /* List head of all devices */
        struct list_head        bic_tags;       /* List head of all tag types */
        time_t                  bic_time;       /* Last probe time */
-p      unsigned int            bic_idmax;      /* Highest ID assigned */
+       time_t                  bic_ftime;      /* Mod time of the cachefile */
        unsigned int            bic_flags;      /* Status flags of the cache */
        char                    *bic_filename;  /* filename of cache */
 };
@@ -98,7 +103,6 @@ p    unsigned int            bic_idmax;      /* Highest ID assigned */
 
 extern char *blkid_strdup(const char *s);
 extern char *blkid_strndup(const char *s, const int length);
-extern blkid_cache blkid_new_cache(void);
 
 #define BLKID_CACHE_FILE "/etc/blkid.tab"
 extern const char *blkid_devdirs[];
@@ -118,31 +122,37 @@ extern const char *blkid_devdirs[];
 #define BLKID_PRI_LVM  20
 #define BLKID_PRI_MD   10
 
-#if defined(TEST_PROGRAM)
-#define DEBUG
-#endif
-
-#ifdef DEBUG
-#define DEBUG_CACHE
-#define DEBUG_DUMP
-#define DEBUG_DEV
-#define DEBUG_DEVNAME
-#define DEBUG_DEVNO
-#define DEBUG_PROBE
-#define DEBUG_READ
-#define DEBUG_RESOLVE
-#define DEBUG_SAVE
-#define DEBUG_TAG
-#define CHECK_TAG
+#if defined(TEST_PROGRAM) && !defined(CONFIG_BLKID_DEBUG)
+#define CONFIG_BLKID_DEBUG
 #endif
 
-#if defined(TEST_PROGRAM) && !defined(DEBUG_DUMP)
-#define DEBUG_DUMP
+#define DEBUG_CACHE    0x0001
+#define DEBUG_DUMP     0x0002
+#define DEBUG_DEV      0x0004
+#define DEBUG_DEVNAME  0x0008
+#define DEBUG_DEVNO    0x0010
+#define DEBUG_PROBE    0x0020
+#define DEBUG_READ     0x0040
+#define DEBUG_RESOLVE  0x0080
+#define DEBUG_SAVE     0x0100
+#define DEBUG_TAG      0x0200
+#define DEBUG_INIT     0x8000
+#define DEBUG_ALL      0xFFFF
+
+#ifdef CONFIG_BLKID_DEBUG
+#include <stdio.h>
+extern int     blkid_debug_mask;
+#define DBG(m,x)       if ((m) & blkid_debug_mask) x;
+#else
+#define DBG(m,x)
 #endif
 
-#ifdef DEBUG_DUMP
-static inline void DEB_DUMP_TAG(blkid_tag tag)
+#ifdef CONFIG_BLKID_DEBUG
+static inline void DEB_DUMP_TAG(int mask, blkid_tag tag)
 {
+       if (!(mask & blkid_debug_mask))
+               return;
+       
        if (!tag) {
                printf("    tag: NULL\n");
                return;
@@ -151,10 +161,13 @@ static inline void DEB_DUMP_TAG(blkid_tag tag)
        printf("    tag: %s=\"%s\"\n", tag->bit_name, tag->bit_val);
 }
 
-static inline void DEB_DUMP_DEV(blkid_dev dev)
+static inline void DEB_DUMP_DEV(int mask, blkid_dev dev)
 {
        struct list_head *p;
 
+       if (!(mask & blkid_debug_mask))
+               return;
+       
        if (!dev) {
                printf("  dev: NULL\n");
                return;
@@ -162,47 +175,45 @@ static inline void DEB_DUMP_DEV(blkid_dev dev)
 
        printf("  dev: name = %s\n", dev->bid_name);
        printf("  dev: DEVNO=\"0x%0Lx\"\n", dev->bid_devno);
-       printf("  dev: ID=\"%u\"\n", dev->bid_id);
        printf("  dev: TIME=\"%lu\"\n", dev->bid_time);
        printf("  dev: PRI=\"%d\"\n", dev->bid_pri);
        printf("  dev: flags = 0x%08X\n", dev->bid_flags);
 
        list_for_each(p, &dev->bid_tags) {
                blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags);
-               DEB_DUMP_TAG(tag);
+               DEB_DUMP_TAG(mask, tag);
        }
        printf("\n");
 }
 
-static inline void DEB_DUMP_CACHE(blkid_cache cache)
+static inline void DEB_DUMP_CACHE(int mask, blkid_cache cache)
 {
        struct list_head *p;
 
-       if (!cache) {
+       if (!cache || !(mask & blkid_debug_mask)) {
                printf("cache: NULL\n");
                return;
        }
 
        printf("cache: time = %lu\n", cache->bic_time);
-       printf("cache: idmax = %u\n", cache->bic_idmax);
        printf("cache: flags = 0x%08X\n", cache->bic_flags);
 
        list_for_each(p, &cache->bic_devs) {
                blkid_dev dev = list_entry(p, struct blkid_struct_dev, bid_devs);
-               DEB_DUMP_DEV(dev);
+               DEB_DUMP_DEV(mask, dev);
        }
 }
 #else
-#define DEB_DUMP_TAG(tag) do {} while (0)
-#define DEB_DUMP_DEV(dev) do {} while (0)
-#define DEB_DUMP_CACHE(cache) do {} while (0)
+#define DEB_DUMP_TAG(mask, tag) do {} while (0)
+#define DEB_DUMP_DEV(mask, dev) do {} while (0)
+#define DEB_DUMP_CACHE(mask, cache) do {} while (0)
 #endif
 
 /* lseek.c */
 extern blkid_loff_t blkid_llseek(int fd, blkid_loff_t offset, int whence);
 
-/* probe.c */
-extern blkid_dev blkid_verify_devname(blkid_cache cache, blkid_dev dev);
+/* read.c */
+extern void blkid_read_cache(blkid_cache cache);
 
 /* save.c */
 extern int blkid_flush_cache(blkid_cache cache);
@@ -213,7 +224,7 @@ extern int blkid_flush_cache(blkid_cache cache);
 extern void blkid_free_tag(blkid_tag tag);
 extern blkid_tag blkid_find_tag_dev(blkid_dev dev, const char *type);
 extern int blkid_set_tag(blkid_dev dev, const char *name,
-                        const char *value, const int vlength, int replace);
+                        const char *value, const int vlength);
 
 /*
  * Functions to create and find a specific tag type: dev.c