From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 1/4] SUNRPC: Clean up use of curly braces in switch cases
Date: Tue, 22 Mar 2011 18:09:08 -0400 [thread overview]
Message-ID: <20110322220907.4360.79821.stgit@matisse.1015granger.net> (raw)
In-Reply-To: <20110322220518.4360.51304.stgit@matisse.1015granger.net>
Clean up. Preferred style is not to use curly braces around
switch cases. I'm about to add another case that needs yet
another different type cast.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
net/sunrpc/clnt.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 6111ea2..3725c6d 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -305,22 +305,21 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
* up a string representation of the passed-in address.
*/
if (xprtargs.servername == NULL) {
+ struct sockaddr_in *sin =
+ (struct sockaddr_in *)args->address;
+ struct sockaddr_in6 *sin6 =
+ (struct sockaddr_in6 *)args->address;
+
servername[0] = '\0';
switch (args->address->sa_family) {
- case AF_INET: {
- struct sockaddr_in *sin =
- (struct sockaddr_in *)args->address;
+ case AF_INET:
snprintf(servername, sizeof(servername), "%pI4",
&sin->sin_addr.s_addr);
break;
- }
- case AF_INET6: {
- struct sockaddr_in6 *sin =
- (struct sockaddr_in6 *)args->address;
+ case AF_INET6:
snprintf(servername, sizeof(servername), "%pI6",
- &sin->sin6_addr);
+ &sin6->sin6_addr);
break;
- }
default:
/* caller wants default server name, but
* address family isn't recognized. */
next prev parent reply other threads:[~2011-03-22 22:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-22 22:08 [PATCH 0/4] RFC: RPC over AF_LOCAL, kernel client-side Chuck Lever
2011-03-22 22:09 ` Chuck Lever [this message]
2011-03-22 22:09 ` [PATCH 2/4] SUNRPC: Rename xs_encode_tcp_fragment_header() Chuck Lever
2011-03-22 22:09 ` [PATCH 3/4] SUNRPC: Support for RPC over AF_LOCAL transports Chuck Lever
2011-03-22 22:09 ` [PATCH 4/4] SUNRPC: Use AF_LOCAL for rpcbind upcalls Chuck Lever
2011-03-23 15:26 ` [PATCH 0/4] RFC: RPC over AF_LOCAL, kernel client-side Andy Adamson
2011-03-23 15:56 ` Chuck Lever
2011-03-23 17:02 ` Trond Myklebust
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110322220907.4360.79821.stgit@matisse.1015granger.net \
--to=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).