diff options
author | Milan Broz | 2012-07-26 16:41:30 +0200 |
---|---|---|
committer | Karel Zak | 2012-07-26 16:41:39 +0200 |
commit | 4e395c55f719824080bf7878bfa1ef57f6737119 (patch) | |
tree | aed797a7274b8c701950e61e1994da61c8a29a5a /disk-utils/partx.c | |
parent | lsblk: support -o +<attr> for adding attribute to output fields. (diff) | |
download | kernel-qcow2-util-linux-4e395c55f719824080bf7878bfa1ef57f6737119.tar.gz kernel-qcow2-util-linux-4e395c55f719824080bf7878bfa1ef57f6737119.tar.xz kernel-qcow2-util-linux-4e395c55f719824080bf7878bfa1ef57f6737119.zip |
partx: support -o +<attr> for adding attribute to output fields
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/partx.c')
-rw-r--r-- | disk-utils/partx.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/disk-utils/partx.c b/disk-utils/partx.c index 923ca98b0..9764478f8 100644 --- a/disk-utils/partx.c +++ b/disk-utils/partx.c @@ -643,6 +643,7 @@ int main(int argc, char **argv) char *type = NULL; char *device = NULL; /* pointer to argv[], ie: /dev/sda1 */ char *wholedisk = NULL; /* allocated, ie: /dev/sda */ + char *outarg = NULL; dev_t disk_devno = 0, part_devno = 0; static const struct option long_opts[] = { @@ -700,11 +701,7 @@ int main(int argc, char **argv) errx(EXIT_FAILURE, _("failed to parse --nr <M-N> range")); break; case 'o': - ncolumns = string_to_idarray(optarg, - columns, ARRAY_SIZE(columns), - column_name_to_id); - if (ncolumns < 0) - return EXIT_FAILURE; + outarg = optarg; break; case 'P': tt_flags |= TT_FL_EXPORT; @@ -748,6 +745,11 @@ int main(int argc, char **argv) columns[ncolumns++] = COL_UUID; } + if (what == ACT_SHOW && outarg && + string_add_to_idarray(outarg, columns, ARRAY_SIZE(columns), + &ncolumns, column_name_to_id) < 0) + return EXIT_FAILURE; + /* * Note that 'partx /dev/sda1' == 'partx /dev/sda1 /dev/sda' * so assume that the device and/or disk are always the last |