Replace inline version of similar, but less complete, functionality
with the lib/blkdev.c function. The function will inform if a type is
unknown, which appears as hex string value.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Note that lib/tt.c will never truncate columns without TT_FL_TRUNC or
relative column width. So it's fine to set small width for columns
with SIZEs, the defined width is minimal width.
Signed-off-by: Karel Zak <kzak@redhat.com>
$ lsblk --inverse -o NAME /dev/dm-0
NAME
luks-10d813de-fa82-4f67-a86c-23d5d0e7c30e (dm-0)
└─sda6
└─sda
Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
$ lsblk -P -o NAME /dev/dm-0
NAME="luks-10d813de-fa82-4f67-a86c-23d5d0e7c30e (dm-0)"
the (dm-0) sucks in the parsable output...
Reported-by: Peter Rajnoha <prajnoha@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
If you mark a column with TT_FL_NOEXTREMES flag then extremely
large fields will no have effect to column width. Foe example:
without the TT_FL_NOEXTREMES flag for the 'AAA' column:
AAA BBB CCC DDD
aa bbb ccc ddd
aaaaaaaaaaa bb ccc ddd
aa bb ccc ddd
aa bb ccc ddd
with the flags:
AAA BBB CCC DDD
aa bbb ccc dddddddddd
aaaaaaaaaaa
bb ccc dddddddd
aa bb ccc dddddd
aa bb ccc ddddddddd
Signed-off-by: Karel Zak <kzak@redhat.com>
We use ARRAY_SIZE() instead to define the amount of available columns.
[kzak@redhat.com: - fix compiler warnings [-Wsign-compare]]
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
The lsblk depends on /sys/dev/block/ symlinks, which appeared in
kernel 2.6.27. Users with old, or non-sysfs configured, kernel
got ealier message
lsblk: md0: failed to initialize sysfs handler
lsblk: xvda: failed to initialize sysfs handler
[...]
that I found a little too difficult to understand. This patch will
change the message to
lsblk: failed to access sysfs directory: /sys/dev/block: No such file or directory
and informs in manual page what could be reason to that.
[kzak@redhat.com: - use access() rather than opendir()]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
[kzak@redhat.com: - enable udev support by default
- don't check for libudev.h
- minor udev code refactoring in lsblk.c]
Signed-off-by: Ilias Mamedov <arknir@yandex.ru>
Signed-off-by: Karel Zak <kzak@redhat.com>
If lsblk runing on system where many devices appears and disappears
during lsblk run, lsblk should not fail or crash but just ignore
disappeared device.
Let's detect context initialization failures and skip device
instead of failing.
Also fix possible dereferencing of NULL parent pointer and
properly handle some error paths.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Add queue request size parameter.
Very useful for tuning multipath performance.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Add device state column. For normal disk it could be running or offline,
for device-mapper devices running or suspended.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
string with a different format based on the following flags:
SIZE_SUFFIX_1LETTER = "1K"
SIZE_SUFFIX_3LETTER = "1KiB",
SIZE_SUFFIX_SPACE = "1 KiB" or "1 K"
[kzak@redhat.com: - rename flags to SIZE_SUFFIX_* format,
- fix suffix[] buffer size
- add 3 letter version to the test]
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Use atol() instead of atoi() when extracting discard_max_bytes.
Only print discard_alignment and discard_zeroes_data if the device
supports discard. This prevents printing of undefined values with older
kernels.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
I got tired of poking around in sysfs to find the discard topology.
Here's a patch against lsblk that adds a -D option to present this
information in a human-readable form:
NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
sda 0 0B 0B 0
└─sda1 0 0B 0B 0
sdb 0 512B 2G 1
└─sdb1 0 512B 2G 1
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Solaris lacks err, errx, warn and warnx. This also means the err.h header
doesn't exist. Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.
Signed-off-by: Fabian Groffen <grobian@gentoo.org>