diff options
| author | Karel Zak <kzak@redhat.com> | 2020-09-09 14:50:02 +0200 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2020-09-09 14:50:02 +0200 |
| commit | c90a8f1a3cdf116e050708098f0188349b55abc3 (patch) | |
| tree | 0da32a0822b593dd42777b54487be514a5a78514 /misc-utils/lsblk.c | |
| parent | 14bb8e3ca6abaab9a584413d2dd74a6eb2cc18d0 (diff) | |
| download | util-linux-c90a8f1a3cdf116e050708098f0188349b55abc3.tar.gz | |
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>
Diffstat (limited to 'misc-utils/lsblk.c')
| -rw-r--r-- | misc-utils/lsblk.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 82eae6bad8..1c4bae5bf3 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -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; } /* |
