• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

systemd / systemd / 15263807472

26 May 2025 08:53PM UTC coverage: 72.046% (-0.002%) from 72.048%
15263807472

push

github

yuwata
src/core/manager.c: log preset activity on first boot

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.

5 of 6 new or added lines in 1 file covered. (83.33%)

5463 existing lines in 165 files now uncovered.

299151 of 415222 relevant lines covered (72.05%)

702386.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.92
/src/basic/hash-funcs.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include <stdlib.h>
4
#include <string.h>
5
#include <sys/sysmacros.h>
6

7
#include "hash-funcs.h"
8
#include "path-util.h"
9
#include "siphash24.h"
10
#include "strv.h"
11

12
void string_hash_func(const char *p, struct siphash *state) {
88,359,862✔
13
        siphash24_compress(p, strlen(p) + 1, state);
88,359,862✔
14
}
88,359,862✔
15

16
DEFINE_HASH_OPS(string_hash_ops,
17
                char, string_hash_func, string_compare_func);
18
DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(
518,955✔
19
                string_hash_ops_free,
20
                char, string_hash_func, string_compare_func, free);
21
DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
28,371✔
22
                string_hash_ops_value_free,
23
                char, string_hash_func, string_compare_func,
24
                void, free);
25
DEFINE_HASH_OPS_FULL(
23,399,804✔
26
                string_hash_ops_free_free,
27
                char, string_hash_func, string_compare_func, free,
28
                void, free);
29
DEFINE_HASH_OPS_FULL(
531,330✔
30
                string_hash_ops_free_strv_free,
31
                char, string_hash_func, string_compare_func, free,
32
                char*, strv_free);
33

34
void path_hash_func(const char *q, struct siphash *state) {
22,669,789✔
35
        bool add_slash = false;
22,669,789✔
36

37
        assert(q);
22,669,789✔
38
        assert(state);
22,669,789✔
39

40
        /* Calculates a hash for a path in a way this duplicate inner slashes don't make a differences, and also
41
         * whether there's a trailing slash or not. This fits well with the semantics of path_compare(), which does
42
         * similar checks and also doesn't care for trailing slashes. Note that relative and absolute paths (i.e. those
43
         * which begin in a slash or not) will hash differently though. */
44

45
        /* if path is absolute, add one "/" to the hash. */
46
        if (path_is_absolute(q))
22,669,789✔
47
                siphash24_compress_byte('/', state);
17,868,366✔
48

49
        for (;;) {
218,580,933✔
50
                const char *e;
120,625,361✔
51
                int r;
120,625,361✔
52

53
                r = path_find_first_component(&q, true, &e);
120,625,361✔
54
                if (r == 0)
120,625,361✔
55
                        return;
22,669,789✔
56

57
                if (add_slash)
97,955,708✔
58
                        siphash24_compress_byte('/', state);
75,357,110✔
59

60
                if (r < 0) {
97,955,708✔
61
                        /* if a component is invalid, then add remaining part as a string. */
62
                        string_hash_func(q, state);
136✔
63
                        return;
136✔
64
                }
65

66
                /* Add this component to the hash. */
67
                siphash24_compress(e, r, state);
97,955,572✔
68

69
                add_slash = true;
97,955,572✔
70
        }
71
}
72

73
DEFINE_HASH_OPS(path_hash_ops,
74
                char, path_hash_func, path_compare);
75
DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(
1,257,368✔
76
                path_hash_ops_free,
77
                char, path_hash_func, path_compare, free);
78
DEFINE_HASH_OPS_FULL(
94,662✔
79
                path_hash_ops_free_free,
80
                char, path_hash_func, path_compare, free,
81
                void, free);
82

83
void trivial_hash_func(const void *p, struct siphash *state) {
27,201,339✔
84
        siphash24_compress_typesafe(p, state);
27,201,339✔
85
}
27,201,339✔
86

87
int trivial_compare_func(const void *a, const void *b) {
15,515,311✔
88
        return CMP(a, b);
15,515,311✔
89
}
90

91
DEFINE_HASH_OPS(trivial_hash_ops,
92
                void, trivial_hash_func, trivial_compare_func);
93
DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(
8,655✔
94
                trivial_hash_ops_free,
95
                void, trivial_hash_func, trivial_compare_func, free);
96
DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
5,833✔
97
                trivial_hash_ops_value_free,
98
                void, trivial_hash_func, trivial_compare_func,
99
                void, free);
100
DEFINE_HASH_OPS_FULL(
3,374✔
101
                trivial_hash_ops_free_free,
102
                void, trivial_hash_func, trivial_compare_func, free,
103
                void, free);
104

105
void uint64_hash_func(const uint64_t *p, struct siphash *state) {
29,112,743✔
106
        siphash24_compress_typesafe(*p, state);
29,112,743✔
107
}
29,112,743✔
108

109
int uint64_compare_func(const uint64_t *a, const uint64_t *b) {
25,028,100✔
110
        return CMP(*a, *b);
25,028,100✔
111
}
112

113
DEFINE_HASH_OPS(uint64_hash_ops,
114
                uint64_t, uint64_hash_func, uint64_compare_func);
115
DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
31,873✔
116
                uint64_hash_ops_value_free,
117
                uint64_t, uint64_hash_func, uint64_compare_func,
118
                void, free);
119

120
#if SIZEOF_DEV_T != 8
121
void devt_hash_func(const dev_t *p, struct siphash *state) {
122
        siphash24_compress_typesafe(*p, state);
123
}
124
#endif
125

126
int devt_compare_func(const dev_t *a, const dev_t *b) {
22✔
127
        int r;
22✔
128

129
        r = CMP(major(*a), major(*b));
22✔
130
        if (r != 0)
22✔
UNCOV
131
                return r;
×
132

133
        return CMP(minor(*a), minor(*b));
22✔
134
}
135

136
DEFINE_HASH_OPS(devt_hash_ops, dev_t, devt_hash_func, devt_compare_func);
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc