if BUILD_LIBBLKID
sbin_PROGRAMS += blkid findfs wipefs
dist_man_MANS += blkid.8 findfs.8 wipefs.8
-blkid_SOURCES = blkid.c $(top_srcdir)/lib/ismounted.c
+blkid_SOURCES = blkid.c $(top_srcdir)/lib/ismounted.c ../lib/strtosize.c
blkid_LDADD = $(ul_libblkid_la)
blkid_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir)
findfs_LDADD = $(ul_libblkid_la)
specific NAME=value pair, or displaying NAME=value pairs for one or
more devices.
.SH OPTIONS
+The \fIsize\fR and \fIoffset\fR arguments may be followed by binary (2^N)
+suffixes KiB, MiB, GiB, TiB, PiB and EiB (the "iB" is optional, e.g. "K" has the
+same meaning as "KiB") or decimal (10^N) suffixes KB, MB, GB, PB and EB.
.TP
.BI \-c " cachefile"
Read from
vol_id compatible mode; usable in udev rules
.RE
.TP
-.BI \-O " bytes"
+.BI \-O " offset"
Probe at the given offset (only useful with \fB-p\fR).
.TP
.BI \-p
.B "-s none"
with no other options.
.TP
-.BI \-S " bytes"
+.BI \-S " size"
Overwrite device/file size (only useful with \fB-p\fR).
.TP
.BI \-t " NAME" = "value"
#include <blkid.h>
#include "ismounted.h"
+#include "strtosize.h"
const char *progname = "blkid";
" <dev> specify device(s) to probe (default: all devices)\n\n"
"Low-level probing options:\n"
" -p switch to low-level mode (bypass cache)\n"
- " -S <bytes> overwrite device size\n"
- " -O <bytes> probe at the given offset\n"
+ " -S <size> overwrite device size\n"
+ " -O <offset> probe at the given offset\n"
" -u <list> filter by \"usage\" (e.g. -u filesystem,raid)\n"
" -n <list> filter by filesystem type (e.g. -n vfat,ext3)\n"
"\n",
int output_format = 0;
int lookup = 0, gc = 0, lowprobe = 0, eval = 0;
int c;
- blkid_loff_t offset = 0, size = 0;
+ uintmax_t offset = 0, size = 0;
show[0] = NULL;
}
break;
case 'O':
- offset = strtoll(optarg, NULL, 10);
+ if (strtosize(optarg, &offset))
+ fprintf(stderr,
+ "Invalid offset '%s' specified\n",
+ optarg);
break;
case 'p':
lowprobe++;
show[numtag] = NULL;
break;
case 'S':
- size = strtoll(optarg, NULL, 10);
+ if (strtosize(optarg, &size))
+ fprintf(stderr,
+ "Invalid size '%s' specified\n",
+ optarg);
break;
case 't':
if (search_type) {
for (i = 0; i < numdev; i++)
err = lowprobe_device(pr, devices[i], show,
- output_format, offset, size);
+ output_format,
+ (blkid_loff_t) offset,
+ (blkid_loff_t) size);
blkid_free_probe(pr);
} else if (eval) {
/*