Print dependencies in inverse order.
.IP "\fB\-t, \-\-topology\fP"
Output info about block device topology.
+.IP "\fB\-S, \-\-scsi\fP"
+Output info about SCSI devices.
This option is equivalent to "-o NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE".
.IP "\fB\-V, \-\-version\fP"
Output version information and exit.
/*
* lsblk(8) - list block devices
*
- * Copyright (C) 2010,2011 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2010,2011,2012 Red Hat, Inc. All rights reserved.
* Written by Milan Broz <mbroz@redhat.com>
* Karel Zak <kzak@redhat.com>
*
unsigned int bytes:1; /* print SIZE in bytes */
unsigned int inverse:1; /* print inverse dependencies */
unsigned int nodeps:1; /* don't print slaves/holders */
+ unsigned int scsi:1; /* print only device with HCTL (SCSI) */
};
struct lsblk *lsblk; /* global handler */
char *attr = NULL;
const char *trans = NULL;
- /* SPI - Serial Peripheral Interface */
+ /* SCSI - Serial Peripheral Interface */
if (sysfs_scsi_host_is(sysfs, "spi"))
trans = "spi";
cxt->nholders = sysfs_count_dirents(&cxt->sysfs, "holders");
cxt->nslaves = sysfs_count_dirents(&cxt->sysfs, "slaves");
+ /* ignore non-SCSI devices */
+ if (lsblk->scsi && sysfs_scsi_get_hctl(&cxt->sysfs, NULL, NULL, NULL, NULL))
+ return -1;
+
return 0;
}
" -r, --raw use raw output format\n"
" -s, --inverse inverse dependencies\n"
" -t, --topology output info about topology\n"
+ " -S, --scsi output info about SCSI devices\n"
" -V, --version output version information and exit\n"));
fprintf(out, _("\nAvailable columns (for --output):\n"));
{ "include", 1, 0, 'I' },
{ "topology", 0, 0, 't' },
{ "pairs", 0, 0, 'P' },
+ { "scsi", 0, 0, 'S' },
{ "version", 0, 0, 'V' },
{ NULL, 0, 0, 0 },
};
memset(lsblk, 0, sizeof(*lsblk));
while((c = getopt_long(argc, argv,
- "abdDe:fhlnmo:PiI:rstV", longopts, NULL)) != -1) {
+ "abdDe:fhlnmo:PiI:rstVS", longopts, NULL)) != -1) {
err_exclusive_options(c, longopts, excl, excl_st);
columns[ncolumns++] = COL_RQ_SIZE;
columns[ncolumns++] = COL_RA;
break;
+ case 'S':
+ lsblk->nodeps = 1;
+ lsblk->scsi = 1;
+ columns[ncolumns++] = COL_NAME;
+ columns[ncolumns++] = COL_HCTL;
+ columns[ncolumns++] = COL_TYPE;
+ columns[ncolumns++] = COL_VENDOR;
+ columns[ncolumns++] = COL_MODEL;
+ columns[ncolumns++] = COL_REV;
+ break;
case 'V':
printf(_("%s from %s\n"), program_invocation_short_name,
PACKAGE_STRING);