diff options
author | Karel Zak | 2010-03-03 15:01:44 +0100 |
---|---|---|
committer | Karel Zak | 2010-03-03 15:01:44 +0100 |
commit | eeaeb7540b16a43a3c4b0923737c4b573f7d7c01 (patch) | |
tree | a6cea8bbeca27110bfd582765c6af47b7bfc6a5c /shlibs/blkid | |
parent | libblkid: support alignment_offset=-1 (diff) | |
download | kernel-qcow2-util-linux-eeaeb7540b16a43a3c4b0923737c4b573f7d7c01.tar.gz kernel-qcow2-util-linux-eeaeb7540b16a43a3c4b0923737c4b573f7d7c01.tar.xz kernel-qcow2-util-linux-eeaeb7540b16a43a3c4b0923737c4b573f7d7c01.zip |
libblkid: cleanup usage of empty topology values
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid')
-rw-r--r-- | shlibs/blkid/src/topology/ioctl.c | 5 | ||||
-rw-r--r-- | shlibs/blkid/src/topology/sysfs.c | 4 | ||||
-rw-r--r-- | shlibs/blkid/src/topology/topology.c | 6 |
3 files changed, 7 insertions, 8 deletions
diff --git a/shlibs/blkid/src/topology/ioctl.c b/shlibs/blkid/src/topology/ioctl.c index e85ecdf95..50b933c34 100644 --- a/shlibs/blkid/src/topology/ioctl.c +++ b/shlibs/blkid/src/topology/ioctl.c @@ -41,7 +41,6 @@ static struct topology_val { static int probe_ioctl_tp(blkid_probe pr, const struct blkid_idmag *mag) { int i; - int count = 0; for (i = 0; i < ARRAY_SIZE(topology_vals); i++) { struct topology_val *val = &topology_vals[i]; @@ -57,11 +56,9 @@ static int probe_ioctl_tp(blkid_probe pr, const struct blkid_idmag *mag) rc = val->set_ulong(pr, (unsigned long) data); if (rc) goto err; - count++; } - if (count) - return 0; + return 0; nothing: return 1; err: diff --git a/shlibs/blkid/src/topology/sysfs.c b/shlibs/blkid/src/topology/sysfs.c index 25e2b0aa0..d04f0a86e 100644 --- a/shlibs/blkid/src/topology/sysfs.c +++ b/shlibs/blkid/src/topology/sysfs.c @@ -66,8 +66,6 @@ static int probe_sysfs_tp(blkid_probe pr, const struct blkid_idmag *mag) if (blkid_devno_get_u64_attribute(attr_dev, val->attr, &data)) continue; - if (!data) - continue; rc = val->set_ulong(pr, (unsigned long) data); } else if (val->set_int) { @@ -76,8 +74,6 @@ static int probe_sysfs_tp(blkid_probe pr, const struct blkid_idmag *mag) if (blkid_devno_get_s64_attribute(attr_dev, val->attr, &data)) continue; - if (!data) - continue; rc = val->set_int(pr, (int) data); } diff --git a/shlibs/blkid/src/topology/topology.c b/shlibs/blkid/src/topology/topology.c index fa49fd092..1162cb0ef 100644 --- a/shlibs/blkid/src/topology/topology.c +++ b/shlibs/blkid/src/topology/topology.c @@ -43,6 +43,10 @@ * @ALIGNMENT_OFFSET: indicates how many bytes the beginning o the device is * offset from the disk's natural alignment. * + * The NAME=value tags are not defined when the corresponding topology value + * is zero. The MINIMUM_IO_SIZE should be always defined if kernel provides + * topology information. + * * Binary interface: * * blkid_probe_get_tolology() @@ -214,6 +218,8 @@ static int topology_set_value(blkid_probe pr, const char *name, if (!chn) return -1; + if (!data) + return 0; /* ignore zeros */ if (chn->binary) { unsigned long *v = |