chiark / gitweb /
tree-wide: drop 'This file is part of systemd' blurb
[elogind.git] / src / basic / proc-cmdline.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5   Copyright 2010 Lennart Poettering
6 ***/
7
8 #include <stdbool.h>
9
10 #include "log.h"
11
12 enum {
13         PROC_CMDLINE_STRIP_RD_PREFIX = 1,
14         PROC_CMDLINE_VALUE_OPTIONAL = 2,
15 };
16
17 typedef int (*proc_cmdline_parse_t)(const char *key, const char *value, void *data);
18
19 int proc_cmdline(char **ret);
20
21 int proc_cmdline_parse(const proc_cmdline_parse_t parse, void *userdata, unsigned flags);
22
23 #if 0 /// UNNEEDED by elogind
24 int proc_cmdline_get_key(const char *parameter, unsigned flags, char **value);
25 int proc_cmdline_get_bool(const char *key, bool *ret);
26
27 char *proc_cmdline_key_startswith(const char *s, const char *prefix);
28 #endif // 0
29 bool proc_cmdline_key_streq(const char *x, const char *y);
30
31 #if 0 /// UNNEEDED by elogind
32 int shall_restore_state(void);
33 const char* runlevel_to_target(const char *rl);
34 #endif // 0
35
36 /* A little helper call, to be used in proc_cmdline_parse_t callbacks */
37 static inline bool proc_cmdline_value_missing(const char *key, const char *value) {
38         if (!value) {
39                 log_warning("Missing argument for %s= kernel command line switch, ignoring.", key);
40                 return true;
41         }
42
43         return false;
44 }