* lsblk "include" option? @ 2012-06-15 13:09 Marcos Felipe Rasia de Mello 2012-06-19 14:26 ` Karel Zak 0 siblings, 1 reply; 5+ messages in thread From: Marcos Felipe Rasia de Mello @ 2012-06-15 13:09 UTC (permalink / raw) To: util-linux lsblk has an "exclude" (-e, --exclude) option. I wonder if would be possible to add an "include" option to tell it to show *only* specified major number devices. Like lsblk -i 8 to only print major number 8 devices. Regards, Marcos ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lsblk "include" option? 2012-06-15 13:09 lsblk "include" option? Marcos Felipe Rasia de Mello @ 2012-06-19 14:26 ` Karel Zak 2012-06-19 14:46 ` Bernhard Voelker 0 siblings, 1 reply; 5+ messages in thread From: Karel Zak @ 2012-06-19 14:26 UTC (permalink / raw) To: Marcos Felipe Rasia de Mello; +Cc: util-linux On Fri, Jun 15, 2012 at 10:09:16AM -0300, Marcos Felipe Rasia de Mello wrote: > lsblk has an "exclude" (-e, --exclude) option. I wonder if would be > possible to add an "include" option to tell it to show *only* > specified major number devices. Like > > lsblk -i 8 Implemented (--include, -I) > to only print major number 8 devices. note that the filters (--exclude and --include) are applied to top-level devices only. For example: $ lsblk --include 8 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 149.1G 0 disk ├─sda1 8:1 0 1000M 0 disk /boot/efi ├─sda2 8:2 0 2G 0 disk /boot ├─sda3 8:3 0 9.7G 0 disk [SWAP] ├─sda4 8:4 0 34.2G 0 disk / ├─sda5 8:5 0 63.2G 0 disk /home └─sda6 8:6 0 39.1G 0 disk └─luks-10d813de-fa82-4f67-a86c-23d5d0e7c30e (dm-0) 253:0 0 39.1G 0 crypt /home/kzak I have a little changed --all option, it's not mutually exclusive to --include and --exclude anymore. The idea is to print all devices including empty devices (empty devices are ignored by default), for example: $ lsblk --all --include 7 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 0 loop loop1 7:1 0 0 loop loop2 7:2 0 0 loop loop3 7:3 0 0 loop loop4 7:4 0 0 loop loop5 7:5 0 0 loop loop6 7:6 0 0 loop loop7 7:7 0 0 loop Karel -- Karel Zak <kzak@redhat.com> http://karelzak.blogspot.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lsblk "include" option? 2012-06-19 14:26 ` Karel Zak @ 2012-06-19 14:46 ` Bernhard Voelker 2012-06-19 15:43 ` Karel Zak 0 siblings, 1 reply; 5+ messages in thread From: Bernhard Voelker @ 2012-06-19 14:46 UTC (permalink / raw) To: Karel Zak; +Cc: Marcos Felipe Rasia de Mello, util-linux On 06/19/2012 04:26 PM, Karel Zak wrote: > On Fri, Jun 15, 2012 at 10:09:16AM -0300, Marcos Felipe Rasia de Mello wrote: >> lsblk has an "exclude" (-e, --exclude) option. I wonder if would be >> possible to add an "include" option to tell it to show *only* >> specified major number devices. Like >> >> lsblk -i 8 > > Implemented (--include, -I) > diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c > index f635a4a..0bcdbfc 100644 > --- a/misc-utils/lsblk.c > +++ b/misc-utils/lsblk.c > @@ -142,7 +142,7 @@ static struct colinfo infos[] = { > > struct lsblk { > struct tt *tt; /* output table */ > - unsigned int all_devices:1; /* print all devices */ > + unsigned int all_devices:1; /* print all devices, icluding empty */ s/icluding/including/ > @@ -1116,6 +1159,7 @@ static void __attribute__((__noreturn__)) help(FILE *out) > " -d, --nodeps don't print slaves or holders\n" > " -D, --discard print discard capabilities\n" > " -e, --exclude <list> exclude devices by major number (default: RAM disks)\n" > + " -i, --include <list> show only devices with specified major numbers\n" s/-i/-I/ BTW: the <list> does not necessarily have to be comma separated; e.g. a dot also works: "lsblk -I 8.11". The same applies to "-e", of course. Have a nice day, Berny ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lsblk "include" option? 2012-06-19 14:46 ` Bernhard Voelker @ 2012-06-19 15:43 ` Karel Zak 2012-06-19 20:48 ` Marcos Felipe Rasia de Mello 0 siblings, 1 reply; 5+ messages in thread From: Karel Zak @ 2012-06-19 15:43 UTC (permalink / raw) To: Bernhard Voelker; +Cc: Marcos Felipe Rasia de Mello, util-linux On Tue, Jun 19, 2012 at 04:46:52PM +0200, Bernhard Voelker wrote: > > > On 06/19/2012 04:26 PM, Karel Zak wrote: > > On Fri, Jun 15, 2012 at 10:09:16AM -0300, Marcos Felipe Rasia de Mello wrote: > >> lsblk has an "exclude" (-e, --exclude) option. I wonder if would be > >> possible to add an "include" option to tell it to show *only* > >> specified major number devices. Like > >> > >> lsblk -i 8 > > > > Implemented (--include, -I) > > > > diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c > > index f635a4a..0bcdbfc 100644 > > --- a/misc-utils/lsblk.c > > +++ b/misc-utils/lsblk.c > > @@ -142,7 +142,7 @@ static struct colinfo infos[] = { > > > > struct lsblk { > > struct tt *tt; /* output table */ > > - unsigned int all_devices:1; /* print all devices */ > > + unsigned int all_devices:1; /* print all devices, icluding empty */ > > s/icluding/including/ > > > @@ -1116,6 +1159,7 @@ static void __attribute__((__noreturn__)) help(FILE *out) > > " -d, --nodeps don't print slaves or holders\n" > > " -D, --discard print discard capabilities\n" > > " -e, --exclude <list> exclude devices by major number (default: RAM disks)\n" > > + " -i, --include <list> show only devices with specified major numbers\n" > > s/-i/-I/ Thanks for review! > BTW: the <list> does not necessarily have to be comma separated; > e.g. a dot also works: "lsblk -I 8.11". The same applies to "-e", > of course. Fixed, this is unexpected feature. Karel -- Karel Zak <kzak@redhat.com> http://karelzak.blogspot.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lsblk "include" option? 2012-06-19 15:43 ` Karel Zak @ 2012-06-19 20:48 ` Marcos Felipe Rasia de Mello 0 siblings, 0 replies; 5+ messages in thread From: Marcos Felipe Rasia de Mello @ 2012-06-19 20:48 UTC (permalink / raw) To: Karel Zak; +Cc: Bernhard Voelker, util-linux 2012/6/19 Karel Zak <kzak@redhat.com>: > On Tue, Jun 19, 2012 at 04:46:52PM +0200, Bernhard Voelker wrote: >> >> >> On 06/19/2012 04:26 PM, Karel Zak wrote: >> > On Fri, Jun 15, 2012 at 10:09:16AM -0300, Marcos Felipe Rasia de Mello= wrote: >> >> lsblk has an "exclude" (-e, --exclude) option. I wonder if would be >> >> possible to add an "include" option to tell it to show *only* >> >> specified major number devices. Like >> >> >> >> lsblk -i 8 >> > >> > =A0Implemented (--include, -I) >> >> >> > diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c >> > index f635a4a..0bcdbfc 100644 >> > --- a/misc-utils/lsblk.c >> > +++ b/misc-utils/lsblk.c >> > @@ -142,7 +142,7 @@ static struct colinfo infos[] =3D { >> > >> > =A0struct lsblk { >> > =A0 =A0 =A0 =A0 struct tt *tt; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* o= utput table */ >> > - =A0 =A0 =A0 unsigned int all_devices:1; =A0 =A0 /* print all devices= */ >> > + =A0 =A0 =A0 unsigned int all_devices:1; =A0 =A0 /* print all devices= , icluding empty */ >> >> s/icluding/including/ >> >> > @@ -1116,6 +1159,7 @@ static void __attribute__((__noreturn__)) help(F= ILE *out) >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 " -d, --nodeps =A0 =A0 =A0 =A0 don't p= rint slaves or holders\n" >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 " -D, --discard =A0 =A0 =A0 =A0print d= iscard capabilities\n" >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 " -e, --exclude <list> exclude devices= by major number (default: RAM disks)\n" >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 " -i, --include <list> show only devices= with specified major numbers\n" >> >> s/-i/-I/ > > Thanks for review! > >> BTW: the <list> does not necessarily have to be comma separated; >> e.g. a dot also works: "lsblk -I 8.11". The same applies to "-e", >> of course. > > Fixed, this is unexpected feature. > Thank you both! Marcos ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-06-19 20:48 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-06-15 13:09 lsblk "include" option? Marcos Felipe Rasia de Mello 2012-06-19 14:26 ` Karel Zak 2012-06-19 14:46 ` Bernhard Voelker 2012-06-19 15:43 ` Karel Zak 2012-06-19 20:48 ` Marcos Felipe Rasia de Mello
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.