aboutsummaryrefslogtreecommitdiffstats
path: root/misc-utils/lsblk.c
AgeCommit message (Collapse)AuthorFilesLines
2015-01-06textual: add a docstring to most of the utilitiesBenno Schulenberg1-0/+4
This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-12-02lsblk: add SUBSYSTEMS columnKarel Zak1-0/+37
$ lsblk -oNAME,SIZE,TYPE,SUBSYSTEMS /dev/sr0 NAME SIZE TYPE SUBSYSTEMS sr0 7.8M rom block:scsi:usb:pci Signed-off-by: Karel Zak <kzak@redhat.com>
2014-12-02lsblk: add HOTPLUG columnKarel Zak1-1/+6
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-01lsblk: fix compiler warningSami Kerola1-4/+4
warning: ISO C forbids empty initializer braces [-Wpedantic] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-08-11textual: remove some inconsistent periods from error messagesBenno Schulenberg1-2/+2
While doing so, also improve translatability and some wordings. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-07-22Merge branch 'master' of https://github.com/yurchor/util-linuxKarel Zak1-1/+1
* 'master' of https://github.com/yurchor/util-linux: Fix typos in user visible messages
2014-07-18lsblk: check number of used columnsKarel Zak1-45/+59
The current code does not check size of the columns[] array when add the next on command line specified column. We check the array size for "-o <columns>" but not for another options. Old version: $ for x in $(seq 0 100); do echo "-t"; done | xargs lsblk xargs: lsblk: terminated by signal 11 new version: $ for x in $(seq 0 100); do echo "-t"; done | xargs lsblk lsblk: too many columns specified, the limit is 83 columns. Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-18lsblk: differentiate between infos[] and columns[]Karel Zak1-3/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-03Fix typos in user visible messagesYuri Chornoivan1-1/+1
2014-06-06libsmartcols: add debug messagesKarel Zak1-0/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-21lsblk: fix, set default sort_id = -1Ruediger Meier1-1/+0
Introduced in 642048e4: $ lsblk -o SIZE /dev/loop1 lsblk: the sort column has to be between output columns. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-20lsblk: add --sort <column>Karel Zak1-32/+179
This implementation allow to sort output by arbitrary output column. Note that output is always converted to human readable strings, but sort functions in many cases work with original data (stored as private data to cells by scols_cell_set_userdata()). Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-06lsblk: add -O option to show all available columnsMasatake YAMATO1-1/+12
Simple command line for gathering information as many as possible is useful when understanding a system, especially when trouble shooting. This patch introduces -O option which enables all available columns. [kzak@redhat.com: - define collisions between options, - define columns when parse argv[]] Signed-off-by: Masatake YAMATO <yamato@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-03libsmartcols: clean up flags usageKarel Zak1-5/+5
* rename flags functions to scols_table_enable_* * rename *_no_foo() functions to _nofoo() * output formats are mutually exclusive, so don't use flags there * don't assume symbols in scols_new_table(), use scols_table_set_symbols() Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-03lsblk: remove unnecessary codeKarel Zak1-1/+0
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-03lsblk: clean up data preparationKarel Zak1-132/+77
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-03lsblk: use libsmartcolsOndrej Oprala1-98/+114
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-03-07lsblk: add PARTFLAGS columnKarel Zak1-1/+12
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-10lsblk: add PARTTYPE tagMichael Marineau1-0/+13
To stay in sync with blkid add PARTTYPE as an available output column.
2013-11-18lsblk: fix -D segfaultKarel Zak1-3/+3
References: https://bugzilla.redhat.com/show_bug.cgi?id=1031262 Signed-off-by: Karel Zak <kzak@redhat.com>
2013-10-14textual: remove duplicate mention of '--help' from lsblk help textBenno Schulenberg1-4/+3
Also improve the alphabetization of the other options. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-09-16lsblk: use TT_FL_FREEDATA for tt tableKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-21misc: use libmnt_table reference counterKarel Zak1-2/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-21misc: use libmnt_cache reference countingKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-08lsblk: use devno to get mountpointKarel Zak1-2/+6
The device (for example LVM logical volume) could be renamed and then the device name from /proc/self/mountinfo does not match with reality. So, we also need to check devno. Unfortunately we cannot completely rely on devno, because for example btrfs uses psudo device numbers. References: https://bugzilla.redhat.com/show_bug.cgi?id=980463 Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-13lsblk: add SERIAL columnKarel Zak1-1/+13
... to return short serial number of the disk (from udev db) Addresses: https://github.com/karelzak/util-linux/issues/33 Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-26Fix various typosYuri Chornoivan1-1/+1
2013-03-29lsblk: add --pathsKarel Zak1-19/+42
Now it's not so simple to generate full paths to devices if you want to use user friendly names like /dev/mapper/foo. Let's make it easy.
2013-03-27lsblk: check returns [coverity scan]Karel Zak1-1/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-18lsblk: resuse udev handlerKarel Zak1-4/+9
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-25lsblk: make usage() translator friendlySami Kerola1-25/+24
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-25textual: use UTIL_LINUX_VERSION everywhereKarel Zak1-2/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-07lsblk: Add write-same attribute to topology infoMilan Broz1-1/+16
Signed-off-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-12lsblk: don't care about xasprintf() return codeKarel Zak1-4/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-27lsblk: fix copy & past bugKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-07lsblk: add TRANsport to --scsi outputKarel Zak1-0/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-07lsblk: don't ignore disk deviceKarel Zak1-3/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-07lsblk: Add --scsi switchMilan Broz1-3/+20
The --scsi switch prints similar information to lsscsi command. Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-11-07lsblk: Add vendor columnMilan Broz1-0/+9
Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-11-07lsblk: Add revision columnMilan Broz1-0/+9
Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-10-23misc: make readlink() usage more robustKarel Zak1-2/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23lsblk: use new sysfs functions, clean up get_transport()Karel Zak1-62/+22
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23lib/sysfs: add functions for SCSI host attributesKarel Zak1-42/+11
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23include/sysfs: add SCSI host:channel:target:lun supportKarel Zak1-23/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-23lsblk: add SCSI transport type attributeMilan Broz1-0/+131
Patch adds "SCSI transport layer" similar attribute to "lsscsi -t". This is useful for script where you want to distinguish e.g. FC, iSCSI or USB devices from local disks. Detection logic is quite simplified in comparison to lsscsi but it should provide the same output (except detailed transport attributes). Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-10-23lsblk: add SCSI H:C:T:L attributeMilan Broz1-0/+32
For block devices it is sometimes useful to print SCSI device ID" Host:Channel:Target:LUN. Patch adds column name HCTL which can be used in lsblk. Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-10-23lsblk: add parent kernel name columnMilan Broz1-1/+6
For raw output used in scripts it is sometimes necessary to reconstruct tree of devices. Parent kernel name (PKNAME) provides needed information to do that easily. Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-10-02lsblk: fix reporting of 'part' typePeter Rajnoha1-3/+3
Partitions are incorrectly marked with 'disk' type on lsblk output while it should be marked as 'part' type. Before: $ lsblk /dev/sda NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 128M 0 disk `-sda1 8:1 0 64M 0 disk With this patch applied: $ lsblk /dev/sda NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 128M 0 disk `-sda1 8:1 0 64M 0 part Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
2012-09-21lsblk: fix processing of dm partition mappingsPeter Rajnoha1-26/+42
As blkid_devno_to_wholedisk returns parent dm device for a partition mapping, the condition used in lsblk incorrectly checked the parent-child relationship. In this particular case, we need to process the dm partition mapping like any other non-partition device as dm devices always use proper holders/slaves sysfs hierarchy instead of /sys/block/<parent>/<name> that is used for real partitions. Example (test1 is a partition mapping and sdb1 is a real partition): $ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 128M 0 disk `-test (dm-0) 253:0 0 128M 0 dm `-test1 (dm-1) 253:1 0 127M 0 part sdb 8:16 0 128M 0 disk `-sdb1 8:17 0 127M 0 disk Before this patch (test1 skipped!): $ lsblk -s /dev/mapper/test1 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT test (dm-0) 253:0 0 128M 0 dm `-sda 8:0 0 128M 0 disk $ lsblk -s /dev/sdb1 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb1 8:17 0 127M 0 disk `-sdb 8:16 0 128M 0 disk With this patch (test1 processed correctly): $ lsblk -s /dev/mapper/test1 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT test1 (dm-1) 253:1 0 127M 0 part `-test (dm-0) 253:0 0 128M 0 dm `-sda 8:0 0 128M 0 disk $ lsblk -s /dev/sdb1 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb1 8:17 0 127M 0 disk `-sdb 8:16 0 128M 0 disk
2012-09-04textual: fix typos in messagesYuri Chornoivan1-1/+1
2012-09-04lsblk: add add_random columnsMilan Broz1-0/+7
Allow printing of queue/add_random attribute which describes if device adds randomness to kernel RNG pool. Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-08-14lsblk: add WWN, improve udev supportKarel Zak1-13/+37
* read WWN from udev DB * use *_ENC properties from udev DB to get original unmodified strings (otherwise for example blank space is replaced with '_' in ID_FS_LABEL) * always read from udev, libblkid is fallback solution only Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-26lsblk: support -o +<attr> for adding attribute to output fields.Milan Broz1-5/+6
Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-07-26lsblk: add read-ahead column.Milan Broz1-0/+8
Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-07-26lsblk: use err_exclusive_options()Karel Zak1-19/+12
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-25lsblk: fix dm_name usageKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-21lsblk: check sysfs_read_u64 return code [coverity scan]Karel Zak1-2/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-21lsblk: check ioctl result [coverity scan]Karel Zak1-1/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-19lsblk: fix usage, improve exclude/include lists parsingKarel Zak1-8/+17
Reported-by: Bernhard Voelker <mail@bernhard-voelker.de> Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-19lsblk: add --include optionKarel Zak1-11/+59
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-19Merge branch '2012wk24' of git://github.com/kerolasa/lelux-utiliteetitKarel Zak1-12/+20
* '2012wk24' of git://github.com/kerolasa/lelux-utiliteetit: (24 commits) more: fix pointer wrap around compiler warnings more: fix search repetition regression lscpu: values in /proc/bus/pci/devices are always unsigned scriptreplay: fix compiler format warning lib/mbsalign: abort() when non-expected case is encountered mkfs.cramfs: disallow unknown command line options fsck.cramfs: disallow unknown command line options setarch: disallow unknown command line options hexdump: print sensible message when all input file arguments fail mount: (new) use exclusive_option() dmesg: use exclusive_option() wipefs: use exclusive_option() wdctl: correct manual section reference wdctl: use exclusive_option() prlimit: use exclusive_option() lscpu: use exclusive_option() losetup: use exclusive_option() chcpu: use exclusive_option() lsblk: use exclusive_option() findmnt: use exclusive_option() ...
2012-06-19lsblk: permit option --exclude more than onceBernhard Voelker1-4/+2
Previously, `lsblk -e 8 -e 11` did not exlude maj:8 as requested. Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2012-06-17lsblk: use exclusive_option()Sami Kerola1-12/+20
This commit fixes exclusions which where meant to happen, but where not successful. For example lsblk -r -l # did exclude lsblk -l -r # did not exclude Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-15lsblk: use fallback for TYPEKarel Zak1-2/+7
... bug introduced by 1edd8af70b4794c796d0faed0cf763ff3474b92e Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-11lsblk: use blkdev_scsi_type_to_name()Sami Kerola1-17/+1
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>
2012-05-03lsblk: fix /sys/.../ro usageKarel Zak1-1/+1
Reported-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-26lsblk: remove private \x<hex> coding, decode data from udevKarel Zak1-38/+12
* remove private encoding code (all encoding will be in lib/tt.c) * decode LABELs from udev Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-19lsblk: add support for PARTUUID= and PARTLABEL=Karel Zak1-6/+39
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-04misc-utils: verify writing to streams was successfulSami Kerola1-0/+2
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04lsblk: count with terminating character, man page -s entryPeter Rajnoha1-1/+1
Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
2012-04-03lsblk: use libmount to get mountpoints/swapsKarel Zak1-12/+63
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-20misc: clenaup SIZE columns in lsblk and findmntKarel Zak1-1/+1
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>
2012-03-18xalloc: use xasprintf in all filesSami Kerola1-1/+1
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-08lsblk: add --version switchMilan Broz1-5/+11
[kzak@redhat.com: - update usage() and man page] Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-03-08lsblk: escape unsafe chars in parsable outputKarel Zak1-8/+38
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-07lsblk: use readlink_at from at.cKarel Zak1-9/+24
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-07lsblk: add inverse tree support (-s)Peter Rajnoha1-54/+160
$ 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>
2012-03-07lsblk: remove (dm-N) from NAME for raw/pair output formatKarel Zak1-2/+7
$ 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>
2012-02-24docs: corrections to FSF license files, and postal addressSami Kerola1-3/+3
The COPYING and Documentation/licenses/COPYING* files are being replaced by files from GNU web site. http://www.gnu.org/licenses/gpl-2.0.txt http://www.gnu.org/licenses/lgpl-2.1.txt Postal addresses to FSF in other files are updated to match with the address in license files. Reference: http://lists.gnu.org/archive/html/freefont-announce/2005-04/msg00001.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-03lsblk: check stat() return codeKarel Zak1-5/+9
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-16lsblk: add UUID to --fs outputKarel Zak1-0/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-10lib,tt: add TT_FL_NOEXTREMESKarel Zak1-1/+1
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>
2011-11-02lsblk: remove __NCOLUMNSDavidlohr Bueso1-10/+10
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>
2011-10-10lsblk: inform about depencency to /sys/dev/blockSami Kerola1-0/+9
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>
2011-10-03lsblk: add udev supportIlias Mamedov1-4/+45
[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>
2011-08-02textual: add some guiding comments for translatorsBenno Schulenberg1-0/+1
These are picked up by xgettext and put in the POT file. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-02lsblk: correct mistaken wordBenno Schulenberg1-1/+1
Reported-by: Petr Písař <petr.pisar@atlas.cz> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-01lsblk: fix compiler warnings [-Wsign-compare]Karel Zak1-3/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-29misc: use unsigned int for bit-filedsKarel Zak1-4/+4
Reported-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-27include: [strutils.c] add list parsersKarel Zak1-2/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-27include; [tt.c] check for array size in columns parserKarel Zak1-2/+5
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-21lsblk: ignore device if disappear while processingMilan Broz1-23/+48
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>
2011-07-15lsblk: add queue request size attributeMilan Broz1-0/+8
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>
2011-07-15lsblk: add state attributeMilan Broz1-0/+13
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>
2011-05-26This adds a second parameter to size_to_human_string() to return aFrancesco Cosoleto1-3/+3
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>
2011-05-18lsblk: use sysfs_read_u64() rather than sysfs_strdup() + atol()Karel Zak1-7/+19
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-18lib: [sysfs.c] make sysfs_read_* function more robustKarel Zak1-4/+9
The functions does not modify result if the requested sysfs attribute does not exist. Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-18lsblk: improve discard supportMartin K. Petersen1-4/+9
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>
2011-05-16lsblk: use generic sysfs functionsKarel Zak1-201/+47
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-10lsblk: add --pairs to output in key="value" formatKarel Zak1-5/+12
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-05lsblk: add support for discard topology (-D option)Martin K. Petersen1-3/+44
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>
2011-03-11lsblk: fix strtoul() usage [coverity scan]Karel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-11lsblk: use ssize_t for readlink() return codeKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-10lsblk: add TYPE column to lsblk outputMilan Broz1-1/+75
[kzak@redhat.com: - fix leaks - use lowercase for TYPEs] Signed-off-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-03move struct option to .rodataKarel Zak1-1/+1
It does not make sense to have writable large arrays of "struct option" on the stack. Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-21lsblk: bitwise or TT_FL_ASCII with tt_flags instead of settingDave Reisner1-1/+1
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-02-18lsblk: fix readlink() usageKarel Zak1-2/+2
Reported-by: Steve Grubb <sgrubb@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-16textual: fix three typos in message strings and improve consistencyBenno Schulenberg1-1/+1
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-02-14build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen1-1/+1
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>
2011-02-11partx, lsblk: fix gettext callsKarel Zak1-1/+1
Reported-by: Peter Breitenlohner <peb@mppmu.mpg.de> Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-10lsblk: use "RM" for removableKarel Zak1-4/+4
Suggested by Przemoc <noreply-comment@blogger.com> at my blog. Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-04remove duplicate includesKarel Zak1-1/+0
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-26lsblk: rename "RA" column to "RE"Karel Zak1-4/+4
The RA abbreviation is usually used for readahead, the column in lsblk(8) means removable. Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-16lsblk: add --nodepsKarel Zak1-1/+11
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-10fix __noreturn__ usageKarel Zak1-2/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-09partx: complete rewriteDavidlohr Bueso1-46/+0
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-24build-sys: fix lsblk buildingKarel Zak1-2/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-24lsblk: add new utilityMilan Broz1-0/+1062
Signed-off-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>