]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
4e731273 LP |
2 | #pragma once |
3 | ||
1d84ad94 LP |
4 | #include <stdbool.h> |
5 | ||
6 | #include "log.h" | |
7 | ||
8 | enum { | |
9 | PROC_CMDLINE_STRIP_RD_PREFIX = 1, | |
10 | PROC_CMDLINE_VALUE_OPTIONAL = 2, | |
11 | }; | |
12 | ||
13 | typedef int (*proc_cmdline_parse_t)(const char *key, const char *value, void *data); | |
14 | ||
4e731273 | 15 | int proc_cmdline(char **ret); |
1d84ad94 LP |
16 | |
17 | int proc_cmdline_parse(const proc_cmdline_parse_t parse, void *userdata, unsigned flags); | |
18 | ||
19 | int proc_cmdline_get_key(const char *parameter, unsigned flags, char **value); | |
20 | int proc_cmdline_get_bool(const char *key, bool *ret); | |
21 | ||
22 | char *proc_cmdline_key_startswith(const char *s, const char *prefix); | |
23 | bool proc_cmdline_key_streq(const char *x, const char *y); | |
4e731273 LP |
24 | |
25 | int shall_restore_state(void); | |
c573dcfe | 26 | const char* runlevel_to_target(const char *rl); |
1d84ad94 LP |
27 | |
28 | /* A little helper call, to be used in proc_cmdline_parse_t callbacks */ | |
29 | static inline bool proc_cmdline_value_missing(const char *key, const char *value) { | |
30 | if (!value) { | |
31 | log_warning("Missing argument for %s= kernel command line switch, ignoring.", key); | |
32 | return true; | |
33 | } | |
34 | ||
35 | return false; | |
36 | } |