diff options
author | Karel Zak | 2015-11-19 11:57:05 +0100 |
---|---|---|
committer | Karel Zak | 2015-11-19 11:57:05 +0100 |
commit | f98d9641a371421640a8f1cfe497030758f86dca (patch) | |
tree | 29ad3ae36ae09890d78046c571cd28133f1ffe29 /sys-utils/losetup.c | |
parent | losetup: support list direct io (diff) | |
download | kernel-qcow2-util-linux-f98d9641a371421640a8f1cfe497030758f86dca.tar.gz kernel-qcow2-util-linux-f98d9641a371421640a8f1cfe497030758f86dca.tar.xz kernel-qcow2-util-linux-f98d9641a371421640a8f1cfe497030758f86dca.zip |
losetup: clean up --direct-io
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/losetup.c')
-rw-r--r-- | sys-utils/losetup.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c index 918c34da6..1d57ab341 100644 --- a/sys-utils/losetup.c +++ b/sys-utils/losetup.c @@ -399,7 +399,7 @@ static void usage(FILE *out) fputs(_(" --sizelimit <num> device is limited to <num> bytes of the file\n"), out); fputs(_(" -P, --partscan create a partitioned loop device\n"), out); fputs(_(" -r, --read-only set up a read-only loop device\n"), out); - fputs(_(" --direct-io open backing file with O_DIRECT\n"), out); + fputs(_(" --direct-io[=<on|off>] open backing file with O_DIRECT\n"), out); fputs(_(" --show print device name after setup (with -f)\n"), out); fputs(_(" -v, --verbose verbose mode\n"), out); @@ -477,7 +477,7 @@ int main(int argc, char **argv) { "sizelimit", 1, 0, OPT_SIZELIMIT }, { "partscan", 0, 0, 'P' }, { "read-only", 0, 0, 'r' }, - { "direct-io", 1, 0, OPT_DIO }, + { "direct-io", 2, 0, OPT_DIO }, { "raw", 0, 0, OPT_RAW }, { "show", 0, 0, OPT_SHOW }, { "verbose", 0, 0, 'v' }, @@ -568,8 +568,9 @@ int main(int argc, char **argv) showdev = 1; break; case OPT_DIO: - set_dio = 1; - use_dio = strtoul_or_err(optarg, _("failed to parse dio")); + use_dio = set_dio = 1; + if (optarg) + use_dio = parse_switch(optarg, _("argument error"), "on", "off", NULL); break; case 'v': break; |