It seems like overkill to provide this #ifdef. For example coreutils
use "char *" for all selinux contexts (since 2014).
Signed-off-by: Karel Zak <kzak@redhat.com>
It seems the current kernel can create a loop devices with a different
major number. For example
# losetup /dev/loop12345678 file.img
# lsblk /dev/loop12345678
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop12345678 15:811342 0 5M 0 loop
We need a way how to verify the device is loopdev also when the device is
not associated with any backing file -- in this case there is no "loop"
directory in /sys/dev/block/<maj:min>/, but we can cannonicalize this sysfs
symlink as it points to /sys/devices/virtual/block/loop<n> (see "loop" in
the path).
Note that without this change losetup is not able to list and delete
the loop device.
Addresses: https://github.com/karelzak/util-linux/issues/1202
Signed-off-by: Karel Zak <kzak@redhat.com>
Easiest way to get rid of the following warning is to ignore the warning.
This might cause people who use non-GNU make to have hard time, but are
there such people compiling this project?
sys-utils/Makemodule.am:226: warning: addprefix sys-utils/,$(SETARCH_LINKS: non-POSIX variable name
sys-utils/Makemodule.am:226: (probably a GNU make extension)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The current GFS2 prober hard codes superblock constants, but these
constants are affected by GFS2 development.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1913844
Signed-off-by: Karel Zak <kzak@redhat.com>
It displays filesystem root attached to system, for example
btrfs with two mounted subvolumes:
$ lsblk -oNAME,SIZE,MOUNTPOINTS,FSROOTS /dev/sdc1
NAME SIZE MOUNTPOINTS FSROOTS
sdc1 50M /mnt/A /foo
/mnt/B /bar
Signed-off-by: Karel Zak <kzak@redhat.com>
* add libmount FS to struct lsblk_device
* add new column MOUNTPOINTS (pl.) with multi-line cells to display
all mountpoints relevant for the device
* the old MOUNTPOINT is backwardly compatible and it (usually) displays the
last device mountpoint from /proc/self/mountinfo
For example btrfs with more subvolumes:
$ lsblk -o+MOUNTPOINTS /dev/sdc1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT MOUNTPOINTS
sdc1 8:33 0 50M 0 part /mnt/test /mnt/A
/mnt/test
/mnt/B
Note, in this case MOUNTPOINT displays mount point where is mounted
root of the filesystem.
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch add support to format multi-line cells (columns with
SCOLS_FL_WRAP) to arrays in JSON output.
For example mountpoints[] in lsblk output:
Normal output:
$ lsblk -oNAME,FSTYPE,TYPE,MOUNTPOINTS /dev/sdc1
NAME FSTYPE TYPE MOUNTPOINTS
sdc1 btrfs part /mnt/A
/mnt/test
/mnt/B
JSON output:
$ lsblk -J -oNAME,FSTYPE,TYPE,MOUNTPOINTS /dev/sdc1
{
"blockdevices": [
{
"name": "sdc1",
"fstype": "btrfs",
"type": "part",
"mountpoints": [
"/mnt/A",
"/mnt/test",
"/mnt/B"
]
}
]
}
Signed-off-by: Karel Zak <kzak@redhat.com>
The function mnt_fs_is_swaparea() does not return TRUE for entries
from /proc/swaps. This is pretty strange.
Signed-off-by: Karel Zak <kzak@redhat.com>
GNU libc's getopt_long(3) have the tradition of not shuffling arguments
to find options when either POSIXLY_CORRECT is defined in environment
variables or '+' prepended in short options. Hence, the current code
base is fine as is fine as is for util-linux built with GNU libc.
However, musl libc only honour POSIX convention when short options
prepended with '+'. musl libc doesn't care about POSIXLY_CORRECT.
Thus, the behaviour of util-linux's getopt(1) that linked with musl-libc
doesn't match with its own documentation.
Let's make sure a '+' is always prepended to short options if
POSIXLY_CORRECT is defined.
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
* '2020wk47' of https://github.com/kerolasa/util-linux:
build-sys: sort various lists in configure.ac
mkswap: tell how to fix insecure permissions and owner in warning
lsipc: make default output byte sizes to be in human units
man: add missing backslash to caret printing macro
lscpu: fix variable shadowing
uuidgen: give hint in usage() what uuid namepaces can be used
uuidgen: use errx() rather than fprintf() when priting errors
libuuid: simplify uuid_is_null() check
uuidparse: use uuid type definitions from libuuid header
uuidparse: use libuuid function to test nil uuid
This is difference between (c)fdisk and GNU Parted, fdisks keep all
changes in memory until user explicitly ask for write operation.
Addresses: https://github.com/karelzak/util-linux/pull/1227
Signed-off-by: Karel Zak <kzak@redhat.com>
The man-page indicates that mount expects UUIDs to be lower case.
Mention that NTFS and FAT volume IDs are to be specified in upper case.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Recent request to make ipcs(1) list sizes in human format caused the
observation lsipc(1) is not doing that either. This commit changes sizes to
human format, assuming --bytes option is not used.
Reference: https://github.com/karelzak/util-linux/issues/1199
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/lscpu-virt.c: In function ‘lscpu_read_virtualization’:
sys-utils/lscpu-virt.c:574:9: warning: declaration of ‘buf’ shadows a previous local [-Wshadow]
574 | char buf[256];
| ^~~
sys-utils/lscpu-virt.c:506:7: note: shadowed declaration is here
506 | char buf[BUFSIZ];
| ^~~
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
There is no need to check uuid byte by byte. Also by using size of the uuid
type magic constant can be avoided.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
A 33553920 byte optimal I/O size arises from badly-implemented USB SATA
adapters reporting 0xffff 512 byte sectors (32 MiB - 512). Commit
acb7651f88 indirectly addresses this by
ignoring the optimal I/O size if it's not a multiple of the physical
sector size. That works if the physical sector size is 4096, but
33553920 optimal is allowed for 512 physical.
This commit explicitly ignores 33553920, as there is no legitimate
situation where this number would be the real optimal I/O size.
Signed-off-by: Ryan Finnie <ryan@finnie.org>
Closes: https://github.com/karelzak/util-linux/issues/1221