ff6046
From 84b15a8a493424efa8c9eaa9a44a23c3c59742bd Mon Sep 17 00:00:00 2001
ff6046
From: Lukas Nykryn <lnykryn@redhat.com>
ff6046
Date: Thu, 25 Oct 2018 16:21:26 +0200
ff6046
Subject: [PATCH] proc-cmdline: introduce PROC_CMDLINE_RD_STRICT
ff6046
ff6046
Our current set of flags allows an option to be either
ff6046
use just in initrd or both in initrd and normal system.
ff6046
This new flag is intended to be used in the case where
ff6046
you want apply some settings just in initrd or just
ff6046
in normal system.
ff6046
ff6046
(cherry picked from commit ed58820d7669971762dd887dc117d922c23f2543)
ff6046
ff6046
Related: #1643429
ff6046
---
ff6046
 src/basic/proc-cmdline.c | 3 ++-
ff6046
 src/basic/proc-cmdline.h | 1 +
ff6046
 2 files changed, 3 insertions(+), 1 deletion(-)
ff6046
ff6046
diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c
ff6046
index add481c2ae..530ac37460 100644
ff6046
--- a/src/basic/proc-cmdline.c
ff6046
+++ b/src/basic/proc-cmdline.c
ff6046
@@ -72,7 +72,8 @@ int proc_cmdline_parse(proc_cmdline_parse_t parse_item, void *data, unsigned fla
ff6046
 
ff6046
                         if (flags & PROC_CMDLINE_STRIP_RD_PREFIX)
ff6046
                                 key = q;
ff6046
-                }
ff6046
+                } else if (in_initrd() && flags & PROC_CMDLINE_RD_STRICT)
ff6046
+                        continue;
ff6046
 
ff6046
                 value = strchr(key, '=');
ff6046
                 if (value)
ff6046
diff --git a/src/basic/proc-cmdline.h b/src/basic/proc-cmdline.h
ff6046
index 4a9e6e0f62..140200dbf4 100644
ff6046
--- a/src/basic/proc-cmdline.h
ff6046
+++ b/src/basic/proc-cmdline.h
ff6046
@@ -8,6 +8,7 @@
ff6046
 enum {
ff6046
         PROC_CMDLINE_STRIP_RD_PREFIX = 1,
ff6046
         PROC_CMDLINE_VALUE_OPTIONAL = 2,
ff6046
+        PROC_CMDLINE_RD_STRICT = 4
ff6046
 };
ff6046
 
ff6046
 typedef int (*proc_cmdline_parse_t)(const char *key, const char *value, void *data);