* remove NAMELEN, use PATH_MAX
* mark global variables as static
* move all global variables to the begin of the code
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'hardlink' of https://github.com/rudimeier/util-linux: (25 commits)
hardlink: add first simple tests
hardlink: util-linux usage
hardlink: fix compiler warnings
hardlink: style indentations and license header
hardlink: enable build with and without pcre2
fixes for the fixes
temporal fix before re-patch (updates from Fedora repo)
Update hardlink.1
Fixed version number, added changelog about Todd Lewis' patch
exclude files via pcre
Fixed 32 bit build with gcc7 (RH Bugzilla ID 1422989)
spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); update FSF address at .c source file
Revert "spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); current FSF address at .c source file"
spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); current FSF address at .c source file
Mention -f option in the man page
do not allow to hardlink files across filesystems by default (#786719) (use -f option to override)
fix possible buffer overflows, integer overflows, update man page
fix URL and remove mmap() (#676962, #672917)
- update docs to describe highest verbosity -vv option (#210816) - use dist Resolves: 210816
mostly spec cleanup
...
The function colors_init() checks for colors, it means it fails
on monochrome terminals, but cal(1) in this case still need to
highlight the current day.
Reported-by: Nuno Silva <nunojsilva@ist.utl.pt>
Signed-off-by: Karel Zak <kzak@redhat.com>
this is deemed a useful special case since journalctl will only show
either the first or last element of the message array if the field
appears multiple times.
Based on patch from: Kjetil Torgrim Homme <kjetil.homme@redpill-linpro.com>
https://github.com/karelzak/util-linux/pull/743
Addresses: https://github.com/karelzak/util-linux/issues/742
Signed-off-by: Karel Zak <kzak@redhat.com>
blkid(8) in high-level mode checks partitions and unpartitioned
whole-disk devices from the file /proc/partitions.
The current heuristic assumes that partition name ends with a digit.
Unfortunately, this is not correct -- for example md0 or nvme0n1 are
whole-disk devices.
This commit uses sysfs_devno_is_wholedisk() to make sure the device is
a partition (according to kernel or DM). It's probably more expensive,
because this way requires more syscalls (to read stuff from /sys etc.).
The patch also adds more information to the blkid(8) man page.
Addresses: https://github.com/karelzak/util-linux/issues/728
Signed-off-by: Karel Zak <kzak@redhat.com>
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>
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>
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>
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>
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>
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>
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>
The patch does not change code logic and semantic -- just rename.
* set_cxt() to set_device()
* struct blkdev_cxt to lsblk_device
Signed-off-by: Karel Zak <kzak@redhat.com>
* add struct ul_timer as API abstraction to hide differences between
timer_create() and setitimer()
* add setitimer() detection to ./configure.ac
* add fallback code to use setitimer() if timer_create() not available
(for example on OSX)
Addresses: https://github.com/karelzak/util-linux/issues/584
Signed-off-by: Karel Zak <kzak@redhat.com>
blkid(8) returns information from partition table also for empty
partitions. This is necessary for example for udev, but it could be
confusing if you care about on-device content only.
Default:
# blkid -p /dev/md0p1; echo $?
/dev/md0p1: PART_ENTRY_SCHEME="dos" PART_ENTRY_UUID="6d8796b1-01" PART_ENTRY_TYPE="0x83" PART_ENTRY_NUMBER="1" PART_ENTRY_OFFSET="2048" PART_ENTRY_SIZE="204800" PART_ENTRY_DISK="9:0"
0
With --no-part-details:
# blkid -p /dev/md0p1 --no-part-details; echo $?
2
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1653413
Signed-off-by: Karel Zak <kzak@redhat.com>
This limits what the uuid daemon has access to when it runs.
Further improving this with additional option or making
things even tighter is most likely possible.
Signed-off-by: Andreas Henriksson <andreas@fatal.se>