]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/proc-cmdline.h
util: introduce memcmp_safe()
[thirdparty/systemd.git] / src / basic / proc-cmdline.h
CommitLineData
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
8enum {
9 PROC_CMDLINE_STRIP_RD_PREFIX = 1,
10 PROC_CMDLINE_VALUE_OPTIONAL = 2,
11};
12
13typedef int (*proc_cmdline_parse_t)(const char *key, const char *value, void *data);
14
4e731273 15int proc_cmdline(char **ret);
1d84ad94
LP
16
17int proc_cmdline_parse(const proc_cmdline_parse_t parse, void *userdata, unsigned flags);
18
19int proc_cmdline_get_key(const char *parameter, unsigned flags, char **value);
20int proc_cmdline_get_bool(const char *key, bool *ret);
21
22char *proc_cmdline_key_startswith(const char *s, const char *prefix);
23bool proc_cmdline_key_streq(const char *x, const char *y);
4e731273
LP
24
25int shall_restore_state(void);
c573dcfe 26const char* runlevel_to_target(const char *rl);
1d84ad94
LP
27
28/* A little helper call, to be used in proc_cmdline_parse_t callbacks */
29static 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}