Skip to contentSkip to conversation

docbook: fix printk of ip address

PATCH Superseded Randy Dunlap 2 participants 4 messages Jul 30, 2009

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

PATCH 1/1 docbook: fix printk of ip address

Does this need to be changed to __be32?

---
From: Tobias Klauser <[email protected]>

Use the %pI4 format string instead of %d.%d.%d.%d and NIPQUAD.

---
 Documentation/DocBook/kernel-hacking.tmpl |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/DocBook/kernel-hacking.tmpl +1 -1
@@ -450,7 +450,7 @@ printk(KERN_INFO "i = %u\n", i);
 
    <programlisting>
 __u32 ipaddress;
-printk(KERN_INFO "my ip: %d.%d.%d.%d\n", NIPQUAD(ipaddress));
+printk(KERN_INFO "my ip: %pI4\n", &amp;ipaddress);
    </programlisting>
 
    <para>

---
~Randy
LPC 2009, Sept. 23-25, Portland, Oregon
http://linuxplumbersconf.org/2009/

maintainer
#1 lore raw

From: Randy Dunlap <[email protected]>
Date: Thu, 30 Jul 2009 12:25:18 -0700

Quoted 1 line

Does this need to be changed to __be32?

Yes, the value passed in must be in network byte order when using %pI4.

#2 lore raw

PATCH v2 1/1 docbook: fix printk of ip address

From: Tobias Klauser <[email protected]>

Use the %pI4 format string instead of %d.%d.%d.%d and NIPQUAD.

---
 Documentation/DocBook/kernel-hacking.tmpl |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/DocBook/kernel-hacking.tmpl +2 -2
@@ -449,8 +449,8 @@ printk(KERN_INFO "i = %u\n", i);
    </para>
 
    <programlisting>
-__u32 ipaddress;
-printk(KERN_INFO "my ip: %d.%d.%d.%d\n", NIPQUAD(ipaddress));
+__be32 ipaddress;
+printk(KERN_INFO "my ip: %pI4\n", &amp;ipaddress);
    </programlisting>
 
    <para>

---
~Randy
LPC 2009, Sept. 23-25, Portland, Oregon
http://linuxplumbersconf.org/2009/