]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lsblk: Ignore hidden devices
authorRitika Srivastava <ritika.srivastava@oracle.com>
Wed, 13 May 2020 22:06:10 +0000 (15:06 -0700)
committerKarel Zak <kzak@redhat.com>
Fri, 15 May 2020 10:27:19 +0000 (12:27 +0200)
commit467e1e9ddeb6cd782d360d02f9fa04417e26d4d4
tree82a3c7966938bfccabc36b02ca961e3a06f872ce
parent1beb4d61346f26ab21599d4c1eeb233af8d97aba
lsblk: Ignore hidden devices

Lsblk throws the following error for nvmeNcXnY devices.

lsblk: nvme1c1n1: unknown device name

This is because nvmeNcXnY devices are hidden and do not have
the file /sys/block/<nvmeNcXnY>/dev.

Following patch was added
https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/?id=d51f05bfecb299a830897106460bf395be440c0a
Which made lsblk read from /sys/block/<nvmeNcXnY>/device/dev
which do exist for nvmeNcXnY devices.

After the above patch, the unknown error goes away.
However, another error is encountered in the very next step.

nvme1c1n1: failed to initialize sysfs handler

This is because lsblk looks for /sys/dev/block/242:1
(nvmeNcXnY major:minor) pathname which usually exists for other
block devices but not for the nvmeNcXnY devices as they are hidden.

Below patch does not even print this error for hidden devices
and exits silently.

[kzak@redhat.com: - add prefix to make sysfs_devname_is_hidden()
                    usable for  /sys dumps
                  - use the function in initialize_device() more early]

Signed-off-by: Ritika Srivastava <ritika.srivastava@oracle.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
include/sysfs.h
lib/sysfs.c
misc-utils/lsblk.c