chiark / gitweb /
tree-wide: allow state to be passed through to parse_proc_cmdline_item
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 22 Oct 2016 18:24:52 +0000 (14:24 -0400)
committerSven Eden <yamakuzure@gmx.net>
Wed, 5 Jul 2017 06:50:55 +0000 (08:50 +0200)
No functional change.

src/basic/log.c
src/basic/proc-cmdline.c
src/basic/proc-cmdline.h

index 521ea92efd16c892d4c1f3352f28a87db35e175d..e05dd65689cf0d226e3f1a22895ff3043049fca0 100644 (file)
@@ -985,7 +985,7 @@ int log_set_max_level_from_string(const char *e) {
         return 0;
 }
 
         return 0;
 }
 
-static int parse_proc_cmdline_item(const char *key, const char *value) {
+static int parse_proc_cmdline_item(const char *key, const char *value, void *data) {
 
         /*
          * The systemd.log_xyz= settings are parsed by all tools, and
 
         /*
          * The systemd.log_xyz= settings are parsed by all tools, and
@@ -1030,7 +1030,7 @@ void log_parse_environment(void) {
                 /* Only try to read the command line in daemons.
                    We assume that anything that has a controlling
                    tty is user stuff. */
                 /* Only try to read the command line in daemons.
                    We assume that anything that has a controlling
                    tty is user stuff. */
-                (void) parse_proc_cmdline(parse_proc_cmdline_item);
+                (void) parse_proc_cmdline(parse_proc_cmdline_item, NULL);
 
         e = secure_getenv("SYSTEMD_LOG_TARGET");
         if (e && log_set_target_from_string(e) < 0)
 
         e = secure_getenv("SYSTEMD_LOG_TARGET");
         if (e && log_set_target_from_string(e) < 0)
index 60a4e23226c57c8e4fdd18748f9efa2f699b557f..eb6ca61019b6e1f500362d4281e5fcc21b1fc707 100644 (file)
@@ -42,7 +42,7 @@ int proc_cmdline(char **ret) {
                 return read_one_line_file("/proc/cmdline", ret);
 }
 
                 return read_one_line_file("/proc/cmdline", ret);
 }
 
-int parse_proc_cmdline(int (*parse_item)(const char *key, const char *value)) {
+int parse_proc_cmdline(int (*parse_item)(const char *key, const char *value, void *data), void *data) {
         _cleanup_free_ char *line = NULL;
         const char *p;
         int r;
         _cleanup_free_ char *line = NULL;
         const char *p;
         int r;
@@ -73,7 +73,7 @@ int parse_proc_cmdline(int (*parse_item)(const char *key, const char *value)) {
                 if (value)
                         *(value++) = 0;
 
                 if (value)
                         *(value++) = 0;
 
-                r = parse_item(word, value);
+                r = parse_item(word, value, data);
                 if (r < 0)
                         return r;
         }
                 if (r < 0)
                         return r;
         }
index 09a3e6690d9298052acefb31248c4d8cb0a709cb..e662e55ac77911baa31b37890a74b5249b14b723 100644 (file)
@@ -20,7 +20,7 @@
 ***/
 
 int proc_cmdline(char **ret);
 ***/
 
 int proc_cmdline(char **ret);
-int parse_proc_cmdline(int (*parse_word)(const char *key, const char *value));
+int parse_proc_cmdline(int (*parse_word)(const char *key, const char *value, void *data), void *data);
 int get_proc_cmdline_key(const char *parameter, char **value);
 
 #if 0 /// UNNEEDED by elogind
 int get_proc_cmdline_key(const char *parameter, char **value);
 
 #if 0 /// UNNEEDED by elogind