Commit Graph
4392 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 5143e657d2 basic/architecture: sort and reindent one more table
No idea why I didn't do this one in the previous round.
2021-11-30 13:54:29 +01:00
Yu Watanabe a6f44d610c tree-wide: fix typo 2021-11-30 12:30:07 +00:00
Zbigniew Jędrzejewski-Szmek 08e70b4a21 Merge pull request #21541 from bluca/analyze_security_profile
analyze: add --profile switch to security verb
2021-11-29 21:23:34 +01:00
Zbigniew Jędrzejewski-Szmek 4b658ff651 Merge pull request #21531 from keszybz/log2-tables
Optimize log2 tables
2021-11-29 13:58:49 +01:00
Zbigniew Jędrzejewski-Szmek f4ada1b42f basic/util: add macro variants of log2 functions
The macro variants can be used in static initializers.

The same guard against calling __builtin_clz(0) is added as for
__builtin_clzll(0), since that's undefined behaviour too. Our code
wouldn't call it, but this avoids a potential pitfall with the macro.
All variants map 0→0. Otherwise we'd often have to handle 0 specially
in callers.

__builtin_clz takes unsigned as the argument, so there's no LOG2I macro.
2021-11-29 11:12:52 +01:00
Luca Boccassi 13c02e7bd5 portable: move profile search helper to path-lookup
Will be used in systemd-analyze later
2021-11-26 17:50:59 +00:00
Zbigniew Jędrzejewski-Szmek 58c34be864 basic/util: rename u64log2 to log2u64
u64log2 was strangely named. We even have log2i and log2u right below
in that file.
2021-11-26 15:29:06 +01:00
Zbigniew Jędrzejewski-Szmek 1ba193d73e basic/strv: drop strv_free_free
I think the function name is confusing: we generally say "free_free" when
both keys and values are freed in a hash map, but here the type is an
array of strvs, so the name should be something like strv_array_free.

The function is unused since 143fadf369 (2018),
let's just drop it.
2021-11-26 14:58:44 +01:00
Zbigniew Jędrzejewski-Szmek 14337c374a basic/strv: inline variables and modernize style a bit 2021-11-26 14:52:03 +01:00
Zbigniew Jędrzejewski-Szmek 66a8eddd6d Merge pull request #21360 from yuwata/network-json
network: json: add more information
2021-11-26 11:04:52 +01:00
Lennart Poettering 7ff048a718 Merge pull request #21487 from DaanDeMeyer/dissect-image-other-arch
Allow dissect_image() to dissect images from architectures other than the native one
2021-11-25 17:36:57 +01:00
Yu Watanabe f9930401d5 in-addr-util: introduce FAMILY_ADDRESS_SIZE_SAFE() macro 2021-11-25 22:34:29 +09:00
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
Daan De Meyer 3c58ae1313 basic: Rename SECONDARY_ARCHITECTURE to ARCHITECTURE_SECONDARY
For easier integration with the _GPT_ALL_ARCHES macro in a future
commit.
2021-11-24 12:00:41 +01:00
Daan De Meyer b998ff21e1 basic: Give architecure enum a name 2021-11-24 12:00:41 +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