Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 153651
b: refs/heads/master
c: 4cd5dc7
h: refs/heads/master
i:
  153649: 6d3c646
  153647: 1c83ae9
v: v3
  • Loading branch information
Chuck Lever authored and J. Bruce Fields committed Apr 28, 2009
1 parent 386c0ed commit 48d974a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: abc5c44d6284fab8fb21bcfc52c0f16f980637df
refs/heads/master: 4cd5dc751a5889b5b37aa88752e33a58d8f6b624
53 changes: 29 additions & 24 deletions trunk/fs/nfsd/nfsctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,31 @@ static ssize_t write_versions(struct file *file, char *buf, size_t size)
return rv;
}

/*
* A transport listener is removed by writing a "-", it's transport
* name, and it's port number.
*/
static ssize_t __write_ports_delxprt(char *buf)
{
struct svc_xprt *xprt;
char transport[16];
int port;

if (sscanf(&buf[1], "%15s %4u", transport, &port) != 2)
return -EINVAL;

if (port < 1 || port > USHORT_MAX || nfsd_serv == NULL)
return -EINVAL;

xprt = svc_find_xprt(nfsd_serv, transport, AF_UNSPEC, port);
if (xprt == NULL)
return -ENOTCONN;

svc_close_xprt(xprt);
svc_xprt_put(xprt);
return 0;
}

static ssize_t __write_ports(struct file *file, char *buf, size_t size)
{
if (size == 0) {
Expand Down Expand Up @@ -984,30 +1009,10 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size)
return err < 0 ? err : 0;
}
}
/*
* Remove a transport by writing it's transport name and port number
*/
if (buf[0] == '-' && isalpha(buf[1])) {
struct svc_xprt *xprt;
int err = -EINVAL;
char transport[16];
int port;
if (sscanf(&buf[1], "%15s %4d", transport, &port) == 2) {
if (port < 1 || port > 65535)
return -EINVAL;
if (nfsd_serv) {
xprt = svc_find_xprt(nfsd_serv, transport,
AF_UNSPEC, port);
if (xprt) {
svc_close_xprt(xprt);
svc_xprt_put(xprt);
err = 0;
} else
err = -ENOTCONN;
}
return err < 0 ? err : 0;
}
}

if (buf[0] == '-' && isalpha(buf[1]))
return __write_ports_delxprt(buf);

return -EINVAL;
}

Expand Down

0 comments on commit 48d974a

Please sign in to comment.