Compare commits
84 commits
master
...
stable/v2.
Author | SHA1 | Date | |
---|---|---|---|
|
e98ef85a8f | ||
|
12169133ee | ||
|
508e251108 | ||
|
6b865e1b01 | ||
|
aa4f94cb56 | ||
|
cad75b6356 | ||
|
8acfe93b77 | ||
|
5f31e774c5 | ||
|
29626b0956 | ||
|
90835e74a8 | ||
|
7826c3ebee | ||
|
07e6b9a127 | ||
|
cc99bfd06a | ||
|
3b59942da4 | ||
|
4746cf9368 | ||
|
a34e6aced4 | ||
|
423d9efabb | ||
|
8feec98a8f | ||
|
36ce0c2501 | ||
|
1943ad6cd5 | ||
|
174f2b3904 | ||
|
1a4522541b | ||
|
3aba3fb95b | ||
|
c289c152a3 | ||
|
665e28c302 | ||
|
d9fca2b62e | ||
|
d84ee5a461 | ||
|
c50da4b07a | ||
|
d5adeed7a2 | ||
|
868f7f10ce | ||
|
2278e2f913 | ||
|
d8a4e680f3 | ||
|
f5765e238b | ||
|
22d0a65571 | ||
|
205e88e51c | ||
|
aebfa97d54 | ||
|
bbe24d5b10 | ||
|
bc58e3b35d | ||
|
f5a411883d | ||
|
64e67f720f | ||
|
4c3c050064 | ||
|
58c107277a | ||
|
8549017af9 | ||
|
fa818dc8df | ||
|
1e9fc724e4 | ||
|
53ff0fcdab | ||
|
1a4b5c832c | ||
|
61307a950f | ||
|
8c85b08057 | ||
|
5004732d8c | ||
|
c082e6182f | ||
|
b04446bfd4 | ||
|
9429cc72b5 | ||
|
198fd3fb2c | ||
|
20c04a5097 | ||
|
9d4d768f2d | ||
|
98ed3edf8e | ||
|
f25cc33724 | ||
|
760c016418 | ||
|
ddf48064fb | ||
|
230459358a | ||
|
6fa034d0a9 | ||
|
f8c9ef62e4 | ||
|
9422991c92 | ||
|
2806759b5a | ||
|
01e3ec5150 | ||
|
16e5dccf83 | ||
|
00a19fb8cd | ||
|
158639a2a4 | ||
|
43926e0b04 | ||
|
01bb5d12d7 | ||
|
da22c179c2 | ||
|
1bfc285fa0 | ||
|
66fac3e71f | ||
|
d2e3ac9595 | ||
|
a369feacc5 | ||
|
f084562c36 | ||
|
88f76e37a2 | ||
|
f65c49002f | ||
|
ddf9b36ea4 | ||
|
0d0766fbe5 | ||
|
873a896e02 | ||
|
69d8400e40 | ||
|
0ee8ac0652 |
124 changed files with 93397 additions and 15138 deletions
2
.github/workflows/cibuild-setup-ubuntu.sh
vendored
2
.github/workflows/cibuild-setup-ubuntu.sh
vendored
|
@ -2,6 +2,8 @@
|
|||
|
||||
set -ex
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
apt-get -y update --fix-missing
|
||||
|
||||
# Xenial uses btrfs-tools, but since Focal it's btrfs-progs
|
||||
|
|
2
AUTHORS
2
AUTHORS
|
@ -397,6 +397,7 @@ CONTRIBUTORS:
|
|||
Helmut Grohne <helmut@subdivi.de>
|
||||
Hendrik Lönngren <wikibugs@googlemail.com>
|
||||
Henne Vogelsang <hvogel@opensuse.org>
|
||||
Hennie Botha <42469385+theHenMan@users.noreply.github.com>
|
||||
Hideki EIRAKU <hdk@igel.co.jp>
|
||||
Hill Ma <maahiuzeon@gmail.com>
|
||||
Hiroaki Sengoku <sengoku@senri.gcd.org>
|
||||
|
@ -750,6 +751,7 @@ CONTRIBUTORS:
|
|||
ratijas <me@ratijas.tk>
|
||||
Raul Gutierrez Segales <rgs@itevenworks.net>
|
||||
Ray Wang <wanglei1123@gmail.com>
|
||||
Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>
|
||||
Rian Hunter <rian@alum.mit.edu>
|
||||
Richard Allen <rsaxvc@rsaxvc.net>
|
||||
Richard Fuchs <rfuchs@sipwise.com>
|
||||
|
|
117
Documentation/releases/v2.39.1-ReleaseNotes
Normal file
117
Documentation/releases/v2.39.1-ReleaseNotes
Normal file
|
@ -0,0 +1,117 @@
|
|||
util-linux v2.39.1 Release Notes
|
||||
================================
|
||||
|
||||
The main objective of this maintenance release is to address bugs in libmount and
|
||||
resolve the regression that occurred due to the v2.39 rewrite for the new kernel
|
||||
mount interface.
|
||||
|
||||
The meson build system has also been enhanced.
|
||||
|
||||
|
||||
Changes between v2.39 and v2.39.1
|
||||
---------------------------------
|
||||
|
||||
blkzone:
|
||||
- don't take address of struct blk_zone [Thomas Weißschuh]
|
||||
build-sys:
|
||||
- add --disable-waitpid [Frantisek Sumsal]
|
||||
- don't call pkg-config --static if unnecessary [Karel Zak]
|
||||
- fix typo in waitpid check [Thomas Weißschuh]
|
||||
- only pass --failure-level if supported [Thomas Weißschuh]
|
||||
cal:
|
||||
- fix error message for bad -c argument [Jakub Wilk]
|
||||
- fix long option name for -c [Jakub Wilk]
|
||||
ci:
|
||||
- prevent prompts during installation [Thomas Weißschuh]
|
||||
dmesg:
|
||||
- make kmsg read() buffer big enough for kernel [anteater]
|
||||
docs:
|
||||
- update AUTHORS file [Karel Zak]
|
||||
enosys:
|
||||
- add support for MIPS, PowerPC and ARC [Thomas Weißschuh]
|
||||
- add support for loongarch [Thomas Weißschuh]
|
||||
- add support for sparc [Thomas Weißschuh]
|
||||
- split audit arch detection into dedicated header [Thomas Weißschuh]
|
||||
hardlink:
|
||||
- (man) add missing comma [Jakub Wilk]
|
||||
lib:
|
||||
- remove pager.c from libcommon [Karel Zak]
|
||||
lib/ include/:
|
||||
- cleanup license headers [Karel Zak]
|
||||
lib/color-names:
|
||||
- fix license header [Karel Zak]
|
||||
lib/loopdev:
|
||||
- consistently return error values from loopcxt_find_unused() [Thomas Weißschuh]
|
||||
- document function return values [Thomas Weißschuh]
|
||||
lib/strutils:
|
||||
- fix typo [Jakub Wilk]
|
||||
libblkid:
|
||||
- (bcache) also calculate checksum over journal buckets [Thomas Weißschuh]
|
||||
- (bcache) extend superblock definition [Thomas Weißschuh]
|
||||
- jfs - avoid undefined shift [Milan Broz]
|
||||
libmount:
|
||||
- (optlist) correctly detect ro status [Thomas Weißschuh]
|
||||
- always ignore user=<name> [Karel Zak]
|
||||
- check for availability of mount_setattr [Thomas Weißschuh]
|
||||
- cleanup enosys returns from mount hoop [Karel Zak]
|
||||
- don't call hooks after mount.<type> helper [Karel Zak]
|
||||
- don't call mount.<type> helper with usernames [Karel Zak]
|
||||
- don't pass option "defaults" to helper [Thomas Weißschuh]
|
||||
- fix options prepend/insert and merging [Karel Zak]
|
||||
- fix sync options between context and fs structs [Karel Zak]
|
||||
- introduce LIBMOUNT_FORCE_MOUNT2={always,never,auto} [Karel Zak]
|
||||
libsmartcols:
|
||||
- (samples) fix format truncation warning [Thomas Weißschuh]
|
||||
logger:
|
||||
- initialize socket credentials contol union [Karel Zak]
|
||||
losetup:
|
||||
- deduplicate find_unused() logic [Thomas Weißschuh]
|
||||
lsfd:
|
||||
- (filter) weakly support ARRAY_STRING and ARRAY_NUMBER json types [Masatake YAMATO]
|
||||
- (tests) fix typo [Thomas Weißschuh]
|
||||
- use ARRAY_STRING for ENDPOINTS column in JSON output mode [Masatake YAMATO]
|
||||
meson:
|
||||
- add conditionalization for test progs [Zbigniew Jędrzejewski-Szmek]
|
||||
- check for _NL_TIME_WEEK_1STDAY in langinfo.h [Christian Hesse]
|
||||
- conditionalize waitpid [Zbigniew Jędrzejewski-Szmek]
|
||||
- implement HAVE_PTY [Zbigniew Jędrzejewski-Szmek]
|
||||
- include bash-completion for newgrp [Christian Hesse]
|
||||
- include bash-completion for write [Christian Hesse]
|
||||
- install chfn setuid [Christian Hesse]
|
||||
- install chsh setuid [Christian Hesse]
|
||||
- install mount setuid [Christian Hesse]
|
||||
- install newgrp setuid [Christian Hesse]
|
||||
- install su setuid [Christian Hesse]
|
||||
- install symlink for vigr man page [Christian Hesse]
|
||||
- install umount setuid [Christian Hesse]
|
||||
- install wall setgid [Christian Hesse]
|
||||
- install write setgid [Christian Hesse]
|
||||
- require 0.57 [Thomas Weißschuh]
|
||||
mkfs.minix:
|
||||
- handle 64bit time on 32bit system [Thomas Weißschuh]
|
||||
po:
|
||||
- merge changes [Karel Zak]
|
||||
- update hr.po (from translationproject.org) [Božidar Putanec]
|
||||
po-man:
|
||||
- add ko.po (from translationproject.org) [Seong-ho Cho]
|
||||
- add ro.po (from translationproject.org) [Remus-Gabriel Chelu]
|
||||
- merge changes [Karel Zak]
|
||||
- update uk.po (from translationproject.org) [Yuri Chornoivan]
|
||||
sfdisk:
|
||||
- add hint about duplicate UUIDs when use dump [Karel Zak]
|
||||
test_enosys:
|
||||
- fix build on old kernels [Thomas Weißschuh]
|
||||
test_uuidd:
|
||||
- make pthread_t formatting more robust [Thomas Weißschuh]
|
||||
tests:
|
||||
- (lsfd) add a case for verifying ENDPOINTS column output in JSON mode [Masatake YAMATO]
|
||||
- (run.sh) detect builddir from working directory [Thomas Weißschuh]
|
||||
- backport mount_setattr test [Karel Zak]
|
||||
- backport special mount script [Karel Zak]
|
||||
- fix update special mount test output [Karel Zak]
|
||||
tools:
|
||||
- (asciidoctor) explicitly require extensions module [Thomas Weißschuh]
|
||||
unshare:
|
||||
- fix error message for unexpected time offsets [Thomas Weißschuh]
|
||||
waitpid:
|
||||
- only build when pidfd_open is available [Thomas Weißschuh]
|
|
@ -230,10 +230,13 @@ asciidoc_man_cmd = $(ASCIIDOCTOR) \
|
|||
-a 'package-docdir=$(docdir)' \
|
||||
-a 'VERSION=$(VERSION)' \
|
||||
-a 'ADJTIME_PATH=$(ADJTIME_PATH)' \
|
||||
--failure-level ERROR \
|
||||
--load-path '$(abs_srcdir)/tools' \
|
||||
--require asciidoctor-includetracker
|
||||
|
||||
if HAVE_ASCIIDOCTOR_FAILURE_LEVEL
|
||||
asciidoc_man_cmd += --failure-level ERROR
|
||||
endif
|
||||
|
||||
SUFFIXES = .1.adoc .3.adoc .5.adoc .8.adoc .1 .3 .5 .8
|
||||
.1.adoc.1 .3.adoc.3 .5.adoc.5 .8.adoc.8:
|
||||
$(AM_V_GEN) test -f ./$@ || \
|
||||
|
|
4
NEWS
4
NEWS
|
@ -1,3 +1,7 @@
|
|||
util-linux 2.39.1: Jun 27 2023
|
||||
* see Documentation/releases/v2.39.1-ReleaseNotes or the complete changelog at
|
||||
https://www.kernel.org/pub/linux/utils/util-linux/v2.39/v2.39.1-ChangeLog
|
||||
|
||||
util-linux 2.39: May 17 2023
|
||||
* see Documentation/releases/v2.39-ReleaseNotes or the complete changelog at
|
||||
https://www.kernel.org/pub/linux/utils/util-linux/v2.39/v2.39-ChangeLog
|
||||
|
|
20
configure.ac
20
configure.ac
|
@ -29,7 +29,7 @@ PACKAGE_VERSION_RELEASE=$(echo $PACKAGE_VERSION | awk -F. '{
|
|||
|
||||
dnl libblkid version
|
||||
LIBBLKID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
|
||||
LIBBLKID_DATE="17-May-2023"
|
||||
LIBBLKID_DATE="27-Jun-2023"
|
||||
LIBBLKID_LT_MAJOR=1
|
||||
LIBBLKID_LT_MINOR=1
|
||||
LIBBLKID_LT_MICRO=0
|
||||
|
@ -802,6 +802,17 @@ AC_ARG_ENABLE([asciidoc],
|
|||
UL_BUILD_INIT([asciidoc])
|
||||
UL_REQUIRES_PROGRAM([asciidoc], [ASCIIDOCTOR], [asciidoctor], [man pages])
|
||||
AM_CONDITIONAL([ENABLE_ASCIIDOC], [test "x$build_asciidoc" = xyes])
|
||||
have_asciidoctor_failure_level=no
|
||||
AS_IF([test "x$build_asciidoc" = xyes], [
|
||||
AC_MSG_CHECKING([whether ${ASCIIDOCTOR} supports --failure-level])
|
||||
AS_IF([${ASCIIDOCTOR} --help | grep failure-level >/dev/null 2>&1 ], [
|
||||
AC_MSG_RESULT([yes])
|
||||
have_asciidoctor_failure_level=yes
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
AM_CONDITIONAL([HAVE_ASCIIDOCTOR_FAILURE_LEVEL], [test "x$have_asciidoctor_failure_level" = xyes])
|
||||
|
||||
have_manpages=no
|
||||
AS_IF([test -f "$srcdir/sys-utils/mount.8"], [
|
||||
|
@ -1847,8 +1858,13 @@ UL_BUILD_INIT([fadvise], [check])
|
|||
UL_REQUIRES_LINUX([fadvise])
|
||||
AM_CONDITIONAL([BUILD_FADVISE], [test "x$build_fadvise" = xyes])
|
||||
|
||||
UL_BUILD_INIT([waitpid], [check])
|
||||
AC_ARG_ENABLE([waitpid],
|
||||
AS_HELP_STRING([--disable-waitpid], [do not build waitpid]),
|
||||
[], [UL_DEFAULT_ENABLE([waitpid], [check])]
|
||||
)
|
||||
UL_BUILD_INIT([waitpid])
|
||||
UL_REQUIRES_LINUX([waitpid])
|
||||
UL_REQUIRES_SYSCALL_CHECK([waitpid], [UL_CHECK_SYSCALL([pidfd_open])], [pidfd_open])
|
||||
AM_CONDITIONAL([BUILD_WAITPID], [test "x$build_waitpid" = xyes])
|
||||
|
||||
UL_BUILD_INIT([getopt], [yes])
|
||||
|
|
|
@ -157,7 +157,9 @@ fdisk_SOURCES = \
|
|||
disk-utils/fdisk.h \
|
||||
disk-utils/fdisk-menu.c \
|
||||
disk-utils/fdisk-list.c \
|
||||
disk-utils/fdisk-list.h
|
||||
disk-utils/fdisk-list.h \
|
||||
include/pager.h \
|
||||
lib/pager.c
|
||||
|
||||
fdisk_LDADD = $(LDADD) libcommon.la libfdisk.la \
|
||||
libsmartcols.la libtcolors.la $(READLINE_LIBS)
|
||||
|
|
|
@ -20,7 +20,7 @@ fsck - check and repair a Linux filesystem
|
|||
|
||||
== DESCRIPTION
|
||||
|
||||
*fsck* is used to check and optionally repair one or more Linux filesystems. _filesystem_ can be a device name (e.g., _/dev/hdc1_, _/dev/sdb2_), a mount point (e.g., _/_, _/usr_, _/home_), or an filesystem label or UUID specifier (e.g., UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). Normally, the *fsck* program will try to handle filesystems on different physical disk drives in parallel to reduce the total amount of time needed to check all of them.
|
||||
*fsck* is used to check and optionally repair one or more Linux filesystems. _filesystem_ can be a device name (e.g., _/dev/hdc1_, _/dev/sdb2_), a mount point (e.g., _/_, _/usr_, _/home_), or a filesystem label or UUID specifier (e.g., UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). Normally, the *fsck* program will try to handle filesystems on different physical disk drives in parallel to reduce the total amount of time needed to check all of them.
|
||||
|
||||
If no filesystems are specified on the command line, and the *-A* option is not specified, *fsck* will default to checking filesystems in _/etc/fstab_ serially. This is equivalent to the *-As* options.
|
||||
|
||||
|
|
|
@ -69,7 +69,8 @@ fdisk_sources = files(
|
|||
'fdisk.h',
|
||||
'fdisk-menu.c',
|
||||
'fdisk-list.c',
|
||||
'fdisk-list.h')
|
||||
'fdisk-list.h') + \
|
||||
pager_c
|
||||
|
||||
sfdisk_sources = files(
|
||||
'sfdisk.c',
|
||||
|
|
|
@ -157,9 +157,9 @@ static void __attribute__((__noreturn__)) usage(void)
|
|||
static inline time_t mkfs_minix_time(time_t *t)
|
||||
{
|
||||
const char *str = getenv("MKFS_MINIX_TEST_SECOND_SINCE_EPOCH");
|
||||
time_t sec;
|
||||
uint64_t sec;
|
||||
|
||||
if (str && sscanf(str, "%ld", &sec) == 1)
|
||||
if (str && sscanf(str, "%"SCNd64, &sec) == 1)
|
||||
return sec;
|
||||
return time(t);
|
||||
}
|
||||
|
|
|
@ -366,6 +366,8 @@ ____
|
|||
*sfdisk /dev/sda < sda.dump*
|
||||
____
|
||||
|
||||
Note that sfdisk completely restores partition types and partition UUIDs. This could potentially become problematic if you duplicate the same layout to different disks, as it may result in duplicate UUIDs within your system.
|
||||
|
||||
=== Full binary backup
|
||||
|
||||
If you want to do a full binary backup of all sectors where the partition table is stored, then use the *--backup-pt-sectors* command. It writes the sectors to _~/sfdisk-<device>-<offset>.bak_ files. The default name of the backup file can be changed with the *--backup-file* option. The backup files contain only raw data from the _device_. For example:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
dist_noinst_HEADERS += \
|
||||
include/all-io.h \
|
||||
include/audit-arch.h \
|
||||
include/bitops.h \
|
||||
include/blkdev.h \
|
||||
include/buffer.h \
|
||||
|
|
64
include/audit-arch.h
Normal file
64
include/audit-arch.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (C) 2023 Thomas Weißschuh <thomas@t-8ch.de>
|
||||
*
|
||||
* This file may be distributed under the terms of the
|
||||
* GNU Lesser General Public License.
|
||||
*/
|
||||
#ifndef UTIL_LINUX_AUDIT_ARCH_H
|
||||
#define UTIL_LINUX_AUDIT_ARCH_H
|
||||
|
||||
#if __x86_64__
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_X86_64
|
||||
#elif __i386__
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_I386
|
||||
#elif __arm__
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_ARM
|
||||
#elif __aarch64__
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_AARCH64
|
||||
#elif __riscv
|
||||
# if __riscv_xlen == 32
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_RISCV32
|
||||
# elif __riscv_xlen == 64
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_RISCV64
|
||||
# endif
|
||||
#elif __s390x__
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_S390X
|
||||
#elif __s390__
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_S390
|
||||
#elif __PPC64__
|
||||
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_PPC64
|
||||
# else
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_PPC64LE
|
||||
# endif
|
||||
#elif __powerpc__
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_PPC
|
||||
#elif __mips__
|
||||
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_MIPS
|
||||
# else
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_MIPSEL
|
||||
# endif
|
||||
#elif __arc__
|
||||
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_ARCV2BE
|
||||
# else
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_ARCV2
|
||||
# endif
|
||||
#elif __sparc__
|
||||
# if __SIZEOF_POINTER__ == 4
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_SPARC
|
||||
# else
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_SPARC64
|
||||
# endif
|
||||
#elif __loongarch__
|
||||
# if __SIZEOF_POINTER__ == 4
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_LOONGARCH32
|
||||
# else
|
||||
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_LOONGARCH64
|
||||
# endif
|
||||
#else
|
||||
# error Unknown target architecture
|
||||
#endif
|
||||
|
||||
#endif /* UTIL_LINUX_AUDIT_ARCH_H */
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2015 Karel Zak <kzak@redhat.com>
|
||||
* No copyright is claimed. This code is in the public domain; do with
|
||||
* it what you wish.
|
||||
*
|
||||
* This file may be distributed under the terms of the
|
||||
* GNU Lesser General Public License.
|
||||
* Copyright (C) 2012-2015 Karel Zak <kzak@redhat.com>
|
||||
*/
|
||||
#ifndef UTIL_LINUX_COLOR_NAMES_H
|
||||
#define UTIL_LINUX_COLOR_NAMES_H
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* Copyright (C) 2012 Ondrej Oprala <ooprala@redhat.com>
|
||||
* Copyright (C) 2012-2014 Karel Zak <kzak@redhat.com>
|
||||
*
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* This file may be redistributed under the terms of the
|
||||
* GNU Lesser General Public License.
|
||||
*/
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
/*
|
||||
* No copyright is claimed. This code is in the public domain; do with
|
||||
* it what you wish.
|
||||
*/
|
||||
#ifndef UTIL_LINUX_ENV_H
|
||||
#define UTIL_LINUX_ENV_H
|
||||
|
||||
|
|
|
@ -1,19 +1,15 @@
|
|||
/* Align/Truncate a string in a given screen width
|
||||
Copyright (C) 2009-2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2013 Karel Zak <kzak@redhat.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* Align/Truncate a string in a given screen width
|
||||
* Copyright (C) 2009-2010 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2010-2013 Karel Zak <kzak@redhat.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 2.1 of the License, or (at your
|
||||
* option) any later version.
|
||||
*/
|
||||
#ifndef UTIL_LINUX_MBSALIGN_H
|
||||
# define UTIL_LINUX_MBSALIGN_H
|
||||
# include <stddef.h>
|
||||
|
|
|
@ -1,26 +1,17 @@
|
|||
/***
|
||||
SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
|
||||
First set of functions in this file are part of systemd, and were
|
||||
copied to util-linux at August 2013.
|
||||
|
||||
Copyright 2010 Lennart Poettering
|
||||
Copyright (C) 2014 Karel Zak <kzak@redhat.com>
|
||||
|
||||
systemd is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
systemd is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
/*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* First set of functions in this file are part of systemd, and were
|
||||
* copied to util-linux at August 2013.
|
||||
*
|
||||
* Copyright 2010 Lennart Poettering
|
||||
* Copyright (C) 2014 Karel Zak <kzak@redhat.com>
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*/
|
||||
#ifndef UTIL_LINUX_TIME_UTIL_H
|
||||
#define UTIL_LINUX_TIME_UTIL_H
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ libcommon_la_SOURCES = \
|
|||
lib/mbsalign.c \
|
||||
lib/mbsedit.c\
|
||||
lib/md5.c \
|
||||
lib/pager.c \
|
||||
lib/pwdutils.c \
|
||||
lib/randutils.c \
|
||||
lib/sha1.c \
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* No copyright is claimed. This code is in the public domain; do with
|
||||
* it what you wish.
|
||||
*
|
||||
* Written by Karel Zak <kzak@redhat.com>
|
||||
* Copyright (C) 2012-2015 Karel Zak <kzak@redhat.com>
|
||||
*/
|
||||
#include "c.h"
|
||||
#include "color-names.h"
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* Copyright (C) 2012 Ondrej Oprala <ooprala@redhat.com>
|
||||
* Copyright (C) 2012-2014 Karel Zak <kzak@redhat.com>
|
||||
*
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* Terminology:
|
||||
*
|
||||
* cpuset - (libc) cpu_set_t data structure represents set of CPUs
|
||||
|
|
|
@ -580,7 +580,7 @@ static int loopcxt_next_from_sysfs(struct loopdev_cxt *lc)
|
|||
/*
|
||||
* @lc: context, has to initialized by loopcxt_init_iterator()
|
||||
*
|
||||
* Returns: 0 on success, -1 on error, 1 at the end of scanning. The details
|
||||
* Returns: 0 on success, < 0 on error, 1 at the end of scanning. The details
|
||||
* about the current loop device are available by
|
||||
* loopcxt_get_{fd,backing_file,device,offset, ...} functions.
|
||||
*/
|
||||
|
@ -1602,6 +1602,8 @@ done:
|
|||
* kernels we have to check all loop devices to found unused one.
|
||||
*
|
||||
* See kernel commit 770fe30a46a12b6fb6b63fbe1737654d28e8484.
|
||||
*
|
||||
* Returns: 0 = success, < 0 error
|
||||
*/
|
||||
int loopcxt_find_unused(struct loopdev_cxt *lc)
|
||||
{
|
||||
|
@ -1617,6 +1619,8 @@ int loopcxt_find_unused(struct loopdev_cxt *lc)
|
|||
ctl = open(_PATH_DEV_LOOPCTL, O_RDWR|O_CLOEXEC);
|
||||
if (ctl >= 0)
|
||||
rc = ioctl(ctl, LOOP_CTL_GET_FREE);
|
||||
else
|
||||
rc = -errno;
|
||||
if (rc >= 0) {
|
||||
char name[16];
|
||||
snprintf(name, sizeof(name), "loop%d", rc);
|
||||
|
@ -1638,6 +1642,8 @@ int loopcxt_find_unused(struct loopdev_cxt *lc)
|
|||
rc = loopcxt_next(lc);
|
||||
loopcxt_deinit_iterator(lc);
|
||||
DBG(CXT, ul_debugobj(lc, "find_unused by scan [rc=%d]", rc));
|
||||
if (rc)
|
||||
return -ENOENT;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
@ -1681,6 +1687,9 @@ char *loopdev_get_backing_file(const char *device)
|
|||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns: TRUE/FALSE
|
||||
*/
|
||||
int loopdev_has_backing_file(const char *device)
|
||||
{
|
||||
char *tmp = loopdev_get_backing_file(device);
|
||||
|
@ -1718,6 +1727,9 @@ int loopdev_is_used(const char *device, const char *filename,
|
|||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns: 0 = success, < 0 error
|
||||
*/
|
||||
int loopdev_delete(const char *device)
|
||||
{
|
||||
struct loopdev_cxt lc;
|
||||
|
|
|
@ -1,21 +1,16 @@
|
|||
/* Align/Truncate a string in a given screen width
|
||||
Copyright (C) 2009-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Pádraig Brady. */
|
||||
|
||||
/*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* Align/Truncate a string in a given screen width
|
||||
* Copyright (C) 2009-2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 2.1 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Written by Pádraig Brady.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* Very simple multibyte buffer editor. Allows to maintaine the current
|
||||
* position in the string, add and remove chars on the current position.
|
||||
*
|
||||
|
|
|
@ -17,7 +17,6 @@ lib_common_sources = '''
|
|||
mbsalign.c
|
||||
mbsedit.c
|
||||
md5.c
|
||||
pager.c
|
||||
procfs.c
|
||||
pwdutils.c
|
||||
randutils.c
|
||||
|
@ -37,6 +36,7 @@ md5_c = files('md5.c')
|
|||
sha1_c = files('sha1.c')
|
||||
strutils_c = files('strutils.c')
|
||||
strv_c = files('strv.c')
|
||||
pager_c = files('pager.c')
|
||||
|
||||
lib_common_sources += [idcache_c,
|
||||
randutils_c,
|
||||
|
|
11
lib/path.c
11
lib/path.c
|
@ -1,4 +1,10 @@
|
|||
/*
|
||||
* No copyright is claimed. This code is in the public domain; do with
|
||||
* it what you wish.
|
||||
*
|
||||
* Copyright (C) 2018 Karel Zak <kzak@redhat.com>
|
||||
*
|
||||
*
|
||||
* Simple functions to access files. Paths can be globally prefixed to read
|
||||
* data from an alternative source (e.g. a /proc dump for regression tests).
|
||||
*
|
||||
|
@ -7,11 +13,6 @@
|
|||
*
|
||||
* The ul_path_read_* API is possible to use without path_cxt handler. In this
|
||||
* case is not possible to use global prefix and printf-like formatting.
|
||||
*
|
||||
* No copyright is claimed. This code is in the public domain; do with
|
||||
* it what you wish.
|
||||
*
|
||||
* Written by Karel Zak <kzak@redhat.com> [February 2018]
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* No copyright is claimed. This code is in the public domain; do with
|
||||
* it what you wish.
|
||||
*
|
||||
* Written by Karel Zak <kzak@redhat.com>
|
||||
* Copyright (C) 2021 Karel Zak <kzak@redhat.com>
|
||||
*/
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -397,7 +397,7 @@ int ul_strtou32(const char *str, uint32_t *num, int base)
|
|||
* Convert strings to numbers in defined range and print message on error.
|
||||
*
|
||||
* These functions are used when we read input from users (getopt() etc.). It's
|
||||
* better to consolidate the code and keep it all based on 64-bit numbers then
|
||||
* better to consolidate the code and keep it all based on 64-bit numbers than
|
||||
* implement it for 32 and 16-bit numbers too.
|
||||
*/
|
||||
int64_t str2num_or_err(const char *str, int base, const char *errmesg,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* No copyright is claimed. This code is in the public domain; do with
|
||||
* it what you wish.
|
||||
*
|
||||
* Written by Karel Zak <kzak@redhat.com>
|
||||
* Copyright (C) 2011 Karel Zak <kzak@redhat.com>
|
||||
*/
|
||||
#include <ctype.h>
|
||||
#include <libgen.h>
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
/***
|
||||
First set of functions in this file are part of systemd, and were
|
||||
copied to util-linux at August 2013.
|
||||
|
||||
Copyright 2010 Lennart Poettering
|
||||
|
||||
systemd is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
systemd is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with util-linux; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
/*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* First set of functions in this file are part of systemd, and were
|
||||
* copied to util-linux at August 2013.
|
||||
*
|
||||
* Copyright 2010 Lennart Poettering
|
||||
* Copyright (C) 2014 Karel Zak <kzak@redhat.com>
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* xxHash - Extremely Fast Hash algorithm
|
||||
* Copyright (C) 2012-2020 Yann Collet
|
||||
*
|
||||
|
|
|
@ -17,10 +17,11 @@
|
|||
#include "xxhash.h"
|
||||
|
||||
#define SB_LABEL_SIZE 32
|
||||
#define SB_JOURNAL_BUCKETS 256U
|
||||
|
||||
/*
|
||||
* The bcache_super_block is heavily simplified version of struct cache_sb in kernel.
|
||||
* https://github.com/torvalds/linux/blob/master/include/uapi/linux/bcache.h
|
||||
* The bcache_super_block is adapted from struct cache_sb in kernel.
|
||||
* https://github.com/torvalds/linux/blob/master/drivers/md/bcache/bcache_ondisk.h
|
||||
*/
|
||||
struct bcache_super_block {
|
||||
uint64_t csum;
|
||||
|
@ -28,6 +29,43 @@ struct bcache_super_block {
|
|||
uint64_t version;
|
||||
uint8_t magic[16]; /* bcache file system identifier */
|
||||
uint8_t uuid[16]; /* device identifier */
|
||||
uint8_t set_info[16]; /* magic or uuid */
|
||||
uint8_t label[SB_LABEL_SIZE];
|
||||
uint64_t flags;
|
||||
uint64_t seq;
|
||||
|
||||
uint64_t feature_compat;
|
||||
uint64_t feature_incompat;
|
||||
uint64_t feature_ro_compat;
|
||||
|
||||
uint64_t pad[5];
|
||||
|
||||
union {
|
||||
struct {
|
||||
/* Cache devices */
|
||||
uint64_t nbuckets; /* device size */
|
||||
|
||||
uint16_t block_size; /* sectors */
|
||||
uint16_t bucket_size; /* sectors */
|
||||
|
||||
uint16_t nr_in_set;
|
||||
uint16_t nr_this_dev;
|
||||
};
|
||||
struct {
|
||||
/* Backing devices */
|
||||
uint64_t data_offset;
|
||||
};
|
||||
};
|
||||
|
||||
uint32_t last_mount;
|
||||
|
||||
uint16_t first_bucket;
|
||||
union {
|
||||
uint16_t njournal_buckets;
|
||||
uint16_t keys;
|
||||
};
|
||||
uint64_t d[SB_JOURNAL_BUCKETS]; /* journal buckets */
|
||||
uint16_t obso_bucket_size_hi; /* obsoleted */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct bcachefs_sb_field {
|
||||
|
@ -102,8 +140,6 @@ struct bcachefs_super_block {
|
|||
#define BCACHE_SB_MAGIC_OFF offsetof(struct bcache_super_block, magic)
|
||||
/* start of checksummed data within superblock */
|
||||
#define BCACHE_SB_CSUMMED_START 8
|
||||
/* end of checksummed data within superblock */
|
||||
#define BCACHE_SB_CSUMMED_END 208
|
||||
/* granularity of offset and length fields within superblock */
|
||||
#define BCACHEFS_SECTOR_SIZE 512
|
||||
/* maximum superblock size */
|
||||
|
@ -118,9 +154,19 @@ struct bcachefs_super_block {
|
|||
static int bcache_verify_checksum(blkid_probe pr, const struct blkid_idmag *mag,
|
||||
const struct bcache_super_block *bcs)
|
||||
{
|
||||
unsigned char *csummed = blkid_probe_get_sb_buffer(pr, mag, BCACHE_SB_CSUMMED_END);
|
||||
uint64_t csum = ul_crc64_we(csummed + BCACHE_SB_CSUMMED_START,
|
||||
BCACHE_SB_CSUMMED_END - BCACHE_SB_CSUMMED_START);
|
||||
const unsigned char *csummed;
|
||||
size_t csummed_size;
|
||||
uint64_t csum;
|
||||
|
||||
if (le16_to_cpu(bcs->keys) > ARRAY_SIZE(bcs->d))
|
||||
return 0;
|
||||
|
||||
/* up to the end of bcs->d[] */
|
||||
csummed_size = offsetof(typeof(*bcs), d) +
|
||||
sizeof(bcs->d[0]) * le16_to_cpu(bcs->keys);
|
||||
csummed = blkid_probe_get_sb_buffer(pr, mag, csummed_size);
|
||||
csum = ul_crc64_we(csummed + BCACHE_SB_CSUMMED_START,
|
||||
csummed_size - BCACHE_SB_CSUMMED_START);
|
||||
return blkid_probe_verify_csum(pr, csum, le64_to_cpu(bcs->csum));
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ static int probe_jfs(blkid_probe pr, const struct blkid_idmag *mag)
|
|||
js = blkid_probe_get_sb(pr, mag, struct jfs_super_block);
|
||||
if (!js)
|
||||
return errno ? -errno : 1;
|
||||
if (le16_to_cpu(js->js_l2bsize) > 32 || le16_to_cpu(js->js_l2pbsize) > 32)
|
||||
if (le16_to_cpu(js->js_l2bsize) > 31 || le16_to_cpu(js->js_l2pbsize) > 31)
|
||||
return 1;
|
||||
if (le32_to_cpu(js->js_bsize) != (1U << le16_to_cpu(js->js_l2bsize)))
|
||||
return 1;
|
||||
|
|
|
@ -141,7 +141,7 @@ foreach libmount_test: libmount_tests
|
|||
c_args : ['-DTEST_PROGRAM'],
|
||||
)
|
||||
# the test-setup expects the helpers in the toplevel build-directory
|
||||
link = meson.build_root() / test_name
|
||||
link = meson.project_build_root() / test_name
|
||||
run_command('ln', '-srf', exe.full_path(), link,
|
||||
check : true)
|
||||
endforeach
|
||||
|
|
|
@ -911,9 +911,29 @@ int mnt_context_set_fs(struct libmnt_context *cxt, struct libmnt_fs *fs)
|
|||
if (!cxt)
|
||||
return -EINVAL;
|
||||
|
||||
if (cxt->fs == fs)
|
||||
return 0;
|
||||
|
||||
DBG(CXT, ul_debugobj(cxt, "setting new FS"));
|
||||
mnt_ref_fs(fs); /* new */
|
||||
mnt_unref_fs(cxt->fs); /* old */
|
||||
|
||||
/* new */
|
||||
if (fs) {
|
||||
struct libmnt_optlist *ol = mnt_context_get_optlist(cxt);
|
||||
|
||||
if (!ol)
|
||||
return -ENOMEM;
|
||||
|
||||
mnt_ref_fs(fs);
|
||||
|
||||
mnt_optlist_set_optstr(ol, mnt_fs_get_options(fs), NULL);
|
||||
mnt_fs_follow_optlist(fs, ol);
|
||||
}
|
||||
|
||||
/* old */
|
||||
if (cxt->fs)
|
||||
mnt_fs_follow_optlist(cxt->fs, NULL);
|
||||
mnt_unref_fs(cxt->fs);
|
||||
|
||||
cxt->fs = fs;
|
||||
return 0;
|
||||
}
|
||||
|
@ -932,8 +952,17 @@ struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt)
|
|||
{
|
||||
if (!cxt)
|
||||
return NULL;
|
||||
if (!cxt->fs)
|
||||
if (!cxt->fs) {
|
||||
struct libmnt_optlist *ol = mnt_context_get_optlist(cxt);
|
||||
|
||||
if (!ol)
|
||||
return NULL;
|
||||
cxt->fs = mnt_new_fs();
|
||||
if (!cxt->fs)
|
||||
return NULL;
|
||||
|
||||
mnt_fs_follow_optlist(cxt->fs, ol);
|
||||
}
|
||||
return cxt->fs;
|
||||
}
|
||||
|
||||
|
@ -3314,6 +3343,50 @@ static int test_flags(struct libmnt_test *ts, int argc, char *argv[])
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int test_cxtsync(struct libmnt_test *ts, int argc, char *argv[])
|
||||
{
|
||||
struct libmnt_context *cxt;
|
||||
struct libmnt_fs *fs;
|
||||
unsigned long flags = 0;
|
||||
int rc;
|
||||
|
||||
if (argc != 4)
|
||||
return -EINVAL;
|
||||
|
||||
fs = mnt_new_fs();
|
||||
if (!fs)
|
||||
return -ENOMEM;
|
||||
|
||||
rc = mnt_fs_set_options(fs, argv[1]);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
cxt = mnt_new_context();
|
||||
if (!cxt)
|
||||
return -ENOMEM;
|
||||
|
||||
rc = mnt_context_set_fs(cxt, fs);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = mnt_context_append_options(cxt, argv[2]);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = mnt_fs_append_options(fs, argv[3]);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
mnt_context_get_mflags(cxt, &flags);
|
||||
|
||||
printf(" fs options: %s\n", mnt_fs_get_options(fs));
|
||||
printf("context options: %s\n", mnt_context_get_options(cxt));
|
||||
printf(" context mflags: %08lx\n", flags);
|
||||
|
||||
mnt_free_context(cxt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int test_mountall(struct libmnt_test *ts, int argc, char *argv[])
|
||||
{
|
||||
struct libmnt_context *cxt;
|
||||
|
@ -3361,6 +3434,8 @@ static int test_mountall(struct libmnt_test *ts, int argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct libmnt_test tss[] = {
|
||||
|
@ -3368,6 +3443,7 @@ int main(int argc, char *argv[])
|
|||
{ "--umount", test_umount, "[-t <type>] [-f][-l][-r] <src>|<target>" },
|
||||
{ "--mount-all", test_mountall, "[-O <pattern>] [-t <pattern] mount all filesystems from fstab" },
|
||||
{ "--flags", test_flags, "[-o <opts>] <spec>" },
|
||||
{ "--cxtsync", test_cxtsync, "<fsopts> <cxtopts> <fsopts>" },
|
||||
{ "--search-helper", test_search_helper, "<fstype>" },
|
||||
{ NULL }};
|
||||
|
||||
|
|
|
@ -177,6 +177,22 @@ static int evaluate_permissions(struct libmnt_context *cxt)
|
|||
if (rc)
|
||||
return rc;
|
||||
|
||||
/*
|
||||
* Ignore user=<name> (if <name> is set). Let's keep it hidden
|
||||
* for normal library operations, but visible for /sbin/mount.<type>
|
||||
* helpers.
|
||||
*/
|
||||
if (user_flags & MNT_MS_USER
|
||||
&& (opt = mnt_optlist_get_opt(ol, MNT_MS_USER, cxt->map_userspace))
|
||||
&& mnt_opt_has_value(opt)) {
|
||||
DBG(CXT, ul_debugobj(cxt, "perms: user=<name> detected, ignore"));
|
||||
|
||||
cxt->flags |= MNT_FL_SAVED_USER;
|
||||
|
||||
mnt_opt_set_external(opt, 1);
|
||||
user_flags &= ~MNT_MS_USER;
|
||||
}
|
||||
|
||||
if (!mnt_context_is_restricted(cxt)) {
|
||||
/*
|
||||
* superuser mount
|
||||
|
@ -228,22 +244,6 @@ static int evaluate_permissions(struct libmnt_context *cxt)
|
|||
return -EPERM;
|
||||
}
|
||||
|
||||
/*
|
||||
* Ignore user=<name> (if <name> is set). Let's keep it hidden
|
||||
* for normal library operations, but visible for /sbin/mount.<type>
|
||||
* helpers.
|
||||
*/
|
||||
if (user_flags & MNT_MS_USER
|
||||
&& (opt = mnt_optlist_get_opt(ol, MNT_MS_USER, cxt->map_userspace))
|
||||
&& mnt_opt_has_value(opt)) {
|
||||
DBG(CXT, ul_debugobj(cxt, "perms: user=<name> detected, ignore"));
|
||||
|
||||
cxt->flags |= MNT_FL_SAVED_USER;
|
||||
|
||||
mnt_opt_set_external(opt, 1);
|
||||
user_flags &= ~MNT_MS_USER;
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert MS_SECURE between system flags on position where is MNT_MS_USER
|
||||
*/
|
||||
|
@ -377,9 +377,7 @@ int mnt_context_mount_setopt(struct libmnt_context *cxt, int c, char *arg)
|
|||
|
||||
static int exec_helper(struct libmnt_context *cxt)
|
||||
{
|
||||
struct libmnt_optlist *ol;
|
||||
struct libmnt_ns *ns_tgt = mnt_context_get_target_ns(cxt);
|
||||
const char *o = NULL;
|
||||
char *namespace = NULL;
|
||||
int rc;
|
||||
pid_t pid;
|
||||
|
@ -391,14 +389,6 @@ static int exec_helper(struct libmnt_context *cxt)
|
|||
|
||||
DBG(CXT, ul_debugobj(cxt, "mount: executing helper %s", cxt->helper));
|
||||
|
||||
ol = mnt_context_get_optlist(cxt);
|
||||
if (!ol)
|
||||
return -ENOMEM;
|
||||
|
||||
rc = mnt_optlist_get_optstr(ol, &o, NULL, MNT_OL_FLTR_HELPERS);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (ns_tgt->fd != -1
|
||||
&& asprintf(&namespace, "/proc/%i/fd/%i",
|
||||
getpid(), ns_tgt->fd) == -1) {
|
||||
|
@ -412,8 +402,24 @@ static int exec_helper(struct libmnt_context *cxt)
|
|||
case 0:
|
||||
{
|
||||
const char *args[14], *type;
|
||||
struct libmnt_optlist *ol = mnt_context_get_optlist(cxt);
|
||||
struct libmnt_opt *opt;
|
||||
const char *o = NULL;
|
||||
int i = 0;
|
||||
|
||||
if (!ol)
|
||||
_exit(EXIT_FAILURE);
|
||||
|
||||
/* Call helper with original user=<name> (aka "saved user")
|
||||
* or remove the username at all.
|
||||
*/
|
||||
opt = mnt_optlist_get_opt(ol, MNT_MS_USER, cxt->map_userspace);
|
||||
if (opt && !(cxt->flags & MNT_FL_SAVED_USER))
|
||||
mnt_opt_set_value(opt, NULL);
|
||||
|
||||
if (mnt_optlist_get_optstr(ol, &o, NULL, MNT_OL_FLTR_HELPERS))
|
||||
_exit(EXIT_FAILURE);
|
||||
|
||||
if (drop_permissions() != 0)
|
||||
_exit(EXIT_FAILURE);
|
||||
|
||||
|
@ -502,6 +508,8 @@ static int do_mount(struct libmnt_context *cxt, const char *try_type)
|
|||
assert(cxt->fs);
|
||||
assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED));
|
||||
|
||||
mnt_context_reset_status(cxt);
|
||||
|
||||
if (try_type) {
|
||||
rc = mnt_context_prepare_helper(cxt, "mount", try_type);
|
||||
if (rc)
|
||||
|
|
|
@ -228,10 +228,14 @@ int mnt_fs_follow_optlist(struct libmnt_fs *fs, struct libmnt_optlist *ol)
|
|||
|
||||
if (fs->optlist == ol)
|
||||
return 0;
|
||||
if (fs->optlist)
|
||||
mnt_unref_optlist(fs->optlist);
|
||||
|
||||
fs->opts_age = 0;
|
||||
fs->optlist = ol;
|
||||
mnt_ref_optlist(ol);
|
||||
|
||||
if (ol)
|
||||
mnt_ref_optlist(ol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -919,7 +923,11 @@ int mnt_fs_set_options(struct libmnt_fs *fs, const char *optstr)
|
|||
|
||||
if (!fs)
|
||||
return -EINVAL;
|
||||
fs->opts_age = 0;
|
||||
|
||||
if (fs->optlist) {
|
||||
fs->opts_age = 0;
|
||||
return mnt_optlist_set_optstr(fs->optlist, optstr, NULL);
|
||||
}
|
||||
|
||||
if (optstr) {
|
||||
int rc = mnt_split_optstr(optstr, &u, &v, &f, 0, 0);
|
||||
|
@ -968,8 +976,10 @@ int mnt_fs_append_options(struct libmnt_fs *fs, const char *optstr)
|
|||
return -EINVAL;
|
||||
if (!optstr)
|
||||
return 0;
|
||||
|
||||
fs->opts_age = 0;
|
||||
if (fs->optlist) {
|
||||
fs->opts_age = 0;
|
||||
return mnt_optlist_append_optstr(fs->optlist, optstr, NULL);
|
||||
}
|
||||
|
||||
rc = mnt_split_optstr(optstr, &u, &v, &f, 0, 0);
|
||||
if (rc)
|
||||
|
@ -1013,7 +1023,10 @@ int mnt_fs_prepend_options(struct libmnt_fs *fs, const char *optstr)
|
|||
if (!optstr)
|
||||
return 0;
|
||||
|
||||
fs->opts_age = 0;
|
||||
if (fs->optlist) {
|
||||
fs->opts_age = 0;
|
||||
return mnt_optlist_prepend_optstr(fs->optlist, optstr, NULL);
|
||||
}
|
||||
|
||||
rc = mnt_split_optstr(optstr, &u, &v, &f, 0, 0);
|
||||
if (rc)
|
||||
|
|
|
@ -239,6 +239,10 @@ static int hook_create_mount(struct libmnt_context *cxt,
|
|||
int rc = 0;
|
||||
|
||||
assert(cxt);
|
||||
|
||||
if (mnt_context_helper_executed(cxt))
|
||||
return 0;
|
||||
|
||||
assert(cxt->fs);
|
||||
|
||||
api = get_sysapi(cxt);
|
||||
|
@ -309,6 +313,9 @@ static int hook_reconfigure_mount(struct libmnt_context *cxt,
|
|||
|
||||
assert(cxt);
|
||||
|
||||
if (mnt_context_helper_executed(cxt))
|
||||
return 0;
|
||||
|
||||
api = get_sysapi(cxt);
|
||||
assert(api);
|
||||
assert(api->fd_tree >= 0);
|
||||
|
@ -379,6 +386,9 @@ static int hook_set_vfsflags(struct libmnt_context *cxt,
|
|||
uint64_t set = 0, clr = 0;
|
||||
int rc = 0;
|
||||
|
||||
if (mnt_context_helper_executed(cxt))
|
||||
return 0;
|
||||
|
||||
DBG(HOOK, ul_debugobj(hs, "setting VFS flags"));
|
||||
|
||||
ol = mnt_context_get_optlist(cxt);
|
||||
|
@ -471,6 +481,9 @@ static int hook_attach_target(struct libmnt_context *cxt,
|
|||
const char *target;
|
||||
int rc = 0;
|
||||
|
||||
if (mnt_context_helper_executed(cxt))
|
||||
return 0;
|
||||
|
||||
target = mnt_fs_get_target(cxt->fs);
|
||||
if (!target)
|
||||
return -EINVAL;
|
||||
|
@ -510,6 +523,15 @@ static inline int fsopen_is_supported(void)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static inline int mount_setattr_is_supported(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
errno = 0;
|
||||
rc = mount_setattr(-1, NULL, 0, NULL, 0);
|
||||
return !(rc == -1 && errno == ENOSYS);
|
||||
}
|
||||
|
||||
/*
|
||||
* open_tree() and fsopen()
|
||||
*/
|
||||
|
@ -587,6 +609,43 @@ fake:
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int force_classic_mount(struct libmnt_context *cxt)
|
||||
{
|
||||
const char *env = getenv("LIBMOUNT_FORCE_MOUNT2");
|
||||
|
||||
if (env) {
|
||||
if (strcmp(env, "always") == 0)
|
||||
return 1;
|
||||
if (strcmp(env, "never") == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* "auto" (default) -- try to be smart */
|
||||
|
||||
/* For external /sbin/mount.<type> helpers we use the new API only for
|
||||
* propagation setting. In this case, the usability of mount_setattr()
|
||||
* will be verified later */
|
||||
if (cxt->helper)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* The current kernel btrfs driver does not completely implement
|
||||
* fsconfig() as it does not work with selinux stuff.
|
||||
*
|
||||
* Don't use the new mount API in this situation. Let's hope this issue
|
||||
* is temporary.
|
||||
*/
|
||||
{
|
||||
const char *type = mnt_fs_get_fstype(cxt->fs);
|
||||
|
||||
if (type && strcmp(type, "btrfs") == 0 && cxt->has_selinux_opt)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Analyze library context and register hook to call mount-like syscalls.
|
||||
*
|
||||
|
@ -607,20 +666,9 @@ static int hook_prepare(struct libmnt_context *cxt,
|
|||
assert(cxt);
|
||||
assert(hs == &hookset_mount);
|
||||
|
||||
/*
|
||||
* The current kernel btrfs driver does not completely implement
|
||||
* fsconfig() as it does not work with selinux stuff.
|
||||
*
|
||||
* Don't use the new mount API in this situation. Let's hope this issue
|
||||
* is temporary.
|
||||
*/
|
||||
{
|
||||
const char *type = mnt_fs_get_fstype(cxt->fs);
|
||||
|
||||
if (type && strcmp(type, "btrfs") == 0 && cxt->has_selinux_opt) {
|
||||
DBG(HOOK, ul_debugobj(hs, "don't use new API (btrfs issue)"));
|
||||
return 0;
|
||||
}
|
||||
if (force_classic_mount(cxt)) {
|
||||
DBG(HOOK, ul_debugobj(hs, "new API disabled"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
DBG(HOOK, ul_debugobj(hs, "prepare mount"));
|
||||
|
@ -639,13 +687,8 @@ static int hook_prepare(struct libmnt_context *cxt,
|
|||
/* open_tree() or fsopen() */
|
||||
if (!rc) {
|
||||
rc = init_sysapi(cxt, hs, flags);
|
||||
if (rc && cxt->syscall_status == -ENOSYS) {
|
||||
/* we need to recover from this error, so hook_mount_legacy.c
|
||||
* can try to continue */
|
||||
reset_syscall_status(cxt);
|
||||
free_hookset_data(cxt, hs);
|
||||
return 1;
|
||||
}
|
||||
if (rc && cxt->syscall_status == -ENOSYS)
|
||||
goto enosys;
|
||||
}
|
||||
|
||||
/* check mutually exclusive operations */
|
||||
|
@ -675,9 +718,13 @@ static int hook_prepare(struct libmnt_context *cxt,
|
|||
/* call mount_setattr() */
|
||||
if (!rc
|
||||
&& cxt->helper == NULL
|
||||
&& (set != 0 || clr != 0 || (flags & MS_REMOUNT)))
|
||||
&& (set != 0 || clr != 0 || (flags & MS_REMOUNT))) {
|
||||
if (!mount_setattr_is_supported())
|
||||
goto enosys;
|
||||
|
||||
rc = mnt_context_append_hook(cxt, hs, MNT_STAGE_MOUNT, NULL,
|
||||
hook_set_vfsflags);
|
||||
}
|
||||
|
||||
/* call move_mount() to attach target */
|
||||
if (!rc
|
||||
|
@ -688,12 +735,24 @@ static int hook_prepare(struct libmnt_context *cxt,
|
|||
hook_attach_target);
|
||||
|
||||
/* set propagation (has to be attached to VFS) */
|
||||
if (!rc && mnt_optlist_get_propagation(ol))
|
||||
if (!rc && mnt_optlist_get_propagation(ol)) {
|
||||
if (!mount_setattr_is_supported())
|
||||
goto enosys;
|
||||
|
||||
rc = mnt_context_append_hook(cxt, hs, MNT_STAGE_MOUNT_POST, NULL,
|
||||
hook_set_propagation);
|
||||
}
|
||||
|
||||
DBG(HOOK, ul_debugobj(hs, "prepare mount done [rc=%d]", rc));
|
||||
return rc;
|
||||
|
||||
enosys:
|
||||
/* we need to recover from this error, so hook_mount_legacy.c
|
||||
* can try to continue */
|
||||
DBG(HOOK, ul_debugobj(hs, "failed to init new API"));
|
||||
reset_syscall_status(cxt);
|
||||
hookset_deinit(cxt, hs);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const struct libmnt_hookset hookset_mount =
|
||||
|
|
|
@ -338,6 +338,7 @@ int mnt_optlist_merge_opts(struct libmnt_optlist *ls)
|
|||
|
||||
/* remove inverted option */
|
||||
else if (opt->ent && x->ent
|
||||
&& opt->map == x->map
|
||||
&& opt->ent->id == x->ent->id
|
||||
&& (opt->ent->mask & MNT_INVERT
|
||||
|| x->ent->mask & MNT_INVERT))
|
||||
|
@ -462,7 +463,7 @@ static struct libmnt_opt *optlist_new_opt(struct libmnt_optlist *ls,
|
|||
else if (opt->ent->id == MS_BIND)
|
||||
ls->is_bind = 1;
|
||||
else if (opt->ent->id == MS_RDONLY)
|
||||
ls->is_rdonly = 1;
|
||||
ls->is_rdonly = opt->ent->mask & MNT_INVERT ? 0 : 1;
|
||||
else if (opt->ent->id == MS_MOVE)
|
||||
ls->is_move = 1;
|
||||
else if (opt->ent->id == MS_SILENT)
|
||||
|
@ -520,6 +521,8 @@ static int optlist_add_optstr(struct libmnt_optlist *ls, const char *optstr,
|
|||
if (!opt)
|
||||
return -ENOMEM;
|
||||
opt->src = MNT_OPTSRC_STRING;
|
||||
if (where)
|
||||
where = &opt->opts;
|
||||
}
|
||||
|
||||
optlist_cleanup_cache(ls);
|
||||
|
@ -622,6 +625,8 @@ static int optlist_add_flags(struct libmnt_optlist *ls, unsigned long flags,
|
|||
if (!opt)
|
||||
return -ENOMEM;
|
||||
opt->src = MNT_OPTSRC_FLAG;
|
||||
if (where)
|
||||
where = &opt->opts;
|
||||
}
|
||||
|
||||
optlist_cleanup_cache(ls);
|
||||
|
|
|
@ -147,7 +147,7 @@ static const struct libmnt_optmap linux_flags_map[] =
|
|||
*/
|
||||
static const struct libmnt_optmap userspace_opts_map[] =
|
||||
{
|
||||
{ "defaults", 0, 0 }, /* default options */
|
||||
{ "defaults", 0, MNT_NOHLPS }, /* default options */
|
||||
|
||||
{ "auto", MNT_MS_NOAUTO, MNT_NOHLPS | MNT_INVERT | MNT_NOMTAB }, /* Can be mounted using -a */
|
||||
{ "noauto", MNT_MS_NOAUTO, MNT_NOHLPS | MNT_NOMTAB }, /* Can only be mounted explicitly */
|
||||
|
|
|
@ -69,7 +69,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
struct libscols_table *tb;
|
||||
size_t i;
|
||||
const size_t timecellsz = sizeof(stringify_value(UINT_MAX));
|
||||
const size_t timecellsz = 500;
|
||||
struct timeval last;
|
||||
|
||||
scols_init_debug(0);
|
||||
|
|
10
m4/ul.m4
10
m4/ul.m4
|
@ -30,10 +30,12 @@ dnl
|
|||
dnl Calls pkg-config --static
|
||||
dnl
|
||||
AC_DEFUN([UL_PKG_STATIC], [
|
||||
if AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$2"]); then
|
||||
$1=`$PKG_CONFIG --libs --static "$2"`
|
||||
else
|
||||
AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available])
|
||||
if test "$enable_static" != xno; then
|
||||
if AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$2"]); then
|
||||
$1=`$PKG_CONFIG --libs --static "$2"`
|
||||
else
|
||||
AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
|
|
162
meson.build
162
meson.build
|
@ -1,6 +1,6 @@
|
|||
project('util-linux', 'c',
|
||||
version : run_command('tools/git-version-gen', check: true).stdout(),
|
||||
meson_version: '>=0.53.0',
|
||||
meson_version: '>=0.57.0',
|
||||
license : 'GPLv2+')
|
||||
|
||||
pkgconfig = import('pkgconfig')
|
||||
|
@ -483,6 +483,18 @@ have = cc.compiles('''
|
|||
name : 'langinfo.h defines _NL_ABALTMON_x constants')
|
||||
conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
|
||||
|
||||
have = cc.compiles('''
|
||||
#define _GNU_SOURCE 1
|
||||
#include <langinfo.h>
|
||||
int main(void) {
|
||||
char *str;
|
||||
str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
|
||||
return 0;
|
||||
}
|
||||
''',
|
||||
name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
|
||||
conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
|
||||
|
||||
funcs = '''
|
||||
clearenv
|
||||
close_range
|
||||
|
@ -708,6 +720,9 @@ int main(void) {
|
|||
have = cc.compiles(code, name : 'using __progname')
|
||||
conf.set('HAVE___PROGNAME', have ? 1 : false)
|
||||
|
||||
have = conf.get('HAVE_PTY_H') != false and conf.get('HAVE_SYS_SIGNALFD_H') != false
|
||||
conf.set('HAVE_PTY', have ? 1 : false)
|
||||
|
||||
have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
|
||||
conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
|
||||
|
||||
|
@ -895,6 +910,7 @@ exe = executable(
|
|||
link_with : [lib_common, logindefs_c],
|
||||
dependencies : chfn_chsh_deps,
|
||||
install_dir : usrbin_exec_dir,
|
||||
install_mode : 'rwsr-xr-x',
|
||||
install : opt,
|
||||
build_by_default : opt)
|
||||
|
||||
|
@ -907,6 +923,7 @@ exe2 = executable(
|
|||
link_with : lib_common,
|
||||
dependencies : chfn_chsh_deps,
|
||||
install_dir : usrbin_exec_dir,
|
||||
install_mode : 'rwsr-xr-x',
|
||||
install : opt,
|
||||
build_by_default : opt)
|
||||
if opt and not is_disabler(exe)
|
||||
|
@ -994,6 +1011,7 @@ exe = executable(
|
|||
lib_pam_misc,
|
||||
lib_util,
|
||||
realtime_libs],
|
||||
install_mode : 'rwsr-xr-x',
|
||||
install : opt,
|
||||
build_by_default : opt)
|
||||
if opt and not is_disabler(exe)
|
||||
|
@ -1009,11 +1027,13 @@ exe = executable(
|
|||
include_directories : includes,
|
||||
dependencies : [lib_crypt],
|
||||
install_dir : usrbin_exec_dir,
|
||||
install_mode : 'rwsr-xr-x',
|
||||
install : opt,
|
||||
build_by_default : opt)
|
||||
if opt and not is_disabler(exe)
|
||||
exes += exe
|
||||
manadocs += ['login-utils/newgrp.1.adoc']
|
||||
bashcompletions += ['newgrp']
|
||||
endif
|
||||
|
||||
opt = not get_option('build-lslogins').disabled()
|
||||
|
@ -1052,6 +1072,9 @@ if opt and not is_disabler(exe)
|
|||
'vipw',
|
||||
join_paths(usrbin_exec_dir, 'vigr'))
|
||||
manadocs += ['login-utils/vipw.8.adoc']
|
||||
meson.add_install_script(meson_make_symlink,
|
||||
'vipw.8',
|
||||
join_paths(mandir, 'man8/vigr.8'))
|
||||
endif
|
||||
|
||||
opt = not get_option('build-runuser').disabled()
|
||||
|
@ -1621,6 +1644,7 @@ exe = executable(
|
|||
lib_smartcols,
|
||||
lib_mount],
|
||||
dependencies : lib_selinux,
|
||||
install_mode : 'rwsr-xr-x',
|
||||
install : opt,
|
||||
build_by_default : opt)
|
||||
exe2 = executable(
|
||||
|
@ -1629,6 +1653,7 @@ exe2 = executable(
|
|||
include_directories : includes,
|
||||
link_with : [lib_common,
|
||||
lib_mount],
|
||||
install_mode : 'rwsr-xr-x',
|
||||
install : opt,
|
||||
build_by_default : opt)
|
||||
if opt and not is_disabler(exe)
|
||||
|
@ -2379,6 +2404,7 @@ exe = executable(
|
|||
include_directories : includes,
|
||||
link_with : [lib_common],
|
||||
install_dir : usrbin_exec_dir,
|
||||
install_mode : 'rwxr-sr-x',
|
||||
install : opt,
|
||||
build_by_default : opt)
|
||||
if opt
|
||||
|
@ -2397,11 +2423,13 @@ exe = executable(
|
|||
include_directories : includes,
|
||||
link_with : [lib_common],
|
||||
install_dir : usrbin_exec_dir,
|
||||
install_mode : 'rwxr-sr-x',
|
||||
install : opt,
|
||||
build_by_default : opt)
|
||||
if opt
|
||||
exes += exe
|
||||
manadocs += ['term-utils/write.1.adoc']
|
||||
bashcompletions += ['write']
|
||||
endif
|
||||
|
||||
# chgrp tty $(DESTDIR)$(usrbin_execdir)/write
|
||||
|
@ -2843,17 +2871,19 @@ if not is_disabler(exe)
|
|||
bashcompletions += ['fadvise']
|
||||
endif
|
||||
|
||||
exe = executable(
|
||||
'waitpid',
|
||||
waitpid_sources,
|
||||
include_directories : includes,
|
||||
link_with : [lib_common],
|
||||
install_dir : usrbin_exec_dir,
|
||||
install : true)
|
||||
if not is_disabler(exe)
|
||||
exes += exe
|
||||
manadocs += ['misc-utils/waitpid.1.adoc']
|
||||
bashcompletions += ['waitpid']
|
||||
if LINUX and conf.get('HAVE_PIDFD_OPEN') != false
|
||||
exe = executable(
|
||||
'waitpid',
|
||||
waitpid_sources,
|
||||
include_directories : includes,
|
||||
link_with : [lib_common],
|
||||
install_dir : usrbin_exec_dir,
|
||||
install : true)
|
||||
if not is_disabler(exe)
|
||||
exes += exe
|
||||
manadocs += ['misc-utils/waitpid.1.adoc']
|
||||
bashcompletions += ['waitpid']
|
||||
endif
|
||||
endif
|
||||
|
||||
############################################################
|
||||
|
@ -2962,46 +2992,48 @@ exe = executable(
|
|||
include_directories : dir_include)
|
||||
exes += exe
|
||||
|
||||
# XXX: HAVE_OPENAT && HAVE_DIRFD
|
||||
exe = executable(
|
||||
'test_procfs',
|
||||
'lib/procfs.c',
|
||||
c_args : ['-DTEST_PROGRAM_PROCFS'],
|
||||
include_directories : dir_include,
|
||||
link_with : lib_common)
|
||||
exes += exe
|
||||
if conf.get('HAVE_OPENAT') != false and conf.get('HAVE_DIRFD') != false
|
||||
exe = executable(
|
||||
'test_procfs',
|
||||
'lib/procfs.c',
|
||||
c_args : ['-DTEST_PROGRAM_PROCFS'],
|
||||
include_directories : dir_include,
|
||||
link_with : lib_common)
|
||||
exes += exe
|
||||
|
||||
# XXX: HAVE_OPENAT && HAVE_DIRFD
|
||||
exe = executable(
|
||||
'test_path',
|
||||
'lib/path.c',
|
||||
'lib/fileutils.c',
|
||||
have_cpu_set_t ? 'lib/cpuset.c' : [],
|
||||
c_args : ['-DTEST_PROGRAM_PATH'],
|
||||
include_directories : dir_include,
|
||||
link_with : lib_common)
|
||||
exes += exe
|
||||
exe = executable(
|
||||
'test_path',
|
||||
'lib/path.c',
|
||||
'lib/fileutils.c',
|
||||
have_cpu_set_t ? 'lib/cpuset.c' : [],
|
||||
c_args : ['-DTEST_PROGRAM_PATH'],
|
||||
include_directories : dir_include,
|
||||
link_with : lib_common)
|
||||
exes += exe
|
||||
endif
|
||||
|
||||
# XXX: HAVE_PTY
|
||||
exe = executable(
|
||||
'test_pty',
|
||||
pty_session_c,
|
||||
monotonic_c,
|
||||
c_args : ['-DTEST_PROGRAM_PTY'],
|
||||
include_directories : dir_include,
|
||||
link_with : [lib_common],
|
||||
dependencies : [lib_m,
|
||||
realtime_libs,
|
||||
lib_util])
|
||||
exes += exe
|
||||
if conf.get('HAVE_PTY') != false
|
||||
exe = executable(
|
||||
'test_pty',
|
||||
pty_session_c,
|
||||
monotonic_c,
|
||||
c_args : ['-DTEST_PROGRAM_PTY'],
|
||||
include_directories : dir_include,
|
||||
link_with : [lib_common],
|
||||
dependencies : [lib_m,
|
||||
realtime_libs,
|
||||
lib_util])
|
||||
exes += exe
|
||||
endif
|
||||
|
||||
# XXX: LINUX
|
||||
exe = executable(
|
||||
'test_cpuset',
|
||||
'lib/cpuset.c',
|
||||
c_args : ['-DTEST_PROGRAM_CPUSET'],
|
||||
include_directories : dir_include)
|
||||
exes += exe
|
||||
if LINUX
|
||||
exe = executable(
|
||||
'test_cpuset',
|
||||
'lib/cpuset.c',
|
||||
c_args : ['-DTEST_PROGRAM_CPUSET'],
|
||||
include_directories : dir_include)
|
||||
exes += exe
|
||||
endif
|
||||
|
||||
exe = executable(
|
||||
'test_sysfs',
|
||||
|
@ -3238,12 +3270,13 @@ exe = executable(
|
|||
include_directories : includes)
|
||||
exes += exe
|
||||
|
||||
# XXX: LINUX
|
||||
exe = executable(
|
||||
'test_mkfds',
|
||||
'tests/helpers/test_mkfds.c',
|
||||
include_directories : includes)
|
||||
exes += exe
|
||||
if LINUX
|
||||
exe = executable(
|
||||
'test_mkfds',
|
||||
'tests/helpers/test_mkfds.c',
|
||||
include_directories : includes)
|
||||
exes += exe
|
||||
endif
|
||||
|
||||
exe = executable(
|
||||
'test_enosys',
|
||||
|
@ -3253,14 +3286,15 @@ exes += exe
|
|||
|
||||
############################################################
|
||||
|
||||
# XXX: HAVE_OPENAT
|
||||
exe = executable(
|
||||
'sample-scols-tree',
|
||||
'libsmartcols/samples/tree.c',
|
||||
include_directories : includes,
|
||||
link_with : [lib_smartcols, lib_common])
|
||||
if not is_disabler(exe)
|
||||
exes += exe
|
||||
if conf.get('HAVE_OPENAT') != false
|
||||
exe = executable(
|
||||
'sample-scols-tree',
|
||||
'libsmartcols/samples/tree.c',
|
||||
include_directories : includes,
|
||||
link_with : [lib_smartcols, lib_common])
|
||||
if not is_disabler(exe)
|
||||
exes += exe
|
||||
endif
|
||||
endif
|
||||
|
||||
exe = executable(
|
||||
|
@ -3337,7 +3371,7 @@ configure_file(output : 'meson.conf',
|
|||
'''asan=@0@
|
||||
PYTHON=@1@
|
||||
'''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
|
||||
python.path())])
|
||||
python.full_path())])
|
||||
|
||||
run_sh = find_program('tests/run.sh')
|
||||
run_target(
|
||||
|
|
|
@ -320,7 +320,7 @@ int main(int argc, char **argv)
|
|||
{"twelve", no_argument, NULL, 'Y'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"vertical", no_argument, NULL,'v'},
|
||||
{"column", required_argument, NULL,'c'},
|
||||
{"columns", required_argument, NULL,'c'},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
|
@ -433,7 +433,8 @@ int main(int argc, char **argv)
|
|||
if (strcmp(optarg, "auto") == 0)
|
||||
cols = COLUMNS_AUTO;
|
||||
else
|
||||
cols = strtosize_or_err(optarg, "foo");
|
||||
cols = strtosize_or_err(optarg,
|
||||
_("failed to parse columns"));
|
||||
break;
|
||||
case 'V':
|
||||
print_version(EXIT_SUCCESS);
|
||||
|
|
|
@ -42,7 +42,7 @@ are very often different from the beginning.
|
|||
|
||||
include::man-common/help-version.adoc[]
|
||||
|
||||
*-c* *--content*::
|
||||
*-c*, *--content*::
|
||||
Consider only file content, not attributes, when determining whether two files are equal. Same as *-pot*.
|
||||
|
||||
*-b*, *--io-size* _size_::
|
||||
|
|
|
@ -471,7 +471,7 @@ static void write_output(struct logger_ctl *ctl, const char *const msg)
|
|||
union {
|
||||
struct cmsghdr cmh;
|
||||
char control[CMSG_SPACE(sizeof(struct ucred))];
|
||||
} cbuf;
|
||||
} cbuf = { .control = { 0 } };
|
||||
#endif
|
||||
|
||||
/* 4) add extra \n to make sure message is terminated */
|
||||
|
|
|
@ -746,6 +746,10 @@ static struct node *dparser_compile1(struct parser *parser, struct node *last)
|
|||
int ntype;
|
||||
switch (jtype) {
|
||||
case SCOLS_JSON_STRING:
|
||||
case SCOLS_JSON_ARRAY_STRING:
|
||||
case SCOLS_JSON_ARRAY_NUMBER:
|
||||
/* We handles SCOLS_JSON_ARRAY_* as a string
|
||||
* till we implement operators for arrays. */
|
||||
ntype = NODE_STR;
|
||||
break;
|
||||
case SCOLS_JSON_NUMBER:
|
||||
|
|
|
@ -145,7 +145,7 @@ static const struct colinfo infos[] = {
|
|||
0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
|
||||
N_("device type (blk, char, or nodev)") },
|
||||
[COL_ENDPOINTS] = { "ENDPOINTS",
|
||||
0, SCOLS_FL_WRAP, SCOLS_JSON_STRING,
|
||||
0, SCOLS_FL_WRAP, SCOLS_JSON_ARRAY_STRING,
|
||||
N_("IPC endpoints information communicated with the fd") },
|
||||
[COL_FLAGS] = { "FLAGS",
|
||||
0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING,
|
||||
|
@ -1561,6 +1561,7 @@ static void __attribute__((__noreturn__)) usage(void)
|
|||
for (i = 0; i < ARRAY_SIZE(infos); i++)
|
||||
fprintf(out, " %16s %-10s%s\n", infos[i].name,
|
||||
infos[i].json_type == SCOLS_JSON_STRING? "<string>":
|
||||
infos[i].json_type == SCOLS_JSON_ARRAY_STRING? "<string>":
|
||||
infos[i].json_type == SCOLS_JSON_NUMBER? "<number>":
|
||||
"<boolean>",
|
||||
_(infos[i].help));
|
||||
|
|
|
@ -184,7 +184,7 @@ static void create_nthreads(process_t *proc, size_t index)
|
|||
}
|
||||
|
||||
LOG(2, (stderr, "%d: started thread [tid=%jd,index=%zu]\n",
|
||||
proc->pid, (intmax_t) th->tid, th->index));
|
||||
proc->pid, (intmax_t) (intptr_t) th->tid, th->index));
|
||||
index += nobjects;
|
||||
ncreated++;
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ static void create_nthreads(process_t *proc, size_t index)
|
|||
}
|
||||
|
||||
LOG(2, (stderr, "%d: thread exited [tid=%jd,return=%d]\n",
|
||||
proc->pid, (intmax_t) th->tid, th->retval));
|
||||
proc->pid, (intmax_t) (intptr_t) th->tid, th->retval));
|
||||
}
|
||||
|
||||
free(threads);
|
||||
|
@ -260,7 +260,7 @@ static void object_dump(size_t idx, object_t *obj)
|
|||
fprintf(stderr, " uuid: <%s>\n", p);
|
||||
fprintf(stderr, " idx: %zu\n", obj->idx);
|
||||
fprintf(stderr, " process: %d\n", (int) obj->pid);
|
||||
fprintf(stderr, " thread: %jd\n", (intmax_t) obj->tid);
|
||||
fprintf(stderr, " thread: %jd\n", (intmax_t) (intptr_t) obj->tid);
|
||||
fprintf(stderr, "}\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -35,10 +35,13 @@ asciidoc_man_cmd = $(ASCIIDOCTOR) \
|
|||
-a 'package-docdir=$(docdir)' \
|
||||
-a 'VERSION=$(VERSION)' \
|
||||
-a 'ADJTIME_PATH=$(ADJTIME_PATH)' \
|
||||
--failure-level ERROR \
|
||||
--load-path '$(top_srcdir)/tools' \
|
||||
--require asciidoctor-unicodeconverter
|
||||
|
||||
if HAVE_ASCIIDOCTOR_FAILURE_LEVEL
|
||||
asciidoc_man_cmd += --failure-level ERROR
|
||||
endif
|
||||
|
||||
gen-mans: gen-trans
|
||||
@set -e; \
|
||||
for l in $(PO_LANGS); do \
|
||||
|
|
1783
po-man/cs.po
1783
po-man/cs.po
File diff suppressed because it is too large
Load diff
1788
po-man/de.po
1788
po-man/de.po
File diff suppressed because it is too large
Load diff
1784
po-man/es.po
1784
po-man/es.po
File diff suppressed because it is too large
Load diff
1785
po-man/fr.po
1785
po-man/fr.po
File diff suppressed because it is too large
Load diff
38919
po-man/ko.po
Normal file
38919
po-man/ko.po
Normal file
File diff suppressed because it is too large
Load diff
1777
po-man/pt_BR.po
1777
po-man/pt_BR.po
File diff suppressed because it is too large
Load diff
38277
po-man/ro.po
Normal file
38277
po-man/ro.po
Normal file
File diff suppressed because it is too large
Load diff
1785
po-man/sr.po
1785
po-man/sr.po
File diff suppressed because it is too large
Load diff
1908
po-man/uk.po
1908
po-man/uk.po
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
468
po/pt_BR.po
468
po/pt_BR.po
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
466
po/zh_CN.po
466
po/zh_CN.po
File diff suppressed because it is too large
Load diff
601
po/zh_TW.po
601
po/zh_TW.po
File diff suppressed because it is too large
Load diff
|
@ -157,7 +157,7 @@ if BUILD_DMESG
|
|||
bin_PROGRAMS += dmesg
|
||||
MANPAGES += sys-utils/dmesg.1
|
||||
dist_noinst_DATA += sys-utils/dmesg.1.adoc
|
||||
dmesg_SOURCES = sys-utils/dmesg.c lib/monotonic.c
|
||||
dmesg_SOURCES = sys-utils/dmesg.c lib/monotonic.c include/pager.h lib/pager.c
|
||||
dmesg_LDADD = $(LDADD) libcommon.la libtcolors.la $(REALTIME_LIBS)
|
||||
dmesg_CFLAGS = $(AM_CFLAGS)
|
||||
check_PROGRAMS += test_dmesg
|
||||
|
|
|
@ -271,19 +271,12 @@ static int blkzone_report(struct blkzone_control *ctl)
|
|||
break;
|
||||
|
||||
for (i = 0; i < zi->nr_zones; i++) {
|
||||
/*
|
||||
* blk_zone_report hasn't been packed since https://github.com/torvalds/linux/commit/b3e7e7d2d668de0102264302a4d10dd9d4438a42
|
||||
* was merged. See https://github.com/util-linux/util-linux/issues/1083
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
|
||||
const struct blk_zone *entry = &zi->zones[i];
|
||||
#pragma GCC diagnostic pop
|
||||
unsigned int type = entry->type;
|
||||
uint64_t start = entry->start;
|
||||
uint64_t wp = entry->wp;
|
||||
uint8_t cond = entry->cond;
|
||||
uint64_t len = entry->len;
|
||||
const struct blk_zone entry = zi->zones[i];
|
||||
unsigned int type = entry.type;
|
||||
uint64_t start = entry.start;
|
||||
uint64_t wp = entry.wp;
|
||||
uint8_t cond = entry.cond;
|
||||
uint64_t len = entry.len;
|
||||
uint64_t cap;
|
||||
|
||||
if (!len) {
|
||||
|
@ -292,9 +285,9 @@ static int blkzone_report(struct blkzone_control *ctl)
|
|||
}
|
||||
|
||||
if (has_zone_capacity(zi))
|
||||
cap = zone_capacity(entry);
|
||||
cap = zone_capacity(&entry);
|
||||
else
|
||||
cap = entry->len;
|
||||
cap = entry.len;
|
||||
|
||||
if (only_capacity_sum) {
|
||||
capacity_sum += cap;
|
||||
|
@ -303,7 +296,7 @@ static int blkzone_report(struct blkzone_control *ctl)
|
|||
", cap 0x%06"PRIx64", wptr 0x%06"PRIx64
|
||||
" reset:%u non-seq:%u, zcond:%2u(%s) [type: %u(%s)]\n"),
|
||||
start, len, cap, (type == 0x1) ? 0 : wp - start,
|
||||
entry->reset, entry->non_seq,
|
||||
entry.reset, entry.non_seq,
|
||||
cond, condition_str[cond & (ARRAY_SIZE(condition_str) - 1)],
|
||||
type, type_text[type]);
|
||||
} else {
|
||||
|
@ -311,7 +304,7 @@ static int blkzone_report(struct blkzone_control *ctl)
|
|||
", wptr 0x%06"PRIx64
|
||||
" reset:%u non-seq:%u, zcond:%2u(%s) [type: %u(%s)]\n"),
|
||||
start, len, (type == 0x1) ? 0 : wp - start,
|
||||
entry->reset, entry->non_seq,
|
||||
entry.reset, entry.non_seq,
|
||||
cond, condition_str[cond & (ARRAY_SIZE(condition_str) - 1)],
|
||||
type, type_text[type]);
|
||||
}
|
||||
|
|
|
@ -179,7 +179,13 @@ struct dmesg_control {
|
|||
|
||||
int kmsg; /* /dev/kmsg file descriptor */
|
||||
ssize_t kmsg_first_read;/* initial read() return code */
|
||||
char kmsg_buf[BUFSIZ];/* buffer to read kmsg data */
|
||||
/*
|
||||
* the kernel will give EINVAL if we do read() on /proc/kmsg with
|
||||
* length insufficient for the next message. messages may be up to
|
||||
* PRINTK_MESSAGE_MAX, which is defined as 2048, so we must be
|
||||
* able to buffer at least that much in one call
|
||||
*/
|
||||
char kmsg_buf[2048]; /* buffer to read kmsg data */
|
||||
|
||||
usec_t since; /* filter records by time */
|
||||
usec_t until; /* filter records by time */
|
||||
|
|
|
@ -470,6 +470,25 @@ static void warn_size(const char *filename, uint64_t size, uint64_t offset, int
|
|||
filename);
|
||||
}
|
||||
|
||||
static int find_unused(struct loopdev_cxt *lc)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = loopcxt_find_unused(lc);
|
||||
if (!rc)
|
||||
return 0;
|
||||
|
||||
if (access(_PATH_DEV_LOOPCTL, F_OK) == 0 &&
|
||||
access(_PATH_DEV_LOOPCTL, W_OK) != 0)
|
||||
;
|
||||
else
|
||||
errno = -rc;
|
||||
|
||||
warn(_("cannot find an unused loop device"));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int create_loop(struct loopdev_cxt *lc,
|
||||
int nooverlap, int lo_flags, int flags,
|
||||
const char *file, uint64_t offset, uint64_t sizelimit,
|
||||
|
@ -551,10 +570,8 @@ static int create_loop(struct loopdev_cxt *lc,
|
|||
/* Note that loopcxt_{find_unused,set_device}() resets
|
||||
* loopcxt struct.
|
||||
*/
|
||||
if (!hasdev && (rc = loopcxt_find_unused(lc))) {
|
||||
warnx(_("cannot find an unused loop device"));
|
||||
if (!hasdev && (rc = find_unused(lc)))
|
||||
break;
|
||||
}
|
||||
if (flags & LOOPDEV_FL_OFFSET)
|
||||
loopcxt_set_offset(lc, offset);
|
||||
if (flags & LOOPDEV_FL_SIZELIMIT)
|
||||
|
@ -868,18 +885,8 @@ int main(int argc, char **argv)
|
|||
res = delete_all_loops(&lc);
|
||||
break;
|
||||
case A_FIND_FREE:
|
||||
res = loopcxt_find_unused(&lc);
|
||||
if (res) {
|
||||
int errsv = errno;
|
||||
|
||||
if (access(_PATH_DEV_LOOPCTL, F_OK) == 0 &&
|
||||
access(_PATH_DEV_LOOPCTL, W_OK) != 0)
|
||||
;
|
||||
else
|
||||
errno = errsv;
|
||||
|
||||
warn(_("cannot find an unused loop device"));
|
||||
} else
|
||||
res = find_unused(&lc);
|
||||
if (!res)
|
||||
printf("%s\n", loopcxt_get_device(&lc));
|
||||
break;
|
||||
case A_SHOW:
|
||||
|
|
|
@ -206,6 +206,12 @@ static const struct id_part apple_part[] = {
|
|||
{ 0x031, "Avalanche-A15" },
|
||||
{ 0x032, "Blizzard-M2" },
|
||||
{ 0x033, "Avalanche-M2" },
|
||||
{ 0x034, "Blizzard-M2-Pro" },
|
||||
{ 0x035, "Avalanche-M2-Pro" },
|
||||
{ 0x036, "Sawtooth-A16" },
|
||||
{ 0x037, "Everest-A16" },
|
||||
{ 0x038, "Blizzard-M2-Max" },
|
||||
{ 0x039, "Avalanche-M2-Max" },
|
||||
{ -1, "unknown" },
|
||||
};
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ fstrim_sources = files(
|
|||
dmesg_sources = files(
|
||||
'dmesg.c',
|
||||
) + \
|
||||
monotonic_c
|
||||
monotonic_c + pager_c
|
||||
|
||||
ctrlaltdel_sources = files(
|
||||
'ctrlaltdel.c',
|
||||
|
|
|
@ -184,6 +184,8 @@ Since util-linux 2.35, *mount* does not exit when user permissions are inadequat
|
|||
|
||||
For more details, see *fstab*(5). Only the user that mounted a filesystem can unmount it again. If any user should be able to unmount it, then use *users* instead of *user* in the _fstab_ line. The *owner* option is similar to the *user* option, with the restriction that the user must be the owner of the special file. This may be useful e.g. for _/dev/fd_ if a login script makes the console user owner of this device. The *group* option is similar, with the restriction that the user must be a member of the group of the special file.
|
||||
|
||||
The *user* mount option is accepted if no username is specified. If used in the format *user=someone*, the option is silently ignored and visible only for external mount helpers (/sbin/mount.<type>) for compatibility with some network filesystems.
|
||||
|
||||
=== Bind mount operation
|
||||
|
||||
Remount part of the file hierarchy somewhere else. The call is:
|
||||
|
@ -1608,6 +1610,9 @@ The command *mount* does not pass the mount options *unbindable*, *runbindable*,
|
|||
|
||||
== ENVIRONMENT
|
||||
|
||||
*LIBMOUNT_FORCE_MOUNT2*={always|never|auto}::
|
||||
force to use classic mount(2) system call (requires support for new file descriptors based mount API). The default is *auto*; in this case, libmount tries to be smart and use classic mount(2) only for well-known issues. If the new mount API is unavailable, libmount can still use traditional mount(2), although LIBMOUNT_FORCE_MOUNT2 is set to *never*.
|
||||
|
||||
*LIBMOUNT_FSTAB*=<path>::
|
||||
overrides the default location of the _fstab_ file (ignored for suid)
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue