]> err.no Git - util-linux/commitdiff
libblkid: use superblock filter functions
authorKarel Zak <kzak@redhat.com>
Tue, 15 Sep 2009 20:02:20 +0000 (22:02 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 16 Sep 2009 08:57:23 +0000 (10:57 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/blkid/src/probe.c
shlibs/blkid/src/superblocks/superblocks.c

index 0dc70ebccaad1e6e7b1c89e83482c1272197179d..529a283cfafe39c08e5a6b41875cca4ad32d8cfa 100644 (file)
@@ -452,125 +452,6 @@ int blkid_probe_set_device(blkid_probe pr, int fd,
        return 0;
 }
 
-int blkid_probe_set_request(blkid_probe pr, int flags)
-{
-       if (!pr)
-               return -1;
-       pr->probreq = flags;
-       return 0;
-}
-
-int blkid_probe_reset_filter(blkid_probe pr)
-{
-       if (!pr)
-               return -1;
-       if (pr->fltr)
-               memset(pr->fltr, 0, BLKID_FLTR_SIZE * sizeof(unsigned long));
-       blkid_probe_reset_idx(pr);
-       return 0;
-}
-
-/*
- * flag:
- *
- *  BLKID_FLTR_NOTIN  - probe all filesystems which are NOT IN names[]
- *
- *  BLKID_FLTR_ONLYIN - probe filesystem which are IN names[]
- */
-int blkid_probe_filter_types(blkid_probe pr, int flag, char *names[])
-{
-       int i;
-
-       if (!pr || !names)
-               return -1;
-       if (!pr->fltr) {
-               pr->fltr = calloc(BLKID_FLTR_SIZE, sizeof(unsigned long));
-               blkid_probe_reset_idx(pr);
-       } else
-               blkid_probe_reset_filter(pr);
-
-       if (!pr->fltr)
-               return -1;
-
-       for (i = 0; i < ARRAY_SIZE(idinfos); i++) {
-               int has = 0;
-               const struct blkid_idinfo *id = idinfos[i];
-               char **n;
-
-               for (n = names; *n; n++) {
-                       if (!strcmp(id->name, *n)) {
-                               has = 1;
-                               break;
-                       }
-               }
-               /* The default is enable all filesystems,
-                * set relevant bitmap bit means disable the filesystem.
-                */
-               if (flag & BLKID_FLTR_ONLYIN) {
-                      if (!has)
-                               blkid_bmp_set_item(pr->fltr, i);
-               } else if (flag & BLKID_FLTR_NOTIN) {
-                       if (has)
-                               blkid_bmp_set_item(pr->fltr, i);
-               }
-       }
-       DBG(DEBUG_LOWPROBE, printf("a new probing type-filter initialized\n"));
-       return 0;
-}
-
-/*
- * flag:
- *
- *  BLKID_FLTR_NOTIN  - probe all filesystems which are NOT IN "usage"
- *
- *  BLKID_FLTR_ONLYIN - probe filesystem which are IN "usage"
- *
- * where the "usage" is a set of filesystem according the usage flag (crypto,
- * raid, filesystem, ...)
- */
-int blkid_probe_filter_usage(blkid_probe pr, int flag, int usage)
-{
-       int i;
-
-       if (!pr || !usage)
-               return -1;
-       if (!pr->fltr) {
-               pr->fltr = calloc(BLKID_FLTR_SIZE, sizeof(unsigned long));
-               blkid_probe_reset_idx(pr);
-       } else
-               blkid_probe_reset_filter(pr);
-
-       if (!pr->fltr)
-               return -1;
-
-       for (i = 0; i < ARRAY_SIZE(idinfos); i++) {
-               const struct blkid_idinfo *id = idinfos[i];
-
-               if (id->usage & usage) {
-                       if (flag & BLKID_FLTR_NOTIN)
-                               blkid_bmp_set_item(pr->fltr, i);
-               } else if (flag & BLKID_FLTR_ONLYIN)
-                       blkid_bmp_set_item(pr->fltr, i);
-       }
-       DBG(DEBUG_LOWPROBE, printf("a new probing usage-filter initialized\n"));
-       return 0;
-}
-
-
-int blkid_probe_invert_filter(blkid_probe pr)
-{
-       int i;
-
-       if (!pr || !pr->fltr)
-               return -1;
-       for (i = 0; i < BLKID_FLTR_SIZE; i++)
-               pr->fltr[i] = ~pr->fltr[i];
-
-       blkid_probe_reset_idx(pr);
-       DBG(DEBUG_LOWPROBE, printf("probing filter inverted\n"));
-       return 0;
-}
-
 /*
  * The blkid_do_probe() calls the probe functions. This routine could be used
  * in a loop when you need to probe for all possible filesystems/raids.
index 4ad73d378055a48698969a29fa71ed8f5749e68f..61c1bff3f5765257bcf1e6db4ce2aced54117853 100644 (file)
@@ -437,3 +437,79 @@ static int blkid_probe_set_usage(blkid_probe pr, int usage)
 
        return blkid_probe_set_value(pr, "USAGE", (unsigned char *) u, strlen(u) + 1);
 }
+
+
+/*
+ * DEPRECATED FUNCTIONS
+ */
+
+/**
+ * blkid_probe_set_request:
+ * @pr: probe
+ * @flags: BLKID_PROBREQ_* (deprecated) or BLKID_SUBLKS_* flags
+ *
+ * Returns: 0 on success, or -1 in case of error.
+ *
+ * Deprecated: Use blkid_probe_set_superblocks_flags().
+ */
+int blkid_probe_set_request(blkid_probe pr, int flags)
+{
+       return blkid_probe_set_superblocks_flags(pr, flags);
+}
+
+/**
+ * blkid_probe_reset_filter:
+ * @pr: prober
+ *
+ * Returns: 0 on success, or -1 in case of error.
+ *
+ * Deprecated: Use blkid_probe_reset_superblocks_filter().
+ */
+int blkid_probe_reset_filter(blkid_probe pr)
+{
+       return __blkid_probe_reset_filter(pr, BLKID_CHAIN_SUBLKS);
+}
+
+/**
+ * blkid_probe_invert_filter:
+ * @pr: prober
+ *
+ * Returns: 0 on success, or -1 in case of error.
+ *
+ * Deprecated: Use blkid_probe_invert_superblocks_filter().
+ */
+int blkid_probe_invert_filter(blkid_probe pr)
+{
+       return __blkid_probe_invert_filter(pr, BLKID_CHAIN_SUBLKS);
+}
+
+/**
+ * blkid_probe_filter_types
+ * @pr: prober
+ * @flag: filter BLKID_FLTR_{NOTIN,ONLYIN} flag
+ * @names: NULL terminated array of probing function names (e.g. "vfat").
+ *
+ * Returns: 0 on success, or -1 in case of error.
+ *
+ * Deprecated: Use blkid_probe_filter_superblocks_types().
+ */
+int blkid_probe_filter_types(blkid_probe pr, int flag, char *names[])
+{
+       return __blkid_probe_filter_types(pr, BLKID_CHAIN_SUBLKS, flag, names);
+}
+
+/**
+ * blkid_probe_filter_usage
+ * @pr: prober
+ * @flag: filter BLKID_FLTR_{NOTIN,ONLYIN} flag
+ * @usage: BLKID_USAGE_* flags
+ *
+ * Returns: 0 on success, or -1 in case of error.
+ *
+ * Deprecated: Use blkid_probe_filter_superblocks_usage().
+ */
+int blkid_probe_filter_usage(blkid_probe pr, int flag, int usage)
+{
+       return blkid_probe_filter_superblocks_usage(pr, flag, usage);
+}
+