The original Julian's hardlink.c code is pretty readable, but for
util-linux we use a little different indention (aka Linux kernel
coding style).
Signed-off-by: Karel Zak <kzak@redhat.com>
We usually use "debug" for very detailed information. For end-user
information is better to talk about "verbose" output.
Signed-off-by: Karel Zak <kzak@redhat.com>
* use config.h like other code on package
* use c.h and remove from code stuff defined in the header file
* remove FALSE/TRUE redefinition
Signed-off-by: Karel Zak <kzak@redhat.com>
The current version used in util-linux is based on original code from
Jakub Jelinek.
The new version is based on Debian implementation from
https://salsa.debian.org/jak/hardlink. This new version uses nftw()
to walk on directories tree and organize internal data binary tree
(tsearch() and twalk()). This new version provides more features like
--ignore-{mode,owner,time}, --respect-xattrs, --respect-name,
--include, --keep-oldest, --minimize, --maximize, etc.
Note that the new version uses -f for --respect-name, the old version
uses -f to hardlinking across filesystems (very probably rarely unused
feature).
Addresses: https://github.com/karelzak/util-linux/issues/808
Signed-off-by: Karel Zak <kzak@redhat.com>
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>
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 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>
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
We encode to "safe" strings almost all variables for 'blkid -o udev'
and we need it also for SYSTEM_ID, PUBLISHER_ID, APPLICATION_ID,
BOOT_SYSTEM_ID and recently added VOLUME_SET_ID and DATA_PREPARER_ID.
This change makes blkid from util-linux more compatible with built-in
udevd blkid.
Addresses: https://github.com/karelzak/util-linux/pull/1215 (commit 5cbffdb74f)
Signed-off-by: Karel Zak <kzak@redhat.com>
The shells are very restrictive about variable names, only [:alnum:]
chars are allowed (and alphabetic chars as the first char). The
library will replace "bad" chars with "_". The char '%' at the end is
replaced by _PCT.
Addresses: https://github.com/karelzak/util-linux/issues/1201
Signed-off-by: Karel Zak <kzak@redhat.com>
* pali/multisesssion:
libblkid: udf: add support for unclosed sequential Write-Once media
libblkid: udf: add support for multisession via session_offset hint
libblkid: iso9660: add support for multisession via session_offset hint
libblkid: fix blkid_probe_get_sb() to use hint offset calculation
libblkid: allow to specify offset defined by hint for blkid_probe_get_idmag()
libblkid: detect session_offset hint for optical discs
libblkid: do size correction of optical discs also by last written sector
libblkid: detect CD/DVD discs in packet writing mode
libblkid: overwrite existing hint
libblkid: export blkid_probe_reset_hints()
blkid: add --hint <name>=value
libblkid: add blkid_probe_{set,get}_hint()
* sami/uuidd-work:
uuidd: fix misleading indentation
uuidd: make timeout to take effect when debug is not defined
uuidd: remove unnecessary bulk request size limit
uuidd: add uuidd specific data types that are used in protocol
uuidd: reorder bulk time and random generation code
uuidd: document uuidd protocol
uuidd: override operation type when performing bulk request
uuidd: move option parsing to separate function
uuidd: add command-line option values struct
uuidd: use pid_t type when referring to process id
This is unnecessary, we have ${docsdir}/util-linux which is good
enough for these two getopt examples. I guess the "getopt"
subdirectory is legacy from time getopt has been merged into
util-linux.
Signed-off-by: Karel Zak <kzak@redhat.com>
This dependence is defined by
$ cat /sys/class/pktcdvd/device_map
pktcdvd0 252:0 11:0
Unfortunately, there is not any direct sysfs way how to refer this
relationship in /sys/{block,dev/block}. So, we have to read the
device_map file and then compare device numbers with the list.
$ lsblk /dev/sr0
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
└─pktcdvd0 252:0 1 0B 0 disk
Addresses: https://github.com/karelzak/util-linux/issues/1185
Signed-off-by: Karel Zak <kzak@redhat.com>
The trailing comma made code to compile without issues, but meant all_done()
was called only when --debug was in defined in command-line.
Fixes: 3d6250e96b
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Limiting random query to 1000 uuid's was pointless when the next line will
further restrict upper limit to 63 entries. The 63 entries is what fits to
the uuidd communication buffer with the header.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Use a typedef for types that are sensitive what comes to uuidd protocol
field widths, read write sizes, and related checks.
Proposed-by: Karel Zak <kzak@redhat.com>
Reference: https://github.com/karelzak/util-linux/pull/1196#discussion_r528595794
Signed-off-by: Sami Kerola <kerolasa@iki.fi>