misc-utils/wipefs.c: In function ‘main’:
misc-utils/wipefs.c:838:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
misc-utils/wipefs.c:838:3: note: use option -std=c99 or -std=gnu99 to compile your code
Signed-off-by: Karel Zak <kzak@redhat.com>
UINT64_MAX is 18446744073709551615, but 2^64 is 18446744073709551616.
We also need to use kbytes in all calculation in the test than bytes
as ipcs by default do not use bytes anymore.
Signed-off-by: Karel Zak <kzak@redhat.com>
The previous commit 7a08784ab0 reduced
number of situation when we need fallback when kbytes calculated for
shmall pages, but there is still possible to see overflows.
This patch add fallback also for kbytes.
Signed-off-by: Karel Zak <kzak@redhat.com>
Linux kernel since 6730e6580177d13f4612767873cb5a533ad63c61 checks for
limits and kernel ipc/utils.h defines
#define IPCMNI_SHIFT 15
#define IPCMNI (1 << IPCMNI_SHIFT)
it means 32768 (aka shortint max). Let's use it in our tests too to
avoid "Invalid argument" when write to /proc/sys/kernel/shmmni.
Signed-off-by: Karel Zak <kzak@redhat.com>
Avoid computing the number of bytes in shmall, by only
computing and printing the number of Kbytes. This avoids
some overflows, e.g.
$ echo "4503599627370496" > /proc/sys/kernel/shmall
$ ipcs -l | grep 'max total shared memory'
Before:
max total shared memory (kbytes) = 18014398509481980
After:
max total shared memory (kbytes) = 18014398509481984
$ echo "99993599627370500" > /proc/sys/kernel/shmall
99993599627370500
$ ipcs -l | grep 'max total shared memory'
Before:
max total shared memory (kbytes) = 18014398509481980
After:
max total shared memory (kbytes) = 399974398509482000
v1->v2:
Print the non-overflow KB value only for IPC_UNIT_KB and
IPC_UNIT_DEFAULT.
This way --bytes and --human options will still get an expected
output
(but not avoiding the overflow).
Signed-off-by: Vasilis Liaskovitis <vliaskovitis@suse.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
It might be useful for security auditing purposes list all possible
mount flags/options including default set which are normally not listed.
This patch adds "--vfs-all" option to list all fs-independent flags
on VFS-OPTIONS column, as well as libmount funcionality to accomplish
it.
i.e.:
$ findmnt -o VFS-OPTIONS
VFS-OPTIONS
rw,relatime
rw,nosuid,nodev,noexec,relatime
rw,nosuid,nodev,noexec,relatime
ro,nosuid,nodev,noexec
...
$ findmnt --vfs-all -o VFS-OPTIONS
VFS-OPTIONS
rw,exec,suid,dev,async,loud,nomand,atime,noiversion,diratime,relatime,nostrictatime,nolazytime,symfollow
rw,noexec,nosuid,nodev,async,loud,nomand,atime,noiversion,diratime,relatime,nostrictatime,nolazytime,symfollow
rw,noexec,nosuid,nodev,async,loud,nomand,atime,noiversion,diratime,relatime,nostrictatime,nolazytime,symfollow
ro,noexec,nosuid,nodev,async,loud,nomand,atime,noiversion,diratime,norelatime,nostrictatime,nolazytime,symfollow
...
[kzak@redhat.com: - cleanup coding style and comments]
Signed-off-by: Roberto Bergantinos Corpas <rbergant@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
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>