]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/proc-cmdline.h
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / basic / proc-cmdline.h
CommitLineData
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
27enum {
28 PROC_CMDLINE_STRIP_RD_PREFIX = 1,
29 PROC_CMDLINE_VALUE_OPTIONAL = 2,
30};
31
32typedef int (*proc_cmdline_parse_t)(const char *key, const char *value, void *data);
33
4e731273 34int proc_cmdline(char **ret);
1d84ad94
LP
35
36int proc_cmdline_parse(const proc_cmdline_parse_t parse, void *userdata, unsigned flags);
37
38int proc_cmdline_get_key(const char *parameter, unsigned flags, char **value);
39int proc_cmdline_get_bool(const char *key, bool *ret);
40
41char *proc_cmdline_key_startswith(const char *s, const char *prefix);
42bool proc_cmdline_key_streq(const char *x, const char *y);
4e731273
LP
43
44int shall_restore_state(void);
c573dcfe 45const char* runlevel_to_target(const char *rl);
1d84ad94
LP
46
47/* A little helper call, to be used in proc_cmdline_parse_t callbacks */
48static 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}