SUNRPC: service request network namespace helper introduced
This is a cleanup patch - makes code looks simplier. It replaces widely used rqstp->rq_xprt->xpt_net by introduced SVC_NET(rqstp). Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
5e1533c788
commit
9695c7057f
5 changed files with 9 additions and 7 deletions
|
@ -331,7 +331,7 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
|
||||||
struct nsm_handle *nsm = NULL;
|
struct nsm_handle *nsm = NULL;
|
||||||
struct sockaddr *src_sap = svc_daddr(rqstp);
|
struct sockaddr *src_sap = svc_daddr(rqstp);
|
||||||
size_t src_len = rqstp->rq_daddrlen;
|
size_t src_len = rqstp->rq_daddrlen;
|
||||||
struct net *net = rqstp->rq_xprt->xpt_net;
|
struct net *net = SVC_NET(rqstp);
|
||||||
struct nlm_lookup_host_info ni = {
|
struct nlm_lookup_host_info ni = {
|
||||||
.server = 1,
|
.server = 1,
|
||||||
.sap = svc_addr(rqstp),
|
.sap = svc_addr(rqstp),
|
||||||
|
|
|
@ -863,7 +863,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
|
||||||
.drc_status = 0,
|
.drc_status = 0,
|
||||||
.clp = NULL,
|
.clp = NULL,
|
||||||
.slotid = NFS4_NO_SLOT,
|
.slotid = NFS4_NO_SLOT,
|
||||||
.net = rqstp->rq_xprt->xpt_net,
|
.net = SVC_NET(rqstp),
|
||||||
};
|
};
|
||||||
unsigned int nops = 0;
|
unsigned int nops = 0;
|
||||||
|
|
||||||
|
@ -879,7 +879,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
|
||||||
return rpc_garbage_args;
|
return rpc_garbage_args;
|
||||||
|
|
||||||
if (hdr_arg.minorversion == 0) {
|
if (hdr_arg.minorversion == 0) {
|
||||||
cps.clp = nfs4_find_client_ident(rqstp->rq_xprt->xpt_net, hdr_arg.cb_ident);
|
cps.clp = nfs4_find_client_ident(SVC_NET(rqstp), hdr_arg.cb_ident);
|
||||||
if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp))
|
if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp))
|
||||||
return rpc_drop_reply;
|
return rpc_drop_reply;
|
||||||
}
|
}
|
||||||
|
|
|
@ -929,7 +929,7 @@ struct svc_export *
|
||||||
rqst_exp_get_by_name(struct svc_rqst *rqstp, struct path *path)
|
rqst_exp_get_by_name(struct svc_rqst *rqstp, struct path *path)
|
||||||
{
|
{
|
||||||
struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
|
struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
|
||||||
struct nfsd_net *nn = net_generic(rqstp->rq_xprt->xpt_net, nfsd_net_id);
|
struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
|
||||||
struct cache_detail *cd = nn->svc_export_cache;
|
struct cache_detail *cd = nn->svc_export_cache;
|
||||||
|
|
||||||
if (rqstp->rq_client == NULL)
|
if (rqstp->rq_client == NULL)
|
||||||
|
@ -960,7 +960,7 @@ struct svc_export *
|
||||||
rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv)
|
rqst_exp_find(struct svc_rqst *rqstp, int fsid_type, u32 *fsidv)
|
||||||
{
|
{
|
||||||
struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
|
struct svc_export *gssexp, *exp = ERR_PTR(-ENOENT);
|
||||||
struct nfsd_net *nn = net_generic(rqstp->rq_xprt->xpt_net, nfsd_net_id);
|
struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
|
||||||
struct cache_detail *cd = nn->svc_export_cache;
|
struct cache_detail *cd = nn->svc_export_cache;
|
||||||
|
|
||||||
if (rqstp->rq_client == NULL)
|
if (rqstp->rq_client == NULL)
|
||||||
|
|
|
@ -546,7 +546,7 @@ idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen
|
||||||
.type = type,
|
.type = type,
|
||||||
};
|
};
|
||||||
int ret;
|
int ret;
|
||||||
struct nfsd_net *nn = net_generic(rqstp->rq_xprt->xpt_net, nfsd_net_id);
|
struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
|
||||||
|
|
||||||
if (namelen + 1 > sizeof(key.name))
|
if (namelen + 1 > sizeof(key.name))
|
||||||
return nfserr_badowner;
|
return nfserr_badowner;
|
||||||
|
@ -571,7 +571,7 @@ idmap_id_to_name(struct svc_rqst *rqstp, int type, uid_t id, char *name)
|
||||||
.type = type,
|
.type = type,
|
||||||
};
|
};
|
||||||
int ret;
|
int ret;
|
||||||
struct nfsd_net *nn = net_generic(rqstp->rq_xprt->xpt_net, nfsd_net_id);
|
struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
|
||||||
|
|
||||||
strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname));
|
strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname));
|
||||||
ret = idmap_lookup(rqstp, idtoname_lookup, &key, nn->idtoname_cache, &item);
|
ret = idmap_lookup(rqstp, idtoname_lookup, &key, nn->idtoname_cache, &item);
|
||||||
|
|
|
@ -278,6 +278,8 @@ struct svc_rqst {
|
||||||
struct task_struct *rq_task; /* service thread */
|
struct task_struct *rq_task; /* service thread */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define SVC_NET(svc_rqst) (svc_rqst->rq_xprt->xpt_net)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Rigorous type checking on sockaddr type conversions
|
* Rigorous type checking on sockaddr type conversions
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue