Commit graph

25 commits

Author SHA1 Message Date
Milan Broz
01e487c020 lsblk: add state attribute
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-07-15 15:35:10 +02:00
Francesco Cosoleto
5d2a98490e This adds a second parameter to size_to_human_string() to return a
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-26 15:32:33 +02:00
Karel Zak
9cfe1b9c6a lsblk: use sysfs_read_u64() rather than sysfs_strdup() + atol()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-18 12:17:43 +02:00
Karel Zak
90e9fcda3b lib: [sysfs.c] make sysfs_read_* function more robust
The functions does not modify result if the requested sysfs attribute
does not exist.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-18 11:57:17 +02:00
Martin K. Petersen
98055888e9 lsblk: improve discard support
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-18 11:13:36 +02:00
Karel Zak
766ab9b08d lsblk: use generic sysfs functions
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-16 20:22:52 +02:00
Karel Zak
6ea1bdd32c lsblk: add --pairs to output in key="value" format
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-10 10:38:29 +02:00
Martin K. Petersen
2d2322461c lsblk: add support for discard topology (-D option)
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-05-05 10:09:26 +02:00
Karel Zak
ed34643cbc lsblk: fix strtoul() usage [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-11 13:36:00 +01:00
Karel Zak
eb9a65bb54 lsblk: use ssize_t for readlink() return code
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-11 10:49:08 +01:00
Milan Broz
18eac5bad9 lsblk: add TYPE column to lsblk output
[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-10 15:49:36 +01:00
Karel Zak
6c7d5ae9a2 move struct option to .rodata
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-03-03 15:00:30 +01:00
Dave Reisner
449f9336bb lsblk: bitwise or TT_FL_ASCII with tt_flags instead of setting
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-02-21 17:10:55 +01:00
Karel Zak
cc6b1d11ea lsblk: fix readlink() usage
Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-18 14:36:04 +01:00
Benno Schulenberg
e22d8b9519 textual: fix three typos in message strings and improve consistency
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-02-16 15:30:13 +01:00
Fabian Groffen
eb76ca98b0 build-sys: provide alternatives for err, errx, warn and warnx
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-14 17:45:24 +01:00
Karel Zak
d015794e09 partx, lsblk: fix gettext calls
Reported-by: Peter Breitenlohner <peb@mppmu.mpg.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-11 09:06:27 +01:00
Karel Zak
627970a7f9 lsblk: use "RM" for removable
Suggested by Przemoc <noreply-comment@blogger.com> at my blog.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-10 11:18:51 +01:00
Karel Zak
218f9d3d66 remove duplicate includes
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-01-04 22:36:09 +01:00
Karel Zak
61cbc01a89 lsblk: rename "RA" column to "RE"
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-26 23:53:21 +01:00
Karel Zak
f31505fe03 lsblk: add --nodeps
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-16 12:47:30 +01:00
Karel Zak
abafd68667 fix __noreturn__ usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-10 16:47:18 +01:00
Davidlohr Bueso
c4ecaf21d5 partx: complete rewrite
Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-09 21:54:17 +01:00
Karel Zak
f77fa578e3 build-sys: fix lsblk building
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-24 18:16:44 +01:00
Milan Broz
2a4c734bee lsblk: add new utility
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-24 17:08:32 +01:00