mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Dave Jones <davej@redhat.com>
Cc: lkml <linux-kernel@vger.kernel.org>, akpm <akpm@linux-foundation.org>
Subject: Re: [PATCH] add "notime" boot option
Date: Tue, 22 May 2007 13:00:50 -0700	[thread overview]
Message-ID: <20070522130050.26a846cc.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20070522194030.GF12157@redhat.com>

On Tue, 22 May 2007 15:40:30 -0400 Dave Jones wrote:

> Not disagreeing with the patch, but I wonder if it'd be a net win
> if we had a helper that would replace the zillion instances
> of "set this variable to a 0/1 depending if its prefixed with 'no'"
> with 1-2 lines.

I don't know about that, but I had another version of this patch
that removed the use of __setup() and just used the module_param()
that is already there (but with the param renamed to "time" and
changed to a bool), so that the usage on the command line is:
  linux printk.time=<bool>

I like this alternate version pretty well, but it causes more
change and a usage that is not well-known.  Patch is below.
The __setup() declaration and its function helper are not removed
yet, but they could be, and just leave the value-setting job
to the module_param() code.  All tested.

---

From: Randy Dunlap <randy.dunlap@oracle.com>

Allow printk_time to be enabled or disabled at boot time.
Previously it could be enabled only, but not disabled.

Change printk_time from an int to a bool since that's what it is.
Make its logical (exposed) name just be "time".

Note:  Changes kernel boot option syntax from "time" to "time=value".

Since printk_time is declared as a module_param, it can also be
changed at run-time by modifying
  /sys/module/printk/parameters/time
to a value of 1/Y/y to enabled it or 0/N/n to disable it.

Since printk_time is declared as a module_param, its value can also
be set at boot-time by using
  linux printk.time=<bool>

If we are willing to drop the shorter "time=value" syntax, we could
also drop the entire printk_time_setup() function and the __setup()
for it.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 Documentation/kernel-parameters.txt |    5 ++++-
 kernel/printk.c                     |   12 +++++++-----
 2 files changed, 11 insertions(+), 6 deletions(-)

--- linux-2622-rc2.orig/Documentation/kernel-parameters.txt
+++ linux-2622-rc2/Documentation/kernel-parameters.txt
@@ -1824,7 +1824,10 @@ and is between 256 and 4096 characters. 
 	thash_entries=	[KNL,NET]
 			Set number of hash buckets for TCP connection
 
-	time		Show timing data prefixed to each printk message line
+	time=		Show timing data prefixed to each printk message line
+			Format: <bool>  (1=enable, 0=disable)
+or	printk.time=	Show timing data prefixed to each printk message line
+			Format: <bool>  (1/Y/y=enable, 0/N/n=disable)
 
 	tipar.timeout=	[HW,PPT]
 			Set communications timeout in tenths of a second
--- linux-2622-rc2.orig/kernel/printk.c
+++ linux-2622-rc2/kernel/printk.c
@@ -449,17 +449,19 @@ static int printk_time = 1;
 #else
 static int printk_time = 0;
 #endif
-module_param(printk_time, int, S_IRUGO | S_IWUSR);
+module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
 
 static int __init printk_time_setup(char *str)
 {
-	if (*str)
+	if (!*str)
 		return 0;
-	printk_time = 1;
+	if (*str == '1')
+		printk_time = 1;
+	else if (*str == '0')
+		printk_time = 0;
 	return 1;
 }
-
-__setup("time", printk_time_setup);
+__setup("time=", printk_time_setup);
 
 __attribute__((weak)) unsigned long long printk_clock(void)
 {

  reply	other threads:[~2007-05-22 19:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-22 19:09 Randy Dunlap
2007-05-22 19:40 ` Dave Jones
2007-05-22 20:00   ` Randy Dunlap [this message]
2007-05-23 11:03 ` Michael Tokarev
2007-05-23 17:04   ` Randy Dunlap
2007-05-23 19:15     ` Rene Herman
2007-05-23 20:55       ` Randy Dunlap
2007-05-24  4:54         ` Rene Herman
2007-05-24  5:08           ` Randy Dunlap
2007-05-24  5:11             ` Rene Herman
2007-05-24  6:29               ` Rene Herman
2007-05-24 16:13 ` Jan Engelhardt
2007-05-24 16:24   ` Randy Dunlap
2007-05-24 16:33     ` Jan Engelhardt
2007-05-25  0:15       ` [PATCH] use printk.time option, drop time/notime Randy Dunlap
2007-05-29 20:07         ` Andrew Morton
2007-05-29 21:28           ` Jan Engelhardt
2007-05-30 18:37           ` [PATCH v3] add printk.time option, deprecate 'time' Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070522130050.26a846cc.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome