List all block devices.
.IP "\fB\-b, \-\-bytes\fP"
Print the SIZE column in bytes rather than in human readable format.
+.IP "\fB\-d, \-\-nodeps\fP"
+Don't print device holders or slaves. For example "lsblk --nodeps /dev/sda" prints
+information about the sda device only.
.IP "\fB\-e, \-\-exclude \fIlist\fP
Exclude devices by comma delimited list of major device numbers. Note that RAM
disks (major=1) are excluded by default.
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 */
assert(cxt);
assert(cxt->sysfs_fd >= 0);
+ if (lsblk->nodeps)
+ return 0;
+
if (!cxt->nholders)
return 0;
"\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"
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' },
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;
case 'b':
lsblk->bytes = 1;
break;
+ case 'd':
+ lsblk->nodeps = 1;
+ break;
case 'e':
parse_excludes(optarg);
break;