Skip to contentSkip to conversation

printk-formats.txt documentation update

PATCH In review Andrew Murray 7 participants 31 messages Feb 6, 2011 – Jun 10, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 printk-formats.txt documentation update

From: Andrew Murray <[email protected]>

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

---

Documentation/printk-formats.txt +36 -1
index 1b5a5dd..df14336 100644
@@ -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):
#1 lore raw
Quoted 44 lines · Andrew Murray

From: Andrew Murray <[email protected]>

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

---

Documentation/printk-formats.txt +28 -1
index 1b5a5dd..df14336 100644
@@ -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

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 49

Quoted 10 lines
Documentation/printk-formats.txt +8 -0
+	%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
=============================

#2 lore raw
In reply to Andrew Murray

Documentation/printk-formats.txt

Quoted 6 lines · Andrew Murray

From: Andrew Murray <[email protected]>
This patch updates the incomplete documentation concerning the printk extended format specifiers.

---

Documentation/printk-formats.txt +0 -0

[]

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 13

Quoted 7 lines
Documentation/printk-formats.txt +2 -1
@@ -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.

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 18

Quoted 5 lines
Documentation/printk-formats.txt +5 -0
+
+	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?

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 26

Quoted 8 lines
Documentation/printk-formats.txt +8 -0
+	%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

Quoted 10 lines
Documentation/printk-formats.txt +10 -0
+	%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
+

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 46

Quoted 10 lines
Documentation/printk-formats.txt +10 -0
+	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

#3 lore raw

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

Thanks,

Andrew Murray

Quoted 68 lines · Joe Perches

Documentation/printk-formats.txt

Quoted 6 lines · Andrew Murray

From: Andrew Murray <[email protected]>
This patch updates the incomplete documentation concerning the printk extended format specifiers.

---

Documentation/printk-formats.txt +0 -0

[]

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 13

Quoted 7 lines
Documentation/printk-formats.txt +0 -0
@@ -9,7 +9,42 @@ If variable is of Type,              use printk format specifier:

              size_t                  %zu or %zx
              ssize_t                 %zd or %zx

Documentation/printk-formats.txt +2 -1
-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.

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 18

Quoted 5 lines
Documentation/printk-formats.txt +5 -0
+
+     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?

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 26

Quoted 8 lines

+     %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]

Documentation/printk-formats.txt +4 -0
+
+     MAC/FDDI addresses:
+
+     %pM     colon-seperated 6-byte MAC address in hex notation, e.g. 00:01:02:03:04:05

spelling: separated

Quoted 10 lines

+     %pm     non-colon-seperated 6-byte MAC address is hex notation, e.g. 000102030405
+     %pMF    6-byte dash-separated FDDI hex notation

Documentation/printk-formats.txt +8 -0
+
+     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
+

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 46

Quoted 10 lines
Documentation/printk-formats.txt +10 -0
+     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

Signature · 24 lines
Andrew Murray, Embedded Linux Group
MPC Data Limited
e-mail: [email protected]  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.
#4 lore raw
In reply to Andrew Murray
Quoted 42 lines · Andrew Murray

From: Andrew Murray <[email protected]>

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

---

Documentation/printk-formats.txt +0 -0
index 1b5a5dd..df14336 100644
@@ -9,7 +9,42 @@ If variable is of Type,                use printk format specifier:

               size_t                  %zu or %zx
               ssize_t                 %zd or %zx

Documentation/printk-formats.txt +26 -1
-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:

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 47

Quoted 10 lines
Documentation/printk-formats.txt +10 -0
+       %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 -- [email protected]

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

#5 lore raw
Quoted 1 line · Geert Uytterhoeven

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 <[email protected]>

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

---

Documentation/printk-formats.txt +108 -3
index 1b5a5dd..cad0dda 100644
@@ -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 <[email protected]>
+By Randy Dunlap <[email protected]> and
+Andrew Murray <[email protected]>
#6 lore raw
Quoted 5 lines · Andrew Murray
Quoted 1 line · Geert Uytterhoeven

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 <[email protected]>

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

---

Documentation/printk-formats.txt +108 -3
index 1b5a5dd..cad0dda 100644
@@ -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 <[email protected]>
+By Randy Dunlap <[email protected]> and
+Andrew Murray <[email protected]>
#7 lore raw
Quoted 5 lines · Andrew Murray

On 6 February 2011 16:14, Andrew Murray <[email protected]> wrote:
From: Andrew Murray <[email protected]>

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

Good one, thanks!

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 37

Quoted 6 lines
Documentation/printk-formats.txt +6 -0
+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

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#8 lore raw
Quoted 6 lines · Wolfram Sang
Quoted 3 lines · Andrew Murray

+
+     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 <[email protected]>

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

---

Documentation/printk-formats.txt +108 -3
index 1b5a5dd..cad0dda 100644
@@ -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 <[email protected]>
+By Randy Dunlap <[email protected]> and
+Andrew Murray <[email protected]>
#9 lore raw
Quoted 8 lines · Andrew Murray
Quoted 6 lines · Wolfram Sang

Documentation/printk-formats.txt If variable is of Type, use printk format specifier:

Quoted 3 lines · Andrew Murray
Documentation/printk-formats.txt +3 -0
+
+     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:

Documentation/printk-formats.txt

Quoted 1 line
Documentation/printk-formats.txt +0 -0

[]

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 34

Quoted 3 lines
Documentation/printk-formats.txt +3 -0
+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.

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 46

Quoted 11 lines
Documentation/printk-formats.txt +11 -0
+	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

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 88

Quoted 13 lines
Documentation/printk-formats.txt +13 -0
+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

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 92

Quoted 4 lines
Documentation/printk-formats.txt +4 -0
+
+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

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 93

Quoted 1 line
Documentation/printk-formats.txt +1 -0
+	%pU[bBlL]
	%pUb	00010203-0405-0607-08090a0b0c0d0e0f
	%pUB	00010203-0405-0607-08090A0B0C0D0E0F
	%pUl	03020100-0504-0706-08090a0b0c0d0e0f
	%pUL	03020100-0504-0706-08090A0B0E0D0E0F
Quoted 8 lines
Documentation/printk-formats.txt +8 -0
+	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.
+

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 112

Quoted 10 lines
Documentation/printk-formats.txt +10 -0
+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

#10 lore raw
Quoted 6 lines · Joe Perches
Quoted 3 lines · Andrew Murray
Quoted 2 lines · Wolfram Sang
Quoted 1 line · Andrew Murray

+

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

Andrew Murray

#11 lore raw

PATCH 1/1 Revised patch

Hi,

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

From: Andrew Murray <[email protected]>

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

---
 Documentation/printk-formats.txt |  113 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 111 insertions(+), 2 deletions(-)
Documentation/printk-formats.txt +111 -2
index 1b5a5dd..2968cbf 100644
@@ -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 <[email protected]>
+By Randy Dunlap <[email protected]> and
+Andrew Murray <[email protected]>
Signature · 1 line
1.7.4.1
#12 lore raw

Re: [PATCH] Revised patch

Quoted 2 lines · Andrew Murray

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

#13 lore raw

Re: [PATCH] Revised patch

2011-06-09 (목), 10:40 -0700, Joe Perches:

Quoted 8 lines · Andrew Murray
Quoted 2 lines

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.

Signature · 2 lines
Regards,
Namhyung Kim
#14 lore raw

Re: [PATCH] Revised patch

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

Quoted 22 lines · Namhyung Kim

2011-06-09 (목), 10:40 -0700, Joe Perches:

Quoted 8 lines · Andrew Murray
Quoted 2 lines

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

Signature · 24 lines
Andrew Murray, Embedded Linux Group
MPC Data Limited
e-mail: [email protected]  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.
#15 lore raw

PATCH 1/1 printk-formats.txt documentation update

From: Andrew Murray <[email protected]>

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

---
 Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 117 insertions(+), 2 deletions(-)
Documentation/printk-formats.txt +117 -2
index 1b5a5dd..69713d6 100644
@@ -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 <[email protected]>
+By Randy Dunlap <[email protected]> and
+Andrew Murray <[email protected]>
Signature · 1 line
1.7.4.1
#16 lore raw

2011-06-09 (목), 19:04 +0100, Andrew Murray:

Quoted 20 lines

From: Andrew Murray <[email protected]>

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

---
 Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 117 insertions(+), 2 deletions(-)
Documentation/printk-formats.txt +1 -1
index 1b5a5dd..69713d6 100644
@@ -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

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 22

Quoted 10 lines
Documentation/printk-formats.txt +10 -0
+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.

Signature · 2 lines
Regards,
Namhyung Kim
#17 lore raw

From: Andrew Murray <[email protected]>

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

---
 Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 117 insertions(+), 2 deletions(-)
Documentation/printk-formats.txt +117 -2
index 1b5a5dd..85a06aa 100644
@@ -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 <[email protected]>
+By Randy Dunlap <[email protected]> and
+Andrew Murray <[email protected]>
Signature · 1 line
1.7.4.1
#18 lore raw
Quoted 88 lines · On Thu, 9 Jun 2011 19:55:35 +0100 Andrew Murray wrote:

From: Andrew Murray <[email protected]>

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

---
 Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 117 insertions(+), 2 deletions(-)
Documentation/printk-formats.txt +69 -1
index 1b5a5dd..85a06aa 100644
@@ -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

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 90

Quoted 10 lines
Documentation/printk-formats.txt +10 -0
+	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... :(

Quoted 5 lines
Documentation/printk-formats.txt +5 -0
+	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

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 105

Quoted 10 lines
Documentation/printk-formats.txt +10 -0
+	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

Quoted 34 lines
Documentation/printk-formats.txt +23 -1
+	'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 <[email protected]>
+By Randy Dunlap <[email protected]> and
+Andrew Murray <[email protected]>
Signature · 1 line
1.7.4.1

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

#19 lore raw

From: Andrew Murray <[email protected]>

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

---
 Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 117 insertions(+), 2 deletions(-)
Documentation/printk-formats.txt +117 -2
index 1b5a5dd..6455e5b 100644
@@ -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 <[email protected]>
+By Randy Dunlap <[email protected]> and
+Andrew Murray <[email protected]>
Signature · 1 line
1.7.4.1
#20 lore raw
Quoted 15 lines · On Thu, 9 Jun 2011 22:24:48 +0100 Andrew Murray wrote:

From: Andrew Murray <[email protected]>

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

---
 Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 117 insertions(+), 2 deletions(-)
Documentation/printk-formats.txt +0 -0
index 1b5a5dd..6455e5b 100644

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 17

Quoted 9 lines
Documentation/printk-formats.txt +8 -0
@@ -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?

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 111

Quoted 6 lines
Documentation/printk-formats.txt +6 -0
+	'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 ***

#21 lore raw
Quoted 4 lines · Randy Dunlap

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 105

Quoted 1 line · On Thu, 9 Jun 2011 22:24:48 +0100 Andrew Murray wrote:
Documentation/printk-formats.txt +1 -0
+	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

#22 lore raw
Quoted 5 lines · Joe Perches
Quoted 4 lines · Randy Dunlap
Quoted 1 line · 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!

Quoted 12 lines

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

#23 lore raw
In reply to Joe Perches
Quoted 6 lines · On Thu, 09 Jun 2011 15:00:29 -0700 Joe Perches wrote:
Quoted 4 lines · Randy Dunlap

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 105

Quoted 1 line · On Thu, 9 Jun 2011 22:24:48 +0100 Andrew Murray wrote:
Documentation/printk-formats.txt +1 -0
+	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?

Quoted 7 lines

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.

Quoted 1 line

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 ***

#24 lore raw
Quoted 8 lines · Randy Dunlap

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

#25 lore raw
Quoted 8 lines · On Thu, 09 Jun 2011 15:53:38 -0700 Joe Perches wrote:
Quoted 7 lines · Randy Dunlap

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."

Quoted 6 lines
Quoted 1 line

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 ***

#26 lore raw
In reply to Andrew Murray
Quoted 6 lines · On Thu, 9 Jun 2011 22:24:48 +0100 Andrew Murray wrote:

From: Andrew Murray <[email protected]>

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

Applied with minor tweaks (including dropping trailing whitespace).

Thanks.

Quoted 145 lines
---
 Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 117 insertions(+), 2 deletions(-)
Documentation/printk-formats.txt +117 -2
index 1b5a5dd..6455e5b 100644
@@ -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 <[email protected]>
+By Randy Dunlap <[email protected]> and
+Andrew Murray <[email protected]>
Signature · 6 lines
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

#27 lore raw

Great! Thanks for the help.

Quoted 164 lines · Randy Dunlap
Quoted 6 lines · On Thu,  9 Jun 2011 22:24:48 +0100 Andrew Murray wrote:

From: Andrew Murray <[email protected]>

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

Applied with minor tweaks (including dropping trailing whitespace).

Thanks.

Quoted 141 lines

---
 Documentation/printk-formats.txt |  119 +++++++++++++++++++++++++++++++++++++-

 1 files changed, 117 insertions(+), 2 deletions(-)
Documentation/printk-formats.txt +0 -0
index 1b5a5dd..6455e5b 100644
@@ -9,7 +9,121 @@ If variable is of Type,             use printk format specifier:

              size_t                  %zu or %zx
              ssize_t                 %zd or %zx

Documentation/printk-formats.txt +115 -1
-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):

Documentation/printk-formats.txt +0 -0
@@ -32,4 +146,5 @@ Reminder: sizeof() result is of type size_t.

 Thank you for your cooperation and attention.

Documentation/printk-formats.txt +2 -2
-By Randy Dunlap <[email protected]>
+By Randy Dunlap <[email protected]> and
+Andrew Murray <[email protected]>
--

1.7.4.1

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

#28 lore raw

PATCH 1/1 vsprintf: Update %pI6c to not compress a single 0

In reply to 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.

---
 lib/vsprintf.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
lib/vsprintf.c +3 -1
index c112056..4365df3 100644
@@ -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:
Signature · 1 line
1.7.6.rc0
#29 lore raw

Re: [PATCH] Revised patch

In reply to Andrew Murray
Quoted 8 lines · 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 <[email protected]>

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

Thanks. A few comments below...

Quoted 71 lines
---
 Documentation/printk-formats.txt |  113 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 111 insertions(+), 2 deletions(-)
Documentation/printk-formats.txt +56 -1
index 1b5a5dd..2968cbf 100644
@@ -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

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 77

Quoted 10 lines
Documentation/printk-formats.txt +10 -0
+	%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.

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 84

Quoted 7 lines
Documentation/printk-formats.txt +7 -0
+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
Quoted 5 lines
Documentation/printk-formats.txt +5 -0
+	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

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 99

Quoted 10 lines
Documentation/printk-formats.txt +10 -0
+	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
Quoted 13 lines
Documentation/printk-formats.txt +13 -0
+	'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:

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 122

Quoted 10 lines
Documentation/printk-formats.txt +8 -0
+
+	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

Documentation/printk-formats.txt Reminder: sizeof() result is of type size_t. · line 144

Quoted 8 lines
Documentation/printk-formats.txt +2 -1
@@ -32,4 +140,5 @@ Reminder: sizeof() result is of type size_t.
 Thank you for your cooperation and attention.
 
 
-By Randy Dunlap <[email protected]>
+By Randy Dunlap <[email protected]> and
+Andrew Murray <[email protected]>

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

#30 lore raw

Re: [PATCH] Revised patch

Quoted 3 lines · Randy Dunlap

Documentation/printk-formats.txt If variable is of Type, use printk format specifier: · line 84

Quoted 1 line · On Thu, 9 Jun 2011 18:33:46 +0100 Andrew Murray wrote:
Documentation/printk-formats.txt +1 -0
+	For printing IPv6 network-order 16 bit hex addresses. The 'I6' and 'i6'
	                                16-bit

byte. octet if pedantry is desired.