From 1b780848b0db32b972dc542a2e86aed9127599a1 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 14 Sep 2009 23:33:01 +0200 Subject: [PATCH] libblkid: use the new API in whole u-l-ng Signed-off-by: Karel Zak --- lib/fsprobe.c | 9 ++++++--- misc-utils/blkid.c | 14 +++++++++----- shlibs/blkid/src/evaluate.c | 4 +++- shlibs/blkid/src/superblocks/ext.c | 4 +++- shlibs/blkid/src/verify.c | 14 ++++++++------ 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/lib/fsprobe.c b/lib/fsprobe.c index b47de0ec..0341dab7 100644 --- a/lib/fsprobe.c +++ b/lib/fsprobe.c @@ -133,9 +133,12 @@ fsprobe_get_value(const char *name, const char *devname) goto done; if (blkid_probe_set_device(blprobe, fd, 0, 0)) goto done; - if (blkid_probe_set_request(blprobe, BLKID_PROBREQ_LABEL | - BLKID_PROBREQ_UUID | BLKID_PROBREQ_TYPE )) - goto done; + + blkid_probe_enable_superblocks(blprobe, 1); + + blkid_probe_set_superblocks_flags(blprobe, + BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | BLKID_SUBLKS_TYPE); + if (blkid_do_safeprobe(blprobe)) goto done; if (blkid_probe_lookup_value(blprobe, name, &data, NULL)) diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index 528e4a22..3ab0c7ee 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -551,12 +551,16 @@ int main(int argc, char **argv) pr = blkid_new_probe(); if (!pr) goto exit; - blkid_probe_set_request(pr, - BLKID_PROBREQ_LABEL | BLKID_PROBREQ_UUID | - BLKID_PROBREQ_TYPE | BLKID_PROBREQ_SECTYPE | - BLKID_PROBREQ_USAGE | BLKID_PROBREQ_VERSION); + + blkid_probe_enable_superblocks(pr, 1); + + blkid_probe_set_superblocks_flags(pr, + BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | + BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE | + BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION); + if (fltr_usage && - blkid_probe_filter_usage(pr, fltr_flag, fltr_usage)) + blkid_probe_filter_superblocks_usage(pr, fltr_flag, fltr_usage)) goto exit; for (i = 0; i < numdev; i++) diff --git a/shlibs/blkid/src/evaluate.c b/shlibs/blkid/src/evaluate.c index b8154e47..2308ea80 100644 --- a/shlibs/blkid/src/evaluate.c +++ b/shlibs/blkid/src/evaluate.c @@ -48,7 +48,9 @@ static int verify_tag(const char *devname, const char *name, const char *value) if (!pr) return -1; - blkid_probe_set_request(pr, BLKID_PROBREQ_LABEL | BLKID_PROBREQ_UUID); + blkid_probe_enable_superblocks(pr, TRUE); + blkid_probe_set_superblocks_flags(pr, + BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID); fd = open(devname, O_RDONLY); if (fd < 0) { diff --git a/shlibs/blkid/src/superblocks/ext.c b/shlibs/blkid/src/superblocks/ext.c index 5b190019..4bccd2e7 100644 --- a/shlibs/blkid/src/superblocks/ext.c +++ b/shlibs/blkid/src/superblocks/ext.c @@ -331,6 +331,8 @@ static struct ext2_super_block *ext_get_super( static void ext_get_info(blkid_probe pr, int ver, struct ext2_super_block *es) { + struct blkid_chain *chn = blkid_probe_get_chain(pr); + DBG(DEBUG_PROBE, printf("ext2_sb.compat = %08X:%08X:%08X\n", le32_to_cpu(es->s_feature_compat), le32_to_cpu(es->s_feature_incompat), @@ -344,7 +346,7 @@ static void ext_get_info(blkid_probe pr, int ver, struct ext2_super_block *es) if (le32_to_cpu(es->s_feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) blkid_probe_set_uuid_as(pr, es->s_journal_uuid, "EXT_JOURNAL"); - if (ver != 2 && (pr->probreq & BLKID_PROBREQ_SECTYPE) && + if (ver != 2 && (chn->flags & BLKID_SUBLKS_SECTYPE) && ((le32_to_cpu(es->s_feature_incompat) & EXT2_FEATURE_INCOMPAT_UNSUPPORTED) == 0)) blkid_probe_set_value(pr, "SEC_TYPE", (unsigned char *) "ext2", diff --git a/shlibs/blkid/src/verify.c b/shlibs/blkid/src/verify.c index 78dafe7e..27360260 100644 --- a/shlibs/blkid/src/verify.c +++ b/shlibs/blkid/src/verify.c @@ -110,9 +110,11 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) return NULL; } - blkid_probe_set_request(cache->probe, - BLKID_PROBREQ_LABEL | BLKID_PROBREQ_UUID | - BLKID_PROBREQ_TYPE | BLKID_PROBREQ_SECTYPE); + blkid_probe_enable_superblocks(cache->probe, TRUE); + + blkid_probe_set_superblocks_flags(cache->probe, + BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | + BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE); /* * If we already know the type, then try that first. @@ -124,12 +126,12 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) fltr[0] = dev->bid_type; fltr[1] = NULL; - blkid_probe_filter_types(cache->probe, + blkid_probe_filter_superblocks_type(cache->probe, BLKID_FLTR_ONLYIN, fltr); if (!blkid_do_probe(cache->probe)) goto found_type; - blkid_probe_invert_filter(cache->probe); + blkid_probe_invert_superblocks_filter(cache->probe); /* * Zap the device filesystem information and try again @@ -166,7 +168,7 @@ found_type: } blkid_reset_probe(cache->probe); - blkid_probe_reset_filter(cache->probe); + blkid_probe_reset_superblocks_filter(cache->probe); close(fd); return dev; } -- 2.39.5