NFSD: Finish refactoring __write_ports()

Previous thread: SUNRPC: pass buffer size to svc_sock_names() by Linux Kernel Mailing List on Monday, June 22, 2009 - 2:05 pm. (1 message)

Next thread: nfs41: use nfs4_getaclres by Linux Kernel Mailing List on Monday, June 22, 2009 - 2:02 pm. (1 message)
From: Linux Kernel Mailing List
Date: Monday, June 22, 2009 - 2:05 pm

Gitweb:     http://git.kernel.org/linus/0a5372d8a13c3f670bf7c9c4a68ab04c3664fa28
Commit:     0a5372d8a13c3f670bf7c9c4a68ab04c3664fa28
Parent:     c71206a7b4e829601e44c49d8a0f4df0fdfe9302
Author:     Chuck Lever <chuck.lever@oracle.com>
AuthorDate: Thu Apr 23 19:32:10 2009 -0400
Committer:  J. Bruce Fields <bfields@citi.umich.edu>
CommitDate: Tue Apr 28 13:54:27 2009 -0400

    NFSD: Finish refactoring __write_ports()
    
    Clean up: Refactor transport name listing out of __write_ports() to
    make it easier to understand and maintain.
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
---
 fs/nfsd/nfsctl.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index d491fa9..caf4fdc 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -911,6 +911,17 @@ static ssize_t write_versions(struct file *file, char *buf, size_t size)
 }
 
 /*
+ * Zero-length write.  Return a list of NFSD's current listener
+ * transports.
+ */
+static ssize_t __write_ports_names(char *buf)
+{
+	if (nfsd_serv == NULL)
+		return 0;
+	return svc_xprt_names(nfsd_serv, buf, 0);
+}
+
+/*
  * A single 'fd' number was written, in which case it must be for
  * a socket of a supported family/protocol, and we use it as an
  * nfsd listener.
@@ -1019,13 +1030,8 @@ static ssize_t __write_ports_delxprt(char *buf)
 
 static ssize_t __write_ports(struct file *file, char *buf, size_t size)
 {
-	if (size == 0) {
-		int len = 0;
-
-		if (nfsd_serv)
-			len = svc_xprt_names(nfsd_serv, buf, 0);
-		return len;
-	}
+	if (size == 0)
+		return __write_ports_names(buf);
 
 	if (isdigit(buf[0]))
 		return __write_ports_addfd(buf);
--

Previous thread: SUNRPC: pass buffer size to svc_sock_names() by Linux Kernel Mailing List on Monday, June 22, 2009 - 2:05 pm. (1 message)

Next thread: nfs41: use nfs4_getaclres by Linux Kernel Mailing List on Monday, June 22, 2009 - 2:02 pm. (1 message)