summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* tests: check for tar and {b,g}zipKarel Zak2018-12-112-0/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (umount) make mnt_stat_mountpoin() usable for relative pathsKarel Zak2018-12-101-1/+1
| | | | | | | | | # mount -o loop devicefile /mnt/test # umount devicefile umount: devicefile: not mounted. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1653781 Signed-off-by: Karel Zak <kzak@redhat.com>
* umount: fix --quietKarel Zak2018-12-101-1/+1
| | | | | Addresses: https://github.com/karelzak/util-linux/commit/d5fd9ac6b208c5acdb6c0023757a7e2827474482#commitcomment-31610748 Signed-off-by: Karel Zak <kzak@redhat.com>
* choom: fix negative adjust score usageKarel Zak2018-12-103-1/+24
| | | | | | | | It's really bad idea to use uint64_t (ul_path_write_u64(()) when write signed number. Addresses: https://github.com/karelzak/util-linux/issues/723 Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: fix man page typosSeth Girvan2018-12-104-10/+10
| | | | Signed-off-by: Seth Girvan <snth@snthhacks.com>
* fstrim: fix usage()Karel Zak2018-12-101-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch '2018wk48' of https://github.com/kerolasa/util-linuxKarel Zak2018-12-101-1/+1
|\ | | | | | | | | * '2018wk48' of https://github.com/kerolasa/util-linux: include/c: check returns_nonnull function attribute with __GNUC_PREREQ
| * include/c: check returns_nonnull function attribute with __GNUC_PREREQSami Kerola2018-12-021-1/+1
| | | | | | | | | | | | | | | | | | Karel pointed out previous commit could have been better in github feedback, so lets use the version check macro instead of compare versions directly. Previous-commit: f1b327f8d5c8de7bf7fae99e85765d0954a25bac Reference: https://github.com/karelzak/util-linux/pull/704#issuecomment-432605211 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | fstrim: trim also root FS on --fstabKarel Zak2018-12-102-1/+19
| | | | | | | | | | | | | | | | | | The root fs ("/") is optional in many case in /etc/fstab. This patch forces fstrim to read kernel command line for the root= option to get root FS if the entry is missing in your fstab. Addresses: https://github.com/karelzak/util-linux/issues/719 Signed-off-by: Karel Zak <kzak@redhat.com>
* | libmount: export mnt_guess_system_root() by APIKarel Zak2018-12-105-2/+13
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: add --mergeKarel Zak2018-12-075-47/+112
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libsmartcols: add grouping API docsKarel Zak2018-12-071-0/+13
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libsmartcols: add grouping samplesKarel Zak2018-12-073-0/+290
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libsmartcols: add lines grouping supportKarel Zak2018-12-0713-62/+1177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For some use-case we need to describe M:N relation between output lines. The nice examples are RAIDs or multi-path devices in lsblk output. NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 955.7M 0 loop ┌┈▶ ├─test-thin-metadata 253:0 0 2M 0 dm └┬▶ └─test-thin-data 253:1 0 953.7M 0 dm └┈┈test-thin-pool 253:2 0 953.7M 0 dm In this example two line (test-thin-metadata and test-thin-data) are parents for another line (test-thin-pool). The new API uses term "group" for parental line -- the number of group members is unlimited and every group has at least one child. It's possible that group's child is member of another group: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 955.7M 0 loop ┌┈▶ ├─test-thin-metadata 253:0 0 2M 0 dm └┬▶ └─test-thin-data 253:1 0 953.7M 0 dm ┌┈▶ └┈┈test-thin-pool 253:2 0 953.7M 0 dm ┆ └─test-thin 253:3 0 190.8M 0 dm └┬▶ loop1 7:1 0 190.8M 0 loop └┈┈┈┈┈test-thin-extsnap 253:4 0 190.8M 0 dm For now multi-group relation is unsupported and one line can be member of one group only. The library API and printing code is ready to support this feature, but not sure if we really need it. All what is necessary is to create array of groups in the line struct. Note that grouping is independent on standard parent->child relations between lines and grouping can connect arbitrary lines. The restriction is only that group child cannot be child of another line or child of another group. These cross reference are (and probably will be) impossible. The patch is relative large, but easy to review. Changes: * add new UTF symbols * add scols_symbols_set_group_* public API to modify new symbols * add struct libscols_group, used only internally * add "grpset" array to table struct -- the array is used to keep position of the group in the output. Every active group uses three items in the grpset. If there is more overlapping groups than bigger grpset is allocated. Signed-off-by: Karel Zak <kzak@redhat.com>
* | include/list: add list_entry_is_first() and list_count_entries()Karel Zak2018-12-071-0/+21
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libsmartcols: split print.c into print.c, put.c and print-api.cKarel Zak2018-12-075-312/+339
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libsmartcols: move width calculation to separate fileKarel Zak2018-12-074-395/+412
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libsmartcols: rename table_print.c to print.cKarel Zak2018-12-072-1/+1
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libsmartcols: move buffer stuff to buffer.cKarel Zak2018-12-074-134/+163
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libsmartcols: add another UTF symbolsKarel Zak2018-12-071-4/+7
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libsmartcols: add is_last_child(), move is_last_column()Karel Zak2018-12-072-17/+24
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: make devtree dependences more genericKarel Zak2018-12-072-29/+68
| | | | | | | | | | | | | | We also need reference from child to parent to implement multi-parent view. This change allows to walk on tree in both directions. Signed-off-by: Karel Zak <kzak@redhat.com>
* | docs: add lsblk --merge to TODOKarel Zak2018-12-071-6/+16
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: add --dedup <column>Karel Zak2018-12-074-11/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The target use-case are systems with large number of multi-path devices or systems with duplicate (copied) filesystems. The feature is flexible enough to use arbitrary column (for example WWM or UUID, ...) as de-duplication key. For example tree with multi-path devices sd{c,d,e,f} ./lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 223.6G 0 disk ├─sda1 8:1 0 200M 0 part /boot/efi ├─sda2 8:2 0 200M 0 part /boot ├─sda3 8:3 0 130.3G 0 part ├─sda4 8:4 0 50G 0 part / └─sda5 8:5 0 42.9G 0 part sdb 8:16 0 74.5G 0 disk └─sdb1 8:17 0 74.5G 0 part /home/archive sdc 8:32 0 100M 0 disk └─mpatha 253:0 0 100M 0 mpath ├─mpatha1 253:1 0 50M 0 part └─mpatha2 253:2 0 49M 0 part sdd 8:48 0 100M 0 disk └─mpatha 253:0 0 100M 0 mpath ├─mpatha1 253:1 0 50M 0 part └─mpatha2 253:2 0 49M 0 part sde 8:64 0 100M 0 disk └─mpatha 253:0 0 100M 0 mpath ├─mpatha1 253:1 0 50M 0 part └─mpatha2 253:2 0 49M 0 part sdf 8:80 0 100M 0 disk └─mpatha 253:0 0 100M 0 mpath ├─mpatha1 253:1 0 50M 0 part └─mpatha2 253:2 0 49M 0 part De-duplicate by WWN: ./lsblk -M WWN NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 223.6G 0 disk ├─sda1 8:1 0 200M 0 part /boot/efi ├─sda2 8:2 0 200M 0 part /boot ├─sda3 8:3 0 130.3G 0 part ├─sda4 8:4 0 50G 0 part / └─sda5 8:5 0 42.9G 0 part sdb 8:16 0 74.5G 0 disk └─sdb1 8:17 0 74.5G 0 part /home/archive sdc 8:32 0 100M 0 disk └─mpatha 253:0 0 100M 0 mpath ├─mpatha1 253:1 0 50M 0 part └─mpatha2 253:2 0 49M 0 part Addresses: https://github.com/karelzak/util-linux/issues/616 Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: remember whole-disk, remove unused struct memberKarel Zak2018-12-073-14/+18
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: make device_get_data() more genericKarel Zak2018-12-072-58/+78
| | | | | | | | | | | | | | * independent on smartcols line * keep sort data optional Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: apply --nodeps to partitions tooKarel Zak2018-12-071-3/+3
| | | | | | | | | | | | | | The new implementation differentiates between partitions and another dependences -- this is regression, we need root devices only. Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: read queue/discard_granularity only when necessaryKarel Zak2018-12-073-13/+20
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: reuse 'removable' flag from parentKarel Zak2018-12-073-6/+31
| | | | | | | | | | | | | | It's used in the default output, let's make it a little bit more effective. Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: don't keep sysfs dirs openKarel Zak2018-12-071-16/+46
| | | | | | | | | | | | | | Don't keep open sysfs file descriptors for all time to avoid problems on systems with huge number of block devices. Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/path: allow to close dirfdKarel Zak2018-12-072-3/+21
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: rename set_device()Karel Zak2018-12-071-6/+6
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: add commentsKarel Zak2018-12-071-12/+46
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: add process_all_devices_inverse()Karel Zak2018-12-071-35/+90
| | | | | | | | | | | | | | | | | | | | | | This is necessary to implement --inverse. Note that this new implementation scans /sys/dev/block/ to get top-level devices and than it calls process_one_device(). Note that standard non-inverse tree does not use process_one_device() as it's more effective to scan /sys/block where are no partitions. Signed-off-by: Karel Zak <kzak@redhat.com>
* | lib/sysfs: add function to detect partitioned devicesKarel Zak2018-12-072-0/+15
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: reorder functionsKarel Zak2018-12-071-56/+57
| | | | | | | | | | | | | | The goal is to call process_one_device() from process_all_devices(), so let's it keep in code in the right order. Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: make process_partitions() more readableKarel Zak2018-12-071-11/+11
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: remove unncessary parent pointerKarel Zak2018-12-072-33/+18Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: use real rather than hardcoded parentKarel Zak2018-12-071-4/+9
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: use devtree functionsKarel Zak2018-12-071-92/+104
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: add lsblk_device_has_dependence()Karel Zak2018-12-072-11/+29
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: process_one_device() refactoringKarel Zak2018-12-071-11/+24
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: add devtree_get_device_or_new()Karel Zak2018-12-071-13/+26
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: keep functions names consistentKarel Zak2018-12-071-12/+12
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: remove unused reset_device()Karel Zak2018-12-071-25/+0Star
| | | | | | | | | | | | Now all is maintained by reference counting ion the devtree. Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: fix devtree deallocationKarel Zak2018-12-072-15/+6Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: split sysfs reading and scols table fillingKarel Zak2018-12-071-22/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change allows read devices from sysfs only once and reuse device properties if the device is references more than once in the tree (RAIDs, etc.). * every device is in the tree only once (tree->devices list) * iterate_block_devices() reuse already read devices (for example if already read for any dependence) * the smartscols table is build from the final tree The patch temporary disables dependencies evaluation (in process_blkdev() to keep the patch small and simple. Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: cleanup device reference in the treeKarel Zak2018-12-072-4/+37
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: remove badly named debug interface nameKarel Zak2018-12-072-22/+21Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | lsblk: add basic function to build devices treeKarel Zak2018-12-073-3/+354
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>