summaryrefslogtreecommitdiffstats
path: root/libblkid/src/probe.c
diff options
context:
space:
mode:
authorKarel Zak2013-09-11 17:42:48 +0200
committerKarel Zak2013-09-11 17:42:48 +0200
commitd88803a4ad1b4797180ce07ce00c7b879c66dd55 (patch)
tree1cf8db9963d73ef06ed300615b72ceea989c6f29 /libblkid/src/probe.c
parenttests: add bcache images (diff)
downloadkernel-qcow2-util-linux-d88803a4ad1b4797180ce07ce00c7b879c66dd55.tar.gz
kernel-qcow2-util-linux-d88803a4ad1b4797180ce07ce00c7b879c66dd55.tar.xz
kernel-qcow2-util-linux-d88803a4ad1b4797180ce07ce00c7b879c66dd55.zip
libblkid: export info about bad csum
If a bad check sum is detected and BLKID_SUBLKS_BADCSUM is enabled than SBBADCSUM=1 is added to the probing result. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid/src/probe.c')
-rw-r--r--libblkid/src/probe.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
index 29223a664..4b0c99796 100644
--- a/libblkid/src/probe.c
+++ b/libblkid/src/probe.c
@@ -1361,12 +1361,19 @@ int blkid_probe_verify_csum(blkid_probe pr, uint64_t csum, uint64_t expected)
" got %jX, expected %jX",
blkid_probe_get_probername(pr),
csum, expected));
-
- if (!(chn->flags & BLKID_SUBLKS_BADCSUM))
- return 0;
+ /*
+ * Accept bad checksum if BLKID_SUBLKS_BADCSUM flags is set
+ */
+ if (chn->driver->id == BLKID_CHAIN_SUBLKS
+ && (chn->flags & BLKID_SUBLKS_BADCSUM)) {
+ blkid_probe_set_value(pr, "SBBADCSUM", (unsigned char *) "1", 2);
+ goto accept;
+ }
+ return 0; /* bad checksum */
}
- return 1; /* checksum accepted */
+accept:
+ return 1;
}
/**