提交 0a5372d8 编写于 作者: C Chuck Lever 提交者: J. Bruce Fields

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: NChuck Lever <chuck.lever@oracle.com>
Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
上级 c71206a7
......@@ -910,6 +910,17 @@ static ssize_t write_versions(struct file *file, char *buf, size_t size)
return rv;
}
/*
* 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
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册