diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2009-04-23 19:32:10 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-04-28 13:54:27 -0400 |
commit | 0a5372d8a13c3f670bf7c9c4a68ab04c3664fa28 (patch) | |
tree | 378c78a984625b9b09ed30ececd906ea838a2e3b /fs | |
parent | c71206a7b4e829601e44c49d8a0f4df0fdfe9302 (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | 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 d491fa9df9bd..caf4fdc674c0 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) | |||
911 | } | 911 | } |
912 | 912 | ||
913 | /* | 913 | /* |
914 | * Zero-length write. Return a list of NFSD's current listener | ||
915 | * transports. | ||
916 | */ | ||
917 | static ssize_t __write_ports_names(char *buf) | ||
918 | { | ||
919 | if (nfsd_serv == NULL) | ||
920 | return 0; | ||
921 | return svc_xprt_names(nfsd_serv, buf, 0); | ||
922 | } | ||
923 | |||
924 | /* | ||
914 | * A single 'fd' number was written, in which case it must be for | 925 | * A single 'fd' number was written, in which case it must be for |
915 | * a socket of a supported family/protocol, and we use it as an | 926 | * a socket of a supported family/protocol, and we use it as an |
916 | * nfsd listener. | 927 | * nfsd listener. |
@@ -1019,13 +1030,8 @@ static ssize_t __write_ports_delxprt(char *buf) | |||
1019 | 1030 | ||
1020 | static ssize_t __write_ports(struct file *file, char *buf, size_t size) | 1031 | static ssize_t __write_ports(struct file *file, char *buf, size_t size) |
1021 | { | 1032 | { |
1022 | if (size == 0) { | 1033 | if (size == 0) |
1023 | int len = 0; | 1034 | return __write_ports_names(buf); |
1024 | |||
1025 | if (nfsd_serv) | ||
1026 | len = svc_xprt_names(nfsd_serv, buf, 0); | ||
1027 | return len; | ||
1028 | } | ||
1029 | 1035 | ||
1030 | if (isdigit(buf[0])) | 1036 | if (isdigit(buf[0])) |
1031 | return __write_ports_addfd(buf); | 1037 | return __write_ports_addfd(buf); |