swapon_CFLAGS = $(cflags_common)
swapon_LDADD = $(ldadd_common)
-losetup_SOURCES = lomount.c $(srcs_common) loop.h lomount.h
+losetup_SOURCES = lomount.c $(srcs_common) loop.h lomount.h ../lib/strtosize.c
losetup_CPPFLAGS = -DMAIN $(AM_CPPFLAGS)
mount_static_LDADD =
#include <getopt.h>
#include <stdarg.h>
+#include "strtosize.h"
+
static void
usage(void) {
fprintf(stderr, _("\nUsage:\n"
int showdev = 0;
int ro = 0;
int pfd = -1;
- unsigned long long off, slimit;
+ uintmax_t off = 0, slimit = 0;
struct option longopts[] = {
{ "all", 0, 0, 'a' },
{ "set-capacity", 0, 0, 'c' },
textdomain(PACKAGE);
capacity = delete = find = all = 0;
- off = 0;
- slimit = 0;
assoc = offset = sizelimit = encryption = passfd = NULL;
progname = argv[0];
usage();
}
- if (offset && sscanf(offset, "%llu", &off) != 1)
+ if (offset && strtosize(offset, &off)) {
+ error(_("%s: invalid offset '%s' specified"), progname, offset);
usage();
-
- if (sizelimit && sscanf(sizelimit, "%llu", &slimit) != 1)
+ }
+ if (sizelimit && strtosize(sizelimit, &slimit)) {
+ error(_("%s: invalid sizelimit '%s' specified"),
+ progname, sizelimit);
usage();
+ }
if (all)
return show_used_loop_devices();
.RB [ \-o
.IR offset ]
.RB [ \-\-sizelimit
-.IR limit ]
+.IR size ]
.in +8
.RB [ \-p
.IR pfd ]
This cryptoloop module will take the name of an arbitrary encryption type
and find the module that knows how to perform that encryption.
.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.
+
.IP "\fB\-a, \-\-all\fP"
show status of all loop devices
.IP "\fB\-c, \-\-set-capacity\fP \fIloopdev\fP
.IP "\fB\-o, \-\-offset \fIoffset\fP"
the data start is moved \fIoffset\fP bytes into the specified file or
device
-.IP "\fB\-\-sizelimit \fIlimit\fP"
-the data end is set to no more than \fIsizelimit\fP bytes after the data start
+.IP "\fB\-\-sizelimit \fIsize\fP"
+the data end is set to no more than \fIsize\fP bytes after the data start
.IP "\fB\-p, \-\-pass-fd \fInum\fP"
read the passphrase from file descriptor with number
.I num