pr->nvals = 0;
}
+static void blkid_probe_reset_idx(blkid_probe pr)
+{
+ pr->idx = -1;
+}
+
void blkid_reset_probe(blkid_probe pr)
{
if (!pr)
memset(pr->buf, 0, pr->buf_max);
pr->buf_off = 0;
pr->buf_len = 0;
- pr->idx = 0;
if (pr->sbbuf)
memset(pr->sbbuf, 0, BLKID_SB_BUFSIZ);
pr->sbbuf_len = 0;
blkid_probe_reset_vals(pr);
+ blkid_probe_reset_idx(pr);
}
-
/*
* Note that we have two offsets:
*
pr->fd = fd;
pr->off = off;
pr->size = 0;
- pr->idx = 0;
if (size)
pr->size = size;
return -1;
if (pr->fltr)
memset(pr->fltr, 0, BLKID_FLTR_SIZE * sizeof(unsigned long));
- pr->idx = 0;
+ blkid_probe_reset_idx(pr);
return 0;
}
if (!pr || !names)
return -1;
- if (!pr->fltr)
+ if (!pr->fltr) {
pr->fltr = calloc(BLKID_FLTR_SIZE, sizeof(unsigned long));
- else
+ blkid_probe_reset_idx(pr);
+ } else
blkid_probe_reset_filter(pr);
if (!pr->fltr)
}
}
DBG(DEBUG_LOWPROBE, printf("a new probing type-filter initialized\n"));
- pr->idx = 0;
return 0;
}
if (!pr || !usage)
return -1;
- if (!pr->fltr)
+ if (!pr->fltr) {
pr->fltr = calloc(BLKID_FLTR_SIZE, sizeof(unsigned long));
- else
+ blkid_probe_reset_idx(pr);
+ } else
blkid_probe_reset_filter(pr);
if (!pr->fltr)
blkid_bmp_set_item(pr->fltr, i);
}
DBG(DEBUG_LOWPROBE, printf("a new probing usage-filter initialized\n"));
- pr->idx = 0;
return 0;
}
for (i = 0; i < BLKID_FLTR_SIZE; i++)
pr->fltr[i] = ~pr->fltr[i];
+ blkid_probe_reset_idx(pr);
DBG(DEBUG_LOWPROBE, printf("probing filter inverted\n"));
- pr->idx = 0;
return 0;
}
blkid_probe_reset_vals(pr);
- if (pr->idx)
- i = pr->idx + 1;
+ i = pr->idx + 1;
if (i < 0 && i >= ARRAY_SIZE(idinfos))
return -1;