[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH 6/8] mdev: add -v to increase log verbosity
From:       Jan Klötzke <jan () kloetzke ! net>
Date:       2019-12-16 21:56:54
Message-ID: 20191216215656.6438-7-jan () kloetzke ! net
[Download RAW message or body]

If logging to stderr and/or syslog the -v option can be given one or
more times to increase the log verbosity. If mdev is used as hotplug
helper the log level is fixed set to 2 if mdev.log is found an appended
because there is no possiblity to pass arguments to the hotplug helper.

Signed-off-by: Jan Klötzke <jan@kloetzke.net>
---
 util-linux/mdev.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 1ef7a029e..671221af5 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -81,7 +81,7 @@
 //kbuild:lib-$(CONFIG_MDEV) += mdev.o
 
 //usage:#define mdev_trivial_usage
-//usage:       "[-S] " IF_FEATURE_MDEV_DAEMON("[") "[-s]" IF_FEATURE_MDEV_DAEMON(" | [-df]]")
+//usage:       "[-Sv] " IF_FEATURE_MDEV_DAEMON("[") "[-s]" IF_FEATURE_MDEV_DAEMON(" | [-df]]")
 //usage:#define mdev_full_usage "\n\n"
 //usage:       "mdev -s is to be run during boot to scan /sys and populate /dev.\n"
 //usage:	IF_FEATURE_MDEV_DAEMON(
@@ -91,6 +91,7 @@
 //usage:       "\n"
 //usage:       "optional arguments:\n"
 //usage:       "	-S: Log to syslog too\n"
+//usage:       "	-v: Increase log verbosity\n"
 //usage:       "\n"
 //usage:       "Bare mdev is a kernel hotplug helper. To activate it:\n"
 //usage:       "	echo /sbin/mdev >/proc/sys/kernel/hotplug\n"
@@ -302,7 +303,7 @@ struct rule {
 
 struct globals {
 	int root_major, root_minor;
-	smallint verbose;
+	int verbose;
 	char *subsystem;
 	char *subsys_env; /* for putenv("SUBSYSTEM=subsystem") */
 #if ENABLE_FEATURE_MDEV_CONF
@@ -1266,7 +1267,11 @@ int mdev_main(int argc UNUSED_PARAM, char **argv)
 
 	xchdir("/dev");
 
-	opt = getopt32(argv, "sS" IF_FEATURE_MDEV_DAEMON("df"));
+	opt = getopt32(argv, "^"
+		"sS" IF_FEATURE_MDEV_DAEMON("df") "v"
+		"\0"
+		"vv",
+		&G.verbose);
 
 #if ENABLE_FEATURE_MDEV_CONF
 	G.filename = "/etc/mdev.conf";
-- 
2.20.1

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic