aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2009-03-18 20:46:21 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-03-28 15:54:36 -0400
commit9652ada3fb5914a67d8422114e8a76388330fa79 (patch)
treeb37d77bf972dda04b46794c4e50ec6f6d044dc79
parentbaf01caf09e87579c2d157e5ee29975db8551522 (diff)
SUNRPC: Change svc_create_xprt() to take a @family argument
The sv_family field is going away. Pass a protocol family argument to svc_create_xprt() instead of extracting the family from the passed-in svc_serv struct. Again, as this is a listener socket and not an address, we make this new argument an "int" protocol family, instead of an "sa_family_t." Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/lockd/svc.c3
-rw-r--r--fs/nfs/callback.c4
-rw-r--r--fs/nfsd/nfsctl.c2
-rw-r--r--fs/nfsd/nfssvc.c4
-rw-r--r--include/linux/sunrpc/svc_xprt.h3
-rw-r--r--net/sunrpc/svc_xprt.c15
6 files changed, 18 insertions, 13 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 64f1c31b5853..390c5593655c 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -211,7 +211,8 @@ static int create_lockd_listener(struct svc_serv *serv, char *name,
211 211
212 xprt = svc_find_xprt(serv, name, 0, 0); 212 xprt = svc_find_xprt(serv, name, 0, 0);
213 if (xprt == NULL) 213 if (xprt == NULL)
214 return svc_create_xprt(serv, name, port, SVC_SOCK_DEFAULTS); 214 return svc_create_xprt(serv, name, nlmsvc_family,
215 port, SVC_SOCK_DEFAULTS);
215 216
216 svc_xprt_put(xprt); 217 svc_xprt_put(xprt);
217 return 0; 218 return 0;
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 3e634f2a1083..fb35cab63c8a 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -122,8 +122,8 @@ int nfs_callback_up(void)
122 if (!serv) 122 if (!serv)
123 goto out_err; 123 goto out_err;
124 124
125 ret = svc_create_xprt(serv, "tcp", nfs_callback_set_tcpport, 125 ret = svc_create_xprt(serv, "tcp", nfs_callback_family,
126 SVC_SOCK_ANONYMOUS); 126 nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS);
127 if (ret <= 0) 127 if (ret <= 0)
128 goto out_err; 128 goto out_err;
129 nfs_callback_tcpport = ret; 129 nfs_callback_tcpport = ret;
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 5a936c14f6ff..a4ed8644d69c 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -943,7 +943,7 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size)
943 err = nfsd_create_serv(); 943 err = nfsd_create_serv();
944 if (!err) { 944 if (!err) {
945 err = svc_create_xprt(nfsd_serv, 945 err = svc_create_xprt(nfsd_serv,
946 transport, port, 946 transport, PF_INET, port,
947 SVC_SOCK_ANONYMOUS); 947 SVC_SOCK_ANONYMOUS);
948 if (err == -ENOENT) 948 if (err == -ENOENT)
949 /* Give a reasonable perror msg for 949 /* Give a reasonable perror msg for
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 07e4f5d7baa8..ab7f249055b5 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -244,7 +244,7 @@ static int nfsd_init_socks(int port)
244 if (!list_empty(&nfsd_serv->sv_permsocks)) 244 if (!list_empty(&nfsd_serv->sv_permsocks))
245 return 0; 245 return 0;
246 246
247 error = svc_create_xprt(nfsd_serv, "udp", port, 247 error = svc_create_xprt(nfsd_serv, "udp", PF_INET, port,
248 SVC_SOCK_DEFAULTS); 248 SVC_SOCK_DEFAULTS);
249 if (error < 0) 249 if (error < 0)
250 return error; 250 return error;
@@ -253,7 +253,7 @@ static int nfsd_init_socks(int port)
253 if (error < 0) 253 if (error < 0)
254 return error; 254 return error;
255 255
256 error = svc_create_xprt(nfsd_serv, "tcp", port, 256 error = svc_create_xprt(nfsd_serv, "tcp", PF_INET, port,
257 SVC_SOCK_DEFAULTS); 257 SVC_SOCK_DEFAULTS);
258 if (error < 0) 258 if (error < 0)
259 return error; 259 return error;
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 55b68582c5d9..0d9cb6ef28b0 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -71,7 +71,8 @@ int svc_reg_xprt_class(struct svc_xprt_class *);
71void svc_unreg_xprt_class(struct svc_xprt_class *); 71void svc_unreg_xprt_class(struct svc_xprt_class *);
72void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *, 72void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *,
73 struct svc_serv *); 73 struct svc_serv *);
74int svc_create_xprt(struct svc_serv *, char *, unsigned short, int); 74int svc_create_xprt(struct svc_serv *, const char *, const int,
75 const unsigned short, int);
75void svc_xprt_enqueue(struct svc_xprt *xprt); 76void svc_xprt_enqueue(struct svc_xprt *xprt);
76void svc_xprt_received(struct svc_xprt *); 77void svc_xprt_received(struct svc_xprt *);
77void svc_xprt_put(struct svc_xprt *xprt); 78void svc_xprt_put(struct svc_xprt *xprt);
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index c947c93dbc24..2819ee093f36 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -161,7 +161,9 @@ EXPORT_SYMBOL_GPL(svc_xprt_init);
161 161
162static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl, 162static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl,
163 struct svc_serv *serv, 163 struct svc_serv *serv,
164 unsigned short port, int flags) 164 const int family,
165 const unsigned short port,
166 int flags)
165{ 167{
166 struct sockaddr_in sin = { 168 struct sockaddr_in sin = {
167 .sin_family = AF_INET, 169 .sin_family = AF_INET,
@@ -176,12 +178,12 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl,
176 struct sockaddr *sap; 178 struct sockaddr *sap;
177 size_t len; 179 size_t len;
178 180
179 switch (serv->sv_family) { 181 switch (family) {
180 case AF_INET: 182 case PF_INET:
181 sap = (struct sockaddr *)&sin; 183 sap = (struct sockaddr *)&sin;
182 len = sizeof(sin); 184 len = sizeof(sin);
183 break; 185 break;
184 case AF_INET6: 186 case PF_INET6:
185 sap = (struct sockaddr *)&sin6; 187 sap = (struct sockaddr *)&sin6;
186 len = sizeof(sin6); 188 len = sizeof(sin6);
187 break; 189 break;
@@ -192,7 +194,8 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl,
192 return xcl->xcl_ops->xpo_create(serv, sap, len, flags); 194 return xcl->xcl_ops->xpo_create(serv, sap, len, flags);
193} 195}
194 196
195int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port, 197int svc_create_xprt(struct svc_serv *serv, const char *xprt_name,
198 const int family, const unsigned short port,
196 int flags) 199 int flags)
197{ 200{
198 struct svc_xprt_class *xcl; 201 struct svc_xprt_class *xcl;
@@ -209,7 +212,7 @@ int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port,
209 goto err; 212 goto err;
210 213
211 spin_unlock(&svc_xprt_class_lock); 214 spin_unlock(&svc_xprt_class_lock);
212 newxprt = __svc_xpo_create(xcl, serv, port, flags); 215 newxprt = __svc_xpo_create(xcl, serv, family, port, flags);
213 if (IS_ERR(newxprt)) { 216 if (IS_ERR(newxprt)) {
214 module_put(xcl->xcl_owner); 217 module_put(xcl->xcl_owner);
215 return PTR_ERR(newxprt); 218 return PTR_ERR(newxprt);