valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0038-proc-cmdline-introduce-PROC_CMDLINE_RD_STRICT.patch

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