util-linux/libblkid-make-backup-superblock-visible-for-wipefs-8.patch
Karel Zak cb9405c20e 2.22.2-5: #902512, refresh patches
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-20 12:44:06 +01:00

65 lines
2.5 KiB
Diff

diff -up util-linux-2.22.2/libblkid/src/blkidP.h.kzak util-linux-2.22.2/libblkid/src/blkidP.h
--- util-linux-2.22.2/libblkid/src/blkidP.h.kzak 2012-12-12 21:04:47.902355093 +0100
+++ util-linux-2.22.2/libblkid/src/blkidP.h 2013-02-20 10:54:33.885606609 +0100
@@ -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 -up util-linux-2.22.2/libblkid/src/probe.c.kzak util-linux-2.22.2/libblkid/src/probe.c
--- util-linux-2.22.2/libblkid/src/probe.c.kzak 2012-12-12 21:04:47.903355101 +0100
+++ util-linux-2.22.2/libblkid/src/probe.c 2013-02-20 11:02:48.525255696 +0100
@@ -810,6 +810,7 @@ int blkid_probe_get_idmag(blkid_probe pr
static inline void blkid_probe_start(blkid_probe pr)
{
if (pr) {
+ DBG(DEBUG_LOWPROBE, printf("%p: start probe\n", pr));
pr->cur_chain = NULL;
pr->prob_flags = 0;
blkid_probe_set_wiper(pr, 0, 0);
@@ -819,6 +820,7 @@ static inline void blkid_probe_start(blk
static inline void blkid_probe_end(blkid_probe pr)
{
if (pr) {
+ DBG(DEBUG_LOWPROBE, printf("%p: end probe\n", pr));
pr->cur_chain = NULL;
pr->prob_flags = 0;
blkid_probe_set_wiper(pr, 0, 0);
@@ -1057,6 +1059,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;
@@ -1679,3 +1683,7 @@ void blkid_probe_use_wiper(blkid_probe p
}
}
+int blkid_probe_ignore_backup(blkid_probe pr)
+{
+ return pr && (pr->prob_flags & BLKID_PROBE_FL_IGNORE_BACKUP);
+}
diff -up util-linux-2.22.2/libblkid/src/superblocks/btrfs.c.kzak util-linux-2.22.2/libblkid/src/superblocks/btrfs.c
--- util-linux-2.22.2/libblkid/src/superblocks/btrfs.c.kzak 2013-02-20 10:54:03.422381876 +0100
+++ util-linux-2.22.2/libblkid/src/superblocks/btrfs.c 2013-02-20 10:54:33.886606616 +0100
@@ -63,6 +63,11 @@ static int probe_btrfs(blkid_probe pr, c
{
struct btrfs_super_block *bfs;
+ if (mag->kboff > 64 && blkid_probe_ignore_backup(pr)) {
+ DBG(DEBUG_LOWPROBE, printf("btrfs: found backup superblock, ignore\n"));
+ return 1;
+ }
+
bfs = blkid_probe_get_sb(pr, mag, struct btrfs_super_block);
if (!bfs)
return -1;