]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
4e731273 LP |
2 | #pragma once |
3 | ||
4 | /*** | |
5 | This file is part of systemd. | |
6 | ||
7 | Copyright 2010 Lennart Poettering | |
8 | ||
9 | systemd is free software; you can redistribute it and/or modify it | |
10 | under the terms of the GNU Lesser General Public License as published by | |
11 | the Free Software Foundation; either version 2.1 of the License, or | |
12 | (at your option) any later version. | |
13 | ||
14 | systemd is distributed in the hope that it will be useful, but | |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | Lesser General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU Lesser General Public License | |
20 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
21 | ***/ | |
22 | ||
1d84ad94 LP |
23 | #include <stdbool.h> |
24 | ||
25 | #include "log.h" | |
26 | ||
27 | enum { | |
28 | PROC_CMDLINE_STRIP_RD_PREFIX = 1, | |
29 | PROC_CMDLINE_VALUE_OPTIONAL = 2, | |
30 | }; | |
31 | ||
32 | typedef int (*proc_cmdline_parse_t)(const char *key, const char *value, void *data); | |
33 | ||
4e731273 | 34 | int proc_cmdline(char **ret); |
1d84ad94 LP |
35 | |
36 | int proc_cmdline_parse(const proc_cmdline_parse_t parse, void *userdata, unsigned flags); | |
37 | ||
38 | int proc_cmdline_get_key(const char *parameter, unsigned flags, char **value); | |
39 | int proc_cmdline_get_bool(const char *key, bool *ret); | |
40 | ||
41 | char *proc_cmdline_key_startswith(const char *s, const char *prefix); | |
42 | bool proc_cmdline_key_streq(const char *x, const char *y); | |
4e731273 LP |
43 | |
44 | int shall_restore_state(void); | |
c573dcfe | 45 | const char* runlevel_to_target(const char *rl); |
1d84ad94 LP |
46 | |
47 | /* A little helper call, to be used in proc_cmdline_parse_t callbacks */ | |
48 | static inline bool proc_cmdline_value_missing(const char *key, const char *value) { | |
49 | if (!value) { | |
50 | log_warning("Missing argument for %s= kernel command line switch, ignoring.", key); | |
51 | return true; | |
52 | } | |
53 | ||
54 | return false; | |
55 | } |