zramctl: add --output-all option
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
b5b43f276e
commit
2e7ccec7bb
3 changed files with 14 additions and 1 deletions
|
@ -41,6 +41,7 @@ _zramctl_module()
|
||||||
--find
|
--find
|
||||||
--noheadings
|
--noheadings
|
||||||
--output
|
--output
|
||||||
|
--output-all
|
||||||
--raw
|
--raw
|
||||||
--reset
|
--reset
|
||||||
--size
|
--size
|
||||||
|
|
|
@ -59,6 +59,9 @@ Define the status output columns to be used. If no output arrangement is
|
||||||
specified, then a default set is used.
|
specified, then a default set is used.
|
||||||
Use \fB\-\-help\fP to get a list of all supported columns.
|
Use \fB\-\-help\fP to get a list of all supported columns.
|
||||||
.TP
|
.TP
|
||||||
|
.B \-\-output\-all
|
||||||
|
Output all available columns.
|
||||||
|
.TP
|
||||||
.B \-\-raw
|
.B \-\-raw
|
||||||
Use the raw format for status output.
|
Use the raw format for status output.
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -543,6 +543,7 @@ static void __attribute__((__noreturn__)) usage(void)
|
||||||
fputs(_(" -f, --find find a free device\n"), out);
|
fputs(_(" -f, --find find a free device\n"), out);
|
||||||
fputs(_(" -n, --noheadings don't print headings\n"), out);
|
fputs(_(" -n, --noheadings don't print headings\n"), out);
|
||||||
fputs(_(" -o, --output <list> columns to use for status output\n"), out);
|
fputs(_(" -o, --output <list> columns to use for status output\n"), out);
|
||||||
|
fputs(_(" --output-all output all columns\n"), out);
|
||||||
fputs(_(" --raw use raw status output format\n"), out);
|
fputs(_(" --raw use raw status output format\n"), out);
|
||||||
fputs(_(" -r, --reset reset all specified devices\n"), out);
|
fputs(_(" -r, --reset reset all specified devices\n"), out);
|
||||||
fputs(_(" -s, --size <size> device size\n"), out);
|
fputs(_(" -s, --size <size> device size\n"), out);
|
||||||
|
@ -575,7 +576,10 @@ int main(int argc, char **argv)
|
||||||
int rc = 0, c, find = 0, act = A_NONE;
|
int rc = 0, c, find = 0, act = A_NONE;
|
||||||
struct zram *zram = NULL;
|
struct zram *zram = NULL;
|
||||||
|
|
||||||
enum { OPT_RAW = CHAR_MAX + 1 };
|
enum {
|
||||||
|
OPT_RAW = CHAR_MAX + 1,
|
||||||
|
OPT_LIST_TYPES
|
||||||
|
};
|
||||||
|
|
||||||
static const struct option longopts[] = {
|
static const struct option longopts[] = {
|
||||||
{ "algorithm", required_argument, NULL, 'a' },
|
{ "algorithm", required_argument, NULL, 'a' },
|
||||||
|
@ -583,6 +587,7 @@ int main(int argc, char **argv)
|
||||||
{ "find", no_argument, NULL, 'f' },
|
{ "find", no_argument, NULL, 'f' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ "output", required_argument, NULL, 'o' },
|
{ "output", required_argument, NULL, 'o' },
|
||||||
|
{ "output-all",no_argument, NULL, OPT_LIST_TYPES },
|
||||||
{ "noheadings",no_argument, NULL, 'n' },
|
{ "noheadings",no_argument, NULL, 'n' },
|
||||||
{ "reset", no_argument, NULL, 'r' },
|
{ "reset", no_argument, NULL, 'r' },
|
||||||
{ "raw", no_argument, NULL, OPT_RAW },
|
{ "raw", no_argument, NULL, OPT_RAW },
|
||||||
|
@ -625,6 +630,10 @@ int main(int argc, char **argv)
|
||||||
if (ncolumns < 0)
|
if (ncolumns < 0)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
break;
|
break;
|
||||||
|
case OPT_LIST_TYPES:
|
||||||
|
for (ncolumns = 0; (size_t)ncolumns < ARRAY_SIZE(infos); ncolumns++)
|
||||||
|
columns[ncolumns] = ncolumns;
|
||||||
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
size = strtosize_or_err(optarg, _("failed to parse size"));
|
size = strtosize_or_err(optarg, _("failed to parse size"));
|
||||||
act = A_CREATE;
|
act = A_CREATE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue