lsblk: show all empty, except loopdevs

This patch improves the previous commit to accept also another empty devices.

Addresses: https://github.com/karelzak/util-linux/issues/1118
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2020-09-09 14:50:02 +02:00
parent 14bb8e3ca6
commit c90a8f1a3c
1 changed files with 9 additions and 4 deletions

View File

@ -1152,11 +1152,16 @@ static void devtree_to_scols(struct lsblk_devtree *tr, struct libscols_table *ta
static int ignore_empty(struct lsblk_device *dev)
{
if (dev->size != 0)
/* show all non-empty devices */
if (dev->size)
return 0;
if (dev->maj == LOOPDEV_MAJOR && loopdev_has_backing_file(dev->filename))
return 0;
return 1;
/* ignore empty loop devices without backing file */
if (dev->maj == LOOPDEV_MAJOR &&
!loopdev_has_backing_file(dev->filename))
return 1;
return 0;
}
/*