summaryrefslogtreecommitdiffstats
path: root/shlibs/blkid/src/probe.c
diff options
context:
space:
mode:
authorKarel Zak2011-05-16 10:31:50 +0200
committerKarel Zak2011-05-16 20:22:52 +0200
commitac8874cad39711d588c95dfbce79eaf13b14e361 (patch)
tree41f5a786ae8b36fb2b12d1553f92df2a772a8da4 /shlibs/blkid/src/probe.c
parentlibblkid: make whole disk probing more robust (diff)
downloadkernel-qcow2-util-linux-ac8874cad39711d588c95dfbce79eaf13b14e361.tar.gz
kernel-qcow2-util-linux-ac8874cad39711d588c95dfbce79eaf13b14e361.tar.xz
kernel-qcow2-util-linux-ac8874cad39711d588c95dfbce79eaf13b14e361.zip
libblkid: use cached buffers for nested PT probing
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid/src/probe.c')
-rw-r--r--shlibs/blkid/src/probe.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/shlibs/blkid/src/probe.c b/shlibs/blkid/src/probe.c
index 5f75d713e..85db814f0 100644
--- a/shlibs/blkid/src/probe.c
+++ b/shlibs/blkid/src/probe.c
@@ -527,12 +527,18 @@ unsigned char *blkid_probe_get_buffer(blkid_probe pr,
if (pr->parent &&
pr->parent->devno == pr->devno &&
- pr->parent->off == pr->off)
+ pr->parent->off <= pr->off &&
+ pr->parent->off + pr->parent->size >= pr->off + pr->size) {
/*
* This is a cloned prober and points to the same area as
- * parent. Let's use parent's bufferes.
+ * parent. Let's use parent's buffers.
+ *
+ * Note that pr->off (and pr->parent->off) is always from the
+ * beginig of the device.
*/
- return blkid_probe_get_buffer(pr->parent, off, len);
+ return blkid_probe_get_buffer(pr->parent,
+ pr->off + off - pr->parent->off, len);
+ }
list_for_each(p, &pr->buffers) {
struct blkid_bufinfo *x =
@@ -737,8 +743,9 @@ int blkid_probe_set_dimension(blkid_probe pr,
return -1;
DBG(DEBUG_LOWPROBE, printf(
- "changing probing area: size=%llu, off=%llu "
+ "changing probing area pr=%p: size=%llu, off=%llu "
"-to-> size=%llu, off=%llu\n",
+ pr,
(unsigned long long) pr->size,
(unsigned long long) pr->off,
(unsigned long long) size,