mirror of
https://github.com/systemd/systemd.git
synced 2025-03-04 20:58:28 +03:00
proc-cmdline: add some explanatory comments
This commit is contained in:
parent
b2d1ad757c
commit
3931056767
@ -268,17 +268,17 @@ int proc_cmdline_get_bool(const char *key, bool *ret) {
|
||||
r = proc_cmdline_get_key(key, PROC_CMDLINE_VALUE_OPTIONAL, &v);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0) {
|
||||
if (r == 0) { /* key not specified at all */
|
||||
*ret = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (v) { /* parameter passed */
|
||||
if (v) { /* key with parameter passed */
|
||||
r = parse_boolean(v);
|
||||
if (r < 0)
|
||||
return r;
|
||||
*ret = r;
|
||||
} else /* no parameter passed */
|
||||
} else /* key without parameter passed */
|
||||
*ret = true;
|
||||
|
||||
return 1;
|
||||
|
@ -6,9 +6,9 @@
|
||||
#include "log.h"
|
||||
|
||||
typedef enum ProcCmdlineFlags {
|
||||
PROC_CMDLINE_STRIP_RD_PREFIX = 1 << 0,
|
||||
PROC_CMDLINE_VALUE_OPTIONAL = 1 << 1,
|
||||
PROC_CMDLINE_RD_STRICT = 1 << 2,
|
||||
PROC_CMDLINE_STRIP_RD_PREFIX = 1 << 0, /* automatically strip "rd." prefix if it is set (and we are in the initrd, since otherwise we'd not consider it anyway) */
|
||||
PROC_CMDLINE_VALUE_OPTIONAL = 1 << 1, /* the value is optional (for boolean switches that can omit the value) */
|
||||
PROC_CMDLINE_RD_STRICT = 1 << 2, /* ignore this in the initrd */
|
||||
} ProcCmdlineFlags;
|
||||
|
||||
typedef int (*proc_cmdline_parse_t)(const char *key, const char *value, void *data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user