diff options
author | Karel Zak | 2010-12-16 12:47:30 +0100 |
---|---|---|
committer | Karel Zak | 2010-12-16 12:47:30 +0100 |
commit | f31505fe0396a880dad297d14c29c2415cc94272 (patch) | |
tree | 9ae7e4adbe715d48135985b535833645fb9fe877 /misc-utils/lsblk.c | |
parent | lib: [tt] fix alignment of the last tree child (diff) | |
download | kernel-qcow2-util-linux-f31505fe0396a880dad297d14c29c2415cc94272.tar.gz kernel-qcow2-util-linux-f31505fe0396a880dad297d14c29c2415cc94272.tar.xz kernel-qcow2-util-linux-f31505fe0396a880dad297d14c29c2415cc94272.zip |
lsblk: add --nodeps
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r-- | misc-utils/lsblk.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index cdfce42f1..c07e30a71 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -118,6 +118,7 @@ struct lsblk { struct tt *tt; /* output table */ int all_devices:1; /* print all devices */ int bytes:1; /* print SIZE in bytes */ + int nodeps:1; /* don't print slaves/holders */ }; struct lsblk *lsblk; /* global handler */ @@ -693,6 +694,9 @@ static int list_holders(struct blkdev_cxt *cxt) assert(cxt); assert(cxt->sysfs_fd >= 0); + if (lsblk->nodeps) + return 0; + if (!cxt->nholders) return 0; @@ -853,6 +857,7 @@ static void __attribute__((__noreturn__)) help(FILE *out) "\nOptions:\n" " -a, --all print all devices\n" " -b, --bytes print SIZE in bytes rather than in human readable format\n" + " -d, --nodeps don't print slaves or holders\n" " -e, --exclude <list> exclude devices by major number (default: RAM disks)\n" " -f, --fs output info about filesystems\n" " -h, --help usage information (this)\n" @@ -888,6 +893,8 @@ int main(int argc, char *argv[]) struct option longopts[] = { { "all", 0, 0, 'a' }, + { "bytes", 0, 0, 'b' }, + { "nodeps", 0, 0, 'd' }, { "help", 0, 0, 'h' }, { "output", 1, 0, 'o' }, { "perms", 0, 0, 'm' }, @@ -908,7 +915,7 @@ int main(int argc, char *argv[]) lsblk = &_ls; memset(lsblk, 0, sizeof(*lsblk)); - while((c = getopt_long(argc, argv, "abe:fhlnmo:irt", longopts, NULL)) != -1) { + while((c = getopt_long(argc, argv, "abde:fhlnmo:irt", longopts, NULL)) != -1) { switch(c) { case 'a': lsblk->all_devices = 1; @@ -916,6 +923,9 @@ int main(int argc, char *argv[]) case 'b': lsblk->bytes = 1; break; + case 'd': + lsblk->nodeps = 1; + break; case 'e': parse_excludes(optarg); break; |