Add a new `MakeFilesystemFlags` enum and use it to replace the existing
`quiet` and `discard` booleans on `make_filesystem()`.
Update the callers. While we're doing that, consolidate some duplicated
logic in systemd-repart.
Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
Change 'flags' to 'fork_flags' in preparation for using 'flags' as an
argument in the next commit.
Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
Add a new member to CopyFlags to request copying of fs-verity status.
If copying of fs-verity is requested then we query the descriptor from
each regular file. If it has one, we use it to setup fs-verity on the
destination, using the same parameters.
Signatures don't seem to be a particularly well-loved (or used) feature
of fs-verity and we don't bother to query them here. Support for that
could be added later, if desired.
This change means that, with the correct combination of flags, we might
end up calling `fsync()` on a read-only file descriptor. This is
permitted by POSIX and supported on Linux.
Nothing uses this yet.
Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
cg_get_keyed_attribute() is a more generic version of this,
and cg_is_empty_recursive() was the only user of this function,
which got converted in the previous commit.
This effectively renames cg_is_empty_recursive() to cg_is_empty().
Note that all existing code calls the former and not the latter,
hence with cgv1 support being dropped it's trivial to consult
cgroup.events directly for populated state everywhere.
Additionally, use more generic cg_get_keyed_attribute() helper
rather than cg_read_event().
This gives us a little more information about what units were enabled
or disabled on that first boot and will be useful for OS developers
tracking down the source of unit state.
An example with this enabled looks like:
```
NET: Registered PF_VSOCK protocol family
systemd[1]: Applying preset policy.
systemd[1]: Unit /etc/systemd/system/dnsmasq.service is masked, ignoring.
systemd[1]: Unit /etc/systemd/system/systemd-repart.service is masked, ignoring.
systemd[1]: Removed '/etc/systemd/system/sockets.target.wants/systemd-resolved-monitor.socket'.
systemd[1]: Removed '/etc/systemd/system/sockets.target.wants/systemd-resolved-varlink.socket'.
systemd[1]: Created symlink '/etc/systemd/system/multi-user.target.wants/var-mnt-workdir.mount' → '/etc/systemd/system/var-mnt-workdir.mount'.
systemd[1]: Created symlink '/etc/systemd/system/multi-user.target.wants/var-mnt-workdir\x2dtmp.mount' → '/etc/systemd/system/var-mnt-workdir\x2dtmp.mount'.
systemd[1]: Created symlink '/etc/systemd/system/afterburn-sshkeys.target.requires/afterburn-sshkeys@core.service' → '/usr/lib/systemd/system/afterburn-sshkeys@.service'.
systemd[1]: Created symlink '/etc/systemd/system/sockets.target.wants/systemd-resolved-varlink.socket' → '/usr/lib/systemd/system/systemd-resolved-varlink.socket'.
systemd[1]: Created symlink '/etc/systemd/system/sockets.target.wants/systemd-resolved-monitor.socket' → '/usr/lib/systemd/system/systemd-resolved-monitor.socket'.
systemd[1]: Populated /etc with preset unit settings.
```
Considering it only happens on first boot and not on every boot I think
the extra information is worth the extra verbosity in the logs just for
that boot.
I guess the current wording of "Interactive authentication required." is
hard to grok for many users. Let's try to reword this, and say
explicitly:
1. That this is a form of "access denied" error
2. That interactive auth could remedy this
3. But that the client disabled interactive auth
I think these are the three primary elements the error msg needs to
convey. I tried to distill this in a short error string with this.
Fixes: #2081
F2FS returns EINVAL from FS_IOC_SETFLAGS when trying to set
FS_NOCOW_FL. Let's handle this by treating EINVAL as not supported.
While we're at it, make sure we use ERRNO_IS_IOCTL_NOT_SUPPORTED()
across the tree instead of ERRNO_IS_NOT_SUPPORTED() when calling any
of the chattr_xxx() functions.
Fixes#37593
Print the original input value on error instead of the consumed string
(which will be empty).
Previously:
$ udevadm info /dev/block/251:0 -e --attr-match='foo=\'
Failed to parse key/value pair : Invalid argument
$ udevadm info /dev/block/251:0 -e --attr-match='foo'
Missing '=' in key/value pair (null).
Now:
$ build/udevadm info /dev/block/251:0 -e --attr-match='foo=\'
Failed to parse key/value pair foo=\: Invalid argument
(The second scenario can't be hit anymore since
d89b3004da due to an extra check before
calling parse_key_value_argument().)
Now that the entire free doesn't trigger any clang unused include
violations anymore, let's re-enable the clangd option as it's much
more useful now that the tree is clean.
We're very limited in our ability to change these due to backwards
compat, so let's skip them from analysis since we won't be able to
fix the errors anyway.
For libsystemd's headers, the changes made depend on whether the
header is installed or not. For installed headers, the only change
made is that commonly included headers were moved to _sd-common.h.
For these headers, there should be no noticeable change in behavior
when including them. For non-installed headers, includes were replaced
with forward declarations where possible as usual.
Split out of #37344.