]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: make backup superblock visible for wipefs(8) only
authorKarel Zak <kzak@redhat.com>
Tue, 19 Feb 2013 14:51:51 +0000 (15:51 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 19 Feb 2013 14:51:51 +0000 (15:51 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/blkidP.h
libblkid/src/probe.c
libblkid/src/superblocks/btrfs.c

index ed0c68c43ad10383e845d642dbe13c8974904aad..2d5e8cb78ac9e0eda364552bcd4a9f4e109cb754 100644 (file)
@@ -224,6 +224,9 @@ struct blkid_struct_probe
 
 /* private per-probing flags */
 #define BLKID_PROBE_FL_IGNORE_PT (1 << 1)      /* ignore partition table */
+#define BLKID_PROBE_FL_IGNORE_BACKUP (1 << 2)  /* ignore backup superblocks or PT */
+
+extern int blkid_probe_ignore_backup(blkid_probe pr);
 
 extern blkid_probe blkid_clone_probe(blkid_probe parent);
 extern blkid_probe blkid_probe_get_wholedisk_probe(blkid_probe pr);
index dd3ebcadeccefc4fce0a42a223a3550b4d3149da..e0ac8ebac722e88fb8403d3f9a5e98b781f451a9 100644 (file)
@@ -1129,6 +1129,8 @@ int blkid_do_safeprobe(blkid_probe pr)
 
        blkid_probe_start(pr);
 
+       pr->prob_flags |= BLKID_PROBE_FL_IGNORE_BACKUP;
+
        for (i = 0; i < BLKID_NCHAINS; i++) {
                struct blkid_chain *chn;
 
@@ -1769,3 +1771,7 @@ void blkid_probe_use_wiper(blkid_probe pr, blkid_loff_t off, blkid_loff_t size)
        }
 }
 
+int blkid_probe_ignore_backup(blkid_probe pr)
+{
+       return pr && (pr->prob_flags & BLKID_PROBE_FL_IGNORE_BACKUP);
+}
index 3c60ef57eb1ea806b30c362b6d5a7eb8a69747ac..552097b9791f7a626cb93ce9298139708d35255f 100644 (file)
@@ -63,6 +63,9 @@ static int probe_btrfs(blkid_probe pr, const struct blkid_idmag *mag)
 {
        struct btrfs_super_block *bfs;
 
+       if (mag->kboff > 64 && blkid_probe_ignore_backup(pr))
+               return 1;
+
        bfs = blkid_probe_get_sb(pr, mag, struct btrfs_super_block);
        if (!bfs)
                return -1;