Linux: use %pI4 if NIPQUAD is not available
authorMarc Dionne <marc.c.dionne@gmail.com>
Wed, 11 Aug 2010 21:18:32 +0000 (17:18 -0400)
committerDerrick Brashear <shadow@dementia.org>
Thu, 12 Aug 2010 20:43:04 +0000 (13:43 -0700)
The definition of NIPQUAD has been removed from the kernel headers
in the mainline kernel.  Replace it by using the %pI4 format
specifier which takes the IP address as a single argument.

There should be no change in the output.

This fix is required for 2.6.36.

Change-Id: I269e5bd754b7aef49b005081eb6b3af1b2679293
Reviewed-on: http://gerrit.openafs.org/2542
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/afs/LINUX/osi_proc.c

index ca83ca0..b4b5c9e 100644 (file)
@@ -95,8 +95,12 @@ static int c_show(struct seq_file *m, void *p)
                if (!tc->cellHosts[j]) break;
 
                addr = tc->cellHosts[j]->addr->sa_ip;
+#if defined(NIPQUAD)
                seq_printf(m, "%u.%u.%u.%u #%u.%u.%u.%u\n",
                           NIPQUAD(addr), NIPQUAD(addr));
+#else
+               seq_printf(m, "%pI4 #%pI4\n", &addr, &addr);
+#endif
        }
 
        return 0;
@@ -208,7 +212,11 @@ static int uu_show(struct seq_file *m, void *p)
         char ipaddr[16];
        int i;
 
+#if defined(NIPQUAD)
         sprintf(ipaddr, "%u.%u.%u.%u", NIPQUAD(np->host));
+#else
+        sprintf(ipaddr, "%pI4", &np->host);
+#endif
        seq_printf(m, "  %-15s %10d %10d", ipaddr, np->uid, np->client_uid);
        if (np->sysnamecount) {
            for (i = 0; i < np->sysnamecount; i++)