diff options
author | Karel Zak | 2011-11-13 21:25:12 +0100 |
---|---|---|
committer | Karel Zak | 2011-11-13 21:25:12 +0100 |
commit | 44765fdd841fb1369cf68f360131ed076f3a2771 (patch) | |
tree | e9b51e8f0a87381c04b17b08ea15076e5304ef91 /libblkid/src/partitions/partitions.c | |
parent | libblkid: add BLKID_PARTS_MAGIC (diff) | |
download | kernel-qcow2-util-linux-44765fdd841fb1369cf68f360131ed076f3a2771.tar.gz kernel-qcow2-util-linux-44765fdd841fb1369cf68f360131ed076f3a2771.tar.xz kernel-qcow2-util-linux-44765fdd841fb1369cf68f360131ed076f3a2771.zip |
libblkid: export info about PT magic strings
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid/src/partitions/partitions.c')
-rw-r--r-- | libblkid/src/partitions/partitions.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libblkid/src/partitions/partitions.c b/libblkid/src/partitions/partitions.c index 86bf43224..aa8ca7c73 100644 --- a/libblkid/src/partitions/partitions.c +++ b/libblkid/src/partitions/partitions.c @@ -530,15 +530,17 @@ int blkid_is_nested_dimension(blkid_partition par, return 1; } -static int idinfo_probe(blkid_probe pr, const struct blkid_idinfo *id) +static int idinfo_probe(blkid_probe pr, const struct blkid_idinfo *id, + struct blkid_chain *chn) { const struct blkid_idmag *mag; + blkid_loff_t off; int rc = 1; /* = nothing detected */ if (pr->size <= 0 || (id->minsz && id->minsz > pr->size)) goto nothing; /* the device is too small */ - if (blkid_probe_get_idmag(pr, id, NULL, &mag)) + if (blkid_probe_get_idmag(pr, id, &off, &mag)) goto nothing; /* final check by probing function */ @@ -549,9 +551,15 @@ static int idinfo_probe(blkid_probe pr, const struct blkid_idinfo *id) if (rc == -1) { /* reset after error */ reset_partlist(blkid_probe_get_partlist(pr)); + if (chn && !chn->binary) + blkid_probe_chain_reset_vals(pr, chn); DBG(DEBUG_LOWPROBE, printf( "%s probefunc failed\n", id->name)); } + if (rc == 0 && mag && chn && !chn->binary) + blkid_probe_set_magic(pr, off, mag->len, + (unsigned char *) mag->magic); + DBG(DEBUG_LOWPROBE, printf( "%s: <--- (rc = %d)\n", id->name, rc)); } @@ -594,7 +602,7 @@ static int partitions_probe(blkid_probe pr, struct blkid_chain *chn) continue; /* apply checks from idinfo */ - if (idinfo_probe(pr, idinfos[i]) != 0) + if (idinfo_probe(pr, idinfos[i], chn) != 0) continue; name = idinfos[i]->name; @@ -678,7 +686,7 @@ int blkid_partitions_do_subprobe(blkid_probe pr, blkid_partition parent, blkid_probe_set_partlist(prc, ls); - rc = idinfo_probe(prc, id); + rc = idinfo_probe(prc, id, blkid_probe_get_chain(pr)); blkid_probe_set_partlist(prc, NULL); blkid_partlist_set_parent(ls, NULL); |