Coverage Report

Created: 2025-11-16 06:36

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/systemd/src/shared/volatile-util.c
Line
Count
Source
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3
#include "alloc-util.h"
4
#include "proc-cmdline.h"
5
#include "string-table.h"
6
#include "volatile-util.h"
7
8
0
int query_volatile_mode(VolatileMode *ret) {
9
0
        _cleanup_free_ char *mode = NULL;
10
0
        int r;
11
12
0
        r = proc_cmdline_get_key("systemd.volatile", PROC_CMDLINE_VALUE_OPTIONAL, &mode);
13
0
        if (r < 0)
14
0
                return r;
15
0
        if (r == 0) {
16
0
                *ret = VOLATILE_NO;
17
0
                return 0;
18
0
        }
19
20
0
        if (mode) {
21
0
                VolatileMode m;
22
23
0
                m = volatile_mode_from_string(mode);
24
0
                if (m < 0)
25
0
                        return m;
26
27
0
                *ret = m;
28
0
        } else
29
0
                *ret = VOLATILE_YES;
30
31
0
        return 1;
32
0
}
33
34
static const char* const volatile_mode_table[_VOLATILE_MODE_MAX] = {
35
        [VOLATILE_NO] = "no",
36
        [VOLATILE_YES] = "yes",
37
        [VOLATILE_STATE] = "state",
38
        [VOLATILE_OVERLAY] = "overlay",
39
};
40
41
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(volatile_mode, VolatileMode, VOLATILE_YES);