Commit Graph

4378 Commits

Author SHA1 Message Date
Lennart Poettering
55cb63bf6e list: add LIST_POP() helper that pops the first item off a linked list 2021-11-25 12:10:03 +01:00
Yu Watanabe
c8e16339f1 Merge pull request #21503 from poettering/ioprio-fix
work around linux 5.15 ioprio API breakage
2021-11-25 14:23:02 +09:00
Zbigniew Jędrzejewski-Szmek
ed15f8bceb Add debug logs of extension-release scanning 2021-11-24 17:43:01 +01:00
Lennart Poettering
ba7772fee4 ioprio: normalize io priority values in configuration
Let's always say IOPRIO_CLASS_BE when IOPRIO_CALSS_NONE is set.
2021-11-24 16:12:15 +01:00
Lennart Poettering
0692548c73 ioprio-util: add macro for default ioprio settings
IOPRIO_CLASS_NONE with any priority value actually is an alias for
IOPRIO_CLASS_BE with priority value 4 – which is the default ioprio for
all processes.

We got this right at one place, but wrong at three others (where we
assumed the default value was 0, not 4). Let's add a
macro that encodes this properly, and use it everywhere.
2021-11-24 16:12:15 +01:00
Lennart Poettering
032b3afbf4 shared: split out ioprio related stuff into ioprio-util.[ch]
No actual code changes, just some splitting out.
2021-11-24 16:12:15 +01:00
Zbigniew Jędrzejewski-Szmek
91ee7c5ebd basic/architectures: sort by name and remove duplicates
C.f. 086df29f35.
2021-11-24 10:05:28 +01:00
Lennart Poettering
aa3cc58a9f recurse-dir: give callers of recurse_dir_at() control over path prefix
One of the niceties of recurse_dir()/recurse_dir_at() is that the path
argument is decoration, it's not used for actually accessing the fs in
anyway. That's very handy in environments where chroots and relative
paths are used, as we can path in any path we like and the recursion
function will suffix with whatever it discovers but will not try to make
sense of the prefix you pass.

This works great, except that the recurse_dir_at() wrapper broke that:
it adjusted the path if NULL to "." simply for the sake of making
openat() on the top work. Let's make this adjustment more local and do
it only for the openat() itself, and otherwise pass the path through the
way we got it. This means: if a caller really wants the paths that are
concatenated to start with a "." it can just pass that. This way the
caller gets full control back of the path prefix. Win!

Note that all current users of recurse_dir_at() don't pass NULL as
second arg, hence this check is without any real effect for now. It's
preparation for future uses however.
2021-11-24 09:34:10 +01:00
Lennart Poettering
ed90de9fbc process-util: add missing NULL initialization for _cleanup_ variable
This is will otherwise trigger a bad memory access in the error path
2021-11-23 18:42:22 +01:00
Boqun Feng
76eec06499 virt: Fix the detection for Hyper-V VMs
Use product_version instead of product_name in DMI table and the string
"Hyper-V" to avoid misdetection.

Fixes: #21468

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
2021-11-23 13:23:33 +01:00
Lennart Poettering
c1b91f06b9 socket-util: add helper for generically initializing sockaddr_union from in_addr_union 2021-11-22 22:18:34 +01:00
Zbigniew Jędrzejewski-Szmek
ba9ddcb8d6 Trivial style fixes 2021-11-19 18:49:46 +01:00
Zbigniew Jędrzejewski-Szmek
086df29f35 shared/gpt: reorder arches alphabetically
It's just too annoying to add new ones otherwise.
2021-11-19 16:52:38 +01:00
Lennart Poettering
f85b12d6fd strv: make sure FOREACH_STRING() can be nested 2021-11-19 11:23:36 +01:00
Daan De Meyer
9c41618008 journal: Don't discard kmsg messages coming from journald itself
Previously, we discarded any kmsg messages coming from journald
itself to avoid infinite loops where potentially the processing
of a kmsg message causes journald to log one or more messages to
kmsg which then get read again by the kmsg handler, ...

However, if we completely disable logging whenever we're processing
a kmsg message coming from journald itself, we also prevent any
infinite loops as we can be sure that journald won't accidentally
generate logging messages while processing a kmsg log message.

This change allows us to store all journald logs generated during
the processing of log messages from other services in the system
journal. Previously these could only be found in kmsg which has
low retention, can't be queried using journalctl and whose logs
don't survive reboots.
2021-11-18 19:37:17 +00:00
Lennart Poettering
c73094f3ac fs-util: add new helper open_mkdir_at() 2021-11-17 21:48:18 +01:00
Lennart Poettering
b049b48c4b Merge pull request #21326 from poettering/mkdir-tweaks
various tweaks to mkdir code
2021-11-16 22:55:11 +01:00
Zbigniew Jędrzejewski-Szmek
af5e64be2e Merge pull request #21392 from keszybz/memleak-fix-and-assorted-fs-code-cleanups
Memleak fix and assorted fs code cleanups
2021-11-16 18:57:04 +01:00
Lennart Poettering
35cd0ba516 shared: clean up mkdir.h/label.h situation
Previously the mkdir_label() family of calls was implemented in
src/shared/mkdir-label.c but its functions partly declared ins
src/shared/label.h and partly in src/basic/mkdir.h (!!). That's weird
(and wrong).

Let's clean this up, and add a proper mkdir-label.h matching the .c
file.
2021-11-16 17:03:28 +01:00
Lennart Poettering
ed304a5d73 mkdir: drop mkdir_errno_wrapper(), use mkdirat_errno_wrapper() instead
Let's reduce our code duplication, and let's focus on using xyzat()
style APIs more, hence drop mkdir_errno_wrapper() and stick to
mkdirar_errno_wrapper() wherever we can, it's a true superset of
functionality after all.
2021-11-16 17:03:03 +01:00
Lennart Poettering
1e146d7382 mkdir: use chase_symlinks_and_stat() where appropriate 2021-11-16 17:01:54 +01:00
Lennart Poettering
c7e715096f mkdir: make sure mode is set 2021-11-16 17:01:49 +01:00
Lennart Poettering
05f05a06cd mkdir: tighten permission check
Let's complain about any bit that is set in the existing inode but no in
the mask we are supposed to use.
2021-11-16 17:00:06 +01:00
Lennart Poettering
67d0c6744f Merge pull request #21275 from keszybz/makefs-quiet
Makefs quiet output
2021-11-16 16:55:47 +01:00
Lennart Poettering
032e11a234 Merge pull request #21386 from keszybz/binfmt-later
Order binfmt.service after local-fs.target
2021-11-16 16:54:47 +01:00
Zbigniew Jędrzejewski-Szmek
9b49a3b49e basic/utf8: add function to convert to ASCII
The conversion must be lossy because ASCII doesn't have enough chars.
2021-11-16 13:54:38 +01:00
Zbigniew Jędrzejewski-Szmek
fb40b13165 basic: f2fs can do discard 2021-11-16 13:00:31 +01:00
Zbigniew Jędrzejewski-Szmek
30741d6cca basic: cramfs is also a read-only fs 2021-11-16 13:00:31 +01:00
Zbigniew Jędrzejewski-Szmek
ae568b15ec basic/generate-fs-switch-case: inline comments
Let's keep the comments together with the lines they describe, this is easier
to read and probably more maintainable in the long run.

Also, () → {} for idiomaticity.
2021-11-16 12:26:23 +01:00
Zbigniew Jędrzejewski-Szmek
7ee587afe3 Merge pull request #21373 from poettering/filesystems-more-groups
some file system tables/magic love
2021-11-16 10:27:21 +01:00
Zbigniew Jędrzejewski-Szmek
1990bc64cd basic/errno-util: adjust indentation
It was bothering me that this backslash wasn't aligned with the
ones below.
2021-11-16 09:21:22 +01:00
Lennart Poettering
7c248223eb tree-wide: use new RET_NERRNO() helper at various places 2021-11-16 08:04:09 +01:00
Lennart Poettering
ef470ffa23 macro: add new helper RET_NERRNO()
This new helper converts libc style syscall return values into
systemd-kernel (actually: kernel style) negative errno values.

It's implemented as macro-like inline function, and propagates return
values >= 0 as themselves and returns -errno for negative error returns.

THis is supposed to be little more than syntactic sugar so that we can
reduce a lot of (short, but still) boilerplate code whever we convert
libc style error handling into our own.

As discussed here:

https://github.com/systemd/systemd/pull/21326#discussion_r748413537
2021-11-16 08:04:09 +01:00
Lennart Poettering
cb3763d57b cgroup-util: laccess() returns negative errno already 2021-11-16 08:04:09 +01:00
Lennart Poettering
ad004abe9d filesystems: apparently f2fs is als reasonably common
As suggested:

https://github.com/systemd/systemd/pull/21373#discussion_r749523677
2021-11-15 22:54:15 +01:00
Lennart Poettering
05715f12a8 filesystems: add ntfs/ntfs3 magic and add it current version to group
As suggested:

https://github.com/systemd/systemd/pull/21373#discussion_r749523677
2021-11-15 22:53:25 +01:00
Lennart Poettering
ad4e99fe9a filesystems: add comments to gperf file anomalies
Some file systems have non-unique names or non-unique magics. Let's add
some comments explaining that.
2021-11-15 22:43:03 +01:00
Lennart Poettering
0ed6103c19 filesystems: fix magic of "smb3" fs
smb3 is an alias for modern CIFS, not the old SMB fs (see kmod alias list, i.e. modinfo fs-smb3).

(the old smbfs has long been removed from the kernel actually, it's dead
and obsolete)
2021-11-15 22:43:03 +01:00
Lennart Poettering
d7c2f8817a filesystems: list rpc_pipefs as auxiliary kernel API VFS 2021-11-15 22:43:03 +01:00
Lennart Poettering
7e8fd61089 filesystems: list orangefs as network fs
it's the new name or pvfs2, hence we might as well list it, given we
list that already.
2021-11-15 22:43:03 +01:00
Lennart Poettering
2b69f6e591 devtmpfs is a primary API fs 2021-11-15 22:43:03 +01:00
Lennart Poettering
66d39325d7 filesystems: add three more file system types
devtmpfs and cpuset are not actual filesystems of their own. cpuset used
to be but is now an alias for cgroupsfs. devtmpfs is the same as tmpfs
as its just a "named superblock", i.e. a specific instance of tmpfs, but
not a file system of its own.
2021-11-15 22:43:03 +01:00
Lennart Poettering
6d439321e8 filesystems: add internal APIs to convert fs magic to name
We previously had tooling for the opposite direction, let's complete the
work.
2021-11-15 22:43:03 +01:00
Lennart Poettering
3818d6a3a5 mountpoint-util: sort list of read-only fs again 2021-11-15 22:43:03 +01:00
Lennart Poettering
5feeb2584f filesystems: add group for "application" file system
This group shall cover file systems whose job is to make stuff that
isn't actually storing anything in itself, and isn't just an API file
system, but allows exposing stuff with special semantics in the VFS.
2021-11-15 22:43:03 +01:00
Lennart Poettering
9c8214d559 filesystems: add binfmt_misc to auxiliary API VFS group 2021-11-15 22:43:03 +01:00
Lennart Poettering
333a2ad649 filesystems: add ceph to network file systems group 2021-11-15 22:43:03 +01:00
Lennart Poettering
2867cb392a filesystems: slightly update common block device groups 2021-11-15 22:43:03 +01:00
Lennart Poettering
73e7576e3b filesystems: add two new filesystem groups
1. @anonymous → for file systems that aren't real file systems but
   simply the backing for sockets, pipes and other "anonymous" fds.

2. @security → for the various MAC security file systems.
2021-11-15 22:43:03 +01:00
Lennart Poettering
fe0777fb94 Merge pull request #21320 from poettering/namespace-mkdir-umask
make pid1 namespace code independent of umask
2021-11-12 22:12:58 +01:00