losetup: add --output-all option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2018-04-23 21:19:35 +01:00
parent 00147883de
commit 289673b1c0
No known key found for this signature in database
GPG Key ID: A9553245FDE9B739
3 changed files with 12 additions and 1 deletions

View File

@ -63,6 +63,7 @@ _losetup_module()
--list
--noheadings
--output
--output-all
--raw
--help
--version"

View File

@ -145,6 +145,9 @@ print info about all devices. See also \fB\-\-output\fP, \fB\-\-noheadings\fP,
Specify the columns that are to be printed for the \fB\-\-list\fP output.
Use \fB\-\-help\fR to get a list of all supported columns.
.TP
.B \-\-output\-all
Output all available columns.
.TP
.BR \-n , " \-\-noheadings"
Don't print headings for \fB\-\-list\fP output format.
.IP "\fB\-\-raw\fP"

View File

@ -430,6 +430,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" -l, --list list info about all or specified (default)\n"), out);
fputs(_(" -n, --noheadings don't print headings for --list output\n"), out);
fputs(_(" -O, --output <cols> specify columns to output for --list\n"), out);
fputs(_(" --output-all output all columns\n"), out);
fputs(_(" --raw use raw --list output format\n"), out);
fputs(USAGE_SEPARATOR, out);
@ -590,7 +591,8 @@ int main(int argc, char **argv)
OPT_SIZELIMIT = CHAR_MAX + 1,
OPT_SHOW,
OPT_RAW,
OPT_DIO
OPT_DIO,
OPT_OUTPUT_ALL
};
static const struct option longopts[] = {
{ "all", no_argument, NULL, 'a' },
@ -607,6 +609,7 @@ int main(int argc, char **argv)
{ "noheadings", no_argument, NULL, 'n' },
{ "offset", required_argument, NULL, 'o' },
{ "output", required_argument, NULL, 'O' },
{ "output-all", no_argument, NULL, OPT_OUTPUT_ALL },
{ "sizelimit", required_argument, NULL, OPT_SIZELIMIT },
{ "partscan", no_argument, NULL, 'P' },
{ "read-only", no_argument, NULL, 'r' },
@ -701,6 +704,10 @@ int main(int argc, char **argv)
outarg = optarg;
list = 1;
break;
case OPT_OUTPUT_ALL:
for (ncolumns = 0; ncolumns < ARRAY_SIZE(infos); ncolumns++)
columns[ncolumns] = ncolumns;
break;
case 'P':
lo_flags |= LO_FLAGS_PARTSCAN;
break;