Commit 9652ada3 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

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: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent baf01caf
...@@ -211,7 +211,8 @@ static int create_lockd_listener(struct svc_serv *serv, char *name, ...@@ -211,7 +211,8 @@ static int create_lockd_listener(struct svc_serv *serv, char *name,
xprt = svc_find_xprt(serv, name, 0, 0); xprt = svc_find_xprt(serv, name, 0, 0);
if (xprt == NULL) if (xprt == NULL)
return svc_create_xprt(serv, name, port, SVC_SOCK_DEFAULTS); return svc_create_xprt(serv, name, nlmsvc_family,
port, SVC_SOCK_DEFAULTS);
svc_xprt_put(xprt); svc_xprt_put(xprt);
return 0; return 0;
......
...@@ -122,8 +122,8 @@ int nfs_callback_up(void) ...@@ -122,8 +122,8 @@ int nfs_callback_up(void)
if (!serv) if (!serv)
goto out_err; goto out_err;
ret = svc_create_xprt(serv, "tcp", nfs_callback_set_tcpport, ret = svc_create_xprt(serv, "tcp", nfs_callback_family,
SVC_SOCK_ANONYMOUS); nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS);
if (ret <= 0) if (ret <= 0)
goto out_err; goto out_err;
nfs_callback_tcpport = ret; nfs_callback_tcpport = ret;
......
...@@ -943,7 +943,7 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size) ...@@ -943,7 +943,7 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size)
err = nfsd_create_serv(); err = nfsd_create_serv();
if (!err) { if (!err) {
err = svc_create_xprt(nfsd_serv, err = svc_create_xprt(nfsd_serv,
transport, port, transport, PF_INET, port,
SVC_SOCK_ANONYMOUS); SVC_SOCK_ANONYMOUS);
if (err == -ENOENT) if (err == -ENOENT)
/* Give a reasonable perror msg for /* Give a reasonable perror msg for
......
...@@ -244,7 +244,7 @@ static int nfsd_init_socks(int port) ...@@ -244,7 +244,7 @@ static int nfsd_init_socks(int port)
if (!list_empty(&nfsd_serv->sv_permsocks)) if (!list_empty(&nfsd_serv->sv_permsocks))
return 0; return 0;
error = svc_create_xprt(nfsd_serv, "udp", port, error = svc_create_xprt(nfsd_serv, "udp", PF_INET, port,
SVC_SOCK_DEFAULTS); SVC_SOCK_DEFAULTS);
if (error < 0) if (error < 0)
return error; return error;
...@@ -253,7 +253,7 @@ static int nfsd_init_socks(int port) ...@@ -253,7 +253,7 @@ static int nfsd_init_socks(int port)
if (error < 0) if (error < 0)
return error; return error;
error = svc_create_xprt(nfsd_serv, "tcp", port, error = svc_create_xprt(nfsd_serv, "tcp", PF_INET, port,
SVC_SOCK_DEFAULTS); SVC_SOCK_DEFAULTS);
if (error < 0) if (error < 0)
return error; return error;
......
...@@ -71,7 +71,8 @@ int svc_reg_xprt_class(struct svc_xprt_class *); ...@@ -71,7 +71,8 @@ int svc_reg_xprt_class(struct svc_xprt_class *);
void svc_unreg_xprt_class(struct svc_xprt_class *); void svc_unreg_xprt_class(struct svc_xprt_class *);
void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *, void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *,
struct svc_serv *); struct svc_serv *);
int svc_create_xprt(struct svc_serv *, char *, unsigned short, int); int svc_create_xprt(struct svc_serv *, const char *, const int,
const unsigned short, int);
void svc_xprt_enqueue(struct svc_xprt *xprt); void svc_xprt_enqueue(struct svc_xprt *xprt);
void svc_xprt_received(struct svc_xprt *); void svc_xprt_received(struct svc_xprt *);
void svc_xprt_put(struct svc_xprt *xprt); void svc_xprt_put(struct svc_xprt *xprt);
......
...@@ -161,7 +161,9 @@ EXPORT_SYMBOL_GPL(svc_xprt_init); ...@@ -161,7 +161,9 @@ EXPORT_SYMBOL_GPL(svc_xprt_init);
static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl, static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl,
struct svc_serv *serv, struct svc_serv *serv,
unsigned short port, int flags) const int family,
const unsigned short port,
int flags)
{ {
struct sockaddr_in sin = { struct sockaddr_in sin = {
.sin_family = AF_INET, .sin_family = AF_INET,
...@@ -176,12 +178,12 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl, ...@@ -176,12 +178,12 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl,
struct sockaddr *sap; struct sockaddr *sap;
size_t len; size_t len;
switch (serv->sv_family) { switch (family) {
case AF_INET: case PF_INET:
sap = (struct sockaddr *)&sin; sap = (struct sockaddr *)&sin;
len = sizeof(sin); len = sizeof(sin);
break; break;
case AF_INET6: case PF_INET6:
sap = (struct sockaddr *)&sin6; sap = (struct sockaddr *)&sin6;
len = sizeof(sin6); len = sizeof(sin6);
break; break;
...@@ -192,7 +194,8 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl, ...@@ -192,7 +194,8 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl,
return xcl->xcl_ops->xpo_create(serv, sap, len, flags); return xcl->xcl_ops->xpo_create(serv, sap, len, flags);
} }
int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port, int svc_create_xprt(struct svc_serv *serv, const char *xprt_name,
const int family, const unsigned short port,
int flags) int flags)
{ {
struct svc_xprt_class *xcl; struct svc_xprt_class *xcl;
...@@ -209,7 +212,7 @@ int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port, ...@@ -209,7 +212,7 @@ int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port,
goto err; goto err;
spin_unlock(&svc_xprt_class_lock); spin_unlock(&svc_xprt_class_lock);
newxprt = __svc_xpo_create(xcl, serv, port, flags); newxprt = __svc_xpo_create(xcl, serv, family, port, flags);
if (IS_ERR(newxprt)) { if (IS_ERR(newxprt)) {
module_put(xcl->xcl_owner); module_put(xcl->xcl_owner);
return PTR_ERR(newxprt); return PTR_ERR(newxprt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment