public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] module: Limit line length of module prints
@ 2015-12-11  1:50 Laura Abbott
  2015-12-11  9:39 ` Rusty Russell
       [not found] ` <CAGG-pUT9stutifHDUyD8WiFaU5Ysp1vVaRpu7tShZEQEV+7Daw@mail.gmail.com>
  0 siblings, 2 replies; 6+ messages in thread
From: Laura Abbott @ 2015-12-11  1:50 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Laura Abbott, linux-kernel

print_modules currently uses pr_cont to print all module information.
This has the side effect of printing lots of modules on one very long
line. This makes copy/pasting oopses more effort if manual wrapping is
required. Place a reasonable limit (80 chars) on the number of modules
on each line.

Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
---
Does this bother anyone else or am I the only one who hates dealing
with the long lines of "Modules linked in"?
---
 kernel/module.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/kernel/module.c b/kernel/module.c
index 8f051a1..ace82f1 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -4059,11 +4059,14 @@ struct module *__module_text_address(unsigned long addr)
 }
 EXPORT_SYMBOL_GPL(__module_text_address);
 
+#define MAX_LINE_CHARS	80
+
 /* Don't grab lock, we're oopsing. */
 void print_modules(void)
 {
 	struct module *mod;
 	char buf[8];
+	int cnt = 0;
 
 	printk(KERN_DEFAULT "Modules linked in:");
 	/* Most callers should already have preempt disabled, but make sure */
@@ -4071,7 +4074,13 @@ void print_modules(void)
 	list_for_each_entry_rcu(mod, &modules, list) {
 		if (mod->state == MODULE_STATE_UNFORMED)
 			continue;
-		pr_cont(" %s%s", mod->name, module_flags(mod, buf));
+
+		if (cnt > MAX_LINE_CHARS) {
+			cnt = 0;
+			pr_cont("\n");
+		}
+
+		cnt += pr_cont(" %s%s", mod->name, module_flags(mod, buf));
 	}
 	preempt_enable();
 	if (last_unloaded_module[0])
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-12-15 22:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-11  1:50 [RFC][PATCH] module: Limit line length of module prints Laura Abbott
2015-12-11  9:39 ` Rusty Russell
2015-12-11 22:25   ` Laura Abbott
2015-12-14  1:06     ` Rusty Russell
2015-12-15 22:47       ` Laura Abbott
     [not found] ` <CAGG-pUT9stutifHDUyD8WiFaU5Ysp1vVaRpu7tShZEQEV+7Daw@mail.gmail.com>
2015-12-11 22:22   ` Laura Abbott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox