summaryrefslogtreecommitdiffstats
path: root/libblkid
diff options
context:
space:
mode:
authorKarel Zak2013-02-19 15:51:51 +0100
committerKarel Zak2013-02-19 15:51:51 +0100
commit6c4581b6950ac478f29cb12c92dd3d9beff0d53f (patch)
treed4cd6b83d8c11f89456ff21c87ea9f0db0fb0a4a /libblkid
parentlib/tty: don't truncate output on non-terminals (diff)
downloadkernel-qcow2-util-linux-6c4581b6950ac478f29cb12c92dd3d9beff0d53f.tar.gz
kernel-qcow2-util-linux-6c4581b6950ac478f29cb12c92dd3d9beff0d53f.tar.xz
kernel-qcow2-util-linux-6c4581b6950ac478f29cb12c92dd3d9beff0d53f.zip
libblkid: make backup superblock visible for wipefs(8) only
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid')
-rw-r--r--libblkid/src/blkidP.h3
-rw-r--r--libblkid/src/probe.c6
-rw-r--r--libblkid/src/superblocks/btrfs.c3
3 files changed, 12 insertions, 0 deletions
diff --git a/libblkid/src/blkidP.h b/libblkid/src/blkidP.h
index ed0c68c43..2d5e8cb78 100644
--- a/libblkid/src/blkidP.h
+++ b/libblkid/src/blkidP.h
@@ -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);
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
index dd3ebcade..e0ac8ebac 100644
--- a/libblkid/src/probe.c
+++ b/libblkid/src/probe.c
@@ -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);
+}
diff --git a/libblkid/src/superblocks/btrfs.c b/libblkid/src/superblocks/btrfs.c
index 3c60ef57e..552097b97 100644
--- a/libblkid/src/superblocks/btrfs.c
+++ b/libblkid/src/superblocks/btrfs.c
@@ -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;