LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] printk-formats.txt documentation update
@ 2011-02-06  0:15 Andrew Murray
  2011-02-06  0:27 ` Tim Bird
                   ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Andrew Murray @ 2011-02-06  0:15 UTC (permalink / raw)
  To: linux-embedded; +Cc: linux kernel, trivial

From: Andrew Murray <amurray@mpc-data.co.uk>

This patch updates the incomplete documentation concerning the printk
extended format specifiers.

Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
---
diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
index 1b5a5dd..df14336 100644
--- a/Documentation/printk-formats.txt
+++ b/Documentation/printk-formats.txt
@@ -9,7 +9,42 @@ If variable is of Type,		use printk format specifier:
 		size_t			%zu or %zx
 		ssize_t			%zd or %zx

-Raw pointer value SHOULD be printed with %p.
+Raw pointer value SHOULD be printed with %p. The kernel supports
+the following extended format specifiers for pointer types:
+
+	General:
+
+	%pF	function pointer with offset, e.g. module_start
+	%pf	function pointer without offset, e.g. module_start+0x0/0x62 [hello]
+	%pS	text symbol with offset	
+	%ps	text symbol without offset
+	%pR	struct resource with decoded flags, e.g. [mem 0x0-0x1f 64 bit pref]
+	%pr	struct resource with raw flags, e.g. [mem 0x0-0x1f flags 0x201]
+
+	MAC/FDDI addresses:
+	
+	%pM	colon-seperated 6-byte MAC address in hex notation, e.g. 00:01:02:03:04:05
+	%pm	non-colon-seperated 6-byte MAC address is hex notation, e.g. 000102030405
+	%pMF	6-byte dash-separated FDDI hex notation
+
+	IPv4 addresses:
+
+	%pI4	IPv4 dot-seperated decimal without leading 0's, e.g. 1.2.3.4
+	%pi4	IPv4 dot-seperated decimal with leading 0's, 001.002.003.004
+	%p[Ii]4[hl] IPv4 dot-seperated decimal with/without leading 0's for
+		host (h), little (l) or network/big (default) endian order
+
+	IPv6 addresses:
+	%pI6	IPv6 colon-seperated network-order 16 bit hex with leading 0's,
+		e.g. 0001:0203:...:0708
+	%pi6	IPv6 non-colon-seperated network-order 16 bit hex with leading 0's,
+		e.g. 000102...0f
+	%pI6c	IPv6 address as described by
+		http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00,
+		e.g. 1::708
+
+	%pU[bBlL] 16 byte UUID/GUID in big or little endian using lower or upper case
+

 u64 SHOULD be printed with %llu/%llx, (unsigned long long):

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

* Re: [PATCH] printk-formats.txt documentation update
  2011-02-06  0:15 [PATCH] printk-formats.txt documentation update Andrew Murray
@ 2011-02-06  0:27 ` Tim Bird
  2011-02-06  0:37 ` Joe Perches
  2011-02-06 10:16 ` Geert Uytterhoeven
  2 siblings, 0 replies; 31+ messages in thread
From: Tim Bird @ 2011-02-06  0:27 UTC (permalink / raw)
  To: Andrew Murray; +Cc: linux-embedded, linux kernel, trivial

On 02/05/2011 04:15 PM, Andrew Murray wrote:
> From: Andrew Murray <amurray@mpc-data.co.uk>
> 
> This patch updates the incomplete documentation concerning the printk
> extended format specifiers.
> 
> Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
> ---
> diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
> index 1b5a5dd..df14336 100644
> --- a/Documentation/printk-formats.txt
> +++ b/Documentation/printk-formats.txt
> @@ -9,7 +9,42 @@ If variable is of Type,		use printk format specifier:
>  		size_t			%zu or %zx
>  		ssize_t			%zd or %zx
> 
> -Raw pointer value SHOULD be printed with %p.
> +Raw pointer value SHOULD be printed with %p. The kernel supports
> +the following extended format specifiers for pointer types:
> +
> +	General:
> +
> +	%pF	function pointer with offset, e.g. module_start
> +	%pf	function pointer without offset, e.g. module_start+0x0/0x62 [hello]
> +	%pS	text symbol with offset	
> +	%ps	text symbol without offset
> +	%pR	struct resource with decoded flags, e.g. [mem 0x0-0x1f 64 bit pref]
> +	%pr	struct resource with raw flags, e.g. [mem 0x0-0x1f flags 0x201]
> +
> +	MAC/FDDI addresses:
> +	
> +	%pM	colon-seperated 6-byte MAC address in hex notation, e.g. 00:01:02:03:04:05
> +	%pm	non-colon-seperated 6-byte MAC address is hex notation, e.g. 000102030405
> +	%pMF	6-byte dash-separated FDDI hex notation
> +
> +	IPv4 addresses:
> +
> +	%pI4	IPv4 dot-seperated decimal without leading 0's, e.g. 1.2.3.4
> +	%pi4	IPv4 dot-seperated decimal with leading 0's, 001.002.003.004
> +	%p[Ii]4[hl] IPv4 dot-seperated decimal with/without leading 0's for
> +		host (h), little (l) or network/big (default) endian order
> +
> +	IPv6 addresses:
> +	%pI6	IPv6 colon-seperated network-order 16 bit hex with leading 0's,
> +		e.g. 0001:0203:...:0708
> +	%pi6	IPv6 non-colon-seperated network-order 16 bit hex with leading 0's,
> +		e.g. 000102...0f
> +	%pI6c	IPv6 address as described by
> +		http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00,
> +		e.g. 1::708
> +
> +	%pU[bBlL] 16 byte UUID/GUID in big or little endian using lower or upper case
> +
> 
>  u64 SHOULD be printed with %llu/%llx, (unsigned long long):

I like this, as it has information that is not documented elsewhere.

Some feedback on the patch:

Some of these lines are longer than 80 chars.  Can you please truncate
things to fit in an 80-column terminal window?

Thanks,
 -- Tim

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Network Entertainment
=============================


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

* Re: [PATCH] printk-formats.txt documentation update
  2011-02-06  0:15 [PATCH] printk-formats.txt documentation update Andrew Murray
  2011-02-06  0:27 ` Tim Bird
@ 2011-02-06  0:37 ` Joe Perches
  2011-02-06 10:07   ` Andrew Murray
  2011-02-06 10:16 ` Geert Uytterhoeven
  2 siblings, 1 reply; 31+ messages in thread
From: Joe Perches @ 2011-02-06  0:37 UTC (permalink / raw)
  To: Andrew Murray; +Cc: linux-embedded, linux kernel, Jiri Kosina

On Sun, 2011-02-06 at 00:15 +0000, Andrew Murray wrote:
> From: Andrew Murray <amurray@mpc-data.co.uk>
> This patch updates the incomplete documentation concerning the printk
> extended format specifiers.
> Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
> ---
> diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
[]
> @@ -9,7 +9,42 @@ If variable is of Type,		use printk format specifier:
>  		size_t			%zu or %zx
>  		ssize_t			%zd or %zx
> 
> -Raw pointer value SHOULD be printed with %p.
> +Raw pointer value SHOULD be printed with %p. The kernel supports
> +the following extended format specifiers for pointer types:

I think it'd be better if each extension were individually described
with an example output.

> +
> +	General:
> +
> +	%pF	function pointer with offset, e.g. module_start
> +	%pf	function pointer without offset, e.g. module_start+0x0/0x62 [hello]

with/without inversion?

> +	%pS	text symbol with offset	
> +	%ps	text symbol without offset
> +	%pR	struct resource with decoded flags, e.g. [mem 0x0-0x1f 64 bit pref]
> +	%pr	struct resource with raw flags, e.g. [mem 0x0-0x1f flags 0x201]
> +
> +	MAC/FDDI addresses:
> +	
> +	%pM	colon-seperated 6-byte MAC address in hex notation, e.g. 00:01:02:03:04:05

spelling: separated

> +	%pm	non-colon-seperated 6-byte MAC address is hex notation, e.g. 000102030405
> +	%pMF	6-byte dash-separated FDDI hex notation
> +
> +	IPv4 addresses:
> +
> +	%pI4	IPv4 dot-seperated decimal without leading 0's, e.g. 1.2.3.4
> +	%pi4	IPv4 dot-seperated decimal with leading 0's, 001.002.003.004
> +	%p[Ii]4[hl] IPv4 dot-seperated decimal with/without leading 0's for
> +		host (h), little (l) or network/big (default) endian order
> +
> +	IPv6 addresses:
> +	%pI6	IPv6 colon-seperated network-order 16 bit hex with leading 0's,
> +		e.g. 0001:0203:...:0708
> +	%pi6	IPv6 non-colon-seperated network-order 16 bit hex with leading 0's,
> +		e.g. 000102...0f
> +	%pI6c	IPv6 address as described by
> +		http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00,
> +		e.g. 1::708
> +
> +	%pU[bBlL] 16 byte UUID/GUID in big or little endian using lower or upper case

Maybe a simple 2 line table without the e.g.:

	%p<extension1>	sample output1
			description1
	%p<extension2>	sample output2
			description2
	


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

* Re: [PATCH] printk-formats.txt documentation update
  2011-02-06  0:37 ` Joe Perches
@ 2011-02-06 10:07   ` Andrew Murray
  0 siblings, 0 replies; 31+ messages in thread
From: Andrew Murray @ 2011-02-06 10:07 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-embedded, linux kernel, Jiri Kosina

Thanks for the feedback - I will truncate to 80 characters and
implement Joe's advice.

Thanks,

Andrew Murray

On 6 February 2011 00:37, Joe Perches <joe@perches.com> wrote:
> On Sun, 2011-02-06 at 00:15 +0000, Andrew Murray wrote:
>> From: Andrew Murray <amurray@mpc-data.co.uk>
>> This patch updates the incomplete documentation concerning the printk
>> extended format specifiers.
>> Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
>> ---
>> diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
> []
>> @@ -9,7 +9,42 @@ If variable is of Type,              use printk format specifier:
>>               size_t                  %zu or %zx
>>               ssize_t                 %zd or %zx
>>
>> -Raw pointer value SHOULD be printed with %p.
>> +Raw pointer value SHOULD be printed with %p. The kernel supports
>> +the following extended format specifiers for pointer types:
>
> I think it'd be better if each extension were individually described
> with an example output.
>
>> +
>> +     General:
>> +
>> +     %pF     function pointer with offset, e.g. module_start
>> +     %pf     function pointer without offset, e.g. module_start+0x0/0x62 [hello]
>
> with/without inversion?
>
>> +     %pS     text symbol with offset
>> +     %ps     text symbol without offset
>> +     %pR     struct resource with decoded flags, e.g. [mem 0x0-0x1f 64 bit pref]
>> +     %pr     struct resource with raw flags, e.g. [mem 0x0-0x1f flags 0x201]
>> +
>> +     MAC/FDDI addresses:
>> +
>> +     %pM     colon-seperated 6-byte MAC address in hex notation, e.g. 00:01:02:03:04:05
>
> spelling: separated
>
>> +     %pm     non-colon-seperated 6-byte MAC address is hex notation, e.g. 000102030405
>> +     %pMF    6-byte dash-separated FDDI hex notation
>> +
>> +     IPv4 addresses:
>> +
>> +     %pI4    IPv4 dot-seperated decimal without leading 0's, e.g. 1.2.3.4
>> +     %pi4    IPv4 dot-seperated decimal with leading 0's, 001.002.003.004
>> +     %p[Ii]4[hl] IPv4 dot-seperated decimal with/without leading 0's for
>> +             host (h), little (l) or network/big (default) endian order
>> +
>> +     IPv6 addresses:
>> +     %pI6    IPv6 colon-seperated network-order 16 bit hex with leading 0's,
>> +             e.g. 0001:0203:...:0708
>> +     %pi6    IPv6 non-colon-seperated network-order 16 bit hex with leading 0's,
>> +             e.g. 000102...0f
>> +     %pI6c   IPv6 address as described by
>> +             http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00,
>> +             e.g. 1::708
>> +
>> +     %pU[bBlL] 16 byte UUID/GUID in big or little endian using lower or upper case
>
> Maybe a simple 2 line table without the e.g.:
>
>        %p<extension1>  sample output1
>                        description1
>        %p<extension2>  sample output2
>                        description2
>
>
>



-- 
Andrew Murray, Embedded Linux Group
MPC Data Limited
e-mail: amurray@mpc-data.co.uk  web: www.mpc-data.co.uk
tel: +44 (0) 1225 710600               fax: +44 (0) 1225 710601
ddi: +44 (0) 1225 710665

MPC Data Limited is a company registered in England and Wales with
company number 05507446
Registered Address: County Gate, County Way, Trowbridge, Wiltshire, BA14 7FJ
VAT no: 850625238

The information in this email and in the attached documents is
confidential and may be
legally privileged. Any unauthorized review, copying, disclosure or
distribution is
prohibited and may be unlawful. It is intended solely for the
addressee. Access to this
email by anyone else is unauthorized. If you are not the intended
recipient, please
contact the sender by reply email and destroy all copies of the
original message. When
addressed to our clients any opinions or advice contained in this
email is subject to
the terms and conditions expressed in the governing contract.

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

* Re: [PATCH] printk-formats.txt documentation update
  2011-02-06  0:15 [PATCH] printk-formats.txt documentation update Andrew Murray
  2011-02-06  0:27 ` Tim Bird
  2011-02-06  0:37 ` Joe Perches
@ 2011-02-06 10:16 ` Geert Uytterhoeven
  2011-02-06 16:14   ` Andrew Murray
  2 siblings, 1 reply; 31+ messages in thread
From: Geert Uytterhoeven @ 2011-02-06 10:16 UTC (permalink / raw)
  To: Andrew Murray; +Cc: linux-embedded, linux kernel, trivial, rdunlap

On Sun, Feb 6, 2011 at 01:15, Andrew Murray <amurray@mpcdata.com> wrote:
> From: Andrew Murray <amurray@mpc-data.co.uk>
>
> This patch updates the incomplete documentation concerning the printk
> extended format specifiers.
>
> Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
> ---
> diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
> index 1b5a5dd..df14336 100644
> --- a/Documentation/printk-formats.txt
> +++ b/Documentation/printk-formats.txt
> @@ -9,7 +9,42 @@ If variable is of Type,                use printk format specifier:
>                size_t                  %zu or %zx
>                ssize_t                 %zd or %zx
>
> -Raw pointer value SHOULD be printed with %p.
> +Raw pointer value SHOULD be printed with %p. The kernel supports
> +the following extended format specifiers for pointer types:
> +
> +       General:
> +
> +       %pF     function pointer with offset, e.g. module_start
> +       %pf     function pointer without offset, e.g. module_start+0x0/0x62 [hello]
> +       %pS     text symbol with offset
> +       %ps     text symbol without offset
> +       %pR     struct resource with decoded flags, e.g. [mem 0x0-0x1f 64 bit pref]
> +       %pr     struct resource with raw flags, e.g. [mem 0x0-0x1f flags 0x201]
> +
> +       MAC/FDDI addresses:
> +
> +       %pM     colon-seperated 6-byte MAC address in hex notation, e.g. 00:01:02:03:04:05
> +       %pm     non-colon-seperated 6-byte MAC address is hex notation, e.g. 000102030405
> +       %pMF    6-byte dash-separated FDDI hex notation
> +
> +       IPv4 addresses:
> +
> +       %pI4    IPv4 dot-seperated decimal without leading 0's, e.g. 1.2.3.4
> +       %pi4    IPv4 dot-seperated decimal with leading 0's, 001.002.003.004
> +       %p[Ii]4[hl] IPv4 dot-seperated decimal with/without leading 0's for
> +               host (h), little (l) or network/big (default) endian order
> +
> +       IPv6 addresses:
> +       %pI6    IPv6 colon-seperated network-order 16 bit hex with leading 0's,
> +               e.g. 0001:0203:...:0708
> +       %pi6    IPv6 non-colon-seperated network-order 16 bit hex with leading 0's,
> +               e.g. 000102...0f
> +       %pI6c   IPv6 address as described by
> +               http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00,
> +               e.g. 1::708
> +
> +       %pU[bBlL] 16 byte UUID/GUID in big or little endian using lower or upper case
> +

In the mean time, we also got %pV and %pK. Can you please add them as well? Thx!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] printk-formats.txt documentation update
  2011-02-06 10:16 ` Geert Uytterhoeven
@ 2011-02-06 16:14   ` Andrew Murray
  2011-02-06 16:23     ` Andrew Murray
  0 siblings, 1 reply; 31+ messages in thread
From: Andrew Murray @ 2011-02-06 16:14 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-embedded, linux kernel, trivial, rdunlap

On 6 February 2011 10:16, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> In the mean time, we also got %pV and %pK. Can you please add them as well? Thx!

Ok how about this revised patch?

From: Andrew Murray <amurray@mpc-data.co.uk>

This patch updates the incomplete documentation concerning the printk
extended format specifiers.

Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
---
diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
index 1b5a5dd..cad0dda 100644
--- a/Documentation/printk-formats.txt
+++ b/Documentation/printk-formats.txt
@@ -1,4 +1,4 @@
-If variable is of Type,		use printk format specifier:
+f variable is of Type,		use printk format specifier:
 ---------------------------------------------------------
 		int			%d or %x
 		unsigned int		%u or %x
@@ -9,7 +9,111 @@ If variable is of Type,		use printk format specifier:
 		size_t			%zu or %zx
 		ssize_t			%zd or %zx

-Raw pointer value SHOULD be printed with %p.
+Raw pointer value SHOULD be printed with %p. The kernel supports
+the following extended format specifiers for pointer types:
+
+Symbols/Function Pointers:
+
+	%pF	versatile_init+0x0/0x110
+	%pf	versatile_init
+	%pS	versatile_init+0x0/0x110
+	%ps	versatile_init
+
+	For printing symbols and function pointers. The 'S' and 's' specifiers
+	result in the symbol name with ('S') or without ('s') offsets. Where
+	this is used on a kernel without KALLSYMS - the symbol address is
+	printed instead.
+
+	On ia64, ppc64 and parisc64 architectures function pointers are
+	actually function descriptors which must first be resolved. The 'F' and
+	'f' specifiers perform this resolution and then provide the same
+	functionality as the 'S' and 's' specifiers.
+
+Kernel Pointers:
+
+	%pK	0x0
+
+	For printing kernel pointers which should be hidden from unprivileged
+	users. The behaviour of %pK depends on the kptr_resrict sysctl - see
+	Documentation/sysctl/kernel.txt for more details.
+
+Struct Resources:
+
+	%pr	[mem 0x60000000-0x6fffffff flags 0x2200]
+	%pR	[mem 0x60000000-0x6fffffff pref]
+
+	For printing struct resources. The 'R' and 'r' specifiers result in a
+	printed resource with ('R') or without ('r') a decoded flags member.
+
+MAC/FDDI addresses:
+
+	%pM	00:01:02:03:04:05
+	%pMF	00-01-02-03-04-05
+	%pm	000102030405
+
+	For printing 6-byte MAC/FDDI addresses in hex notation. The 'M' and 'm'
+	specifiers result in a printed address with ('M') or without ('m') byte
+	seperators. The default byte seperator is the colon (':').
+
+	Where FDDI addresses are concerned the 'F' specifier can be used after
+	the 'M' specifier to use dash ('-') seperators instead of the default
+	seperator.
+
+IPv4 addresses:
+
+	%pI4	1.2.3.4
+	%pi4	001.002.003.004
+	%p[Ii][hnbl]
+	
+	For printing IPv4 dot-seperated decminal addresses. The 'I4' and 'i4'
+	specifiers result in a printed address with ('i4') or without ('I4')
+	leading zeros.
+
+	The additional 'h', 'n', 'b', and 'l' specifiers are used to specify
+	host, network, big or little endian order addresses respectively. Where
+	no specifier is provided the default network/big endian order is used.
+
+IPv6 addresses:
+
+	%pI6	0001:0002:0003:0004:0005:0006:0007:0008
+	%pi6	00010002000300040005000600070008
+	%pI6c	1:2:3:4:5:6:7:8
+
+	For printing IPv6 network-order 16 bit hex addresses. The 'I6' and 'i6'
+	specifiers result in a printed address with ('I6') or without ('i6')
+	colon-seperaters. Leading zeros are always used.
+
+	The additional 'c' specifier can be used with the 'I' specifier to
+	print a compressed IPv6 address as described by
+	http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00.
+
+UUID/GUID addresses:
+
+	%pU	00010203-0506-0708-090a-0b0c0d0e0fff
+	%pU[bBlL]
+
+	For printing 16 byte UUID/GUIDs addresses. The additional 'l', 'L',
+	'b' and 'B' specifiers are used to specifiy a little endian order in
+	lower ('l') or upper case ('L') hex characters - and big endian order
+	in lower ('b') or upper case ('B') hex characters.
+
+	Where no additional specifiers are used the default little endian
+	order with lower case hex characters will be printed.
+
+struct va_format:
+
+	%pV	
+
+	For printing struct va_format structures. These contain a format string
+	and va_list as follows:
+
+	struct va_format {
+		const char *fmt;
+		va_lost *va;
+	};
+
+	Do not use this feature without some mechanism to verify the
+	correctness of the format string and va_list arguments.

 u64 SHOULD be printed with %llu/%llx, (unsigned long long):

@@ -32,4 +136,5 @@ Reminder: sizeof() result is of type size_t.
 Thank you for your cooperation and attention.


-By Randy Dunlap <rdunlap@xenotime.net>
+By Randy Dunlap <rdunlap@xenotime.net> and
+Andrew Murray <amurray@mpc-data.co.uk>

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

* Re: [PATCH] printk-formats.txt documentation update
  2011-02-06 16:14   ` Andrew Murray
@ 2011-02-06 16:23     ` Andrew Murray
  2011-02-07  9:29       ` Wolfram Sang
  0 siblings, 1 reply; 31+ messages in thread
From: Andrew Murray @ 2011-02-06 16:23 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-embedded, linux kernel, trivial, rdunlap

On 6 February 2011 16:14, Andrew Murray <amurray@mpcdata.com> wrote:
> On 6 February 2011 10:16, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>> In the mean time, we also got %pV and %pK. Can you please add them as well? Thx!
>
> Ok how about this revised patch?
>
I've just noticed a zillion spelling mistakes - find below another
revised patch.

From: Andrew Murray <amurray@mpc-data.co.uk>

This patch updates the incomplete documentation concerning the printk
extended format specifiers.

Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
---
diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
index 1b5a5dd..cad0dda 100644
--- a/Documentation/printk-formats.txt
+++ b/Documentation/printk-formats.txt
@@ -1,4 +1,4 @@
-If variable is of Type,		use printk format specifier:
+f variable is of Type,		use printk format specifier:
 ---------------------------------------------------------
 		int			%d or %x
 		unsigned int		%u or %x
@@ -9,7 +9,111 @@ If variable is of Type,		use printk format specifier:
 		size_t			%zu or %zx
 		ssize_t			%zd or %zx

-Raw pointer value SHOULD be printed with %p.
+Raw pointer value SHOULD be printed with %p. The kernel supports
+the following extended format specifiers for pointer types:
+
+Symbols/Function Pointers:
+
+	%pF	versatile_init+0x0/0x110
+	%pf	versatile_init
+	%pS	versatile_init+0x0/0x110
+	%ps	versatile_init
+
+	For printing symbols and function pointers. The 'S' and 's' specifiers
+	result in the symbol name with ('S') or without ('s') offsets. Where
+	this is used on a kernel without KALLSYMS - the symbol address is
+	printed instead.
+
+	On ia64, ppc64 and parisc64 architectures function pointers are
+	actually function descriptors which must first be resolved. The 'F' and
+	'f' specifiers perform this resolution and then provide the same
+	functionality as the 'S' and 's' specifiers.
+
+Kernel Pointers:
+
+	%pK	0x0
+
+	For printing kernel pointers which should be hidden from unprivileged
+	users. The behaviour of %pK depends on the kptr_resrict sysctl - see
+	Documentation/sysctl/kernel.txt for more details.
+
+Struct Resources:
+
+	%pr	[mem 0x60000000-0x6fffffff flags 0x2200]
+	%pR	[mem 0x60000000-0x6fffffff pref]
+
+	For printing struct resources. The 'R' and 'r' specifiers result in a
+	printed resource with ('R') or without ('r') a decoded flags member.
+
+MAC/FDDI addresses:
+
+	%pM	00:01:02:03:04:05
+	%pMF	00-01-02-03-04-05
+	%pm	000102030405
+
+	For printing 6-byte MAC/FDDI addresses in hex notation. The 'M' and 'm'
+	specifiers result in a printed address with ('M') or without ('m') byte
+	separators. The default byte separator is the colon (':').
+
+	Where FDDI addresses are concerned the 'F' specifier can be used after
+	the 'M' specifier to use dash ('-') separators instead of the default
+	separator.
+
+IPv4 addresses:
+
+	%pI4	1.2.3.4
+	%pi4	001.002.003.004
+	%p[Ii][hnbl]
+	
+	For printing IPv4 dot-separated decimal addresses. The 'I4' and 'i4'
+	specifiers result in a printed address with ('i4') or without ('I4')
+	leading zeros.
+
+	The additional 'h', 'n', 'b', and 'l' specifiers are used to specify
+	host, network, big or little endian order addresses respectively. Where
+	no specifier is provided the default network/big endian order is used.
+
+IPv6 addresses:
+
+	%pI6	0001:0002:0003:0004:0005:0006:0007:0008
+	%pi6	00010002000300040005000600070008
+	%pI6c	1:2:3:4:5:6:7:8
+
+	For printing IPv6 network-order 16 bit hex addresses. The 'I6' and 'i6'
+	specifiers result in a printed address with ('I6') or without ('i6')
+	colon-separators. Leading zeros are always used.
+
+	The additional 'c' specifier can be used with the 'I' specifier to
+	print a compressed IPv6 address as described by
+	http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00.
+
+UUID/GUID addresses:
+
+	%pU	00010203-0506-0708-090a-0b0c0d0e0fff
+	%pU[bBlL]
+
+	For printing 16 byte UUID/GUIDs addresses. The additional 'l', 'L',
+	'b' and 'B' specifiers are used to specify a little endian order in
+	lower ('l') or upper case ('L') hex characters - and big endian order
+	in lower ('b') or upper case ('B') hex characters.
+
+	Where no additional specifiers are used the default little endian
+	order with lower case hex characters will be printed.
+
+struct va_format:
+
+	%pV	
+
+	For printing struct va_format structures. These contain a format string
+	and va_list as follows:
+
+	struct va_format {
+		const char *fmt;
+		va_lost *va;
+	};
+
+	Do not use this feature without some mechanism to verify the
+	correctness of the format string and va_list arguments.

 u64 SHOULD be printed with %llu/%llx, (unsigned long long):

@@ -32,4 +136,5 @@ Reminder: sizeof() result is of type size_t.
 Thank you for your cooperation and attention.


-By Randy Dunlap <rdunlap@xenotime.net>
+By Randy Dunlap <rdunlap@xenotime.net> and
+Andrew Murray <amurray@mpc-data.co.uk>

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

* Re: [PATCH] printk-formats.txt documentation update
  2011-02-06 16:23     ` Andrew Murray
@ 2011-02-07  9:29       ` Wolfram Sang
  2011-02-07 18:12         ` Andrew Murray
  0 siblings, 1 reply; 31+ messages in thread
From: Wolfram Sang @ 2011-02-07  9:29 UTC (permalink / raw)
  To: Andrew Murray
  Cc: Geert Uytterhoeven, linux-embedded, linux kernel, trivial, rdunlap

[-- Attachment #1: Type: text/plain, Size: 727 bytes --]

On Sun, Feb 06, 2011 at 04:23:09PM +0000, Andrew Murray wrote:
> On 6 February 2011 16:14, Andrew Murray <amurray@mpcdata.com> wrote:
> From: Andrew Murray <amurray@mpc-data.co.uk>
> 
> This patch updates the incomplete documentation concerning the printk
> extended format specifiers.

Good one, thanks!

> +Kernel Pointers:
> +
> +	%pK	0x0
> +
> +	For printing kernel pointers which should be hidden from unprivileged
> +	users. The behaviour of %pK depends on the kptr_resrict sysctl - see

Typo: Should be kptr_restrict.

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] printk-formats.txt documentation update
  2011-02-07  9:29       ` Wolfram Sang
@ 2011-02-07 18:12         ` Andrew Murray
  2011-02-07 19:33           ` Joe Perches
  0 siblings, 1 reply; 31+ messages in thread
From: Andrew Murray @ 2011-02-07 18:12 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Geert Uytterhoeven, linux-embedded, linux kernel, trivial, rdunlap

On 7 February 2011 09:29, Wolfram Sang <w.sang@pengutronix.de> wrote:
> On Sun, Feb 06, 2011 at 04:23:09PM +0000, Andrew Murray wrote:
>> +
>> +     For printing kernel pointers which should be hidden from unprivileged
>> +     users. The behaviour of %pK depends on the kptr_resrict sysctl - see
>
> Typo: Should be kptr_restrict.

Updated patch:

From: Andrew Murray <amurray@mpc-data.co.uk>

This patch updates the incomplete documentation concerning the printk
extended format specifiers.

Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
---
diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
index 1b5a5dd..cad0dda 100644
--- a/Documentation/printk-formats.txt
+++ b/Documentation/printk-formats.txt
@@ -1,4 +1,4 @@
-If variable is of Type,		use printk format specifier:
+f variable is of Type,		use printk format specifier:
 ---------------------------------------------------------
 		int			%d or %x
 		unsigned int		%u or %x
@@ -9,7 +9,111 @@ If variable is of Type,		use printk format specifier:
 		size_t			%zu or %zx
 		ssize_t			%zd or %zx

-Raw pointer value SHOULD be printed with %p.
+Raw pointer value SHOULD be printed with %p. The kernel supports
+the following extended format specifiers for pointer types:
+
+Symbols/Function Pointers:
+
+	%pF	versatile_init+0x0/0x110
+	%pf	versatile_init
+	%pS	versatile_init+0x0/0x110
+	%ps	versatile_init
+
+	For printing symbols and function pointers. The 'S' and 's' specifiers
+	result in the symbol name with ('S') or without ('s') offsets. Where
+	this is used on a kernel without KALLSYMS - the symbol address is
+	printed instead.
+
+	On ia64, ppc64 and parisc64 architectures function pointers are
+	actually function descriptors which must first be resolved. The 'F' and
+	'f' specifiers perform this resolution and then provide the same
+	functionality as the 'S' and 's' specifiers.
+
+Kernel Pointers:
+
+	%pK	0x0
+
+	For printing kernel pointers which should be hidden from unprivileged
+	users. The behaviour of %pK depends on the kptr_restrict sysctl - see
+	Documentation/sysctl/kernel.txt for more details.
+
+Struct Resources:
+
+	%pr	[mem 0x60000000-0x6fffffff flags 0x2200]
+	%pR	[mem 0x60000000-0x6fffffff pref]
+
+	For printing struct resources. The 'R' and 'r' specifiers result in a
+	printed resource with ('R') or without ('r') a decoded flags member.
+
+MAC/FDDI addresses:
+
+	%pM	00:01:02:03:04:05
+	%pMF	00-01-02-03-04-05
+	%pm	000102030405
+
+	For printing 6-byte MAC/FDDI addresses in hex notation. The 'M' and 'm'
+	specifiers result in a printed address with ('M') or without ('m') byte
+	separators. The default byte separator is the colon (':').
+
+	Where FDDI addresses are concerned the 'F' specifier can be used after
+	the 'M' specifier to use dash ('-') separators instead of the default
+	separator.
+
+IPv4 addresses:
+
+	%pI4	1.2.3.4
+	%pi4	001.002.003.004
+	%p[Ii][hnbl]
+	
+	For printing IPv4 dot-separated decimal addresses. The 'I4' and 'i4'
+	specifiers result in a printed address with ('i4') or without ('I4')
+	leading zeros.
+
+	The additional 'h', 'n', 'b', and 'l' specifiers are used to specify
+	host, network, big or little endian order addresses respectively. Where
+	no specifier is provided the default network/big endian order is used.
+
+IPv6 addresses:
+
+	%pI6	0001:0002:0003:0004:0005:0006:0007:0008
+	%pi6	00010002000300040005000600070008
+	%pI6c	1:2:3:4:5:6:7:8
+
+	For printing IPv6 network-order 16 bit hex addresses. The 'I6' and 'i6'
+	specifiers result in a printed address with ('I6') or without ('i6')
+	colon-separators. Leading zeros are always used.
+
+	The additional 'c' specifier can be used with the 'I' specifier to
+	print a compressed IPv6 address as described by
+	http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00.
+
+UUID/GUID addresses:
+
+	%pU	00010203-0506-0708-090a-0b0c0d0e0fff
+	%pU[bBlL]
+
+	For printing 16 byte UUID/GUIDs addresses. The additional 'l', 'L',
+	'b' and 'B' specifiers are used to specify a little endian order in
+	lower ('l') or upper case ('L') hex characters - and big endian order
+	in lower ('b') or upper case ('B') hex characters.
+
+	Where no additional specifiers are used the default little endian
+	order with lower case hex characters will be printed.
+
+struct va_format:
+
+	%pV	
+
+	For printing struct va_format structures. These contain a format string
+	and va_list as follows:
+
+	struct va_format {
+		const char *fmt;
+		va_lost *va;
+	};
+
+	Do not use this feature without some mechanism to verify the
+	correctness of the format string and va_list arguments.

 u64 SHOULD be printed with %llu/%llx, (unsigned long long):

@@ -32,4 +136,5 @@ Reminder: sizeof() result is of type size_t.
 Thank you for your cooperation and attention.


-By Randy Dunlap <rdunlap@xenotime.net>
+By Randy Dunlap <rdunlap@xenotime.net> and
+Andrew Murray <amurray@mpc-data.co.uk>

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

* Re: [PATCH] printk-formats.txt documentation update
  2011-02-07 18:12         ` Andrew Murray
@ 2011-02-07 19:33           ` Joe Perches
  2011-02-11  8:15             ` Andrew Murray
  0 siblings, 1 reply; 31+ messages in thread
From: Joe Perches @ 2011-02-07 19:33 UTC (permalink / raw)
  To: Andrew Murray
  Cc: Wolfram Sang, Geert Uytterhoeven, linux-embedded, linux kernel,
	trivial, rdunlap

On Mon, 2011-02-07 at 18:12 +0000, Andrew Murray wrote:
> On 7 February 2011 09:29, Wolfram Sang <w.sang@pengutronix.de> wrote:
> > On Sun, Feb 06, 2011 at 04:23:09PM +0000, Andrew Murray wrote:
> >> +
> >> +     For printing kernel pointers which should be hidden from unprivileged
> >> +     users. The behaviour of %pK depends on the kptr_resrict sysctl - see
> >
> > Typo: Should be kptr_restrict.
> Updated patch:

trivia:

> diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
[]
> +Kernel Pointers:
> +
> +	%pK	0x0

Bad example, leading zeros are emitted.

	%pK	0x01234567 or 0x01234567890abcdef

depending on 32/64 bit. For 2.6.38, output should be 0x00000000
for a 0 if kptr_restrict is set, "(null)" or value otherwise.

> +	For printing kernel pointers which should be hidden from unprivileged
> +	users. The behaviour of %pK depends on the kptr_restrict sysctl - see
> +	Documentation/sysctl/kernel.txt for more details.
> +
> +Struct Resources:
> +
> +	%pr	[mem 0x60000000-0x6fffffff flags 0x2200]
> +	%pR	[mem 0x60000000-0x6fffffff pref]
> +
> +	For printing struct resources. The 'R' and 'r' specifiers result in a
> +	printed resource with ('R') or without ('r') a decoded flags member.

Same issue, mem resources are printed using sizeof(resource_size_t) * 2

> +IPv6 addresses:
> +
> +	%pI6	0001:0002:0003:0004:0005:0006:0007:0008
> +	%pi6	00010002000300040005000600070008
> +	%pI6c	1:2:3:4:5:6:7:8
> +
> +	For printing IPv6 network-order 16 bit hex addresses. The 'I6' and 'i6'
> +	specifiers result in a printed address with ('I6') or without ('i6')
> +	colon-separators. Leading zeros are always used.
> +
> +	The additional 'c' specifier can be used with the 'I' specifier to
> +	print a compressed IPv6 address as described by
> +	http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00.

It's probably better to use:

	http://tools.ietf.org/html/rfc5952

> +
> +UUID/GUID addresses:
> +
> +	%pU	00010203-0506-0708-090a-0b0c0d0e0fff

What happened to 04?

It's probably easier/simpler to just show all possible
output styles.  Assuming an in memory incrementing
16 byte array, output is:

	%pU	00010203-0405-0607-08090a0b0c0d0e0f
	
> +	%pU[bBlL]

	%pUb	00010203-0405-0607-08090a0b0c0d0e0f
	%pUB	00010203-0405-0607-08090A0B0C0D0E0F
	%pUl	03020100-0504-0706-08090a0b0c0d0e0f
	%pUL	03020100-0504-0706-08090A0B0E0D0E0F

> +	For printing 16 byte UUID/GUIDs addresses. The additional 'l', 'L',
> +	'b' and 'B' specifiers are used to specify a little endian order in
> +	lower ('l') or upper case ('L') hex characters - and big endian order
> +	in lower ('b') or upper case ('B') hex characters.
> +
> +	Where no additional specifiers are used the default little endian
> +	order with lower case hex characters will be printed.
> +
> +struct va_format:
> +
> +	%pV	
> +
> +	For printing struct va_format structures. These contain a format string
> +	and va_list as follows:
> +
> +	struct va_format {
> +		const char *fmt;
> +		va_lost *va;

va_list



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

* Re: [PATCH] printk-formats.txt documentation update
  2011-02-07 19:33           ` Joe Perches
@ 2011-02-11  8:15             ` Andrew Murray
  2011-06-09 17:33               ` [PATCH] Revised patch Andrew Murray
  0 siblings, 1 reply; 31+ messages in thread
From: Andrew Murray @ 2011-02-11  8:15 UTC (permalink / raw)
  To: Joe Perches
  Cc: Wolfram Sang, Geert Uytterhoeven, linux-embedded, linux kernel,
	trivial, rdunlap

On 7 February 2011 19:33, Joe Perches <joe@perches.com> wrote:
>
> On Mon, 2011-02-07 at 18:12 +0000, Andrew Murray wrote:
> > On 7 February 2011 09:29, Wolfram Sang <w.sang@pengutronix.de> wrote:
> > > On Sun, Feb 06, 2011 at 04:23:09PM +0000, Andrew Murray wrote:
> > >> +
>

Thanks for the feedback - I'll be on holiday shortly - so will have to
continue this when in return.

Andrew Murray

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

* [PATCH] Revised patch
  2011-02-11  8:15             ` Andrew Murray
@ 2011-06-09 17:33               ` Andrew Murray
  2011-06-09 17:40                 ` Joe Perches
  2011-06-09 17:47                 ` [PATCH] Revised patch Randy Dunlap
  0 siblings, 2 replies; 31+ messages in thread
From: Andrew Murray @ 2011-06-09 17:33 UTC (permalink / raw)
  To: joe
  Cc: w.sang, geert, linux-embedded, linux-kernel, trivial, rdunlap,
	udknight, namhyung, Andrew Murray, Andrew Murray

Hi,

I've updated this patch based on your feedback. This covers all the recent feedback.

From: Andrew Murray <amurray@mpc-data.co.uk>

This patch updates the incomplete documentation concerning the printk
extended format specifiers.

Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>

---
 Documentation/printk-formats.txt |  113 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 111 insertions(+), 2 deletions(-)

diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
index 1b5a5dd..2968cbf 100644
--- a/Documentation/printk-formats.txt
+++ b/Documentation/printk-formats.txt
@@ -9,7 +9,115 @@ If variable is of Type,		use printk format specifier:
 		size_t			%zu or %zx
 		ssize_t			%zd or %zx
 
-Raw pointer value SHOULD be printed with %p.
+Raw pointer value SHOULD be printed with %p. The kernel supports
+the following extended format specifiers for pointer types:
+
+Symbols/Function Pointers:
+
+	%pF	versatile_init+0x0/0x110
+	%pf	versatile_init
+	%pS	versatile_init+0x0/0x110
+	%ps	versatile_init
+
+	For printing symbols and function pointers. The 'S' and 's' specifiers
+	result in the symbol name with ('S') or without ('s') offsets. Where
+	this is used on a kernel without KALLSYMS - the symbol address is
+	printed instead.
+
+	On ia64, ppc64 and parisc64 architectures function pointers are
+	actually function descriptors which must first be resolved. The 'F' and
+	'f' specifiers perform this resolution and then provide the same
+	functionality as the 'S' and 's' specifiers.
+
+Kernel Pointers:
+
+	%pK	0x01234567 or 0x0123456789abcdef
+
+	For printing kernel pointers which should be hidden from unprivileged
+	users. The behaviour of %pK depends on the kptr_restrict sysctl - see
+	Documentation/sysctl/kernel.txt for more details.
+
+Struct Resources:
+
+	%pr	[mem 0x60000000-0x6fffffff flags 0x2200] or
+		[mem 0x0000000060000000-0x000000006fffffff flags 0x2200]
+	%pR	[mem 0x60000000-0x6fffffff pref] or
+		[mem 0x0000000060000000-0x000000006fffffff pref]
+
+	For printing struct resources. The 'R' and 'r' specifiers result in a
+	printed resource with ('R') or without ('r') a decoded flags member.
+
+MAC/FDDI addresses:
+
+	%pM	00:01:02:03:04:05
+	%pMF	00-01-02-03-04-05
+	%pm	000102030405
+
+	For printing 6-byte MAC/FDDI addresses in hex notation. The 'M' and 'm'
+	specifiers result in a printed address with ('M') or without ('m') byte
+	separators. The default byte separator is the colon (':').
+
+	Where FDDI addresses are concerned the 'F' specifier can be used after
+	the 'M' specifier to use dash ('-') separators instead of the default
+	separator.
+
+IPv4 addresses:
+
+	%pI4	1.2.3.4
+	%pi4	001.002.003.004
+	%p[Ii][hnbl]
+	
+	For printing IPv4 dot-separated decimal addresses. The 'I4' and 'i4'
+	specifiers result in a printed address with ('i4') or without ('I4')
+	leading zeros.
+
+	The additional 'h', 'n', 'b', and 'l' specifiers are used to specify
+	host, network, big or little endian order addresses respectively. Where
+	no specifier is provided the default network/big endian order is used.
+
+IPv6 addresses:
+
+	%pI6	0001:0002:0003:0004:0005:0006:0007:0008
+	%pi6	00010002000300040005000600070008
+	%pI6c	1:2:3:4:5:6:7:8
+
+	For printing IPv6 network-order 16 bit hex addresses. The 'I6' and 'i6'
+	specifiers result in a printed address with ('I6') or without ('i6')
+	colon-separators. Leading zeros are always used.
+
+	The additional 'c' specifier can be used with the 'I' specifier to
+	print a compressed IPv6 address as described by
+	http://tools.ietf.org/html/rfc5952
+
+UUID/GUID addresses:
+
+	%pUb	00010203-0405-0607-0809-0a0b0c0d0e0f
+	%pUB	00010203-0405-0607-0809-0A0B0C0D0E0F
+	%pUl	03020100-0504-0706-0809-0a0b0c0e0e0f
+	%pUL	03020100-0504-0706-0809-0A0B0C0E0E0F
+
+	For printing 16 byte UUID/GUIDs addresses. The additional 'l', 'L',
+	'b' and 'B' specifiers are used to specify a little endian order in
+	lower ('l') or upper case ('L') hex characters - and big endian order
+	in lower ('b') or upper case ('B') hex characters.
+
+	Where no additional specifiers are used the default little endian
+	order with lower case hex characters will be printed.
+
+struct va_format:
+
+	%pV	
+
+	For printing struct va_format structures. These contain a format string
+	and va_list as follows:
+
+	struct va_format {
+		const char *fmt;
+		va_list *va;
+	};
+
+	Do not use this feature without some mechanism to verify the
+	correctness of the format string and va_list arguments.
 
 u64 SHOULD be printed with %llu/%llx, (unsigned long long):
 
@@ -32,4 +140,5 @@ Reminder: sizeof() result is of type size_t.
 Thank you for your cooperation and attention.
 
 
-By Randy Dunlap <rdunlap@xenotime.net>
+By Randy Dunlap <rdunlap@xenotime.net> and
+Andrew Murray <amurray@mpc-data.co.uk>
-- 
1.7.4.1


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

* Re: [PATCH] Revised patch
  2011-06-09 17:33               ` [PATCH] Revised patch Andrew Murray
@ 2011-06-09 17:40                 ` Joe Perches
  2011-06-09 17:47                   ` Namhyung Kim
  2011-06-09 17:47                 ` [PATCH] Revised patch Randy Dunlap
  1 sibling, 1 reply; 31+ messages in thread
From: Joe Perches @ 2011-06-09 17:40 UTC (permalink / raw)
  To: Andrew Murray
  Cc: w.sang, geert, linux-embedded, linux-kernel, trivial, rdunlap,
	udknight, namhyung, Andrew Murray

On Thu, 2011-06-09 at 18:33 +0100, Andrew Murray wrote:
> Hi,
> I've updated this patch based on your feedback. This covers all the recent feedback.

Hey Andrew.

You're missing the "%pB" backtrace extension.

It's be better if the "Hi, I've updated" comment stuff
came after the --- content separator in the patch so that
the commit log is a bit neater.

Otherwise, looks great, thanks.

cheers, Joe


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

* Re: [PATCH] Revised patch
  2011-06-09 17:33               ` [PATCH] Revised patch Andrew Murray
  2011-06-09 17:40                 ` Joe Perches
@ 2011-06-09 17:47                 ` Randy Dunlap
  2011-06-09 17:53                   ` Joe Perches
  1 sibling, 1 reply; 31+ messages in thread
From: Randy Dunlap @ 2011-06-09 17:47 UTC (permalink / raw)
  To: Andrew Murray
  Cc: joe, w.sang, geert, linux-embedded, linux-kernel, trivial,
	udknight, namhyung, Andrew Murray

On Thu,  9 Jun 2011 18:33:46 +0100 Andrew Murray wrote:

> Hi,
> 
> I've updated this patch based on your feedback. This covers all the recent feedback.
> 
> From: Andrew Murray <amurray@mpc-data.co.uk>
> 
> This patch updates the incomplete documentation concerning the printk
> extended format specifiers.

Thanks.  A few comments below...

> Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
> 
> ---
>  Documentation/printk-formats.txt |  113 +++++++++++++++++++++++++++++++++++++-
>  1 files changed, 111 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
> index 1b5a5dd..2968cbf 100644
> --- a/Documentation/printk-formats.txt
> +++ b/Documentation/printk-formats.txt
> @@ -9,7 +9,115 @@ If variable is of Type,		use printk format specifier:
>  		size_t			%zu or %zx
>  		ssize_t			%zd or %zx
>  
> -Raw pointer value SHOULD be printed with %p.
> +Raw pointer value SHOULD be printed with %p. The kernel supports
> +the following extended format specifiers for pointer types:
> +
> +Symbols/Function Pointers:
> +
> +	%pF	versatile_init+0x0/0x110
> +	%pf	versatile_init
> +	%pS	versatile_init+0x0/0x110
> +	%ps	versatile_init
> +
> +	For printing symbols and function pointers. The 'S' and 's' specifiers
> +	result in the symbol name with ('S') or without ('s') offsets. Where
> +	this is used on a kernel without KALLSYMS - the symbol address is
> +	printed instead.
> +
> +	On ia64, ppc64 and parisc64 architectures function pointers are
> +	actually function descriptors which must first be resolved. The 'F' and
> +	'f' specifiers perform this resolution and then provide the same
> +	functionality as the 'S' and 's' specifiers.
> +
> +Kernel Pointers:
> +
> +	%pK	0x01234567 or 0x0123456789abcdef
> +
> +	For printing kernel pointers which should be hidden from unprivileged
> +	users. The behaviour of %pK depends on the kptr_restrict sysctl - see
> +	Documentation/sysctl/kernel.txt for more details.
> +
> +Struct Resources:
> +
> +	%pr	[mem 0x60000000-0x6fffffff flags 0x2200] or
> +		[mem 0x0000000060000000-0x000000006fffffff flags 0x2200]
> +	%pR	[mem 0x60000000-0x6fffffff pref] or
> +		[mem 0x0000000060000000-0x000000006fffffff pref]
> +
> +	For printing struct resources. The 'R' and 'r' specifiers result in a
> +	printed resource with ('R') or without ('r') a decoded flags member.
> +
> +MAC/FDDI addresses:
> +
> +	%pM	00:01:02:03:04:05
> +	%pMF	00-01-02-03-04-05
> +	%pm	000102030405
> +
> +	For printing 6-byte MAC/FDDI addresses in hex notation. The 'M' and 'm'
> +	specifiers result in a printed address with ('M') or without ('m') byte
> +	separators. The default byte separator is the colon (':').
> +
> +	Where FDDI addresses are concerned the 'F' specifier can be used after
> +	the 'M' specifier to use dash ('-') separators instead of the default
> +	separator.
> +
> +IPv4 addresses:
> +
> +	%pI4	1.2.3.4
> +	%pi4	001.002.003.004
> +	%p[Ii][hnbl]
> +	
> +	For printing IPv4 dot-separated decimal addresses. The 'I4' and 'i4'
> +	specifiers result in a printed address with ('i4') or without ('I4')
> +	leading zeros.
> +
> +	The additional 'h', 'n', 'b', and 'l' specifiers are used to specify
> +	host, network, big or little endian order addresses respectively. Where
> +	no specifier is provided the default network/big endian order is used.
> +

I would hyphenate the -endian types, but won't insist on that.

> +IPv6 addresses:
> +
> +	%pI6	0001:0002:0003:0004:0005:0006:0007:0008
> +	%pi6	00010002000300040005000600070008
> +	%pI6c	1:2:3:4:5:6:7:8
> +
> +	For printing IPv6 network-order 16 bit hex addresses. The 'I6' and 'i6'

	                                16-bit

> +	specifiers result in a printed address with ('I6') or without ('i6')
> +	colon-separators. Leading zeros are always used.
> +
> +	The additional 'c' specifier can be used with the 'I' specifier to
> +	print a compressed IPv6 address as described by
> +	http://tools.ietf.org/html/rfc5952
> +
> +UUID/GUID addresses:
> +
> +	%pUb	00010203-0405-0607-0809-0a0b0c0d0e0f
> +	%pUB	00010203-0405-0607-0809-0A0B0C0D0E0F
> +	%pUl	03020100-0504-0706-0809-0a0b0c0e0e0f
> +	%pUL	03020100-0504-0706-0809-0A0B0C0E0E0F
> +
> +	For printing 16 byte UUID/GUIDs addresses. The additional 'l', 'L',

	             16-byte

> +	'b' and 'B' specifiers are used to specify a little endian order in
> +	lower ('l') or upper case ('L') hex characters - and big endian order
> +	in lower ('b') or upper case ('B') hex characters.
> +
> +	Where no additional specifiers are used the default little endian
> +	order with lower case hex characters will be printed.
> +
> +struct va_format:
> +
> +	%pV	
> +
> +	For printing struct va_format structures. These contain a format string
> +	and va_list as follows:
> +
> +	struct va_format {
> +		const char *fmt;
> +		va_list *va;
> +	};
> +
> +	Do not use this feature without some mechanism to verify the
> +	correctness of the format string and va_list arguments.
>  
>  u64 SHOULD be printed with %llu/%llx, (unsigned long long):


%pB is missing?
 * - 'B' For backtraced symbolic direct pointers with offset


> @@ -32,4 +140,5 @@ Reminder: sizeof() result is of type size_t.
>  Thank you for your cooperation and attention.
>  
>  
> -By Randy Dunlap <rdunlap@xenotime.net>
> +By Randy Dunlap <rdunlap@xenotime.net> and
> +Andrew Murray <amurray@mpc-data.co.uk>
> -- 


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

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

* Re: [PATCH] Revised patch
  2011-06-09 17:40                 ` Joe Perches
@ 2011-06-09 17:47                   ` Namhyung Kim
  2011-06-09 17:48                     ` Andrew Murray
  0 siblings, 1 reply; 31+ messages in thread
From: Namhyung Kim @ 2011-06-09 17:47 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andrew Murray, w.sang, geert, linux-embedded, linux-kernel,
	trivial, rdunlap, udknight, Andrew Murray

2011-06-09 (목), 10:40 -0700, Joe Perches:
> On Thu, 2011-06-09 at 18:33 +0100, Andrew Murray wrote:
> > Hi,
> > I've updated this patch based on your feedback. This covers all the recent feedback.
> 
> Hey Andrew.
> 
> You're missing the "%pB" backtrace extension.
> 

http://marc.info/?l=linux-kernel&m=130093458112438&w=2

Just for your information. :)
Thanks.


-- 
Regards,
Namhyung Kim



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

* Re: [PATCH] Revised patch
  2011-06-09 17:47                   ` Namhyung Kim
@ 2011-06-09 17:48                     ` Andrew Murray
  2011-06-09 18:04                       ` [PATCH] printk-formats.txt documentation update Andrew Murray
  0 siblings, 1 reply; 31+ messages in thread
From: Andrew Murray @ 2011-06-09 17:48 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Joe Perches, w.sang, geert, linux-embedded, linux-kernel,
	trivial, rdunlap, udknight

Thanks - I've actually written the %pB documentation but just getting
in a mess with Git and my work flow - standby...

On 9 June 2011 18:47, Namhyung Kim <namhyung@gmail.com> wrote:
> 2011-06-09 (목), 10:40 -0700, Joe Perches:
>> On Thu, 2011-06-09 at 18:33 +0100, Andrew Murray wrote:
>> > Hi,
>> > I've updated this patch based on your feedback. This covers all the recent feedback.
>>
>> Hey Andrew.
>>
>> You're missing the "%pB" backtrace extension.
>>
>
> http://marc.info/?l=linux-kernel&m=130093458112438&w=2
>
> Just for your information. :)
> Thanks.
>
>
> --
> Regards,
> Namhyung Kim
>
>
>



-- 
Andrew Murray, Embedded Linux Group
MPC Data Limited
e-mail: amurray@mpc-data.co.uk  web: www.mpc-data.co.uk
tel: +44 (0) 1225 710600               fax: +44 (0) 1225 710601
ddi: +44 (0) 1225 710665

MPC Data Limited is a company registered in England and Wales with
company number 05507446
Registered Address: County Gate, County Way, Trowbridge, Wiltshire, BA14 7FJ
VAT no: 850625238

The information in this email and in the attached documents is
confidential and may be
legally privileged. Any unauthorized review, copying, disclosure or
distribution is
prohibited and may be unlawful. It is intended solely for the
addressee. Access to this
email by anyone else is unauthorized. If you are not the intended
recipient, please
contact the sender by reply email and destroy all copies of the
original message. When
addressed to our clients any opinions or advice contained in this
email is subject to
the terms and conditions expressed in the governing contract.

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

* Re: [PATCH] Revised patch
  2011-06-09 17:47                 ` [PATCH] Revised patch Randy Dunlap
@ 2011-06-09 17:53                   ` Joe Perches
  0 siblings, 0 replies; 31+ messages in thread
From: Joe Perches @ 2011-06-09 17:53 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Andrew Murray, w.sang, geert, linux-embedded, linux-kernel,
	trivial, udknight, namhyung, Andrew Murray

On Thu, 2011-06-09 at 10:47 -0700, Randy Dunlap wrote:
> On Thu,  9 Jun 2011 18:33:46 +0100 Andrew Murray wrote:
> > +	For printing IPv6 network-order 16 bit hex addresses. The 'I6' and 'i6'
> 	                                16-bit

byte.  octet if pedantry is desired.


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

* [PATCH] printk-formats.txt documentation update
  2011-06-09 17:48                     ` Andrew Murray
@ 2011-06-09 18:04                       ` Andrew Murray
  2011-06-09 18:20                         ` Namhyung Kim
  2011-06-09 18:23                         ` [PATCH] vsprintf: Update %pI6c to not compress a single 0 Joe Perches
  0 siblings, 2 replies; 31+ messages in thread
From: Andrew Murray @ 2011-06-09 18:04 UTC (permalink / raw)
  To: joe
  Cc: w.sang, geert, linux-embedded, linux-kernel, trivial, rdunlap,
	udknight, namhyung, Andrew Murray

From: Andrew Murray <amurray@mpc-data.co.uk>

This patch updates the incomplete documentation concerning the printk
extended format specifiers.

Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
---
 Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 117 insertions(+), 2 deletions(-)

diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
index 1b5a5dd..69713d6 100644
--- a/Documentation/printk-formats.txt
+++ b/Documentation/printk-formats.txt
@@ -9,7 +9,121 @@ If variable is of Type,		use printk format specifier:
 		size_t			%zu or %zx
 		ssize_t			%zd or %zx
 
-Raw pointer value SHOULD be printed with %p.
+Raw pointer value SHOULD be printed with %p. The kernel supports
+the following extended format specifiers for pointer types:
+
+Symbols/Function Pointers:
+
+	%pF	versatile_init+0x0/0x110
+	%pf	versatile_init
+	%pS	versatile_init+0x0/0x110
+	%ps	versatile_init
+	%pB	versatile_init+0x0/0x110
+
+	For printing symbols and function pointers. The 'S' and 's' specifiers
+	result in the symbol name with ('S') or without ('s') offsets. Where
+	this is used on a kernel without KALLSYMS - the symbol address is
+	printed instead.
+
+	The 'B' specifier results in the symbol name with offsets and should be
+	used when printing stack backtraces. The specifier takes into
+	consideration the effect of compiler optimisations which may occur
+	when tail-call's are used and marked with the noreturn GCC attribute.
+
+	On ia64, ppc64 and parisc64 architectures function pointers are
+	actually function descriptors which must first be resolved. The 'F' and
+	'f' specifiers perform this resolution and then provide the same
+	functionality as the 'S' and 's' specifiers.
+
+Kernel Pointers:
+
+	%pK	0x01234567 or 0x0123456789abcdef
+
+	For printing kernel pointers which should be hidden from unprivileged
+	users. The behaviour of %pK depends on the kptr_restrict sysctl - see
+	Documentation/sysctl/kernel.txt for more details.
+
+Struct Resources:
+
+	%pr	[mem 0x60000000-0x6fffffff flags 0x2200] or
+		[mem 0x0000000060000000-0x000000006fffffff flags 0x2200]
+	%pR	[mem 0x60000000-0x6fffffff pref] or
+		[mem 0x0000000060000000-0x000000006fffffff pref]
+
+	For printing struct resources. The 'R' and 'r' specifiers result in a
+	printed resource with ('R') or without ('r') a decoded flags member.
+
+MAC/FDDI addresses:
+
+	%pM	00:01:02:03:04:05
+	%pMF	00-01-02-03-04-05
+	%pm	000102030405
+
+	For printing 6-byte MAC/FDDI addresses in hex notation. The 'M' and 'm'
+	specifiers result in a printed address with ('M') or without ('m') byte
+	separators. The default byte separator is the colon (':').
+
+	Where FDDI addresses are concerned the 'F' specifier can be used after
+	the 'M' specifier to use dash ('-') separators instead of the default
+	separator.
+
+IPv4 addresses:
+
+	%pI4	1.2.3.4
+	%pi4	001.002.003.004
+	%p[Ii][hnbl]
+	
+	For printing IPv4 dot-separated decimal addresses. The 'I4' and 'i4'
+	specifiers result in a printed address with ('i4') or without ('I4')
+	leading zeros.
+
+	The additional 'h', 'n', 'b', and 'l' specifiers are used to specify
+	host, network, big or little endian order addresses respectively. Where
+	no specifier is provided the default network/big endian order is used.
+
+IPv6 addresses:
+
+	%pI6	0001:0002:0003:0004:0005:0006:0007:0008
+	%pi6	00010002000300040005000600070008
+	%pI6c	1:2:3:4:5:6:7:8
+
+	For printing IPv6 network-order 16-bit hex addresses. The 'I6' and 'i6'
+	specifiers result in a printed address with ('I6') or without ('i6')
+	colon-separators. Leading zeros are always used.
+
+	The additional 'c' specifier can be used with the 'I' specifier to
+	print a compressed IPv6 address as described by
+	http://tools.ietf.org/html/rfc5952
+
+UUID/GUID addresses:
+
+	%pUb	00010203-0405-0607-0809-0a0b0c0d0e0f
+	%pUB	00010203-0405-0607-0809-0A0B0C0D0E0F
+	%pUl	03020100-0504-0706-0809-0a0b0c0e0e0f
+	%pUL	03020100-0504-0706-0809-0A0B0C0E0E0F
+
+	For printing 16-byte UUID/GUIDs addresses. The additional 'l', 'L',
+	'b' and 'B' specifiers are used to specify a little endian order in
+	lower ('l') or upper case ('L') hex characters - and big endian order
+	in lower ('b') or upper case ('B') hex characters.
+
+	Where no additional specifiers are used the default little endian
+	order with lower case hex characters will be printed.
+
+struct va_format:
+
+	%pV	
+
+	For printing struct va_format structures. These contain a format string
+	and va_list as follows:
+
+	struct va_format {
+		const char *fmt;
+		va_list *va;
+	};
+
+	Do not use this feature without some mechanism to verify the
+	correctness of the format string and va_list arguments.
 
 u64 SHOULD be printed with %llu/%llx, (unsigned long long):
 
@@ -32,4 +146,5 @@ Reminder: sizeof() result is of type size_t.
 Thank you for your cooperation and attention.
 
 
-By Randy Dunlap <rdunlap@xenotime.net>
+By Randy Dunlap <rdunlap@xenotime.net> and
+Andrew Murray <amurray@mpc-data.co.uk>
-- 
1.7.4.1


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

* Re: [PATCH] printk-formats.txt documentation update
  2011-06-09 18:04                       ` [PATCH] printk-formats.txt documentation update Andrew Murray
@ 2011-06-09 18:20                         ` Namhyung Kim
  2011-06-09 18:55                           ` Andrew Murray
  2011-06-09 18:23                         ` [PATCH] vsprintf: Update %pI6c to not compress a single 0 Joe Perches
  1 sibling, 1 reply; 31+ messages in thread
From: Namhyung Kim @ 2011-06-09 18:20 UTC (permalink / raw)
  To: Andrew Murray
  Cc: joe, w.sang, geert, linux-embedded, linux-kernel, trivial,
	rdunlap, udknight, Andrew Murray

2011-06-09 (목), 19:04 +0100, Andrew Murray:
> From: Andrew Murray <amurray@mpc-data.co.uk>
> 
> This patch updates the incomplete documentation concerning the printk
> extended format specifiers.
> 
> Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
> ---
>  Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
>  1 files changed, 117 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
> index 1b5a5dd..69713d6 100644
> --- a/Documentation/printk-formats.txt
> +++ b/Documentation/printk-formats.txt
> @@ -9,7 +9,121 @@ If variable is of Type,		use printk format specifier:
>  		size_t			%zu or %zx
>  		ssize_t			%zd or %zx
>  
> -Raw pointer value SHOULD be printed with %p.
> +Raw pointer value SHOULD be printed with %p. The kernel supports
> +the following extended format specifiers for pointer types:
> +
> +Symbols/Function Pointers:
> +
> +	%pF	versatile_init+0x0/0x110
> +	%pf	versatile_init
> +	%pS	versatile_init+0x0/0x110
> +	%ps	versatile_init
> +	%pB	versatile_init+0x0/0x110
> +

-EBADEXAMPLE :)

If %pB is used, the offset part in the output could not be 0. That's the
key (and the only) difference of the %pB specifier than others. Thus the
output would be something like:

	%pB	prev_fn_of_versatile_init+0x88/0x88

Thanks.


-- 
Regards,
Namhyung Kim



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

* [PATCH] vsprintf: Update %pI6c to not compress a single 0
  2011-06-09 18:04                       ` [PATCH] printk-formats.txt documentation update Andrew Murray
  2011-06-09 18:20                         ` Namhyung Kim
@ 2011-06-09 18:23                         ` Joe Perches
  1 sibling, 0 replies; 31+ messages in thread
From: Joe Perches @ 2011-06-09 18:23 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel, Andrew Murray

RFC 5952 http://tools.ietf.org/html/rfc5952
mandates that 2 or more consecutive 0's are
required before using :: compression.

Update ip6_compressed_string to match the RFC and
update the http reference as well.

Signed-off-by: Joe Perches <joe@perches.com>
---
 lib/vsprintf.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index c112056..4365df3 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -666,6 +666,8 @@ char *ip6_compressed_string(char *p, const char *addr)
 			colonpos = i;
 		}
 	}
+	if (longest == 1)		/* don't compress a single 0 */
+		colonpos = -1;
 
 	/* emit address */
 	for (i = 0; i < range; i++) {
@@ -826,7 +828,7 @@ int kptr_restrict __read_mostly;
  *       IPv4 uses dot-separated decimal with leading 0's (010.123.045.006)
  * - '[Ii]4[hnbl]' IPv4 addresses in host, network, big or little endian order
  * - 'I6c' for IPv6 addresses printed as specified by
- *       http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00
+ *       http://tools.ietf.org/html/rfc5952
  * - 'U' For a 16 byte UUID/GUID, it prints the UUID/GUID in the form
  *       "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  *       Options for %pU are:
-- 
1.7.6.rc0




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

* Re: [PATCH] printk-formats.txt documentation update
  2011-06-09 18:20                         ` Namhyung Kim
@ 2011-06-09 18:55                           ` Andrew Murray
  2011-06-09 19:45                             ` Randy Dunlap
  0 siblings, 1 reply; 31+ messages in thread
From: Andrew Murray @ 2011-06-09 18:55 UTC (permalink / raw)
  To: joe
  Cc: w.sang, geert, linux-embedded, linux-kernel, trivial, rdunlap,
	udknight, namhyung, Andrew Murray

From: Andrew Murray <amurray@mpc-data.co.uk>

This patch updates the incomplete documentation concerning the printk
extended format specifiers

Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
---
 Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 117 insertions(+), 2 deletions(-)

diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
index 1b5a5dd..85a06aa 100644
--- a/Documentation/printk-formats.txt
+++ b/Documentation/printk-formats.txt
@@ -9,7 +9,121 @@ If variable is of Type,		use printk format specifier:
 		size_t			%zu or %zx
 		ssize_t			%zd or %zx
 
-Raw pointer value SHOULD be printed with %p.
+Raw pointer value SHOULD be printed with %p. The kernel supports
+the following extended format specifiers for pointer types:
+
+Symbols/Function Pointers:
+
+	%pF	versatile_init+0x0/0x110
+	%pf	versatile_init
+	%pS	versatile_init+0x0/0x110
+	%ps	versatile_init
+	%pB	prev_fn_of_versatile_init+0x88/0x88
+
+	For printing symbols and function pointers. The 'S' and 's' specifiers
+	result in the symbol name with ('S') or without ('s') offsets. Where
+	this is used on a kernel without KALLSYMS - the symbol address is
+	printed instead.
+
+	The 'B' specifier results in the symbol name with offsets and should be
+	used when printing stack backtraces. The specifier takes into
+	consideration the effect of compiler optimisations which may occur
+	when tail-call's are used and marked with the noreturn GCC attribute.
+
+	On ia64, ppc64 and parisc64 architectures function pointers are
+	actually function descriptors which must first be resolved. The 'F' and
+	'f' specifiers perform this resolution and then provide the same
+	functionality as the 'S' and 's' specifiers.
+
+Kernel Pointers:
+
+	%pK	0x01234567 or 0x0123456789abcdef
+
+	For printing kernel pointers which should be hidden from unprivileged
+	users. The behaviour of %pK depends on the kptr_restrict sysctl - see
+	Documentation/sysctl/kernel.txt for more details.
+
+Struct Resources:
+
+	%pr	[mem 0x60000000-0x6fffffff flags 0x2200] or
+		[mem 0x0000000060000000-0x000000006fffffff flags 0x2200]
+	%pR	[mem 0x60000000-0x6fffffff pref] or
+		[mem 0x0000000060000000-0x000000006fffffff pref]
+
+	For printing struct resources. The 'R' and 'r' specifiers result in a
+	printed resource with ('R') or without ('r') a decoded flags member.
+
+MAC/FDDI addresses:
+
+	%pM	00:01:02:03:04:05
+	%pMF	00-01-02-03-04-05
+	%pm	000102030405
+
+	For printing 6-byte MAC/FDDI addresses in hex notation. The 'M' and 'm'
+	specifiers result in a printed address with ('M') or without ('m') byte
+	separators. The default byte separator is the colon (':').
+
+	Where FDDI addresses are concerned the 'F' specifier can be used after
+	the 'M' specifier to use dash ('-') separators instead of the default
+	separator.
+
+IPv4 addresses:
+
+	%pI4	1.2.3.4
+	%pi4	001.002.003.004
+	%p[Ii][hnbl]
+	
+	For printing IPv4 dot-separated decimal addresses. The 'I4' and 'i4'
+	specifiers result in a printed address with ('i4') or without ('I4')
+	leading zeros.
+
+	The additional 'h', 'n', 'b', and 'l' specifiers are used to specify
+	host, network, big or little endian order addresses respectively. Where
+	no specifier is provided the default network/big endian order is used.
+
+IPv6 addresses:
+
+	%pI6	0001:0002:0003:0004:0005:0006:0007:0008
+	%pi6	00010002000300040005000600070008
+	%pI6c	1:2:3:4:5:6:7:8
+
+	For printing IPv6 network-order 16 bit hex addresses. The 'I6' and 'i6'
+	specifiers result in a printed address with ('I6') or without ('i6')
+	colon-separators. Leading zeros are always used.
+
+	The additional 'c' specifier can be used with the 'I' specifier to
+	print a compressed IPv6 address as described by
+	http://tools.ietf.org/html/rfc5952
+
+UUID/GUID addresses:
+
+	%pUb	00010203-0405-0607-0809-0a0b0c0d0e0f
+	%pUB	00010203-0405-0607-0809-0A0B0C0D0E0F
+	%pUl	03020100-0504-0706-0809-0a0b0c0e0e0f
+	%pUL	03020100-0504-0706-0809-0A0B0C0E0E0F
+
+	For printing 16 byte UUID/GUIDs addresses. The additional 'l', 'L',
+	'b' and 'B' specifiers are used to specify a little endian order in
+	lower ('l') or upper case ('L') hex characters - and big endian order
+	in lower ('b') or upper case ('B') hex characters.
+
+	Where no additional specifiers are used the default little endian
+	order with lower case hex characters will be printed.
+
+struct va_format:
+
+	%pV	
+
+	For printing struct va_format structures. These contain a format string
+	and va_list as follows:
+
+	struct va_format {
+		const char *fmt;
+		va_list *va;
+	};
+
+	Do not use this feature without some mechanism to verify the
+	correctness of the format string and va_list arguments.
 
 u64 SHOULD be printed with %llu/%llx, (unsigned long long):
 
@@ -32,4 +146,5 @@ Reminder: sizeof() result is of type size_t.
 Thank you for your cooperation and attention.
 
 
-By Randy Dunlap <rdunlap@xenotime.net>
+By Randy Dunlap <rdunlap@xenotime.net> and
+Andrew Murray <amurray@mpc-data.co.uk>
-- 
1.7.4.1


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

* Re: [PATCH] printk-formats.txt documentation update
  2011-06-09 18:55                           ` Andrew Murray
@ 2011-06-09 19:45                             ` Randy Dunlap
  2011-06-09 21:24                               ` Andrew Murray
  0 siblings, 1 reply; 31+ messages in thread
From: Randy Dunlap @ 2011-06-09 19:45 UTC (permalink / raw)
  To: Andrew Murray
  Cc: joe, w.sang, geert, linux-embedded, linux-kernel, trivial,
	udknight, namhyung, Andrew Murray

On Thu,  9 Jun 2011 19:55:35 +0100 Andrew Murray wrote:

> From: Andrew Murray <amurray@mpc-data.co.uk>
> 
> This patch updates the incomplete documentation concerning the printk
> extended format specifiers
> 
> Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
> ---
>  Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
>  1 files changed, 117 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
> index 1b5a5dd..85a06aa 100644
> --- a/Documentation/printk-formats.txt
> +++ b/Documentation/printk-formats.txt
> @@ -9,7 +9,121 @@ If variable is of Type,		use printk format specifier:
>  		size_t			%zu or %zx
>  		ssize_t			%zd or %zx
>  
> -Raw pointer value SHOULD be printed with %p.
> +Raw pointer value SHOULD be printed with %p. The kernel supports
> +the following extended format specifiers for pointer types:
> +
> +Symbols/Function Pointers:
> +
> +	%pF	versatile_init+0x0/0x110
> +	%pf	versatile_init
> +	%pS	versatile_init+0x0/0x110
> +	%ps	versatile_init
> +	%pB	prev_fn_of_versatile_init+0x88/0x88
> +
> +	For printing symbols and function pointers. The 'S' and 's' specifiers
> +	result in the symbol name with ('S') or without ('s') offsets. Where
> +	this is used on a kernel without KALLSYMS - the symbol address is
> +	printed instead.
> +
> +	The 'B' specifier results in the symbol name with offsets and should be
> +	used when printing stack backtraces. The specifier takes into
> +	consideration the effect of compiler optimisations which may occur
> +	when tail-call's are used and marked with the noreturn GCC attribute.
> +
> +	On ia64, ppc64 and parisc64 architectures function pointers are
> +	actually function descriptors which must first be resolved. The 'F' and
> +	'f' specifiers perform this resolution and then provide the same
> +	functionality as the 'S' and 's' specifiers.
> +
> +Kernel Pointers:
> +
> +	%pK	0x01234567 or 0x0123456789abcdef
> +
> +	For printing kernel pointers which should be hidden from unprivileged
> +	users. The behaviour of %pK depends on the kptr_restrict sysctl - see
> +	Documentation/sysctl/kernel.txt for more details.
> +
> +Struct Resources:
> +
> +	%pr	[mem 0x60000000-0x6fffffff flags 0x2200] or
> +		[mem 0x0000000060000000-0x000000006fffffff flags 0x2200]
> +	%pR	[mem 0x60000000-0x6fffffff pref] or
> +		[mem 0x0000000060000000-0x000000006fffffff pref]
> +
> +	For printing struct resources. The 'R' and 'r' specifiers result in a
> +	printed resource with ('R') or without ('r') a decoded flags member.
> +
> +MAC/FDDI addresses:
> +
> +	%pM	00:01:02:03:04:05
> +	%pMF	00-01-02-03-04-05
> +	%pm	000102030405
> +
> +	For printing 6-byte MAC/FDDI addresses in hex notation. The 'M' and 'm'
> +	specifiers result in a printed address with ('M') or without ('m') byte
> +	separators. The default byte separator is the colon (':').
> +
> +	Where FDDI addresses are concerned the 'F' specifier can be used after
> +	the 'M' specifier to use dash ('-') separators instead of the default
> +	separator.
> +
> +IPv4 addresses:
> +
> +	%pI4	1.2.3.4
> +	%pi4	001.002.003.004
> +	%p[Ii][hnbl]
> +	
> +	For printing IPv4 dot-separated decimal addresses. The 'I4' and 'i4'
> +	specifiers result in a printed address with ('i4') or without ('I4')
> +	leading zeros.
> +
> +	The additional 'h', 'n', 'b', and 'l' specifiers are used to specify
> +	host, network, big or little endian order addresses respectively. Where
> +	no specifier is provided the default network/big endian order is used.
> +
> +IPv6 addresses:
> +
> +	%pI6	0001:0002:0003:0004:0005:0006:0007:0008
> +	%pi6	00010002000300040005000600070008
> +	%pI6c	1:2:3:4:5:6:7:8
> +
> +	For printing IPv6 network-order 16 bit hex addresses. The 'I6' and 'i6'

You lost the hyphen in 16-bit.  The previous patch version had it... :(

> +	specifiers result in a printed address with ('I6') or without ('i6')
> +	colon-separators. Leading zeros are always used.
> +
> +	The additional 'c' specifier can be used with the 'I' specifier to
> +	print a compressed IPv6 address as described by
> +	http://tools.ietf.org/html/rfc5952
> +
> +UUID/GUID addresses:
> +
> +	%pUb	00010203-0405-0607-0809-0a0b0c0d0e0f
> +	%pUB	00010203-0405-0607-0809-0A0B0C0D0E0F
> +	%pUl	03020100-0504-0706-0809-0a0b0c0e0e0f
> +	%pUL	03020100-0504-0706-0809-0A0B0C0E0E0F
> +
> +	For printing 16 byte UUID/GUIDs addresses. The additional 'l', 'L',

same for 16-byte

> +	'b' and 'B' specifiers are used to specify a little endian order in
> +	lower ('l') or upper case ('L') hex characters - and big endian order
> +	in lower ('b') or upper case ('B') hex characters.
> +
> +	Where no additional specifiers are used the default little endian
> +	order with lower case hex characters will be printed.
> +
> +struct va_format:
> +
> +	%pV	
> +
> +	For printing struct va_format structures. These contain a format string
> +	and va_list as follows:
> +
> +	struct va_format {
> +		const char *fmt;
> +		va_list *va;
> +	};
> +
> +	Do not use this feature without some mechanism to verify the
> +	correctness of the format string and va_list arguments.
>  
>  u64 SHOULD be printed with %llu/%llx, (unsigned long long):
>  
> @@ -32,4 +146,5 @@ Reminder: sizeof() result is of type size_t.
>  Thank you for your cooperation and attention.
>  
>  
> -By Randy Dunlap <rdunlap@xenotime.net>
> +By Randy Dunlap <rdunlap@xenotime.net> and
> +Andrew Murray <amurray@mpc-data.co.uk>
> -- 
> 1.7.4.1
> 


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

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

* Re: [PATCH] printk-formats.txt documentation update
  2011-06-09 19:45                             ` Randy Dunlap
@ 2011-06-09 21:24                               ` Andrew Murray
  2011-06-09 21:51                                 ` Randy Dunlap
  2011-06-10 17:50                                 ` Randy Dunlap
  0 siblings, 2 replies; 31+ messages in thread
From: Andrew Murray @ 2011-06-09 21:24 UTC (permalink / raw)
  To: joe
  Cc: w.sang, geert, linux-embedded, linux-kernel, trivial, rdunlap,
	udknight, namhyung, Andrew Murray

From: Andrew Murray <amurray@mpc-data.co.uk>

This patch updates the incomplete documentation concerning the printk
extended format specifiers

Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
---
 Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 117 insertions(+), 2 deletions(-)

diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
index 1b5a5dd..6455e5b 100644
--- a/Documentation/printk-formats.txt
+++ b/Documentation/printk-formats.txt
@@ -9,7 +9,121 @@ If variable is of Type,		use printk format specifier:
 		size_t			%zu or %zx
 		ssize_t			%zd or %zx
 
-Raw pointer value SHOULD be printed with %p.
+Raw pointer value SHOULD be printed with %p. The kernel supports
+the following extended format specifiers for pointer types:
+
+Symbols/Function Pointers:
+
+	%pF	versatile_init+0x0/0x110
+	%pf	versatile_init
+	%pS	versatile_init+0x0/0x110
+	%ps	versatile_init
+	%pB	prev_fn_of_versatile_init+0x88/0x88
+
+	For printing symbols and function pointers. The 'S' and 's' specifiers
+	result in the symbol name with ('S') or without ('s') offsets. Where
+	this is used on a kernel without KALLSYMS - the symbol address is
+	printed instead.
+
+	The 'B' specifier results in the symbol name with offsets and should be
+	used when printing stack backtraces. The specifier takes into
+	consideration the effect of compiler optimisations which may occur
+	when tail-call's are used and marked with the noreturn GCC attribute.
+
+	On ia64, ppc64 and parisc64 architectures function pointers are
+	actually function descriptors which must first be resolved. The 'F' and
+	'f' specifiers perform this resolution and then provide the same
+	functionality as the 'S' and 's' specifiers.
+
+Kernel Pointers:
+
+	%pK	0x01234567 or 0x0123456789abcdef
+
+	For printing kernel pointers which should be hidden from unprivileged
+	users. The behaviour of %pK depends on the kptr_restrict sysctl - see
+	Documentation/sysctl/kernel.txt for more details.
+
+Struct Resources:
+
+	%pr	[mem 0x60000000-0x6fffffff flags 0x2200] or
+		[mem 0x0000000060000000-0x000000006fffffff flags 0x2200]
+	%pR	[mem 0x60000000-0x6fffffff pref] or
+		[mem 0x0000000060000000-0x000000006fffffff pref]
+
+	For printing struct resources. The 'R' and 'r' specifiers result in a
+	printed resource with ('R') or without ('r') a decoded flags member.
+
+MAC/FDDI addresses:
+
+	%pM	00:01:02:03:04:05
+	%pMF	00-01-02-03-04-05
+	%pm	000102030405
+
+	For printing 6-byte MAC/FDDI addresses in hex notation. The 'M' and 'm'
+	specifiers result in a printed address with ('M') or without ('m') byte
+	separators. The default byte separator is the colon (':').
+
+	Where FDDI addresses are concerned the 'F' specifier can be used after
+	the 'M' specifier to use dash ('-') separators instead of the default
+	separator.
+
+IPv4 addresses:
+
+	%pI4	1.2.3.4
+	%pi4	001.002.003.004
+	%p[Ii][hnbl]
+	
+	For printing IPv4 dot-separated decimal addresses. The 'I4' and 'i4'
+	specifiers result in a printed address with ('i4') or without ('I4')
+	leading zeros.
+
+	The additional 'h', 'n', 'b', and 'l' specifiers are used to specify
+	host, network, big or little endian order addresses respectively. Where
+	no specifier is provided the default network/big endian order is used.
+
+IPv6 addresses:
+
+	%pI6	0001:0002:0003:0004:0005:0006:0007:0008
+	%pi6	00010002000300040005000600070008
+	%pI6c	1:2:3:4:5:6:7:8
+
+	For printing IPv6 network-order 16-bit hex addresses. The 'I6' and 'i6'
+	specifiers result in a printed address with ('I6') or without ('i6')
+	colon-separators. Leading zeros are always used.
+
+	The additional 'c' specifier can be used with the 'I' specifier to
+	print a compressed IPv6 address as described by
+	http://tools.ietf.org/html/rfc5952
+
+UUID/GUID addresses:
+
+	%pUb	00010203-0405-0607-0809-0a0b0c0d0e0f
+	%pUB	00010203-0405-0607-0809-0A0B0C0D0E0F
+	%pUl	03020100-0504-0706-0809-0a0b0c0e0e0f
+	%pUL	03020100-0504-0706-0809-0A0B0C0E0E0F
+
+	For printing-16 byte UUID/GUIDs addresses. The additional 'l', 'L',
+	'b' and 'B' specifiers are used to specify a little endian order in
+	lower ('l') or upper case ('L') hex characters - and big endian order
+	in lower ('b') or upper case ('B') hex characters.
+
+	Where no additional specifiers are used the default little endian
+	order with lower case hex characters will be printed.
+
+struct va_format:
+
+	%pV	
+
+	For printing struct va_format structures. These contain a format string
+	and va_list as follows:
+
+	struct va_format {
+		const char *fmt;
+		va_list *va;
+	};
+
+	Do not use this feature without some mechanism to verify the
+	correctness of the format string and va_list arguments.
 
 u64 SHOULD be printed with %llu/%llx, (unsigned long long):
 
@@ -32,4 +146,5 @@ Reminder: sizeof() result is of type size_t.
 Thank you for your cooperation and attention.
 
 
-By Randy Dunlap <rdunlap@xenotime.net>
+By Randy Dunlap <rdunlap@xenotime.net> and
+Andrew Murray <amurray@mpc-data.co.uk>
-- 
1.7.4.1


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

* Re: [PATCH] printk-formats.txt documentation update
  2011-06-09 21:24                               ` Andrew Murray
@ 2011-06-09 21:51                                 ` Randy Dunlap
  2011-06-09 22:00                                   ` Joe Perches
  2011-06-10 17:50                                 ` Randy Dunlap
  1 sibling, 1 reply; 31+ messages in thread
From: Randy Dunlap @ 2011-06-09 21:51 UTC (permalink / raw)
  To: Andrew Murray
  Cc: joe, w.sang, geert, linux-embedded, linux-kernel, trivial,
	udknight, namhyung, Andrew Murray

On Thu,  9 Jun 2011 22:24:48 +0100 Andrew Murray wrote:

> From: Andrew Murray <amurray@mpc-data.co.uk>
> 
> This patch updates the incomplete documentation concerning the printk
> extended format specifiers
> 
> Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
> ---
>  Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
>  1 files changed, 117 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
> index 1b5a5dd..6455e5b 100644
> --- a/Documentation/printk-formats.txt
> +++ b/Documentation/printk-formats.txt
> @@ -9,7 +9,121 @@ If variable is of Type,		use printk format specifier:

> +UUID/GUID addresses:
> +
> +	%pUb	00010203-0405-0607-0809-0a0b0c0d0e0f
> +	%pUB	00010203-0405-0607-0809-0A0B0C0D0E0F
> +	%pUl	03020100-0504-0706-0809-0a0b0c0e0e0f
> +	%pUL	03020100-0504-0706-0809-0A0B0C0E0E0F
> +
> +	For printing-16 byte UUID/GUIDs addresses. The additional 'l', 'L',

	For printing 16-byte

You want to resend or shall I just fix it?

> +	'b' and 'B' specifiers are used to specify a little endian order in
> +	lower ('l') or upper case ('L') hex characters - and big endian order
> +	in lower ('b') or upper case ('B') hex characters.
> +
> +	Where no additional specifiers are used the default little endian
> +	order with lower case hex characters will be printed.


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

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

* Re: [PATCH] printk-formats.txt documentation update
  2011-06-09 21:51                                 ` Randy Dunlap
@ 2011-06-09 22:00                                   ` Joe Perches
  2011-06-09 22:21                                     ` Andrew Murray
  2011-06-09 22:37                                     ` Randy Dunlap
  0 siblings, 2 replies; 31+ messages in thread
From: Joe Perches @ 2011-06-09 22:00 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Andrew Murray, w.sang, geert, linux-embedded, linux-kernel,
	trivial, udknight, namhyung, Andrew Murray

On Thu, 2011-06-09 at 14:51 -0700, Randy Dunlap wrote:
> On Thu,  9 Jun 2011 22:24:48 +0100 Andrew Murray wrote:
> > +	For printing-16 byte UUID/GUIDs addresses. The additional 'l', 'L',
> 	For printing 16-byte
> You want to resend or shall I just fix it?

Hey Randy.

I find your seeming insistence on using a dash
between the numeric count and the word byte to
be a bit odd.

Stylistically, why do you want it there?

cheers, Joe


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

* Re: [PATCH] printk-formats.txt documentation update
  2011-06-09 22:00                                   ` Joe Perches
@ 2011-06-09 22:21                                     ` Andrew Murray
  2011-06-09 22:37                                     ` Randy Dunlap
  1 sibling, 0 replies; 31+ messages in thread
From: Andrew Murray @ 2011-06-09 22:21 UTC (permalink / raw)
  To: Joe Perches
  Cc: Randy Dunlap, w.sang, geert, linux-embedded, linux-kernel,
	trivial, udknight, namhyung

On 9 June 2011 23:00, Joe Perches <joe@perches.com> wrote:
> On Thu, 2011-06-09 at 14:51 -0700, Randy Dunlap wrote:
>> On Thu,  9 Jun 2011 22:24:48 +0100 Andrew Murray wrote:
>> > +   For printing-16 byte UUID/GUIDs addresses. The additional 'l', 'L',
>>       For printing 16-byte
>> You want to resend or shall I just fix it?

Yes Randy please fix it - may be quicker for us both!


>
> Hey Randy.
>
> I find your seeming insistence on using a dash
> between the numeric count and the word byte to
> be a bit odd.
>
> Stylistically, why do you want it there?
>
> cheers, Joe
>
>

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

* Re: [PATCH] printk-formats.txt documentation update
  2011-06-09 22:00                                   ` Joe Perches
  2011-06-09 22:21                                     ` Andrew Murray
@ 2011-06-09 22:37                                     ` Randy Dunlap
  2011-06-09 22:53                                       ` Joe Perches
  1 sibling, 1 reply; 31+ messages in thread
From: Randy Dunlap @ 2011-06-09 22:37 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andrew Murray, w.sang, geert, linux-embedded, linux-kernel,
	trivial, udknight, namhyung, Andrew Murray

On Thu, 09 Jun 2011 15:00:29 -0700 Joe Perches wrote:

> On Thu, 2011-06-09 at 14:51 -0700, Randy Dunlap wrote:
> > On Thu,  9 Jun 2011 22:24:48 +0100 Andrew Murray wrote:
> > > +	For printing-16 byte UUID/GUIDs addresses. The additional 'l', 'L',
> > 	For printing 16-byte
> > You want to resend or shall I just fix it?
> 
> Hey Randy.
> 
> I find your seeming insistence on using a dash
> between the numeric count and the word byte to
> be a bit odd.
> 
> Stylistically, why do you want it there?

Mostly to make it clear.  It's too easy to be ambiguous.


> cheers, Joe

Without hyphen:

	For printing 16 byte UUID/GUIDs addresses.

Those adjectives are confusing.  I don't know what that phrase means.
It could easily mean 16 UUID/GUIDs, but it's ambiguous.

But

	For printing 16-byte UUID/GUIDs addresses.

That means (clearly to me) that UUID/GUIDs are 16-byte entities.

Or see www.incredibleenglish.com/pdf/Hyphens.pdf, section 1,
"Hyphenate unit modifiers."

Or see http://www.ehow.com/how_4473498_use-hyphen-sentence.html, section 1,
"Link compound modifiers with hyphens."

Or see http://www.getitwriteonline.com/archive/040201HyphAdj.htm


HTH.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

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

* Re: [PATCH] printk-formats.txt documentation update
  2011-06-09 22:37                                     ` Randy Dunlap
@ 2011-06-09 22:53                                       ` Joe Perches
  2011-06-09 22:57                                         ` Randy Dunlap
  0 siblings, 1 reply; 31+ messages in thread
From: Joe Perches @ 2011-06-09 22:53 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Andrew Murray, w.sang, geert, linux-embedded, linux-kernel,
	trivial, udknight, namhyung, Andrew Murray

On Thu, 2011-06-09 at 15:37 -0700, Randy Dunlap wrote:
> On Thu, 09 Jun 2011 15:00:29 -0700 Joe Perches wrote:
> see www.incredibleenglish.com/pdf/Hyphens.pdf, section 1,
> "Hyphenate unit modifiers."
> 
> Or see http://www.ehow.com/how_4473498_use-hyphen-sentence.html, section 1,
> "Link compound modifiers with hyphens."
> 
> Or see http://www.getitwriteonline.com/archive/040201HyphAdj.htm

Whatever floats your boat but my 5th grade English teacher
Sr. Mary likely would have been appalled by those articles.

cheers, Joe


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

* Re: [PATCH] printk-formats.txt documentation update
  2011-06-09 22:53                                       ` Joe Perches
@ 2011-06-09 22:57                                         ` Randy Dunlap
  0 siblings, 0 replies; 31+ messages in thread
From: Randy Dunlap @ 2011-06-09 22:57 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andrew Murray, w.sang, geert, linux-embedded, linux-kernel,
	trivial, udknight, namhyung, Andrew Murray

On Thu, 09 Jun 2011 15:53:38 -0700 Joe Perches wrote:

> On Thu, 2011-06-09 at 15:37 -0700, Randy Dunlap wrote:
> > On Thu, 09 Jun 2011 15:00:29 -0700 Joe Perches wrote:
> > see www.incredibleenglish.com/pdf/Hyphens.pdf, section 1,
> > "Hyphenate unit modifiers."
> > 
> > Or see http://www.ehow.com/how_4473498_use-hyphen-sentence.html, section 1,
> > "Link compound modifiers with hyphens."
> > 
> > Or see http://www.getitwriteonline.com/archive/040201HyphAdj.htm
> 
> Whatever floats your boat but my 5th grade English teacher
> Sr. Mary likely would have been appalled by those articles.
> 
> cheers, Joe

Thanks.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

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

* Re: [PATCH] printk-formats.txt documentation update
  2011-06-09 21:24                               ` Andrew Murray
  2011-06-09 21:51                                 ` Randy Dunlap
@ 2011-06-10 17:50                                 ` Randy Dunlap
  2011-06-10 17:56                                   ` Andrew Murray
  1 sibling, 1 reply; 31+ messages in thread
From: Randy Dunlap @ 2011-06-10 17:50 UTC (permalink / raw)
  To: Andrew Murray
  Cc: joe, w.sang, geert, linux-embedded, linux-kernel, trivial,
	udknight, namhyung, Andrew Murray

On Thu,  9 Jun 2011 22:24:48 +0100 Andrew Murray wrote:

> From: Andrew Murray <amurray@mpc-data.co.uk>
> 
> This patch updates the incomplete documentation concerning the printk
> extended format specifiers
> 
> Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>

Applied with minor tweaks (including dropping trailing whitespace).

Thanks.

> ---
>  Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
>  1 files changed, 117 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
> index 1b5a5dd..6455e5b 100644
> --- a/Documentation/printk-formats.txt
> +++ b/Documentation/printk-formats.txt
> @@ -9,7 +9,121 @@ If variable is of Type,		use printk format specifier:
>  		size_t			%zu or %zx
>  		ssize_t			%zd or %zx
>  
> -Raw pointer value SHOULD be printed with %p.
> +Raw pointer value SHOULD be printed with %p. The kernel supports
> +the following extended format specifiers for pointer types:
> +
> +Symbols/Function Pointers:
> +
> +	%pF	versatile_init+0x0/0x110
> +	%pf	versatile_init
> +	%pS	versatile_init+0x0/0x110
> +	%ps	versatile_init
> +	%pB	prev_fn_of_versatile_init+0x88/0x88
> +
> +	For printing symbols and function pointers. The 'S' and 's' specifiers
> +	result in the symbol name with ('S') or without ('s') offsets. Where
> +	this is used on a kernel without KALLSYMS - the symbol address is
> +	printed instead.
> +
> +	The 'B' specifier results in the symbol name with offsets and should be
> +	used when printing stack backtraces. The specifier takes into
> +	consideration the effect of compiler optimisations which may occur
> +	when tail-call's are used and marked with the noreturn GCC attribute.
> +
> +	On ia64, ppc64 and parisc64 architectures function pointers are
> +	actually function descriptors which must first be resolved. The 'F' and
> +	'f' specifiers perform this resolution and then provide the same
> +	functionality as the 'S' and 's' specifiers.
> +
> +Kernel Pointers:
> +
> +	%pK	0x01234567 or 0x0123456789abcdef
> +
> +	For printing kernel pointers which should be hidden from unprivileged
> +	users. The behaviour of %pK depends on the kptr_restrict sysctl - see
> +	Documentation/sysctl/kernel.txt for more details.
> +
> +Struct Resources:
> +
> +	%pr	[mem 0x60000000-0x6fffffff flags 0x2200] or
> +		[mem 0x0000000060000000-0x000000006fffffff flags 0x2200]
> +	%pR	[mem 0x60000000-0x6fffffff pref] or
> +		[mem 0x0000000060000000-0x000000006fffffff pref]
> +
> +	For printing struct resources. The 'R' and 'r' specifiers result in a
> +	printed resource with ('R') or without ('r') a decoded flags member.
> +
> +MAC/FDDI addresses:
> +
> +	%pM	00:01:02:03:04:05
> +	%pMF	00-01-02-03-04-05
> +	%pm	000102030405
> +
> +	For printing 6-byte MAC/FDDI addresses in hex notation. The 'M' and 'm'
> +	specifiers result in a printed address with ('M') or without ('m') byte
> +	separators. The default byte separator is the colon (':').
> +
> +	Where FDDI addresses are concerned the 'F' specifier can be used after
> +	the 'M' specifier to use dash ('-') separators instead of the default
> +	separator.
> +
> +IPv4 addresses:
> +
> +	%pI4	1.2.3.4
> +	%pi4	001.002.003.004
> +	%p[Ii][hnbl]
> +	
> +	For printing IPv4 dot-separated decimal addresses. The 'I4' and 'i4'
> +	specifiers result in a printed address with ('i4') or without ('I4')
> +	leading zeros.
> +
> +	The additional 'h', 'n', 'b', and 'l' specifiers are used to specify
> +	host, network, big or little endian order addresses respectively. Where
> +	no specifier is provided the default network/big endian order is used.
> +
> +IPv6 addresses:
> +
> +	%pI6	0001:0002:0003:0004:0005:0006:0007:0008
> +	%pi6	00010002000300040005000600070008
> +	%pI6c	1:2:3:4:5:6:7:8
> +
> +	For printing IPv6 network-order 16-bit hex addresses. The 'I6' and 'i6'
> +	specifiers result in a printed address with ('I6') or without ('i6')
> +	colon-separators. Leading zeros are always used.
> +
> +	The additional 'c' specifier can be used with the 'I' specifier to
> +	print a compressed IPv6 address as described by
> +	http://tools.ietf.org/html/rfc5952
> +
> +UUID/GUID addresses:
> +
> +	%pUb	00010203-0405-0607-0809-0a0b0c0d0e0f
> +	%pUB	00010203-0405-0607-0809-0A0B0C0D0E0F
> +	%pUl	03020100-0504-0706-0809-0a0b0c0e0e0f
> +	%pUL	03020100-0504-0706-0809-0A0B0C0E0E0F
> +
> +	For printing-16 byte UUID/GUIDs addresses. The additional 'l', 'L',
> +	'b' and 'B' specifiers are used to specify a little endian order in
> +	lower ('l') or upper case ('L') hex characters - and big endian order
> +	in lower ('b') or upper case ('B') hex characters.
> +
> +	Where no additional specifiers are used the default little endian
> +	order with lower case hex characters will be printed.
> +
> +struct va_format:
> +
> +	%pV	
> +
> +	For printing struct va_format structures. These contain a format string
> +	and va_list as follows:
> +
> +	struct va_format {
> +		const char *fmt;
> +		va_list *va;
> +	};
> +
> +	Do not use this feature without some mechanism to verify the
> +	correctness of the format string and va_list arguments.
>  
>  u64 SHOULD be printed with %llu/%llx, (unsigned long long):
>  
> @@ -32,4 +146,5 @@ Reminder: sizeof() result is of type size_t.
>  Thank you for your cooperation and attention.
>  
>  
> -By Randy Dunlap <rdunlap@xenotime.net>
> +By Randy Dunlap <rdunlap@xenotime.net> and
> +Andrew Murray <amurray@mpc-data.co.uk>
> -- 
> 1.7.4.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

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

* Re: [PATCH] printk-formats.txt documentation update
  2011-06-10 17:50                                 ` Randy Dunlap
@ 2011-06-10 17:56                                   ` Andrew Murray
  0 siblings, 0 replies; 31+ messages in thread
From: Andrew Murray @ 2011-06-10 17:56 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: joe, w.sang, geert, linux-embedded, linux-kernel, trivial,
	udknight, namhyung

Great! Thanks for the help.

On 10 June 2011 18:50, Randy Dunlap <rdunlap@xenotime.net> wrote:
> On Thu,  9 Jun 2011 22:24:48 +0100 Andrew Murray wrote:
>
>> From: Andrew Murray <amurray@mpc-data.co.uk>
>>
>> This patch updates the incomplete documentation concerning the printk
>> extended format specifiers
>>
>> Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk>
>
> Applied with minor tweaks (including dropping trailing whitespace).
>
> Thanks.
>
>> ---
>>  Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
>>  1 files changed, 117 insertions(+), 2 deletions(-)
>>
>> diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
>> index 1b5a5dd..6455e5b 100644
>> --- a/Documentation/printk-formats.txt
>> +++ b/Documentation/printk-formats.txt
>> @@ -9,7 +9,121 @@ If variable is of Type,             use printk format specifier:
>>               size_t                  %zu or %zx
>>               ssize_t                 %zd or %zx
>>
>> -Raw pointer value SHOULD be printed with %p.
>> +Raw pointer value SHOULD be printed with %p. The kernel supports
>> +the following extended format specifiers for pointer types:
>> +
>> +Symbols/Function Pointers:
>> +
>> +     %pF     versatile_init+0x0/0x110
>> +     %pf     versatile_init
>> +     %pS     versatile_init+0x0/0x110
>> +     %ps     versatile_init
>> +     %pB     prev_fn_of_versatile_init+0x88/0x88
>> +
>> +     For printing symbols and function pointers. The 'S' and 's' specifiers
>> +     result in the symbol name with ('S') or without ('s') offsets. Where
>> +     this is used on a kernel without KALLSYMS - the symbol address is
>> +     printed instead.
>> +
>> +     The 'B' specifier results in the symbol name with offsets and should be
>> +     used when printing stack backtraces. The specifier takes into
>> +     consideration the effect of compiler optimisations which may occur
>> +     when tail-call's are used and marked with the noreturn GCC attribute.
>> +
>> +     On ia64, ppc64 and parisc64 architectures function pointers are
>> +     actually function descriptors which must first be resolved. The 'F' and
>> +     'f' specifiers perform this resolution and then provide the same
>> +     functionality as the 'S' and 's' specifiers.
>> +
>> +Kernel Pointers:
>> +
>> +     %pK     0x01234567 or 0x0123456789abcdef
>> +
>> +     For printing kernel pointers which should be hidden from unprivileged
>> +     users. The behaviour of %pK depends on the kptr_restrict sysctl - see
>> +     Documentation/sysctl/kernel.txt for more details.
>> +
>> +Struct Resources:
>> +
>> +     %pr     [mem 0x60000000-0x6fffffff flags 0x2200] or
>> +             [mem 0x0000000060000000-0x000000006fffffff flags 0x2200]
>> +     %pR     [mem 0x60000000-0x6fffffff pref] or
>> +             [mem 0x0000000060000000-0x000000006fffffff pref]
>> +
>> +     For printing struct resources. The 'R' and 'r' specifiers result in a
>> +     printed resource with ('R') or without ('r') a decoded flags member.
>> +
>> +MAC/FDDI addresses:
>> +
>> +     %pM     00:01:02:03:04:05
>> +     %pMF    00-01-02-03-04-05
>> +     %pm     000102030405
>> +
>> +     For printing 6-byte MAC/FDDI addresses in hex notation. The 'M' and 'm'
>> +     specifiers result in a printed address with ('M') or without ('m') byte
>> +     separators. The default byte separator is the colon (':').
>> +
>> +     Where FDDI addresses are concerned the 'F' specifier can be used after
>> +     the 'M' specifier to use dash ('-') separators instead of the default
>> +     separator.
>> +
>> +IPv4 addresses:
>> +
>> +     %pI4    1.2.3.4
>> +     %pi4    001.002.003.004
>> +     %p[Ii][hnbl]
>> +
>> +     For printing IPv4 dot-separated decimal addresses. The 'I4' and 'i4'
>> +     specifiers result in a printed address with ('i4') or without ('I4')
>> +     leading zeros.
>> +
>> +     The additional 'h', 'n', 'b', and 'l' specifiers are used to specify
>> +     host, network, big or little endian order addresses respectively. Where
>> +     no specifier is provided the default network/big endian order is used.
>> +
>> +IPv6 addresses:
>> +
>> +     %pI6    0001:0002:0003:0004:0005:0006:0007:0008
>> +     %pi6    00010002000300040005000600070008
>> +     %pI6c   1:2:3:4:5:6:7:8
>> +
>> +     For printing IPv6 network-order 16-bit hex addresses. The 'I6' and 'i6'
>> +     specifiers result in a printed address with ('I6') or without ('i6')
>> +     colon-separators. Leading zeros are always used.
>> +
>> +     The additional 'c' specifier can be used with the 'I' specifier to
>> +     print a compressed IPv6 address as described by
>> +     http://tools.ietf.org/html/rfc5952
>> +
>> +UUID/GUID addresses:
>> +
>> +     %pUb    00010203-0405-0607-0809-0a0b0c0d0e0f
>> +     %pUB    00010203-0405-0607-0809-0A0B0C0D0E0F
>> +     %pUl    03020100-0504-0706-0809-0a0b0c0e0e0f
>> +     %pUL    03020100-0504-0706-0809-0A0B0C0E0E0F
>> +
>> +     For printing-16 byte UUID/GUIDs addresses. The additional 'l', 'L',
>> +     'b' and 'B' specifiers are used to specify a little endian order in
>> +     lower ('l') or upper case ('L') hex characters - and big endian order
>> +     in lower ('b') or upper case ('B') hex characters.
>> +
>> +     Where no additional specifiers are used the default little endian
>> +     order with lower case hex characters will be printed.
>> +
>> +struct va_format:
>> +
>> +     %pV
>> +
>> +     For printing struct va_format structures. These contain a format string
>> +     and va_list as follows:
>> +
>> +     struct va_format {
>> +             const char *fmt;
>> +             va_list *va;
>> +     };
>> +
>> +     Do not use this feature without some mechanism to verify the
>> +     correctness of the format string and va_list arguments.
>>
>>  u64 SHOULD be printed with %llu/%llx, (unsigned long long):
>>
>> @@ -32,4 +146,5 @@ Reminder: sizeof() result is of type size_t.
>>  Thank you for your cooperation and attention.
>>
>>
>> -By Randy Dunlap <rdunlap@xenotime.net>
>> +By Randy Dunlap <rdunlap@xenotime.net> and
>> +Andrew Murray <amurray@mpc-data.co.uk>
>> --
>> 1.7.4.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
> ---
> ~Randy
> *** Remember to use Documentation/SubmitChecklist when testing your code ***
>

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

end of thread, other threads:[~2011-06-10 17:56 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-06  0:15 [PATCH] printk-formats.txt documentation update Andrew Murray
2011-02-06  0:27 ` Tim Bird
2011-02-06  0:37 ` Joe Perches
2011-02-06 10:07   ` Andrew Murray
2011-02-06 10:16 ` Geert Uytterhoeven
2011-02-06 16:14   ` Andrew Murray
2011-02-06 16:23     ` Andrew Murray
2011-02-07  9:29       ` Wolfram Sang
2011-02-07 18:12         ` Andrew Murray
2011-02-07 19:33           ` Joe Perches
2011-02-11  8:15             ` Andrew Murray
2011-06-09 17:33               ` [PATCH] Revised patch Andrew Murray
2011-06-09 17:40                 ` Joe Perches
2011-06-09 17:47                   ` Namhyung Kim
2011-06-09 17:48                     ` Andrew Murray
2011-06-09 18:04                       ` [PATCH] printk-formats.txt documentation update Andrew Murray
2011-06-09 18:20                         ` Namhyung Kim
2011-06-09 18:55                           ` Andrew Murray
2011-06-09 19:45                             ` Randy Dunlap
2011-06-09 21:24                               ` Andrew Murray
2011-06-09 21:51                                 ` Randy Dunlap
2011-06-09 22:00                                   ` Joe Perches
2011-06-09 22:21                                     ` Andrew Murray
2011-06-09 22:37                                     ` Randy Dunlap
2011-06-09 22:53                                       ` Joe Perches
2011-06-09 22:57                                         ` Randy Dunlap
2011-06-10 17:50                                 ` Randy Dunlap
2011-06-10 17:56                                   ` Andrew Murray
2011-06-09 18:23                         ` [PATCH] vsprintf: Update %pI6c to not compress a single 0 Joe Perches
2011-06-09 17:47                 ` [PATCH] Revised patch Randy Dunlap
2011-06-09 17:53                   ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).