Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fbfe3cc677c1a62ca6472abf24d03d4bf9f03a55
Commit:     fbfe3cc677c1a62ca6472abf24d03d4bf9f03a55
Parent:     0c43b3d81cca46ab2469f8802f8bd68b49f1b2a5
Author:     Chuck Lever <[EMAIL PROTECTED]>
AuthorDate: Mon Aug 6 11:57:02 2007 -0400
Committer:  Trond Myklebust <[EMAIL PROTECTED]>
CommitDate: Tue Oct 9 17:15:52 2007 -0400

    SUNRPC: Add hex-formatted address support to rpc_peeraddr2str()
    
    Add support for the NFS client's need to export volume information
    with IP addresses formatted in hex instead of decimal.
    
    This isn't used yet, but subsequent patches (not in this series) will
    change the NFS client to use this functionality.
    
    Signed-off-by: Chuck Lever <[EMAIL PROTECTED]>
    Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>
---
 include/linux/sunrpc/xprt.h |    2 ++
 net/sunrpc/xprtsock.c       |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index d11cedd..4596c26 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -53,6 +53,8 @@ enum rpc_display_format_t {
        RPC_DISPLAY_PORT,
        RPC_DISPLAY_PROTO,
        RPC_DISPLAY_ALL,
+       RPC_DISPLAY_HEX_ADDR,
+       RPC_DISPLAY_HEX_PORT,
        RPC_DISPLAY_MAX,
 };
 
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index b3f40b8..8a684d8 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -296,6 +296,20 @@ static void xs_format_peer_addresses(struct rpc_xprt *xprt)
                        xprt->prot == IPPROTO_UDP ? "udp" : "tcp");
        }
        xprt->address_strings[RPC_DISPLAY_ALL] = buf;
+
+       buf = kzalloc(10, GFP_KERNEL);
+       if (buf) {
+               snprintf(buf, 10, "%02x%02x%02x%02x",
+                               NIPQUAD(addr->sin_addr.s_addr));
+       }
+       xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = buf;
+
+       buf = kzalloc(8, GFP_KERNEL);
+       if (buf) {
+               snprintf(buf, 8, "%4hx",
+                               ntohs(addr->sin_port));
+       }
+       xprt->address_strings[RPC_DISPLAY_HEX_PORT] = buf;
 }
 
 static void xs_free_peer_addresses(struct rpc_xprt *xprt)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to