SUNRPC: pass buffer size to svc_addsock()
authorChuck Lever <chuck.lever@oracle.com>
Thu, 23 Apr 2009 23:32:33 +0000 (19:32 -0400)
committerJ. Bruce Fields <bfields@citi.umich.edu>
Tue, 28 Apr 2009 17:54:28 +0000 (13:54 -0400)
Adjust the synopsis of svc_addsock() 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>
fs/nfsd/nfsctl.c
include/linux/sunrpc/svcsock.h
net/sunrpc/svcsock.c

index 6a1cd90..1f1c215 100644 (file)
@@ -943,7 +943,7 @@ static ssize_t __write_ports_addfd(char *buf)
        if (err != 0)
                goto out;
 
-       err = svc_addsock(nfsd_serv, fd, buf);
+       err = svc_addsock(nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT);
        if (err < 0)
                lockd_down();
 
index 483e103..e23241c 100644 (file)
@@ -39,7 +39,8 @@ int           svc_send(struct svc_rqst *);
 void           svc_drop(struct svc_rqst *);
 void           svc_sock_update_bufs(struct svc_serv *serv);
 int            svc_sock_names(char *buf, struct svc_serv *serv, char *toclose);
-int            svc_addsock(struct svc_serv *serv, int fd, char *name_return);
+int            svc_addsock(struct svc_serv *serv, const int fd,
+                                       char *name_return, const size_t len);
 void           svc_init_xprt_sock(void);
 void           svc_cleanup_xprt_sock(void);
 
index 8b08328..6bec1e2 100644 (file)
@@ -1128,9 +1128,19 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
        return svsk;
 }
 
-int svc_addsock(struct svc_serv *serv,
-               int fd,
-               char *name_return)
+/**
+ * svc_addsock - add a listener socket to an RPC service
+ * @serv: pointer to RPC service to which to add a new listener
+ * @fd: file descriptor of the new listener
+ * @name_return: pointer to buffer to fill in with name of listener
+ * @len: size of the buffer
+ *
+ * Fills in socket name and returns positive length of name if successful.
+ * Name is terminated with '\n'.  On error, returns a negative errno
+ * value.
+ */
+int svc_addsock(struct svc_serv *serv, const int fd, char *name_return,
+               const size_t len)
 {
        int err = 0;
        struct socket *so = sockfd_lookup(fd, &err);