aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2009-04-23 19:32:40 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-04-28 13:54:28 -0400
commit8435d34dbbe75678c3cdad3d53b1e7996a79b3bf (patch)
treeefce3e51cb67c1d8ce39cd87bc22fbac8ee32cbe
parentbfba9ab4c64f0e5c33930711e6c073c285e01fcf (diff)
SUNRPC: pass buffer size to svc_sock_names()
Adjust the synopsis of svc_sock_names() to pass in the size of the output buffer. Add a documenting comment. This is a cosmetic change for now. A subsequent patch will make sure the buffer length is passed to one_sock_name(), where the length will actually be useful. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
-rw-r--r--fs/nfsd/nfsctl.c3
-rw-r--r--include/linux/sunrpc/svcsock.h4
-rw-r--r--net/sunrpc/svcsock.c19
3 files changed, 22 insertions, 4 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 1f1c2159b802..b64a7fbfccf5 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -966,7 +966,8 @@ static ssize_t __write_ports_delfd(char *buf)
966 return -ENOMEM; 966 return -ENOMEM;
967 967
968 if (nfsd_serv != NULL) 968 if (nfsd_serv != NULL)
969 len = svc_sock_names(buf, nfsd_serv, toclose); 969 len = svc_sock_names(nfsd_serv, buf,
970 SIMPLE_TRANSACTION_LIMIT, toclose);
970 if (len >= 0) 971 if (len >= 0)
971 lockd_down(); 972 lockd_down();
972 973
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index e23241c53f42..827163138949 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -38,7 +38,9 @@ int svc_recv(struct svc_rqst *, long);
38int svc_send(struct svc_rqst *); 38int svc_send(struct svc_rqst *);
39void svc_drop(struct svc_rqst *); 39void svc_drop(struct svc_rqst *);
40void svc_sock_update_bufs(struct svc_serv *serv); 40void svc_sock_update_bufs(struct svc_serv *serv);
41int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose); 41int svc_sock_names(struct svc_serv *serv, char *buf,
42 const size_t buflen,
43 const char *toclose);
42int svc_addsock(struct svc_serv *serv, const int fd, 44int svc_addsock(struct svc_serv *serv, const int fd,
43 char *name_return, const size_t len); 45 char *name_return, const size_t len);
44void svc_init_xprt_sock(void); 46void svc_init_xprt_sock(void);
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 6bec1e25b542..032b52ea9541 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -259,8 +259,23 @@ static int one_sock_name(char *buf, struct svc_sock *svsk)
259 return len; 259 return len;
260} 260}
261 261
262int 262/**
263svc_sock_names(char *buf, struct svc_serv *serv, char *toclose) 263 * svc_sock_names - construct a list of listener names in a string
264 * @serv: pointer to RPC service
265 * @buf: pointer to a buffer to fill in with socket names
266 * @buflen: size of the buffer to be filled
267 * @toclose: pointer to '\0'-terminated C string containing the name
268 * of a listener to be closed
269 *
270 * Fills in @buf with a '\n'-separated list of names of listener
271 * sockets. If @toclose is not NULL, the socket named by @toclose
272 * is closed, and is not included in the output list.
273 *
274 * Returns positive length of the socket name string, or a negative
275 * errno value on error.
276 */
277int svc_sock_names(struct svc_serv *serv, char *buf, const size_t buflen,
278 const char *toclose)
264{ 279{
265 struct svc_sock *svsk, *closesk = NULL; 280 struct svc_sock *svsk, *closesk = NULL;
266 int len = 0; 281 int len = 0;