public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: steved@redhat.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 1/2] libexport.a: Reduce code duplication in client_init()
Date: Mon, 12 Apr 2010 15:57:16 -0400	[thread overview]
Message-ID: <20100412195715.9839.87962.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100412195538.9839.76495.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

Clean up:  Most cases in client_init() set clp->m_naddr to zero.  Move
it to the common part of the function, and simplify the logic.  This
will make adding IPv6 support here more straightforward.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 support/export/client.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/support/export/client.c b/support/export/client.c
index aa28fcf..e06c874 100644
--- a/support/export/client.c
+++ b/support/export/client.c
@@ -137,6 +137,7 @@ client_init(nfs_client *clp, const char *hname, struct hostent *hp)
 
 	clp->m_exported = 0;
 	clp->m_count = 0;
+	clp->m_naddr = 0;
 
 	if (clp->m_type == MCL_SUBNETWORK) {
 		char	*cp = strchr(clp->m_hostname, '/');
@@ -160,10 +161,10 @@ client_init(nfs_client *clp, const char *hname, struct hostent *hp)
 			}
 		}
 		*cp = '/';
-		clp->m_naddr = 0;
-	} else if (!hp) {
-		clp->m_naddr = 0;
-	} else {
+		return;
+	}
+
+	if (hp) {
 		char	**ap = hp->h_addr_list;
 		int	i;
 


  parent reply	other threads:[~2010-04-12 19:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-12 19:57 [PATCH 0/2] Two small mountd IPv6 patches Chuck Lever
     [not found] ` <20100412195538.9839.76495.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-04-12 19:57   ` Chuck Lever [this message]
2010-04-12 19:57   ` [PATCH 2/2] libexport.a: Add helper for populating m_addrlist[] Chuck Lever
2010-04-15 13:00   ` [PATCH 0/2] Two small mountd IPv6 patches Steve Dickson

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=20100412195715.9839.87962.stgit@localhost.localdomain \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /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