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