mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Tony Luck <tony.luck@intel.com>,
	Yinghai Lu <yhlu.kernel@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>,
	tglx@linutronix.de, jbarnes@virtuousgeek.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: split e820 reserved entries record to late v4 - fix v7
Date: Mon, 13 Oct 2008 14:46:28 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.00.0810131431510.3288@nehalem.linux-foundation.org> (raw)
In-Reply-To: <48F3BA28.2010605@zytor.com>



On Mon, 13 Oct 2008, H. Peter Anvin wrote:
> 
> Here is a fix... currently running standard tests on it.

Or we could do what Andrew suggested some time ago, and extend %p to do 
resource printing, like %pS and %pF.

TOTALLY UNTESTED! But something like this might allow

	printk(KERN_DEBUG "  reserve_region: (%s) %pR\n"
		res->name, res);

and if I did things right it should print

	reserve_region: (name) [xx-xx]

and maybe it's worth it. We certainly do seem to have a fair number of 
those irritating casts for resource printouts.

		Linus
---
 lib/vsprintf.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index c399bc1..dd62557 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -24,6 +24,7 @@
 #include <linux/kernel.h>
 #include <linux/kallsyms.h>
 #include <linux/uaccess.h>
+#include <linux/ioport.h>
 
 #include <asm/page.h>		/* for PAGE_SIZE */
 #include <asm/div64.h>
@@ -528,6 +529,21 @@ static char *symbol_string(char *buf, char *end, void *ptr, int field_width, int
 #endif
 }
 
+static char *resource_string(char *buf, char *end, struct resource *res, int field_width, int precision, int flags)
+{
+	char sym[4*sizeof(resource_size_t) + 4];
+	char *p = sym, *pend = sym + sizeof(sym);
+
+	*p++ = '[';
+	p = number(p, pend, res->start, 16, -1, -1, 0);
+	*p++ = '-';
+	p = number(p, pend, res->end, 16, -1, -1, 0);
+	*p++ = ']';
+	*p = 0;
+
+	return string(buf, end, sym, field_width, precision, flags);
+}
+
 /*
  * Show a '%p' thing.  A kernel extension is that the '%p' is followed
  * by an extra set of alphanumeric characters that are extended format
@@ -549,6 +565,8 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field
 		/* Fallthrough */
 	case 'S':
 		return symbol_string(buf, end, ptr, field_width, precision, flags);
+	case 'R':
+		return resource_string(buf, end, ptr, field_width, precision, flags);
 	}
 	flags |= SMALL;
 	if (field_width == -1) {

  parent reply	other threads:[~2008-10-13 21:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-01  7:31 Yinghai Lu
2008-09-04 19:04 ` Ingo Molnar
2008-09-04 19:16   ` Andrew Morton
2008-09-04 19:22     ` Yinghai Lu
2008-10-13 20:32       ` Tony Luck
2008-10-13 21:14         ` H. Peter Anvin
2008-10-13 21:17           ` Luck, Tony
2008-10-13 21:46           ` Linus Torvalds [this message]
2008-10-13 21:54             ` H. Peter Anvin
2008-10-13 22:40             ` Yinghai Lu
2008-10-13 22:48               ` H. Peter Anvin
2008-10-14  5:29         ` Yinghai Lu
2008-09-05  8:52   ` Yinghai Lu
2008-09-05 11:45     ` Ingo Molnar

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=alpine.LFD.2.00.0810131431510.3288@nehalem.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=yhlu.kernel@gmail.com \
    /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

all inboxes | Powered by JetHome®