summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libblkid/src/topology/dm.c11
-rw-r--r--libblkid/src/topology/evms.c3
-rw-r--r--libblkid/src/topology/ioctl.c5
-rw-r--r--libblkid/src/topology/lvm.c6
-rw-r--r--libblkid/src/topology/md.c3
-rw-r--r--libblkid/src/topology/sysfs.c6
-rw-r--r--libblkid/src/topology/topology.c7
7 files changed, 25 insertions, 16 deletions
diff --git a/libblkid/src/topology/dm.c b/libblkid/src/topology/dm.c
index 8f33911c0..72ec9bd8e 100644
--- a/libblkid/src/topology/dm.c
+++ b/libblkid/src/topology/dm.c
@@ -26,17 +26,19 @@ static int is_dm_device(dev_t devno)
return blkid_driver_has_major("device-mapper", major(devno));
}
-static int probe_dm_tp(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_dm_tp(blkid_probe pr,
+ const struct blkid_idmag *mag __attribute__((__unused__)))
{
const char *paths[] = {
"/usr/local/sbin/dmsetup",
"/usr/sbin/dmsetup",
"/sbin/dmsetup"
};
- int i, dmpipe[] = { -1, -1 }, stripes, stripesize;
+ int dmpipe[] = { -1, -1 }, stripes, stripesize;
char *cmd = NULL;
FILE *stream = NULL;
long long offset, size;
+ size_t i;
dev_t devno = blkid_probe_get_devno(pr);
if (!devno)
@@ -106,9 +108,8 @@ static int probe_dm_tp(blkid_probe pr, const struct blkid_idmag *mag)
if (!stream)
goto nothing;
- i = fscanf(stream, "%lld %lld striped %d %d ",
- &offset, &size, &stripes, &stripesize);
- if (i != 4)
+ if (fscanf(stream, "%lld %lld striped %d %d ",
+ &offset, &size, &stripes, &stripesize) != 0)
goto nothing;
blkid_topology_set_minimum_io_size(pr, stripesize << 9);
diff --git a/libblkid/src/topology/evms.c b/libblkid/src/topology/evms.c
index a30d8df75..7a4fd554d 100644
--- a/libblkid/src/topology/evms.c
+++ b/libblkid/src/topology/evms.c
@@ -42,7 +42,8 @@ static int is_evms_device(dev_t devno)
return blkid_driver_has_major("evms", major(devno));
}
-static int probe_evms_tp(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_evms_tp(blkid_probe pr,
+ const struct blkid_idmag *mag __attribute__((__unused__)))
{
struct evms_stripe_info evms;
dev_t devno = blkid_probe_get_devno(pr);
diff --git a/libblkid/src/topology/ioctl.c b/libblkid/src/topology/ioctl.c
index 73c18ec9b..3aba09e4f 100644
--- a/libblkid/src/topology/ioctl.c
+++ b/libblkid/src/topology/ioctl.c
@@ -37,9 +37,10 @@ static struct topology_val {
/* we read BLKSSZGET in topology.c */
};
-static int probe_ioctl_tp(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_ioctl_tp(blkid_probe pr,
+ const struct blkid_idmag *mag __attribute__((__unused__)))
{
- int i;
+ size_t i;
for (i = 0; i < ARRAY_SIZE(topology_vals); i++) {
struct topology_val *val = &topology_vals[i];
diff --git a/libblkid/src/topology/lvm.c b/libblkid/src/topology/lvm.c
index 54438b0ad..632c42b71 100644
--- a/libblkid/src/topology/lvm.c
+++ b/libblkid/src/topology/lvm.c
@@ -32,16 +32,18 @@ static int is_lvm_device(dev_t devno)
return blkid_driver_has_major("lvm", major(devno));
}
-static int probe_lvm_tp(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_lvm_tp(blkid_probe pr,
+ const struct blkid_idmag *mag __attribute__((__unused__)))
{
const char *paths[] = {
"/usr/local/sbin/lvdisplay",
"/usr/sbin/lvdisplay",
"/sbin/lvdisplay"
};
- int i, lvpipe[] = { -1, -1 }, stripes = 0, stripesize = 0;
+ int lvpipe[] = { -1, -1 }, stripes = 0, stripesize = 0;
FILE *stream = NULL;
char *cmd = NULL, *devname = NULL, buf[1024];
+ size_t i;
dev_t devno = blkid_probe_get_devno(pr);
if (!devno)
diff --git a/libblkid/src/topology/md.c b/libblkid/src/topology/md.c
index d7275edd6..d14055465 100644
--- a/libblkid/src/topology/md.c
+++ b/libblkid/src/topology/md.c
@@ -72,7 +72,8 @@ static int is_md_device(dev_t devno)
return blkid_driver_has_major("md", major(devno));
}
-static int probe_md_tp(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_md_tp(blkid_probe pr,
+ const struct blkid_idmag *mag __attribute__((__unused__)))
{
int fd = -1;
dev_t disk = 0;
diff --git a/libblkid/src/topology/sysfs.c b/libblkid/src/topology/sysfs.c
index 588fc7a13..e62b84c27 100644
--- a/libblkid/src/topology/sysfs.c
+++ b/libblkid/src/topology/sysfs.c
@@ -39,11 +39,13 @@ static struct topology_val {
{ "queue/physical_block_size", blkid_topology_set_physical_sector_size },
};
-static int probe_sysfs_tp(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_sysfs_tp(blkid_probe pr,
+ const struct blkid_idmag *mag __attribute__((__unused__)))
{
dev_t dev, disk = 0;
- int i, count = 0, rc;
+ int rc;
struct sysfs_cxt sysfs, parent;
+ size_t i, count = 0;
dev = blkid_probe_get_devno(pr);
if (!dev || sysfs_init(&sysfs, dev, NULL) != 0)
diff --git a/libblkid/src/topology/topology.c b/libblkid/src/topology/topology.c
index d2ac97f8a..5cde18767 100644
--- a/libblkid/src/topology/topology.c
+++ b/libblkid/src/topology/topology.c
@@ -144,7 +144,7 @@ blkid_topology blkid_probe_get_topology(blkid_probe pr)
*/
static int topology_probe(blkid_probe pr, struct blkid_chain *chn)
{
- int i = 0;
+ size_t i;
if (!pr || chn->idx < -1)
return -1;
@@ -173,7 +173,7 @@ static int topology_probe(blkid_probe pr, struct blkid_chain *chn)
printf("--> starting probing loop [TOPOLOGY idx=%d]\n",
chn->idx));
- i = chn->idx + 1;
+ i = chn->idx < 0 ? 0 : chn->idx + 1U;
for ( ; i < ARRAY_SIZE(idinfos); i++) {
const struct blkid_idinfo *id = idinfos[i];
@@ -205,7 +205,8 @@ static int topology_probe(blkid_probe pr, struct blkid_chain *chn)
return 1;
}
-static void topology_free(blkid_probe pr, void *data)
+static void topology_free(blkid_probe pr __attribute__((__unused__)),
+ void *data)
{
free(data);
}