]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
proc-cmdline: add some explanatory comments
authorLennart Poettering <lennart@poettering.net>
Thu, 14 May 2020 07:37:27 +0000 (09:37 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 18 May 2020 18:17:57 +0000 (20:17 +0200)
src/basic/proc-cmdline.c
src/basic/proc-cmdline.h

index d3d99d9a7f90228222eaa09de6b778a048b8a95c..d8d30b0f1df44a93c3572a2fc80ee385fe8a7f80 100644 (file)
@@ -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;
index 4115fdbc99fd7d00dbfc33b19681d16d54efcac6..275f46c89ec22987ec77eff2beb182de60683c0b 100644 (file)
@@ -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);