]> 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>
Thu, 14 May 2020 13:48:26 +0000 (15:48 +0200)
commitc8487d854ba5cf5bfcae78d8e5af5587e7622351
tree7b3896a022951916e20715ff63c06bbcb91eedc3
parent72b155ea6e25730d7c01d345cc2df269c2c47635
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