Commit 62403005 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'nfsd-4.13' of git://linux-nfs.org/~bfields/linux

Pull nfsd updates from Bruce Fields:
 "Chuck's RDMA update overhauls the "call receive" side of the
  RPC-over-RDMA transport to use the new rdma_rw API.

  Christoph cleaned the way nfs operations are declared, removing a
  bunch of function-pointer casts and declaring the operation vectors as
  const.

  Christoph's changes touch both client and server, and both client and
  server pulls this time around should be based on the same commits from
  Christoph"

* tag 'nfsd-4.13' of git://linux-nfs.org/~bfields/linux: (53 commits)
  svcrdma: fix an incorrect check on -E2BIG and -EINVAL
  nfsd4: factor ctime into change attribute
  svcrdma: Remove svc_rdma_chunk_ctxt::cc_dir field
  svcrdma: use offset_in_page() macro
  svcrdma: Clean up after converting svc_rdma_recvfrom to rdma_rw API
  svcrdma: Clean-up svc_rdma_unmap_dma
  svcrdma: Remove frmr cache
  svcrdma: Remove unused Read completion handlers
  svcrdma: Properly compute .len and .buflen for received RPC Calls
  svcrdma: Use generic RDMA R/W API in RPC Call path
  svcrdma: Add recvfrom helpers to svc_rdma_rw.c
  sunrpc: Allocate up to RPCSVC_MAXPAGES per svc_rqst
  svcrdma: Don't account for Receive queue "starvation"
  svcrdma: Improve Reply chunk sanity checking
  svcrdma: Improve Write chunk sanity checking
  svcrdma: Improve Read chunk sanity checking
  svcrdma: Remove svc_rdma_marshal.c
  svcrdma: Avoid Send Queue overflow
  svcrdma: Squelch disconnection messages
  sunrpc: Disable splice for krb5i
  ...
parents 19c6e12c b20dae70
...@@ -381,8 +381,9 @@ static void encode_nlm4_lock(struct xdr_stream *xdr, ...@@ -381,8 +381,9 @@ static void encode_nlm4_lock(struct xdr_stream *xdr,
*/ */
static void nlm4_xdr_enc_testargs(struct rpc_rqst *req, static void nlm4_xdr_enc_testargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nlm_args *args) const void *data)
{ {
const struct nlm_args *args = data;
const struct nlm_lock *lock = &args->lock; const struct nlm_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie); encode_cookie(xdr, &args->cookie);
...@@ -402,8 +403,9 @@ static void nlm4_xdr_enc_testargs(struct rpc_rqst *req, ...@@ -402,8 +403,9 @@ static void nlm4_xdr_enc_testargs(struct rpc_rqst *req,
*/ */
static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req, static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nlm_args *args) const void *data)
{ {
const struct nlm_args *args = data;
const struct nlm_lock *lock = &args->lock; const struct nlm_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie); encode_cookie(xdr, &args->cookie);
...@@ -424,8 +426,9 @@ static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req, ...@@ -424,8 +426,9 @@ static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req,
*/ */
static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req, static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nlm_args *args) const void *data)
{ {
const struct nlm_args *args = data;
const struct nlm_lock *lock = &args->lock; const struct nlm_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie); encode_cookie(xdr, &args->cookie);
...@@ -442,8 +445,9 @@ static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req, ...@@ -442,8 +445,9 @@ static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req,
*/ */
static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req, static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nlm_args *args) const void *data)
{ {
const struct nlm_args *args = data;
const struct nlm_lock *lock = &args->lock; const struct nlm_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie); encode_cookie(xdr, &args->cookie);
...@@ -458,8 +462,10 @@ static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req, ...@@ -458,8 +462,10 @@ static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req,
*/ */
static void nlm4_xdr_enc_res(struct rpc_rqst *req, static void nlm4_xdr_enc_res(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nlm_res *result) const void *data)
{ {
const struct nlm_res *result = data;
encode_cookie(xdr, &result->cookie); encode_cookie(xdr, &result->cookie);
encode_nlm4_stat(xdr, result->status); encode_nlm4_stat(xdr, result->status);
} }
...@@ -479,8 +485,10 @@ static void nlm4_xdr_enc_res(struct rpc_rqst *req, ...@@ -479,8 +485,10 @@ static void nlm4_xdr_enc_res(struct rpc_rqst *req,
*/ */
static void nlm4_xdr_enc_testres(struct rpc_rqst *req, static void nlm4_xdr_enc_testres(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nlm_res *result) const void *data)
{ {
const struct nlm_res *result = data;
encode_cookie(xdr, &result->cookie); encode_cookie(xdr, &result->cookie);
encode_nlm4_stat(xdr, result->status); encode_nlm4_stat(xdr, result->status);
if (result->status == nlm_lck_denied) if (result->status == nlm_lck_denied)
...@@ -525,8 +533,9 @@ static int decode_nlm4_testrply(struct xdr_stream *xdr, ...@@ -525,8 +533,9 @@ static int decode_nlm4_testrply(struct xdr_stream *xdr,
static int nlm4_xdr_dec_testres(struct rpc_rqst *req, static int nlm4_xdr_dec_testres(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nlm_res *result) void *data)
{ {
struct nlm_res *result = data;
int error; int error;
error = decode_cookie(xdr, &result->cookie); error = decode_cookie(xdr, &result->cookie);
...@@ -545,8 +554,9 @@ static int nlm4_xdr_dec_testres(struct rpc_rqst *req, ...@@ -545,8 +554,9 @@ static int nlm4_xdr_dec_testres(struct rpc_rqst *req,
*/ */
static int nlm4_xdr_dec_res(struct rpc_rqst *req, static int nlm4_xdr_dec_res(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nlm_res *result) void *data)
{ {
struct nlm_res *result = data;
int error; int error;
error = decode_cookie(xdr, &result->cookie); error = decode_cookie(xdr, &result->cookie);
...@@ -566,15 +576,15 @@ static int nlm4_xdr_dec_res(struct rpc_rqst *req, ...@@ -566,15 +576,15 @@ static int nlm4_xdr_dec_res(struct rpc_rqst *req,
#define PROC(proc, argtype, restype) \ #define PROC(proc, argtype, restype) \
[NLMPROC_##proc] = { \ [NLMPROC_##proc] = { \
.p_proc = NLMPROC_##proc, \ .p_proc = NLMPROC_##proc, \
.p_encode = (kxdreproc_t)nlm4_xdr_enc_##argtype, \ .p_encode = nlm4_xdr_enc_##argtype, \
.p_decode = (kxdrdproc_t)nlm4_xdr_dec_##restype, \ .p_decode = nlm4_xdr_dec_##restype, \
.p_arglen = NLM4_##argtype##_sz, \ .p_arglen = NLM4_##argtype##_sz, \
.p_replen = NLM4_##restype##_sz, \ .p_replen = NLM4_##restype##_sz, \
.p_statidx = NLMPROC_##proc, \ .p_statidx = NLMPROC_##proc, \
.p_name = #proc, \ .p_name = #proc, \
} }
static struct rpc_procinfo nlm4_procedures[] = { static const struct rpc_procinfo nlm4_procedures[] = {
PROC(TEST, testargs, testres), PROC(TEST, testargs, testres),
PROC(LOCK, lockargs, res), PROC(LOCK, lockargs, res),
PROC(CANCEL, cancargs, res), PROC(CANCEL, cancargs, res),
...@@ -592,8 +602,10 @@ static struct rpc_procinfo nlm4_procedures[] = { ...@@ -592,8 +602,10 @@ static struct rpc_procinfo nlm4_procedures[] = {
PROC(GRANTED_RES, res, norep), PROC(GRANTED_RES, res, norep),
}; };
static unsigned int nlm_version4_counts[ARRAY_SIZE(nlm4_procedures)];
const struct rpc_version nlm_version4 = { const struct rpc_version nlm_version4 = {
.number = 4, .number = 4,
.nrprocs = ARRAY_SIZE(nlm4_procedures), .nrprocs = ARRAY_SIZE(nlm4_procedures),
.procs = nlm4_procedures, .procs = nlm4_procedures,
.counts = nlm_version4_counts,
}; };
...@@ -374,8 +374,9 @@ static void encode_nlm_lock(struct xdr_stream *xdr, ...@@ -374,8 +374,9 @@ static void encode_nlm_lock(struct xdr_stream *xdr,
*/ */
static void nlm_xdr_enc_testargs(struct rpc_rqst *req, static void nlm_xdr_enc_testargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nlm_args *args) const void *data)
{ {
const struct nlm_args *args = data;
const struct nlm_lock *lock = &args->lock; const struct nlm_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie); encode_cookie(xdr, &args->cookie);
...@@ -395,8 +396,9 @@ static void nlm_xdr_enc_testargs(struct rpc_rqst *req, ...@@ -395,8 +396,9 @@ static void nlm_xdr_enc_testargs(struct rpc_rqst *req,
*/ */
static void nlm_xdr_enc_lockargs(struct rpc_rqst *req, static void nlm_xdr_enc_lockargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nlm_args *args) const void *data)
{ {
const struct nlm_args *args = data;
const struct nlm_lock *lock = &args->lock; const struct nlm_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie); encode_cookie(xdr, &args->cookie);
...@@ -417,8 +419,9 @@ static void nlm_xdr_enc_lockargs(struct rpc_rqst *req, ...@@ -417,8 +419,9 @@ static void nlm_xdr_enc_lockargs(struct rpc_rqst *req,
*/ */
static void nlm_xdr_enc_cancargs(struct rpc_rqst *req, static void nlm_xdr_enc_cancargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nlm_args *args) const void *data)
{ {
const struct nlm_args *args = data;
const struct nlm_lock *lock = &args->lock; const struct nlm_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie); encode_cookie(xdr, &args->cookie);
...@@ -435,8 +438,9 @@ static void nlm_xdr_enc_cancargs(struct rpc_rqst *req, ...@@ -435,8 +438,9 @@ static void nlm_xdr_enc_cancargs(struct rpc_rqst *req,
*/ */
static void nlm_xdr_enc_unlockargs(struct rpc_rqst *req, static void nlm_xdr_enc_unlockargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nlm_args *args) const void *data)
{ {
const struct nlm_args *args = data;
const struct nlm_lock *lock = &args->lock; const struct nlm_lock *lock = &args->lock;
encode_cookie(xdr, &args->cookie); encode_cookie(xdr, &args->cookie);
...@@ -451,8 +455,10 @@ static void nlm_xdr_enc_unlockargs(struct rpc_rqst *req, ...@@ -451,8 +455,10 @@ static void nlm_xdr_enc_unlockargs(struct rpc_rqst *req,
*/ */
static void nlm_xdr_enc_res(struct rpc_rqst *req, static void nlm_xdr_enc_res(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nlm_res *result) const void *data)
{ {
const struct nlm_res *result = data;
encode_cookie(xdr, &result->cookie); encode_cookie(xdr, &result->cookie);
encode_nlm_stat(xdr, result->status); encode_nlm_stat(xdr, result->status);
} }
...@@ -479,8 +485,10 @@ static void encode_nlm_testrply(struct xdr_stream *xdr, ...@@ -479,8 +485,10 @@ static void encode_nlm_testrply(struct xdr_stream *xdr,
static void nlm_xdr_enc_testres(struct rpc_rqst *req, static void nlm_xdr_enc_testres(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nlm_res *result) const void *data)
{ {
const struct nlm_res *result = data;
encode_cookie(xdr, &result->cookie); encode_cookie(xdr, &result->cookie);
encode_nlm_stat(xdr, result->status); encode_nlm_stat(xdr, result->status);
encode_nlm_testrply(xdr, result); encode_nlm_testrply(xdr, result);
...@@ -523,8 +531,9 @@ static int decode_nlm_testrply(struct xdr_stream *xdr, ...@@ -523,8 +531,9 @@ static int decode_nlm_testrply(struct xdr_stream *xdr,
static int nlm_xdr_dec_testres(struct rpc_rqst *req, static int nlm_xdr_dec_testres(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nlm_res *result) void *data)
{ {
struct nlm_res *result = data;
int error; int error;
error = decode_cookie(xdr, &result->cookie); error = decode_cookie(xdr, &result->cookie);
...@@ -543,8 +552,9 @@ static int nlm_xdr_dec_testres(struct rpc_rqst *req, ...@@ -543,8 +552,9 @@ static int nlm_xdr_dec_testres(struct rpc_rqst *req,
*/ */
static int nlm_xdr_dec_res(struct rpc_rqst *req, static int nlm_xdr_dec_res(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nlm_res *result) void *data)
{ {
struct nlm_res *result = data;
int error; int error;
error = decode_cookie(xdr, &result->cookie); error = decode_cookie(xdr, &result->cookie);
...@@ -564,15 +574,15 @@ static int nlm_xdr_dec_res(struct rpc_rqst *req, ...@@ -564,15 +574,15 @@ static int nlm_xdr_dec_res(struct rpc_rqst *req,
#define PROC(proc, argtype, restype) \ #define PROC(proc, argtype, restype) \
[NLMPROC_##proc] = { \ [NLMPROC_##proc] = { \
.p_proc = NLMPROC_##proc, \ .p_proc = NLMPROC_##proc, \
.p_encode = (kxdreproc_t)nlm_xdr_enc_##argtype, \ .p_encode = nlm_xdr_enc_##argtype, \
.p_decode = (kxdrdproc_t)nlm_xdr_dec_##restype, \ .p_decode = nlm_xdr_dec_##restype, \
.p_arglen = NLM_##argtype##_sz, \ .p_arglen = NLM_##argtype##_sz, \
.p_replen = NLM_##restype##_sz, \ .p_replen = NLM_##restype##_sz, \
.p_statidx = NLMPROC_##proc, \ .p_statidx = NLMPROC_##proc, \
.p_name = #proc, \ .p_name = #proc, \
} }
static struct rpc_procinfo nlm_procedures[] = { static const struct rpc_procinfo nlm_procedures[] = {
PROC(TEST, testargs, testres), PROC(TEST, testargs, testres),
PROC(LOCK, lockargs, res), PROC(LOCK, lockargs, res),
PROC(CANCEL, cancargs, res), PROC(CANCEL, cancargs, res),
...@@ -590,16 +600,20 @@ static struct rpc_procinfo nlm_procedures[] = { ...@@ -590,16 +600,20 @@ static struct rpc_procinfo nlm_procedures[] = {
PROC(GRANTED_RES, res, norep), PROC(GRANTED_RES, res, norep),
}; };
static unsigned int nlm_version1_counts[ARRAY_SIZE(nlm_procedures)];
static const struct rpc_version nlm_version1 = { static const struct rpc_version nlm_version1 = {
.number = 1, .number = 1,
.nrprocs = ARRAY_SIZE(nlm_procedures), .nrprocs = ARRAY_SIZE(nlm_procedures),
.procs = nlm_procedures, .procs = nlm_procedures,
.counts = nlm_version1_counts,
}; };
static unsigned int nlm_version3_counts[ARRAY_SIZE(nlm_procedures)];
static const struct rpc_version nlm_version3 = { static const struct rpc_version nlm_version3 = {
.number = 3, .number = 3,
.nrprocs = ARRAY_SIZE(nlm_procedures), .nrprocs = ARRAY_SIZE(nlm_procedures),
.procs = nlm_procedures, .procs = nlm_procedures,
.counts = nlm_version3_counts,
}; };
static const struct rpc_version *nlm_versions[] = { static const struct rpc_version *nlm_versions[] = {
......
...@@ -476,22 +476,23 @@ static void encode_priv(struct xdr_stream *xdr, const struct nsm_args *argp) ...@@ -476,22 +476,23 @@ static void encode_priv(struct xdr_stream *xdr, const struct nsm_args *argp)
} }
static void nsm_xdr_enc_mon(struct rpc_rqst *req, struct xdr_stream *xdr, static void nsm_xdr_enc_mon(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nsm_args *argp) const void *argp)
{ {
encode_mon_id(xdr, argp); encode_mon_id(xdr, argp);
encode_priv(xdr, argp); encode_priv(xdr, argp);
} }
static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr, static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nsm_args *argp) const void *argp)
{ {
encode_mon_id(xdr, argp); encode_mon_id(xdr, argp);
} }
static int nsm_xdr_dec_stat_res(struct rpc_rqst *rqstp, static int nsm_xdr_dec_stat_res(struct rpc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nsm_res *resp) void *data)
{ {
struct nsm_res *resp = data;
__be32 *p; __be32 *p;
p = xdr_inline_decode(xdr, 4 + 4); p = xdr_inline_decode(xdr, 4 + 4);
...@@ -507,8 +508,9 @@ static int nsm_xdr_dec_stat_res(struct rpc_rqst *rqstp, ...@@ -507,8 +508,9 @@ static int nsm_xdr_dec_stat_res(struct rpc_rqst *rqstp,
static int nsm_xdr_dec_stat(struct rpc_rqst *rqstp, static int nsm_xdr_dec_stat(struct rpc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nsm_res *resp) void *data)
{ {
struct nsm_res *resp = data;
__be32 *p; __be32 *p;
p = xdr_inline_decode(xdr, 4); p = xdr_inline_decode(xdr, 4);
...@@ -529,11 +531,11 @@ static int nsm_xdr_dec_stat(struct rpc_rqst *rqstp, ...@@ -529,11 +531,11 @@ static int nsm_xdr_dec_stat(struct rpc_rqst *rqstp,
#define SM_monres_sz 2 #define SM_monres_sz 2
#define SM_unmonres_sz 1 #define SM_unmonres_sz 1
static struct rpc_procinfo nsm_procedures[] = { static const struct rpc_procinfo nsm_procedures[] = {
[NSMPROC_MON] = { [NSMPROC_MON] = {
.p_proc = NSMPROC_MON, .p_proc = NSMPROC_MON,
.p_encode = (kxdreproc_t)nsm_xdr_enc_mon, .p_encode = nsm_xdr_enc_mon,
.p_decode = (kxdrdproc_t)nsm_xdr_dec_stat_res, .p_decode = nsm_xdr_dec_stat_res,
.p_arglen = SM_mon_sz, .p_arglen = SM_mon_sz,
.p_replen = SM_monres_sz, .p_replen = SM_monres_sz,
.p_statidx = NSMPROC_MON, .p_statidx = NSMPROC_MON,
...@@ -541,8 +543,8 @@ static struct rpc_procinfo nsm_procedures[] = { ...@@ -541,8 +543,8 @@ static struct rpc_procinfo nsm_procedures[] = {
}, },
[NSMPROC_UNMON] = { [NSMPROC_UNMON] = {
.p_proc = NSMPROC_UNMON, .p_proc = NSMPROC_UNMON,
.p_encode = (kxdreproc_t)nsm_xdr_enc_unmon, .p_encode = nsm_xdr_enc_unmon,
.p_decode = (kxdrdproc_t)nsm_xdr_dec_stat, .p_decode = nsm_xdr_dec_stat,
.p_arglen = SM_mon_id_sz, .p_arglen = SM_mon_id_sz,
.p_replen = SM_unmonres_sz, .p_replen = SM_unmonres_sz,
.p_statidx = NSMPROC_UNMON, .p_statidx = NSMPROC_UNMON,
...@@ -550,10 +552,12 @@ static struct rpc_procinfo nsm_procedures[] = { ...@@ -550,10 +552,12 @@ static struct rpc_procinfo nsm_procedures[] = {
}, },
}; };
static unsigned int nsm_version1_counts[ARRAY_SIZE(nsm_procedures)];
static const struct rpc_version nsm_version1 = { static const struct rpc_version nsm_version1 = {
.number = 1, .number = 1,
.nrprocs = ARRAY_SIZE(nsm_procedures), .nrprocs = ARRAY_SIZE(nsm_procedures),
.procs = nsm_procedures .procs = nsm_procedures,
.counts = nsm_version1_counts,
}; };
static const struct rpc_version *nsm_version[] = { static const struct rpc_version *nsm_version[] = {
......
...@@ -739,27 +739,33 @@ module_exit(exit_nlm); ...@@ -739,27 +739,33 @@ module_exit(exit_nlm);
/* /*
* Define NLM program and procedures * Define NLM program and procedures
*/ */
static struct svc_version nlmsvc_version1 = { static unsigned int nlmsvc_version1_count[17];
static const struct svc_version nlmsvc_version1 = {
.vs_vers = 1, .vs_vers = 1,
.vs_nproc = 17, .vs_nproc = 17,
.vs_proc = nlmsvc_procedures, .vs_proc = nlmsvc_procedures,
.vs_count = nlmsvc_version1_count,
.vs_xdrsize = NLMSVC_XDRSIZE, .vs_xdrsize = NLMSVC_XDRSIZE,
}; };
static struct svc_version nlmsvc_version3 = { static unsigned int nlmsvc_version3_count[24];
static const struct svc_version nlmsvc_version3 = {
.vs_vers = 3, .vs_vers = 3,
.vs_nproc = 24, .vs_nproc = 24,
.vs_proc = nlmsvc_procedures, .vs_proc = nlmsvc_procedures,
.vs_count = nlmsvc_version3_count,
.vs_xdrsize = NLMSVC_XDRSIZE, .vs_xdrsize = NLMSVC_XDRSIZE,
}; };
#ifdef CONFIG_LOCKD_V4 #ifdef CONFIG_LOCKD_V4
static struct svc_version nlmsvc_version4 = { static unsigned int nlmsvc_version4_count[24];
static const struct svc_version nlmsvc_version4 = {
.vs_vers = 4, .vs_vers = 4,
.vs_nproc = 24, .vs_nproc = 24,
.vs_proc = nlmsvc_procedures4, .vs_proc = nlmsvc_procedures4,
.vs_count = nlmsvc_version4_count,
.vs_xdrsize = NLMSVC_XDRSIZE, .vs_xdrsize = NLMSVC_XDRSIZE,
}; };
#endif #endif
static struct svc_version * nlmsvc_version[] = { static const struct svc_version *nlmsvc_version[] = {
[1] = &nlmsvc_version1, [1] = &nlmsvc_version1,
[3] = &nlmsvc_version3, [3] = &nlmsvc_version3,
#ifdef CONFIG_LOCKD_V4 #ifdef CONFIG_LOCKD_V4
......
...@@ -62,7 +62,7 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -62,7 +62,7 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
* NULL: Test for presence of service * NULL: Test for presence of service
*/ */
static __be32 static __be32
nlm4svc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) nlm4svc_proc_null(struct svc_rqst *rqstp)
{ {
dprintk("lockd: NULL called\n"); dprintk("lockd: NULL called\n");
return rpc_success; return rpc_success;
...@@ -72,9 +72,9 @@ nlm4svc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) ...@@ -72,9 +72,9 @@ nlm4svc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
* TEST: Check for conflicting lock * TEST: Check for conflicting lock
*/ */
static __be32 static __be32
nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, __nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
struct nlm_res *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_host *host; struct nlm_host *host;
struct nlm_file *file; struct nlm_file *file;
__be32 rc = rpc_success; __be32 rc = rpc_success;
...@@ -99,9 +99,15 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -99,9 +99,15 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
} }
static __be32 static __be32
nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, nlm4svc_proc_test(struct svc_rqst *rqstp)
struct nlm_res *resp)
{ {
return __nlm4svc_proc_test(rqstp, rqstp->rq_resp);
}
static __be32
__nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp)
{
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_host *host; struct nlm_host *host;
struct nlm_file *file; struct nlm_file *file;
__be32 rc = rpc_success; __be32 rc = rpc_success;
...@@ -141,9 +147,15 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -141,9 +147,15 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
} }
static __be32 static __be32
nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, nlm4svc_proc_lock(struct svc_rqst *rqstp)
struct nlm_res *resp) {
return __nlm4svc_proc_lock(rqstp, rqstp->rq_resp);
}
static __be32
__nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_res *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_host *host; struct nlm_host *host;
struct nlm_file *file; struct nlm_file *file;
...@@ -170,13 +182,19 @@ nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -170,13 +182,19 @@ nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
return rpc_success; return rpc_success;
} }
static __be32
nlm4svc_proc_cancel(struct svc_rqst *rqstp)
{
return __nlm4svc_proc_cancel(rqstp, rqstp->rq_resp);
}
/* /*
* UNLOCK: release a lock * UNLOCK: release a lock
*/ */
static __be32 static __be32
nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, __nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_res *resp)
struct nlm_res *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_host *host; struct nlm_host *host;
struct nlm_file *file; struct nlm_file *file;
...@@ -203,14 +221,21 @@ nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -203,14 +221,21 @@ nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
return rpc_success; return rpc_success;
} }
static __be32
nlm4svc_proc_unlock(struct svc_rqst *rqstp)
{
return __nlm4svc_proc_unlock(rqstp, rqstp->rq_resp);
}
/* /*
* GRANTED: A server calls us to tell that a process' lock request * GRANTED: A server calls us to tell that a process' lock request
* was granted * was granted
*/ */
static __be32 static __be32
nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, __nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_res *resp)
struct nlm_res *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
resp->cookie = argp->cookie; resp->cookie = argp->cookie;
dprintk("lockd: GRANTED called\n"); dprintk("lockd: GRANTED called\n");
...@@ -219,6 +244,12 @@ nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -219,6 +244,12 @@ nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
return rpc_success; return rpc_success;
} }
static __be32
nlm4svc_proc_granted(struct svc_rqst *rqstp)
{
return __nlm4svc_proc_granted(rqstp, rqstp->rq_resp);
}
/* /*
* This is the generic lockd callback for async RPC calls * This is the generic lockd callback for async RPC calls
*/ */
...@@ -243,9 +274,10 @@ static const struct rpc_call_ops nlm4svc_callback_ops = { ...@@ -243,9 +274,10 @@ static const struct rpc_call_ops nlm4svc_callback_ops = {
* because we send the callback before the reply proper. I hope this * because we send the callback before the reply proper. I hope this
* doesn't break any clients. * doesn't break any clients.
*/ */
static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *argp, static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc,
__be32 (*func)(struct svc_rqst *, struct nlm_args *, struct nlm_res *)) __be32 (*func)(struct svc_rqst *, struct nlm_res *))
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_host *host; struct nlm_host *host;
struct nlm_rqst *call; struct nlm_rqst *call;
__be32 stat; __be32 stat;
...@@ -261,7 +293,7 @@ static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args ...@@ -261,7 +293,7 @@ static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args
if (call == NULL) if (call == NULL)
return rpc_system_err; return rpc_system_err;
stat = func(rqstp, argp, &call->a_res); stat = func(rqstp, &call->a_res);
if (stat != 0) { if (stat != 0) {
nlmsvc_release_call(call); nlmsvc_release_call(call);
return stat; return stat;
...@@ -273,48 +305,44 @@ static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args ...@@ -273,48 +305,44 @@ static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args
return rpc_success; return rpc_success;
} }
static __be32 nlm4svc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp, static __be32 nlm4svc_proc_test_msg(struct svc_rqst *rqstp)
void *resp)
{ {
dprintk("lockd: TEST_MSG called\n"); dprintk("lockd: TEST_MSG called\n");
return nlm4svc_callback(rqstp, NLMPROC_TEST_RES, argp, nlm4svc_proc_test); return nlm4svc_callback(rqstp, NLMPROC_TEST_RES, __nlm4svc_proc_test);
} }
static __be32 nlm4svc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, static __be32 nlm4svc_proc_lock_msg(struct svc_rqst *rqstp)
void *resp)
{ {
dprintk("lockd: LOCK_MSG called\n"); dprintk("lockd: LOCK_MSG called\n");
return nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, argp, nlm4svc_proc_lock); return nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, __nlm4svc_proc_lock);
} }
static __be32 nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp, static __be32 nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp)
void *resp)
{ {
dprintk("lockd: CANCEL_MSG called\n"); dprintk("lockd: CANCEL_MSG called\n");
return nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, argp, nlm4svc_proc_cancel); return nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, __nlm4svc_proc_cancel);
} }
static __be32 nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, static __be32 nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp)
void *resp)
{ {
dprintk("lockd: UNLOCK_MSG called\n"); dprintk("lockd: UNLOCK_MSG called\n");
return nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, argp, nlm4svc_proc_unlock); return nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, __nlm4svc_proc_unlock);
} }
static __be32 nlm4svc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp, static __be32 nlm4svc_proc_granted_msg(struct svc_rqst *rqstp)
void *resp)
{ {
dprintk("lockd: GRANTED_MSG called\n"); dprintk("lockd: GRANTED_MSG called\n");
return nlm4svc_callback(rqstp, NLMPROC_GRANTED_RES, argp, nlm4svc_proc_granted); return nlm4svc_callback(rqstp, NLMPROC_GRANTED_RES, __nlm4svc_proc_granted);
} }
/* /*
* SHARE: create a DOS share or alter existing share. * SHARE: create a DOS share or alter existing share.
*/ */
static __be32 static __be32
nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, nlm4svc_proc_share(struct svc_rqst *rqstp)
struct nlm_res *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_res *resp = rqstp->rq_resp;
struct nlm_host *host; struct nlm_host *host;
struct nlm_file *file; struct nlm_file *file;
...@@ -345,9 +373,10 @@ nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -345,9 +373,10 @@ nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
* UNSHARE: Release a DOS share. * UNSHARE: Release a DOS share.
*/ */
static __be32 static __be32
nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, nlm4svc_proc_unshare(struct svc_rqst *rqstp)
struct nlm_res *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_res *resp = rqstp->rq_resp;
struct nlm_host *host; struct nlm_host *host;
struct nlm_file *file; struct nlm_file *file;
...@@ -378,22 +407,23 @@ nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -378,22 +407,23 @@ nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
* NM_LOCK: Create an unmonitored lock * NM_LOCK: Create an unmonitored lock
*/ */
static __be32 static __be32
nlm4svc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp, nlm4svc_proc_nm_lock(struct svc_rqst *rqstp)
struct nlm_res *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
dprintk("lockd: NM_LOCK called\n"); dprintk("lockd: NM_LOCK called\n");
argp->monitor = 0; /* just clean the monitor flag */ argp->monitor = 0; /* just clean the monitor flag */
return nlm4svc_proc_lock(rqstp, argp, resp); return nlm4svc_proc_lock(rqstp);
} }
/* /*
* FREE_ALL: Release all locks and shares held by client * FREE_ALL: Release all locks and shares held by client
*/ */
static __be32 static __be32
nlm4svc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp, nlm4svc_proc_free_all(struct svc_rqst *rqstp)
void *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_host *host; struct nlm_host *host;
/* Obtain client */ /* Obtain client */
...@@ -409,9 +439,10 @@ nlm4svc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -409,9 +439,10 @@ nlm4svc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp,
* SM_NOTIFY: private callback from statd (not part of official NLM proto) * SM_NOTIFY: private callback from statd (not part of official NLM proto)
*/ */
static __be32 static __be32
nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, nlm4svc_proc_sm_notify(struct svc_rqst *rqstp)
void *resp)
{ {
struct nlm_reboot *argp = rqstp->rq_argp;
dprintk("lockd: SM_NOTIFY called\n"); dprintk("lockd: SM_NOTIFY called\n");
if (!nlm_privileged_requester(rqstp)) { if (!nlm_privileged_requester(rqstp)) {
...@@ -429,9 +460,10 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, ...@@ -429,9 +460,10 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
* client sent a GRANTED_RES, let's remove the associated block * client sent a GRANTED_RES, let's remove the associated block
*/ */
static __be32 static __be32
nlm4svc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp, nlm4svc_proc_granted_res(struct svc_rqst *rqstp)
void *resp)
{ {
struct nlm_res *argp = rqstp->rq_argp;
if (!nlmsvc_ops) if (!nlmsvc_ops)
return rpc_success; return rpc_success;
...@@ -463,9 +495,9 @@ nlm4svc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp, ...@@ -463,9 +495,9 @@ nlm4svc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp,
struct nlm_void { int dummy; }; struct nlm_void { int dummy; };
#define PROC(name, xargt, xrest, argt, rest, respsize) \ #define PROC(name, xargt, xrest, argt, rest, respsize) \
{ .pc_func = (svc_procfunc) nlm4svc_proc_##name, \ { .pc_func = nlm4svc_proc_##name, \
.pc_decode = (kxdrproc_t) nlm4svc_decode_##xargt, \ .pc_decode = nlm4svc_decode_##xargt, \
.pc_encode = (kxdrproc_t) nlm4svc_encode_##xrest, \ .pc_encode = nlm4svc_encode_##xrest, \
.pc_release = NULL, \ .pc_release = NULL, \
.pc_argsize = sizeof(struct nlm_##argt), \ .pc_argsize = sizeof(struct nlm_##argt), \
.pc_ressize = sizeof(struct nlm_##rest), \ .pc_ressize = sizeof(struct nlm_##rest), \
...@@ -475,7 +507,7 @@ struct nlm_void { int dummy; }; ...@@ -475,7 +507,7 @@ struct nlm_void { int dummy; };
#define No (1+1024/4) /* netobj */ #define No (1+1024/4) /* netobj */
#define St 1 /* status */ #define St 1 /* status */
#define Rg 4 /* range (offset + length) */ #define Rg 4 /* range (offset + length) */
struct svc_procedure nlmsvc_procedures4[] = { const struct svc_procedure nlmsvc_procedures4[] = {
PROC(null, void, void, void, void, 1), PROC(null, void, void, void, void, 1),
PROC(test, testargs, testres, args, res, Ck+St+2+No+Rg), PROC(test, testargs, testres, args, res, Ck+St+2+No+Rg),
PROC(lock, lockargs, res, args, res, Ck+St), PROC(lock, lockargs, res, args, res, Ck+St),
......
...@@ -92,7 +92,7 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -92,7 +92,7 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
* NULL: Test for presence of service * NULL: Test for presence of service
*/ */
static __be32 static __be32
nlmsvc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) nlmsvc_proc_null(struct svc_rqst *rqstp)
{ {
dprintk("lockd: NULL called\n"); dprintk("lockd: NULL called\n");
return rpc_success; return rpc_success;
...@@ -102,9 +102,9 @@ nlmsvc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) ...@@ -102,9 +102,9 @@ nlmsvc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
* TEST: Check for conflicting lock * TEST: Check for conflicting lock
*/ */
static __be32 static __be32
nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, __nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
struct nlm_res *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_host *host; struct nlm_host *host;
struct nlm_file *file; struct nlm_file *file;
__be32 rc = rpc_success; __be32 rc = rpc_success;
...@@ -130,9 +130,15 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -130,9 +130,15 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
} }
static __be32 static __be32
nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, nlmsvc_proc_test(struct svc_rqst *rqstp)
struct nlm_res *resp)
{ {
return __nlmsvc_proc_test(rqstp, rqstp->rq_resp);
}
static __be32
__nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp)
{
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_host *host; struct nlm_host *host;
struct nlm_file *file; struct nlm_file *file;
__be32 rc = rpc_success; __be32 rc = rpc_success;
...@@ -172,9 +178,15 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -172,9 +178,15 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
} }
static __be32 static __be32
nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, nlmsvc_proc_lock(struct svc_rqst *rqstp)
struct nlm_res *resp) {
return __nlmsvc_proc_lock(rqstp, rqstp->rq_resp);
}
static __be32
__nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_res *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_host *host; struct nlm_host *host;
struct nlm_file *file; struct nlm_file *file;
struct net *net = SVC_NET(rqstp); struct net *net = SVC_NET(rqstp);
...@@ -202,13 +214,19 @@ nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -202,13 +214,19 @@ nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
return rpc_success; return rpc_success;
} }
static __be32
nlmsvc_proc_cancel(struct svc_rqst *rqstp)
{
return __nlmsvc_proc_cancel(rqstp, rqstp->rq_resp);
}
/* /*
* UNLOCK: release a lock * UNLOCK: release a lock
*/ */
static __be32 static __be32
nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, __nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_res *resp)
struct nlm_res *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_host *host; struct nlm_host *host;
struct nlm_file *file; struct nlm_file *file;
struct net *net = SVC_NET(rqstp); struct net *net = SVC_NET(rqstp);
...@@ -236,14 +254,21 @@ nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -236,14 +254,21 @@ nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
return rpc_success; return rpc_success;
} }
static __be32
nlmsvc_proc_unlock(struct svc_rqst *rqstp)
{
return __nlmsvc_proc_unlock(rqstp, rqstp->rq_resp);
}
/* /*
* GRANTED: A server calls us to tell that a process' lock request * GRANTED: A server calls us to tell that a process' lock request
* was granted * was granted
*/ */
static __be32 static __be32
nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, __nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_res *resp)
struct nlm_res *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
resp->cookie = argp->cookie; resp->cookie = argp->cookie;
dprintk("lockd: GRANTED called\n"); dprintk("lockd: GRANTED called\n");
...@@ -252,6 +277,12 @@ nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -252,6 +277,12 @@ nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
return rpc_success; return rpc_success;
} }
static __be32
nlmsvc_proc_granted(struct svc_rqst *rqstp)
{
return __nlmsvc_proc_granted(rqstp, rqstp->rq_resp);
}
/* /*
* This is the generic lockd callback for async RPC calls * This is the generic lockd callback for async RPC calls
*/ */
...@@ -284,9 +315,10 @@ static const struct rpc_call_ops nlmsvc_callback_ops = { ...@@ -284,9 +315,10 @@ static const struct rpc_call_ops nlmsvc_callback_ops = {
* because we send the callback before the reply proper. I hope this * because we send the callback before the reply proper. I hope this
* doesn't break any clients. * doesn't break any clients.
*/ */
static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *argp, static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc,
__be32 (*func)(struct svc_rqst *, struct nlm_args *, struct nlm_res *)) __be32 (*func)(struct svc_rqst *, struct nlm_res *))
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_host *host; struct nlm_host *host;
struct nlm_rqst *call; struct nlm_rqst *call;
__be32 stat; __be32 stat;
...@@ -302,7 +334,7 @@ static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args ...@@ -302,7 +334,7 @@ static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args
if (call == NULL) if (call == NULL)
return rpc_system_err; return rpc_system_err;
stat = func(rqstp, argp, &call->a_res); stat = func(rqstp, &call->a_res);
if (stat != 0) { if (stat != 0) {
nlmsvc_release_call(call); nlmsvc_release_call(call);
return stat; return stat;
...@@ -314,50 +346,46 @@ static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args ...@@ -314,50 +346,46 @@ static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args
return rpc_success; return rpc_success;
} }
static __be32 nlmsvc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp, static __be32 nlmsvc_proc_test_msg(struct svc_rqst *rqstp)
void *resp)
{ {
dprintk("lockd: TEST_MSG called\n"); dprintk("lockd: TEST_MSG called\n");
return nlmsvc_callback(rqstp, NLMPROC_TEST_RES, argp, nlmsvc_proc_test); return nlmsvc_callback(rqstp, NLMPROC_TEST_RES, __nlmsvc_proc_test);
} }
static __be32 nlmsvc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, static __be32 nlmsvc_proc_lock_msg(struct svc_rqst *rqstp)
void *resp)
{ {
dprintk("lockd: LOCK_MSG called\n"); dprintk("lockd: LOCK_MSG called\n");
return nlmsvc_callback(rqstp, NLMPROC_LOCK_RES, argp, nlmsvc_proc_lock); return nlmsvc_callback(rqstp, NLMPROC_LOCK_RES, __nlmsvc_proc_lock);
} }
static __be32 nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp, static __be32 nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp)
void *resp)
{ {
dprintk("lockd: CANCEL_MSG called\n"); dprintk("lockd: CANCEL_MSG called\n");
return nlmsvc_callback(rqstp, NLMPROC_CANCEL_RES, argp, nlmsvc_proc_cancel); return nlmsvc_callback(rqstp, NLMPROC_CANCEL_RES, __nlmsvc_proc_cancel);
} }
static __be32 static __be32
nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp)
void *resp)
{ {
dprintk("lockd: UNLOCK_MSG called\n"); dprintk("lockd: UNLOCK_MSG called\n");
return nlmsvc_callback(rqstp, NLMPROC_UNLOCK_RES, argp, nlmsvc_proc_unlock); return nlmsvc_callback(rqstp, NLMPROC_UNLOCK_RES, __nlmsvc_proc_unlock);
} }
static __be32 static __be32
nlmsvc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp, nlmsvc_proc_granted_msg(struct svc_rqst *rqstp)
void *resp)
{ {
dprintk("lockd: GRANTED_MSG called\n"); dprintk("lockd: GRANTED_MSG called\n");
return nlmsvc_callback(rqstp, NLMPROC_GRANTED_RES, argp, nlmsvc_proc_granted); return nlmsvc_callback(rqstp, NLMPROC_GRANTED_RES, __nlmsvc_proc_granted);
} }
/* /*
* SHARE: create a DOS share or alter existing share. * SHARE: create a DOS share or alter existing share.
*/ */
static __be32 static __be32
nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, nlmsvc_proc_share(struct svc_rqst *rqstp)
struct nlm_res *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_res *resp = rqstp->rq_resp;
struct nlm_host *host; struct nlm_host *host;
struct nlm_file *file; struct nlm_file *file;
...@@ -388,9 +416,10 @@ nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -388,9 +416,10 @@ nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
* UNSHARE: Release a DOS share. * UNSHARE: Release a DOS share.
*/ */
static __be32 static __be32
nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, nlmsvc_proc_unshare(struct svc_rqst *rqstp)
struct nlm_res *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_res *resp = rqstp->rq_resp;
struct nlm_host *host; struct nlm_host *host;
struct nlm_file *file; struct nlm_file *file;
...@@ -421,22 +450,23 @@ nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -421,22 +450,23 @@ nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
* NM_LOCK: Create an unmonitored lock * NM_LOCK: Create an unmonitored lock
*/ */
static __be32 static __be32
nlmsvc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp, nlmsvc_proc_nm_lock(struct svc_rqst *rqstp)
struct nlm_res *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
dprintk("lockd: NM_LOCK called\n"); dprintk("lockd: NM_LOCK called\n");
argp->monitor = 0; /* just clean the monitor flag */ argp->monitor = 0; /* just clean the monitor flag */
return nlmsvc_proc_lock(rqstp, argp, resp); return nlmsvc_proc_lock(rqstp);
} }
/* /*
* FREE_ALL: Release all locks and shares held by client * FREE_ALL: Release all locks and shares held by client
*/ */
static __be32 static __be32
nlmsvc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp, nlmsvc_proc_free_all(struct svc_rqst *rqstp)
void *resp)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_host *host; struct nlm_host *host;
/* Obtain client */ /* Obtain client */
...@@ -452,9 +482,10 @@ nlmsvc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -452,9 +482,10 @@ nlmsvc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp,
* SM_NOTIFY: private callback from statd (not part of official NLM proto) * SM_NOTIFY: private callback from statd (not part of official NLM proto)
*/ */
static __be32 static __be32
nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, nlmsvc_proc_sm_notify(struct svc_rqst *rqstp)
void *resp)
{ {
struct nlm_reboot *argp = rqstp->rq_argp;
dprintk("lockd: SM_NOTIFY called\n"); dprintk("lockd: SM_NOTIFY called\n");
if (!nlm_privileged_requester(rqstp)) { if (!nlm_privileged_requester(rqstp)) {
...@@ -472,9 +503,10 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, ...@@ -472,9 +503,10 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
* client sent a GRANTED_RES, let's remove the associated block * client sent a GRANTED_RES, let's remove the associated block
*/ */
static __be32 static __be32
nlmsvc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp, nlmsvc_proc_granted_res(struct svc_rqst *rqstp)
void *resp)
{ {
struct nlm_res *argp = rqstp->rq_argp;
if (!nlmsvc_ops) if (!nlmsvc_ops)
return rpc_success; return rpc_success;
...@@ -505,9 +537,9 @@ nlmsvc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp, ...@@ -505,9 +537,9 @@ nlmsvc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp,
struct nlm_void { int dummy; }; struct nlm_void { int dummy; };
#define PROC(name, xargt, xrest, argt, rest, respsize) \ #define PROC(name, xargt, xrest, argt, rest, respsize) \
{ .pc_func = (svc_procfunc) nlmsvc_proc_##name, \ { .pc_func = nlmsvc_proc_##name, \
.pc_decode = (kxdrproc_t) nlmsvc_decode_##xargt, \ .pc_decode = nlmsvc_decode_##xargt, \
.pc_encode = (kxdrproc_t) nlmsvc_encode_##xrest, \ .pc_encode = nlmsvc_encode_##xrest, \
.pc_release = NULL, \ .pc_release = NULL, \
.pc_argsize = sizeof(struct nlm_##argt), \ .pc_argsize = sizeof(struct nlm_##argt), \
.pc_ressize = sizeof(struct nlm_##rest), \ .pc_ressize = sizeof(struct nlm_##rest), \
...@@ -519,7 +551,7 @@ struct nlm_void { int dummy; }; ...@@ -519,7 +551,7 @@ struct nlm_void { int dummy; };
#define No (1+1024/4) /* Net Obj */ #define No (1+1024/4) /* Net Obj */
#define Rg 2 /* range - offset + size */ #define Rg 2 /* range - offset + size */
struct svc_procedure nlmsvc_procedures[] = { const struct svc_procedure nlmsvc_procedures[] = {
PROC(null, void, void, void, void, 1), PROC(null, void, void, void, void, 1),
PROC(test, testargs, testres, args, res, Ck+St+2+No+Rg), PROC(test, testargs, testres, args, res, Ck+St+2+No+Rg),
PROC(lock, lockargs, res, args, res, Ck+St), PROC(lock, lockargs, res, args, res, Ck+St),
......
...@@ -182,8 +182,9 @@ nlm_encode_testres(__be32 *p, struct nlm_res *resp) ...@@ -182,8 +182,9 @@ nlm_encode_testres(__be32 *p, struct nlm_res *resp)
* First, the server side XDR functions * First, the server side XDR functions
*/ */
int int
nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_args *argp = rqstp->rq_argp;
u32 exclusive; u32 exclusive;
if (!(p = nlm_decode_cookie(p, &argp->cookie))) if (!(p = nlm_decode_cookie(p, &argp->cookie)))
...@@ -199,16 +200,19 @@ nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) ...@@ -199,16 +200,19 @@ nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
} }
int int
nlmsvc_encode_testres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) nlmsvc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_res *resp = rqstp->rq_resp;
if (!(p = nlm_encode_testres(p, resp))) if (!(p = nlm_encode_testres(p, resp)))
return 0; return 0;
return xdr_ressize_check(rqstp, p); return xdr_ressize_check(rqstp, p);
} }
int int
nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_args *argp = rqstp->rq_argp;
u32 exclusive; u32 exclusive;
if (!(p = nlm_decode_cookie(p, &argp->cookie))) if (!(p = nlm_decode_cookie(p, &argp->cookie)))
...@@ -227,8 +231,9 @@ nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) ...@@ -227,8 +231,9 @@ nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
} }
int int
nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_args *argp = rqstp->rq_argp;
u32 exclusive; u32 exclusive;
if (!(p = nlm_decode_cookie(p, &argp->cookie))) if (!(p = nlm_decode_cookie(p, &argp->cookie)))
...@@ -243,8 +248,10 @@ nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) ...@@ -243,8 +248,10 @@ nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
} }
int int
nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_args *argp = rqstp->rq_argp;
if (!(p = nlm_decode_cookie(p, &argp->cookie)) if (!(p = nlm_decode_cookie(p, &argp->cookie))
|| !(p = nlm_decode_lock(p, &argp->lock))) || !(p = nlm_decode_lock(p, &argp->lock)))
return 0; return 0;
...@@ -253,8 +260,9 @@ nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) ...@@ -253,8 +260,9 @@ nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
} }
int int
nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_lock *lock = &argp->lock; struct nlm_lock *lock = &argp->lock;
memset(lock, 0, sizeof(*lock)); memset(lock, 0, sizeof(*lock));
...@@ -274,8 +282,10 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) ...@@ -274,8 +282,10 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
} }
int int
nlmsvc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) nlmsvc_encode_shareres(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_res *resp = rqstp->rq_resp;
if (!(p = nlm_encode_cookie(p, &resp->cookie))) if (!(p = nlm_encode_cookie(p, &resp->cookie)))
return 0; return 0;
*p++ = resp->status; *p++ = resp->status;
...@@ -284,8 +294,10 @@ nlmsvc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) ...@@ -284,8 +294,10 @@ nlmsvc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
} }
int int
nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_res *resp = rqstp->rq_resp;
if (!(p = nlm_encode_cookie(p, &resp->cookie))) if (!(p = nlm_encode_cookie(p, &resp->cookie)))
return 0; return 0;
*p++ = resp->status; *p++ = resp->status;
...@@ -293,8 +305,9 @@ nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) ...@@ -293,8 +305,9 @@ nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
} }
int int
nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp) nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_lock *lock = &argp->lock; struct nlm_lock *lock = &argp->lock;
if (!(p = xdr_decode_string_inplace(p, &lock->caller, if (!(p = xdr_decode_string_inplace(p, &lock->caller,
...@@ -305,8 +318,10 @@ nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp) ...@@ -305,8 +318,10 @@ nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp)
} }
int int
nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp) nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_reboot *argp = rqstp->rq_argp;
if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN))) if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
return 0; return 0;
argp->state = ntohl(*p++); argp->state = ntohl(*p++);
...@@ -316,8 +331,10 @@ nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp) ...@@ -316,8 +331,10 @@ nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp)
} }
int int
nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_res *resp = rqstp->rq_argp;
if (!(p = nlm_decode_cookie(p, &resp->cookie))) if (!(p = nlm_decode_cookie(p, &resp->cookie)))
return 0; return 0;
resp->status = *p++; resp->status = *p++;
...@@ -325,13 +342,13 @@ nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) ...@@ -325,13 +342,13 @@ nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
} }
int int
nlmsvc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) nlmsvc_decode_void(struct svc_rqst *rqstp, __be32 *p)
{ {
return xdr_argsize_check(rqstp, p); return xdr_argsize_check(rqstp, p);
} }
int int
nlmsvc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) nlmsvc_encode_void(struct svc_rqst *rqstp, __be32 *p)
{ {
return xdr_ressize_check(rqstp, p); return xdr_ressize_check(rqstp, p);
} }
...@@ -179,8 +179,9 @@ nlm4_encode_testres(__be32 *p, struct nlm_res *resp) ...@@ -179,8 +179,9 @@ nlm4_encode_testres(__be32 *p, struct nlm_res *resp)
* First, the server side XDR functions * First, the server side XDR functions
*/ */
int int
nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_args *argp = rqstp->rq_argp;
u32 exclusive; u32 exclusive;
if (!(p = nlm4_decode_cookie(p, &argp->cookie))) if (!(p = nlm4_decode_cookie(p, &argp->cookie)))
...@@ -196,16 +197,19 @@ nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) ...@@ -196,16 +197,19 @@ nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
} }
int int
nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_res *resp = rqstp->rq_resp;
if (!(p = nlm4_encode_testres(p, resp))) if (!(p = nlm4_encode_testres(p, resp)))
return 0; return 0;
return xdr_ressize_check(rqstp, p); return xdr_ressize_check(rqstp, p);
} }
int int
nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_args *argp = rqstp->rq_argp;
u32 exclusive; u32 exclusive;
if (!(p = nlm4_decode_cookie(p, &argp->cookie))) if (!(p = nlm4_decode_cookie(p, &argp->cookie)))
...@@ -224,8 +228,9 @@ nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) ...@@ -224,8 +228,9 @@ nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
} }
int int
nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_args *argp = rqstp->rq_argp;
u32 exclusive; u32 exclusive;
if (!(p = nlm4_decode_cookie(p, &argp->cookie))) if (!(p = nlm4_decode_cookie(p, &argp->cookie)))
...@@ -240,8 +245,10 @@ nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) ...@@ -240,8 +245,10 @@ nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
} }
int int
nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_args *argp = rqstp->rq_argp;
if (!(p = nlm4_decode_cookie(p, &argp->cookie)) if (!(p = nlm4_decode_cookie(p, &argp->cookie))
|| !(p = nlm4_decode_lock(p, &argp->lock))) || !(p = nlm4_decode_lock(p, &argp->lock)))
return 0; return 0;
...@@ -250,8 +257,9 @@ nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) ...@@ -250,8 +257,9 @@ nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
} }
int int
nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_lock *lock = &argp->lock; struct nlm_lock *lock = &argp->lock;
memset(lock, 0, sizeof(*lock)); memset(lock, 0, sizeof(*lock));
...@@ -271,8 +279,10 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp) ...@@ -271,8 +279,10 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
} }
int int
nlm4svc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) nlm4svc_encode_shareres(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_res *resp = rqstp->rq_resp;
if (!(p = nlm4_encode_cookie(p, &resp->cookie))) if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
return 0; return 0;
*p++ = resp->status; *p++ = resp->status;
...@@ -281,8 +291,10 @@ nlm4svc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) ...@@ -281,8 +291,10 @@ nlm4svc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
} }
int int
nlm4svc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) nlm4svc_encode_res(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_res *resp = rqstp->rq_resp;
if (!(p = nlm4_encode_cookie(p, &resp->cookie))) if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
return 0; return 0;
*p++ = resp->status; *p++ = resp->status;
...@@ -290,8 +302,9 @@ nlm4svc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) ...@@ -290,8 +302,9 @@ nlm4svc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
} }
int int
nlm4svc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp) nlm4svc_decode_notify(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_args *argp = rqstp->rq_argp;
struct nlm_lock *lock = &argp->lock; struct nlm_lock *lock = &argp->lock;
if (!(p = xdr_decode_string_inplace(p, &lock->caller, if (!(p = xdr_decode_string_inplace(p, &lock->caller,
...@@ -302,8 +315,10 @@ nlm4svc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp) ...@@ -302,8 +315,10 @@ nlm4svc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp)
} }
int int
nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp) nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_reboot *argp = rqstp->rq_argp;
if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN))) if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
return 0; return 0;
argp->state = ntohl(*p++); argp->state = ntohl(*p++);
...@@ -313,8 +328,10 @@ nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp ...@@ -313,8 +328,10 @@ nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp
} }
int int
nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nlm_res *resp = rqstp->rq_argp;
if (!(p = nlm4_decode_cookie(p, &resp->cookie))) if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
return 0; return 0;
resp->status = *p++; resp->status = *p++;
...@@ -322,13 +339,13 @@ nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) ...@@ -322,13 +339,13 @@ nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
} }
int int
nlm4svc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) nlm4svc_decode_void(struct svc_rqst *rqstp, __be32 *p)
{ {
return xdr_argsize_check(rqstp, p); return xdr_argsize_check(rqstp, p);
} }
int int
nlm4svc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) nlm4svc_encode_void(struct svc_rqst *rqstp, __be32 *p)
{ {
return xdr_ressize_check(rqstp, p); return xdr_ressize_check(rqstp, p);
} }
...@@ -439,7 +439,7 @@ static int nfs_callback_authenticate(struct svc_rqst *rqstp) ...@@ -439,7 +439,7 @@ static int nfs_callback_authenticate(struct svc_rqst *rqstp)
/* /*
* Define NFS4 callback program * Define NFS4 callback program
*/ */
static struct svc_version *nfs4_callback_version[] = { static const struct svc_version *nfs4_callback_version[] = {
[1] = &nfs4_callback_version1, [1] = &nfs4_callback_version1,
[4] = &nfs4_callback_version4, [4] = &nfs4_callback_version4,
}; };
......
...@@ -114,8 +114,7 @@ struct cb_sequenceres { ...@@ -114,8 +114,7 @@ struct cb_sequenceres {
uint32_t csr_target_highestslotid; uint32_t csr_target_highestslotid;
}; };
extern __be32 nfs4_callback_sequence(struct cb_sequenceargs *args, extern __be32 nfs4_callback_sequence(void *argp, void *resp,
struct cb_sequenceres *res,
struct cb_process_state *cps); struct cb_process_state *cps);
#define RCA4_TYPE_MASK_RDATA_DLG 0 #define RCA4_TYPE_MASK_RDATA_DLG 0
...@@ -134,15 +133,13 @@ struct cb_recallanyargs { ...@@ -134,15 +133,13 @@ struct cb_recallanyargs {
uint32_t craa_type_mask; uint32_t craa_type_mask;
}; };
extern __be32 nfs4_callback_recallany(struct cb_recallanyargs *args, extern __be32 nfs4_callback_recallany(void *argp, void *resp,
void *dummy,
struct cb_process_state *cps); struct cb_process_state *cps);
struct cb_recallslotargs { struct cb_recallslotargs {
uint32_t crsa_target_highest_slotid; uint32_t crsa_target_highest_slotid;
}; };
extern __be32 nfs4_callback_recallslot(struct cb_recallslotargs *args, extern __be32 nfs4_callback_recallslot(void *argp, void *resp,
void *dummy,
struct cb_process_state *cps); struct cb_process_state *cps);
struct cb_layoutrecallargs { struct cb_layoutrecallargs {
...@@ -159,9 +156,8 @@ struct cb_layoutrecallargs { ...@@ -159,9 +156,8 @@ struct cb_layoutrecallargs {
}; };
}; };
extern __be32 nfs4_callback_layoutrecall( extern __be32 nfs4_callback_layoutrecall(void *argp, void *resp,
struct cb_layoutrecallargs *args, struct cb_process_state *cps);
void *dummy, struct cb_process_state *cps);
struct cb_devicenotifyitem { struct cb_devicenotifyitem {
uint32_t cbd_notify_type; uint32_t cbd_notify_type;
...@@ -175,9 +171,8 @@ struct cb_devicenotifyargs { ...@@ -175,9 +171,8 @@ struct cb_devicenotifyargs {
struct cb_devicenotifyitem *devs; struct cb_devicenotifyitem *devs;
}; };
extern __be32 nfs4_callback_devicenotify( extern __be32 nfs4_callback_devicenotify(void *argp, void *resp,
struct cb_devicenotifyargs *args, struct cb_process_state *cps);
void *dummy, struct cb_process_state *cps);
struct cb_notify_lock_args { struct cb_notify_lock_args {
struct nfs_fh cbnl_fh; struct nfs_fh cbnl_fh;
...@@ -185,15 +180,13 @@ struct cb_notify_lock_args { ...@@ -185,15 +180,13 @@ struct cb_notify_lock_args {
bool cbnl_valid; bool cbnl_valid;
}; };
extern __be32 nfs4_callback_notify_lock(struct cb_notify_lock_args *args, extern __be32 nfs4_callback_notify_lock(void *argp, void *resp,
void *dummy,
struct cb_process_state *cps); struct cb_process_state *cps);
#endif /* CONFIG_NFS_V4_1 */ #endif /* CONFIG_NFS_V4_1 */
extern int check_gss_callback_principal(struct nfs_client *, struct svc_rqst *); extern int check_gss_callback_principal(struct nfs_client *, struct svc_rqst *);
extern __be32 nfs4_callback_getattr(struct cb_getattrargs *args, extern __be32 nfs4_callback_getattr(void *argp, void *resp,
struct cb_getattrres *res,
struct cb_process_state *cps); struct cb_process_state *cps);
extern __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy, extern __be32 nfs4_callback_recall(void *argp, void *resp,
struct cb_process_state *cps); struct cb_process_state *cps);
#if IS_ENABLED(CONFIG_NFS_V4) #if IS_ENABLED(CONFIG_NFS_V4)
extern int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt); extern int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt);
......
...@@ -19,10 +19,11 @@ ...@@ -19,10 +19,11 @@
#define NFSDBG_FACILITY NFSDBG_CALLBACK #define NFSDBG_FACILITY NFSDBG_CALLBACK
__be32 nfs4_callback_getattr(struct cb_getattrargs *args, __be32 nfs4_callback_getattr(void *argp, void *resp,
struct cb_getattrres *res,
struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_getattrargs *args = argp;
struct cb_getattrres *res = resp;
struct nfs_delegation *delegation; struct nfs_delegation *delegation;
struct nfs_inode *nfsi; struct nfs_inode *nfsi;
struct inode *inode; struct inode *inode;
...@@ -68,9 +69,10 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args, ...@@ -68,9 +69,10 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args,
return res->status; return res->status;
} }
__be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy, __be32 nfs4_callback_recall(void *argp, void *resp,
struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_recallargs *args = argp;
struct inode *inode; struct inode *inode;
__be32 res; __be32 res;
...@@ -324,9 +326,10 @@ static u32 do_callback_layoutrecall(struct nfs_client *clp, ...@@ -324,9 +326,10 @@ static u32 do_callback_layoutrecall(struct nfs_client *clp,
return initiate_bulk_draining(clp, args); return initiate_bulk_draining(clp, args);
} }
__be32 nfs4_callback_layoutrecall(struct cb_layoutrecallargs *args, __be32 nfs4_callback_layoutrecall(void *argp, void *resp,
void *dummy, struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_layoutrecallargs *args = argp;
u32 res = NFS4ERR_OP_NOT_IN_SESSION; u32 res = NFS4ERR_OP_NOT_IN_SESSION;
if (cps->clp) if (cps->clp)
...@@ -345,9 +348,10 @@ static void pnfs_recall_all_layouts(struct nfs_client *clp) ...@@ -345,9 +348,10 @@ static void pnfs_recall_all_layouts(struct nfs_client *clp)
do_callback_layoutrecall(clp, &args); do_callback_layoutrecall(clp, &args);
} }
__be32 nfs4_callback_devicenotify(struct cb_devicenotifyargs *args, __be32 nfs4_callback_devicenotify(void *argp, void *resp,
void *dummy, struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_devicenotifyargs *args = argp;
int i; int i;
__be32 res = 0; __be32 res = 0;
struct nfs_client *clp = cps->clp; struct nfs_client *clp = cps->clp;
...@@ -469,10 +473,11 @@ static bool referring_call_exists(struct nfs_client *clp, ...@@ -469,10 +473,11 @@ static bool referring_call_exists(struct nfs_client *clp,
return status; return status;
} }
__be32 nfs4_callback_sequence(struct cb_sequenceargs *args, __be32 nfs4_callback_sequence(void *argp, void *resp,
struct cb_sequenceres *res,
struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_sequenceargs *args = argp;
struct cb_sequenceres *res = resp;
struct nfs4_slot_table *tbl; struct nfs4_slot_table *tbl;
struct nfs4_slot *slot; struct nfs4_slot *slot;
struct nfs_client *clp; struct nfs_client *clp;
...@@ -571,9 +576,10 @@ validate_bitmap_values(unsigned long mask) ...@@ -571,9 +576,10 @@ validate_bitmap_values(unsigned long mask)
return (mask & ~RCA4_TYPE_MASK_ALL) == 0; return (mask & ~RCA4_TYPE_MASK_ALL) == 0;
} }
__be32 nfs4_callback_recallany(struct cb_recallanyargs *args, void *dummy, __be32 nfs4_callback_recallany(void *argp, void *resp,
struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_recallanyargs *args = argp;
__be32 status; __be32 status;
fmode_t flags = 0; fmode_t flags = 0;
...@@ -606,9 +612,10 @@ __be32 nfs4_callback_recallany(struct cb_recallanyargs *args, void *dummy, ...@@ -606,9 +612,10 @@ __be32 nfs4_callback_recallany(struct cb_recallanyargs *args, void *dummy,
} }
/* Reduce the fore channel's max_slots to the target value */ /* Reduce the fore channel's max_slots to the target value */
__be32 nfs4_callback_recallslot(struct cb_recallslotargs *args, void *dummy, __be32 nfs4_callback_recallslot(void *argp, void *resp,
struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_recallslotargs *args = argp;
struct nfs4_slot_table *fc_tbl; struct nfs4_slot_table *fc_tbl;
__be32 status; __be32 status;
...@@ -631,9 +638,11 @@ __be32 nfs4_callback_recallslot(struct cb_recallslotargs *args, void *dummy, ...@@ -631,9 +638,11 @@ __be32 nfs4_callback_recallslot(struct cb_recallslotargs *args, void *dummy,
return status; return status;
} }
__be32 nfs4_callback_notify_lock(struct cb_notify_lock_args *args, void *dummy, __be32 nfs4_callback_notify_lock(void *argp, void *resp,
struct cb_process_state *cps) struct cb_process_state *cps)
{ {
struct cb_notify_lock_args *args = argp;
if (!cps->clp) /* set in cb_sequence */ if (!cps->clp) /* set in cb_sequence */
return htonl(NFS4ERR_OP_NOT_IN_SESSION); return htonl(NFS4ERR_OP_NOT_IN_SESSION);
......
...@@ -43,32 +43,27 @@ ...@@ -43,32 +43,27 @@
/* Internal error code */ /* Internal error code */
#define NFS4ERR_RESOURCE_HDR 11050 #define NFS4ERR_RESOURCE_HDR 11050
typedef __be32 (*callback_process_op_t)(void *, void *,
struct cb_process_state *);
typedef __be32 (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *);
typedef __be32 (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *);
struct callback_op { struct callback_op {
callback_process_op_t process_op; __be32 (*process_op)(void *, void *, struct cb_process_state *);
callback_decode_arg_t decode_args; __be32 (*decode_args)(struct svc_rqst *, struct xdr_stream *, void *);
callback_encode_res_t encode_res; __be32 (*encode_res)(struct svc_rqst *, struct xdr_stream *,
const void *);
long res_maxsize; long res_maxsize;
}; };
static struct callback_op callback_ops[]; static struct callback_op callback_ops[];
static __be32 nfs4_callback_null(struct svc_rqst *rqstp, void *argp, void *resp) static __be32 nfs4_callback_null(struct svc_rqst *rqstp)
{ {
return htonl(NFS4_OK); return htonl(NFS4_OK);
} }
static int nfs4_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) static int nfs4_decode_void(struct svc_rqst *rqstp, __be32 *p)
{ {
return xdr_argsize_check(rqstp, p); return xdr_argsize_check(rqstp, p);
} }
static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p)
{ {
return xdr_ressize_check(rqstp, p); return xdr_ressize_check(rqstp, p);
} }
...@@ -184,8 +179,10 @@ static __be32 decode_op_hdr(struct xdr_stream *xdr, unsigned int *op) ...@@ -184,8 +179,10 @@ static __be32 decode_op_hdr(struct xdr_stream *xdr, unsigned int *op)
return 0; return 0;
} }
static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_getattrargs *args) static __be32 decode_getattr_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, void *argp)
{ {
struct cb_getattrargs *args = argp;
__be32 status; __be32 status;
status = decode_fh(xdr, &args->fh); status = decode_fh(xdr, &args->fh);
...@@ -194,8 +191,10 @@ static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr ...@@ -194,8 +191,10 @@ static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr
return decode_bitmap(xdr, args->bitmap); return decode_bitmap(xdr, args->bitmap);
} }
static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args) static __be32 decode_recall_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, void *argp)
{ {
struct cb_recallargs *args = argp;
__be32 *p; __be32 *p;
__be32 status; __be32 status;
...@@ -217,9 +216,9 @@ static __be32 decode_layout_stateid(struct xdr_stream *xdr, nfs4_stateid *statei ...@@ -217,9 +216,9 @@ static __be32 decode_layout_stateid(struct xdr_stream *xdr, nfs4_stateid *statei
} }
static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp, static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr, void *argp)
struct cb_layoutrecallargs *args)
{ {
struct cb_layoutrecallargs *args = argp;
__be32 *p; __be32 *p;
__be32 status = 0; __be32 status = 0;
uint32_t iomode; uint32_t iomode;
...@@ -262,8 +261,9 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp, ...@@ -262,8 +261,9 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
static static
__be32 decode_devicenotify_args(struct svc_rqst *rqstp, __be32 decode_devicenotify_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct cb_devicenotifyargs *args) void *argp)
{ {
struct cb_devicenotifyargs *args = argp;
__be32 *p; __be32 *p;
__be32 status = 0; __be32 status = 0;
u32 tmp; u32 tmp;
...@@ -403,8 +403,9 @@ static __be32 decode_rc_list(struct xdr_stream *xdr, ...@@ -403,8 +403,9 @@ static __be32 decode_rc_list(struct xdr_stream *xdr,
static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp, static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct cb_sequenceargs *args) void *argp)
{ {
struct cb_sequenceargs *args = argp;
__be32 *p; __be32 *p;
int i; int i;
__be32 status; __be32 status;
...@@ -450,8 +451,9 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp, ...@@ -450,8 +451,9 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp,
static __be32 decode_recallany_args(struct svc_rqst *rqstp, static __be32 decode_recallany_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct cb_recallanyargs *args) void *argp)
{ {
struct cb_recallanyargs *args = argp;
uint32_t bitmap[2]; uint32_t bitmap[2];
__be32 *p, status; __be32 *p, status;
...@@ -469,8 +471,9 @@ static __be32 decode_recallany_args(struct svc_rqst *rqstp, ...@@ -469,8 +471,9 @@ static __be32 decode_recallany_args(struct svc_rqst *rqstp,
static __be32 decode_recallslot_args(struct svc_rqst *rqstp, static __be32 decode_recallslot_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct cb_recallslotargs *args) void *argp)
{ {
struct cb_recallslotargs *args = argp;
__be32 *p; __be32 *p;
p = read_buf(xdr, 4); p = read_buf(xdr, 4);
...@@ -510,8 +513,10 @@ static __be32 decode_lockowner(struct xdr_stream *xdr, struct cb_notify_lock_arg ...@@ -510,8 +513,10 @@ static __be32 decode_lockowner(struct xdr_stream *xdr, struct cb_notify_lock_arg
return 0; return 0;
} }
static __be32 decode_notify_lock_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_notify_lock_args *args) static __be32 decode_notify_lock_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, void *argp)
{ {
struct cb_notify_lock_args *args = argp;
__be32 status; __be32 status;
status = decode_fh(xdr, &args->cbnl_fh); status = decode_fh(xdr, &args->cbnl_fh);
...@@ -641,8 +646,10 @@ static __be32 encode_op_hdr(struct xdr_stream *xdr, uint32_t op, __be32 res) ...@@ -641,8 +646,10 @@ static __be32 encode_op_hdr(struct xdr_stream *xdr, uint32_t op, __be32 res)
return 0; return 0;
} }
static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res) static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr,
const void *resp)
{ {
const struct cb_getattrres *res = resp;
__be32 *savep = NULL; __be32 *savep = NULL;
__be32 status = res->status; __be32 status = res->status;
...@@ -683,8 +690,9 @@ static __be32 encode_sessionid(struct xdr_stream *xdr, ...@@ -683,8 +690,9 @@ static __be32 encode_sessionid(struct xdr_stream *xdr,
static __be32 encode_cb_sequence_res(struct svc_rqst *rqstp, static __be32 encode_cb_sequence_res(struct svc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct cb_sequenceres *res) const void *resp)
{ {
const struct cb_sequenceres *res = resp;
__be32 *p; __be32 *p;
__be32 status = res->csr_status; __be32 status = res->csr_status;
...@@ -871,7 +879,7 @@ static __be32 process_op(int nop, struct svc_rqst *rqstp, ...@@ -871,7 +879,7 @@ static __be32 process_op(int nop, struct svc_rqst *rqstp,
/* /*
* Decode, process and encode a COMPOUND * Decode, process and encode a COMPOUND
*/ */
static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp) static __be32 nfs4_callback_compound(struct svc_rqst *rqstp)
{ {
struct cb_compound_hdr_arg hdr_arg = { 0 }; struct cb_compound_hdr_arg hdr_arg = { 0 };
struct cb_compound_hdr_res hdr_res = { NULL }; struct cb_compound_hdr_res hdr_res = { NULL };
...@@ -907,7 +915,8 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r ...@@ -907,7 +915,8 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
while (status == 0 && nops != hdr_arg.nops) { while (status == 0 && nops != hdr_arg.nops) {
status = process_op(nops, rqstp, &xdr_in, status = process_op(nops, rqstp, &xdr_in,
argp, &xdr_out, resp, &cps); rqstp->rq_argp, &xdr_out, rqstp->rq_resp,
&cps);
nops++; nops++;
} }
...@@ -937,48 +946,46 @@ static struct callback_op callback_ops[] = { ...@@ -937,48 +946,46 @@ static struct callback_op callback_ops[] = {
.res_maxsize = CB_OP_HDR_RES_MAXSZ, .res_maxsize = CB_OP_HDR_RES_MAXSZ,
}, },
[OP_CB_GETATTR] = { [OP_CB_GETATTR] = {
.process_op = (callback_process_op_t)nfs4_callback_getattr, .process_op = nfs4_callback_getattr,
.decode_args = (callback_decode_arg_t)decode_getattr_args, .decode_args = decode_getattr_args,
.encode_res = (callback_encode_res_t)encode_getattr_res, .encode_res = encode_getattr_res,
.res_maxsize = CB_OP_GETATTR_RES_MAXSZ, .res_maxsize = CB_OP_GETATTR_RES_MAXSZ,
}, },
[OP_CB_RECALL] = { [OP_CB_RECALL] = {
.process_op = (callback_process_op_t)nfs4_callback_recall, .process_op = nfs4_callback_recall,
.decode_args = (callback_decode_arg_t)decode_recall_args, .decode_args = decode_recall_args,
.res_maxsize = CB_OP_RECALL_RES_MAXSZ, .res_maxsize = CB_OP_RECALL_RES_MAXSZ,
}, },
#if defined(CONFIG_NFS_V4_1) #if defined(CONFIG_NFS_V4_1)
[OP_CB_LAYOUTRECALL] = { [OP_CB_LAYOUTRECALL] = {
.process_op = (callback_process_op_t)nfs4_callback_layoutrecall, .process_op = nfs4_callback_layoutrecall,
.decode_args = .decode_args = decode_layoutrecall_args,
(callback_decode_arg_t)decode_layoutrecall_args,
.res_maxsize = CB_OP_LAYOUTRECALL_RES_MAXSZ, .res_maxsize = CB_OP_LAYOUTRECALL_RES_MAXSZ,
}, },
[OP_CB_NOTIFY_DEVICEID] = { [OP_CB_NOTIFY_DEVICEID] = {
.process_op = (callback_process_op_t)nfs4_callback_devicenotify, .process_op = nfs4_callback_devicenotify,
.decode_args = .decode_args = decode_devicenotify_args,
(callback_decode_arg_t)decode_devicenotify_args,
.res_maxsize = CB_OP_DEVICENOTIFY_RES_MAXSZ, .res_maxsize = CB_OP_DEVICENOTIFY_RES_MAXSZ,
}, },
[OP_CB_SEQUENCE] = { [OP_CB_SEQUENCE] = {
.process_op = (callback_process_op_t)nfs4_callback_sequence, .process_op = nfs4_callback_sequence,
.decode_args = (callback_decode_arg_t)decode_cb_sequence_args, .decode_args = decode_cb_sequence_args,
.encode_res = (callback_encode_res_t)encode_cb_sequence_res, .encode_res = encode_cb_sequence_res,
.res_maxsize = CB_OP_SEQUENCE_RES_MAXSZ, .res_maxsize = CB_OP_SEQUENCE_RES_MAXSZ,
}, },
[OP_CB_RECALL_ANY] = { [OP_CB_RECALL_ANY] = {
.process_op = (callback_process_op_t)nfs4_callback_recallany, .process_op = nfs4_callback_recallany,
.decode_args = (callback_decode_arg_t)decode_recallany_args, .decode_args = decode_recallany_args,
.res_maxsize = CB_OP_RECALLANY_RES_MAXSZ, .res_maxsize = CB_OP_RECALLANY_RES_MAXSZ,
}, },
[OP_CB_RECALL_SLOT] = { [OP_CB_RECALL_SLOT] = {
.process_op = (callback_process_op_t)nfs4_callback_recallslot, .process_op = nfs4_callback_recallslot,
.decode_args = (callback_decode_arg_t)decode_recallslot_args, .decode_args = decode_recallslot_args,
.res_maxsize = CB_OP_RECALLSLOT_RES_MAXSZ, .res_maxsize = CB_OP_RECALLSLOT_RES_MAXSZ,
}, },
[OP_CB_NOTIFY_LOCK] = { [OP_CB_NOTIFY_LOCK] = {
.process_op = (callback_process_op_t)nfs4_callback_notify_lock, .process_op = nfs4_callback_notify_lock,
.decode_args = (callback_decode_arg_t)decode_notify_lock_args, .decode_args = decode_notify_lock_args,
.res_maxsize = CB_OP_NOTIFY_LOCK_RES_MAXSZ, .res_maxsize = CB_OP_NOTIFY_LOCK_RES_MAXSZ,
}, },
#endif /* CONFIG_NFS_V4_1 */ #endif /* CONFIG_NFS_V4_1 */
...@@ -987,36 +994,40 @@ static struct callback_op callback_ops[] = { ...@@ -987,36 +994,40 @@ static struct callback_op callback_ops[] = {
/* /*
* Define NFS4 callback procedures * Define NFS4 callback procedures
*/ */
static struct svc_procedure nfs4_callback_procedures1[] = { static const struct svc_procedure nfs4_callback_procedures1[] = {
[CB_NULL] = { [CB_NULL] = {
.pc_func = nfs4_callback_null, .pc_func = nfs4_callback_null,
.pc_decode = (kxdrproc_t)nfs4_decode_void, .pc_decode = nfs4_decode_void,
.pc_encode = (kxdrproc_t)nfs4_encode_void, .pc_encode = nfs4_encode_void,
.pc_xdrressize = 1, .pc_xdrressize = 1,
}, },
[CB_COMPOUND] = { [CB_COMPOUND] = {
.pc_func = nfs4_callback_compound, .pc_func = nfs4_callback_compound,
.pc_encode = (kxdrproc_t)nfs4_encode_void, .pc_encode = nfs4_encode_void,
.pc_argsize = 256, .pc_argsize = 256,
.pc_ressize = 256, .pc_ressize = 256,
.pc_xdrressize = NFS4_CALLBACK_BUFSIZE, .pc_xdrressize = NFS4_CALLBACK_BUFSIZE,
} }
}; };
struct svc_version nfs4_callback_version1 = { static unsigned int nfs4_callback_count1[ARRAY_SIZE(nfs4_callback_procedures1)];
const struct svc_version nfs4_callback_version1 = {
.vs_vers = 1, .vs_vers = 1,
.vs_nproc = ARRAY_SIZE(nfs4_callback_procedures1), .vs_nproc = ARRAY_SIZE(nfs4_callback_procedures1),
.vs_proc = nfs4_callback_procedures1, .vs_proc = nfs4_callback_procedures1,
.vs_count = nfs4_callback_count1,
.vs_xdrsize = NFS4_CALLBACK_XDRSIZE, .vs_xdrsize = NFS4_CALLBACK_XDRSIZE,
.vs_dispatch = NULL, .vs_dispatch = NULL,
.vs_hidden = true, .vs_hidden = true,
.vs_need_cong_ctrl = true, .vs_need_cong_ctrl = true,
}; };
struct svc_version nfs4_callback_version4 = { static unsigned int nfs4_callback_count4[ARRAY_SIZE(nfs4_callback_procedures1)];
const struct svc_version nfs4_callback_version4 = {
.vs_vers = 4, .vs_vers = 4,
.vs_nproc = ARRAY_SIZE(nfs4_callback_procedures1), .vs_nproc = ARRAY_SIZE(nfs4_callback_procedures1),
.vs_proc = nfs4_callback_procedures1, .vs_proc = nfs4_callback_procedures1,
.vs_count = nfs4_callback_count4,
.vs_xdrsize = NFS4_CALLBACK_XDRSIZE, .vs_xdrsize = NFS4_CALLBACK_XDRSIZE,
.vs_dispatch = NULL, .vs_dispatch = NULL,
.vs_hidden = true, .vs_hidden = true,
......
...@@ -226,8 +226,8 @@ static inline void nfs_fs_proc_exit(void) ...@@ -226,8 +226,8 @@ static inline void nfs_fs_proc_exit(void)
#endif #endif
/* callback_xdr.c */ /* callback_xdr.c */
extern struct svc_version nfs4_callback_version1; extern const struct svc_version nfs4_callback_version1;
extern struct svc_version nfs4_callback_version4; extern const struct svc_version nfs4_callback_version4;
struct nfs_pageio_descriptor; struct nfs_pageio_descriptor;
/* pagelist.c */ /* pagelist.c */
...@@ -271,12 +271,12 @@ static inline bool nfs_match_open_context(const struct nfs_open_context *ctx1, ...@@ -271,12 +271,12 @@ static inline bool nfs_match_open_context(const struct nfs_open_context *ctx1,
} }
/* nfs2xdr.c */ /* nfs2xdr.c */
extern struct rpc_procinfo nfs_procedures[]; extern const struct rpc_procinfo nfs_procedures[];
extern int nfs2_decode_dirent(struct xdr_stream *, extern int nfs2_decode_dirent(struct xdr_stream *,
struct nfs_entry *, int); struct nfs_entry *, int);
/* nfs3xdr.c */ /* nfs3xdr.c */
extern struct rpc_procinfo nfs3_procedures[]; extern const struct rpc_procinfo nfs3_procedures[];
extern int nfs3_decode_dirent(struct xdr_stream *, extern int nfs3_decode_dirent(struct xdr_stream *,
struct nfs_entry *, int); struct nfs_entry *, int);
...@@ -293,7 +293,7 @@ extern const u32 nfs41_maxgetdevinfo_overhead; ...@@ -293,7 +293,7 @@ extern const u32 nfs41_maxgetdevinfo_overhead;
/* nfs4proc.c */ /* nfs4proc.c */
#if IS_ENABLED(CONFIG_NFS_V4) #if IS_ENABLED(CONFIG_NFS_V4)
extern struct rpc_procinfo nfs4_procedures[]; extern const struct rpc_procinfo nfs4_procedures[];
#endif #endif
#ifdef CONFIG_NFS_V4_SECURITY_LABEL #ifdef CONFIG_NFS_V4_SECURITY_LABEL
......
...@@ -304,7 +304,7 @@ static void encode_mntdirpath(struct xdr_stream *xdr, const char *pathname) ...@@ -304,7 +304,7 @@ static void encode_mntdirpath(struct xdr_stream *xdr, const char *pathname)
} }
static void mnt_xdr_enc_dirpath(struct rpc_rqst *req, struct xdr_stream *xdr, static void mnt_xdr_enc_dirpath(struct rpc_rqst *req, struct xdr_stream *xdr,
const char *dirpath) const void *dirpath)
{ {
encode_mntdirpath(xdr, dirpath); encode_mntdirpath(xdr, dirpath);
} }
...@@ -357,8 +357,9 @@ static int decode_fhandle(struct xdr_stream *xdr, struct mountres *res) ...@@ -357,8 +357,9 @@ static int decode_fhandle(struct xdr_stream *xdr, struct mountres *res)
static int mnt_xdr_dec_mountres(struct rpc_rqst *req, static int mnt_xdr_dec_mountres(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct mountres *res) void *data)
{ {
struct mountres *res = data;
int status; int status;
status = decode_status(xdr, res); status = decode_status(xdr, res);
...@@ -449,8 +450,9 @@ static int decode_auth_flavors(struct xdr_stream *xdr, struct mountres *res) ...@@ -449,8 +450,9 @@ static int decode_auth_flavors(struct xdr_stream *xdr, struct mountres *res)
static int mnt_xdr_dec_mountres3(struct rpc_rqst *req, static int mnt_xdr_dec_mountres3(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct mountres *res) void *data)
{ {
struct mountres *res = data;
int status; int status;
status = decode_fhs_status(xdr, res); status = decode_fhs_status(xdr, res);
...@@ -464,11 +466,11 @@ static int mnt_xdr_dec_mountres3(struct rpc_rqst *req, ...@@ -464,11 +466,11 @@ static int mnt_xdr_dec_mountres3(struct rpc_rqst *req,
return decode_auth_flavors(xdr, res); return decode_auth_flavors(xdr, res);
} }
static struct rpc_procinfo mnt_procedures[] = { static const struct rpc_procinfo mnt_procedures[] = {
[MOUNTPROC_MNT] = { [MOUNTPROC_MNT] = {
.p_proc = MOUNTPROC_MNT, .p_proc = MOUNTPROC_MNT,
.p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, .p_encode = mnt_xdr_enc_dirpath,
.p_decode = (kxdrdproc_t)mnt_xdr_dec_mountres, .p_decode = mnt_xdr_dec_mountres,
.p_arglen = MNT_enc_dirpath_sz, .p_arglen = MNT_enc_dirpath_sz,
.p_replen = MNT_dec_mountres_sz, .p_replen = MNT_dec_mountres_sz,
.p_statidx = MOUNTPROC_MNT, .p_statidx = MOUNTPROC_MNT,
...@@ -476,18 +478,18 @@ static struct rpc_procinfo mnt_procedures[] = { ...@@ -476,18 +478,18 @@ static struct rpc_procinfo mnt_procedures[] = {
}, },
[MOUNTPROC_UMNT] = { [MOUNTPROC_UMNT] = {
.p_proc = MOUNTPROC_UMNT, .p_proc = MOUNTPROC_UMNT,
.p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, .p_encode = mnt_xdr_enc_dirpath,
.p_arglen = MNT_enc_dirpath_sz, .p_arglen = MNT_enc_dirpath_sz,
.p_statidx = MOUNTPROC_UMNT, .p_statidx = MOUNTPROC_UMNT,
.p_name = "UMOUNT", .p_name = "UMOUNT",
}, },
}; };
static struct rpc_procinfo mnt3_procedures[] = { static const struct rpc_procinfo mnt3_procedures[] = {
[MOUNTPROC3_MNT] = { [MOUNTPROC3_MNT] = {
.p_proc = MOUNTPROC3_MNT, .p_proc = MOUNTPROC3_MNT,
.p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, .p_encode = mnt_xdr_enc_dirpath,
.p_decode = (kxdrdproc_t)mnt_xdr_dec_mountres3, .p_decode = mnt_xdr_dec_mountres3,
.p_arglen = MNT_enc_dirpath_sz, .p_arglen = MNT_enc_dirpath_sz,
.p_replen = MNT_dec_mountres3_sz, .p_replen = MNT_dec_mountres3_sz,
.p_statidx = MOUNTPROC3_MNT, .p_statidx = MOUNTPROC3_MNT,
...@@ -495,24 +497,27 @@ static struct rpc_procinfo mnt3_procedures[] = { ...@@ -495,24 +497,27 @@ static struct rpc_procinfo mnt3_procedures[] = {
}, },
[MOUNTPROC3_UMNT] = { [MOUNTPROC3_UMNT] = {
.p_proc = MOUNTPROC3_UMNT, .p_proc = MOUNTPROC3_UMNT,
.p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, .p_encode = mnt_xdr_enc_dirpath,
.p_arglen = MNT_enc_dirpath_sz, .p_arglen = MNT_enc_dirpath_sz,
.p_statidx = MOUNTPROC3_UMNT, .p_statidx = MOUNTPROC3_UMNT,
.p_name = "UMOUNT", .p_name = "UMOUNT",
}, },
}; };
static unsigned int mnt_counts[ARRAY_SIZE(mnt_procedures)];
static const struct rpc_version mnt_version1 = { static const struct rpc_version mnt_version1 = {
.number = 1, .number = 1,
.nrprocs = ARRAY_SIZE(mnt_procedures), .nrprocs = ARRAY_SIZE(mnt_procedures),
.procs = mnt_procedures, .procs = mnt_procedures,
.counts = mnt_counts,
}; };
static unsigned int mnt3_counts[ARRAY_SIZE(mnt_procedures)];
static const struct rpc_version mnt_version3 = { static const struct rpc_version mnt_version3 = {
.number = 3, .number = 3,
.nrprocs = ARRAY_SIZE(mnt3_procedures), .nrprocs = ARRAY_SIZE(mnt3_procedures),
.procs = mnt3_procedures, .procs = mnt3_procedures,
.counts = mnt3_counts,
}; };
static const struct rpc_version *mnt_version[] = { static const struct rpc_version *mnt_version[] = {
......
...@@ -568,8 +568,10 @@ static int decode_diropres(struct xdr_stream *xdr, struct nfs_diropok *result) ...@@ -568,8 +568,10 @@ static int decode_diropres(struct xdr_stream *xdr, struct nfs_diropok *result)
static void nfs2_xdr_enc_fhandle(struct rpc_rqst *req, static void nfs2_xdr_enc_fhandle(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nfs_fh *fh) const void *data)
{ {
const struct nfs_fh *fh = data;
encode_fhandle(xdr, fh); encode_fhandle(xdr, fh);
} }
...@@ -583,23 +585,29 @@ static void nfs2_xdr_enc_fhandle(struct rpc_rqst *req, ...@@ -583,23 +585,29 @@ static void nfs2_xdr_enc_fhandle(struct rpc_rqst *req,
*/ */
static void nfs2_xdr_enc_sattrargs(struct rpc_rqst *req, static void nfs2_xdr_enc_sattrargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nfs_sattrargs *args) const void *data)
{ {
const struct nfs_sattrargs *args = data;
encode_fhandle(xdr, args->fh); encode_fhandle(xdr, args->fh);
encode_sattr(xdr, args->sattr); encode_sattr(xdr, args->sattr);
} }
static void nfs2_xdr_enc_diropargs(struct rpc_rqst *req, static void nfs2_xdr_enc_diropargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nfs_diropargs *args) const void *data)
{ {
const struct nfs_diropargs *args = data;
encode_diropargs(xdr, args->fh, args->name, args->len); encode_diropargs(xdr, args->fh, args->name, args->len);
} }
static void nfs2_xdr_enc_readlinkargs(struct rpc_rqst *req, static void nfs2_xdr_enc_readlinkargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nfs_readlinkargs *args) const void *data)
{ {
const struct nfs_readlinkargs *args = data;
encode_fhandle(xdr, args->fh); encode_fhandle(xdr, args->fh);
prepare_reply_buffer(req, args->pages, args->pgbase, prepare_reply_buffer(req, args->pages, args->pgbase,
args->pglen, NFS_readlinkres_sz); args->pglen, NFS_readlinkres_sz);
...@@ -632,8 +640,10 @@ static void encode_readargs(struct xdr_stream *xdr, ...@@ -632,8 +640,10 @@ static void encode_readargs(struct xdr_stream *xdr,
static void nfs2_xdr_enc_readargs(struct rpc_rqst *req, static void nfs2_xdr_enc_readargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nfs_pgio_args *args) const void *data)
{ {
const struct nfs_pgio_args *args = data;
encode_readargs(xdr, args); encode_readargs(xdr, args);
prepare_reply_buffer(req, args->pages, args->pgbase, prepare_reply_buffer(req, args->pages, args->pgbase,
args->count, NFS_readres_sz); args->count, NFS_readres_sz);
...@@ -672,8 +682,10 @@ static void encode_writeargs(struct xdr_stream *xdr, ...@@ -672,8 +682,10 @@ static void encode_writeargs(struct xdr_stream *xdr,
static void nfs2_xdr_enc_writeargs(struct rpc_rqst *req, static void nfs2_xdr_enc_writeargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nfs_pgio_args *args) const void *data)
{ {
const struct nfs_pgio_args *args = data;
encode_writeargs(xdr, args); encode_writeargs(xdr, args);
xdr->buf->flags |= XDRBUF_WRITE; xdr->buf->flags |= XDRBUF_WRITE;
} }
...@@ -688,16 +700,20 @@ static void nfs2_xdr_enc_writeargs(struct rpc_rqst *req, ...@@ -688,16 +700,20 @@ static void nfs2_xdr_enc_writeargs(struct rpc_rqst *req,
*/ */
static void nfs2_xdr_enc_createargs(struct rpc_rqst *req, static void nfs2_xdr_enc_createargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nfs_createargs *args) const void *data)
{ {
const struct nfs_createargs *args = data;
encode_diropargs(xdr, args->fh, args->name, args->len); encode_diropargs(xdr, args->fh, args->name, args->len);
encode_sattr(xdr, args->sattr); encode_sattr(xdr, args->sattr);
} }
static void nfs2_xdr_enc_removeargs(struct rpc_rqst *req, static void nfs2_xdr_enc_removeargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nfs_removeargs *args) const void *data)
{ {
const struct nfs_removeargs *args = data;
encode_diropargs(xdr, args->fh, args->name.name, args->name.len); encode_diropargs(xdr, args->fh, args->name.name, args->name.len);
} }
...@@ -711,8 +727,9 @@ static void nfs2_xdr_enc_removeargs(struct rpc_rqst *req, ...@@ -711,8 +727,9 @@ static void nfs2_xdr_enc_removeargs(struct rpc_rqst *req,
*/ */
static void nfs2_xdr_enc_renameargs(struct rpc_rqst *req, static void nfs2_xdr_enc_renameargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nfs_renameargs *args) const void *data)
{ {
const struct nfs_renameargs *args = data;
const struct qstr *old = args->old_name; const struct qstr *old = args->old_name;
const struct qstr *new = args->new_name; const struct qstr *new = args->new_name;
...@@ -730,8 +747,10 @@ static void nfs2_xdr_enc_renameargs(struct rpc_rqst *req, ...@@ -730,8 +747,10 @@ static void nfs2_xdr_enc_renameargs(struct rpc_rqst *req,
*/ */
static void nfs2_xdr_enc_linkargs(struct rpc_rqst *req, static void nfs2_xdr_enc_linkargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nfs_linkargs *args) const void *data)
{ {
const struct nfs_linkargs *args = data;
encode_fhandle(xdr, args->fromfh); encode_fhandle(xdr, args->fromfh);
encode_diropargs(xdr, args->tofh, args->toname, args->tolen); encode_diropargs(xdr, args->tofh, args->toname, args->tolen);
} }
...@@ -747,8 +766,10 @@ static void nfs2_xdr_enc_linkargs(struct rpc_rqst *req, ...@@ -747,8 +766,10 @@ static void nfs2_xdr_enc_linkargs(struct rpc_rqst *req,
*/ */
static void nfs2_xdr_enc_symlinkargs(struct rpc_rqst *req, static void nfs2_xdr_enc_symlinkargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nfs_symlinkargs *args) const void *data)
{ {
const struct nfs_symlinkargs *args = data;
encode_diropargs(xdr, args->fromfh, args->fromname, args->fromlen); encode_diropargs(xdr, args->fromfh, args->fromname, args->fromlen);
encode_path(xdr, args->pages, args->pathlen); encode_path(xdr, args->pages, args->pathlen);
encode_sattr(xdr, args->sattr); encode_sattr(xdr, args->sattr);
...@@ -777,8 +798,10 @@ static void encode_readdirargs(struct xdr_stream *xdr, ...@@ -777,8 +798,10 @@ static void encode_readdirargs(struct xdr_stream *xdr,
static void nfs2_xdr_enc_readdirargs(struct rpc_rqst *req, static void nfs2_xdr_enc_readdirargs(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nfs_readdirargs *args) const void *data)
{ {
const struct nfs_readdirargs *args = data;
encode_readdirargs(xdr, args); encode_readdirargs(xdr, args);
prepare_reply_buffer(req, args->pages, 0, prepare_reply_buffer(req, args->pages, 0,
args->count, NFS_readdirres_sz); args->count, NFS_readdirres_sz);
...@@ -809,13 +832,13 @@ static int nfs2_xdr_dec_stat(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -809,13 +832,13 @@ static int nfs2_xdr_dec_stat(struct rpc_rqst *req, struct xdr_stream *xdr,
} }
static int nfs2_xdr_dec_attrstat(struct rpc_rqst *req, struct xdr_stream *xdr, static int nfs2_xdr_dec_attrstat(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_fattr *result) void *result)
{ {
return decode_attrstat(xdr, result, NULL); return decode_attrstat(xdr, result, NULL);
} }
static int nfs2_xdr_dec_diropres(struct rpc_rqst *req, struct xdr_stream *xdr, static int nfs2_xdr_dec_diropres(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_diropok *result) void *result)
{ {
return decode_diropres(xdr, result); return decode_diropres(xdr, result);
} }
...@@ -860,8 +883,9 @@ static int nfs2_xdr_dec_readlinkres(struct rpc_rqst *req, ...@@ -860,8 +883,9 @@ static int nfs2_xdr_dec_readlinkres(struct rpc_rqst *req,
* }; * };
*/ */
static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr, static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_pgio_res *result) void *data)
{ {
struct nfs_pgio_res *result = data;
enum nfs_stat status; enum nfs_stat status;
int error; int error;
...@@ -882,8 +906,10 @@ static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -882,8 +906,10 @@ static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr,
} }
static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, struct xdr_stream *xdr, static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_pgio_res *result) void *data)
{ {
struct nfs_pgio_res *result = data;
/* All NFSv2 writes are "file sync" writes */ /* All NFSv2 writes are "file sync" writes */
result->verf->committed = NFS_FILE_SYNC; result->verf->committed = NFS_FILE_SYNC;
return decode_attrstat(xdr, result->fattr, &result->op_status); return decode_attrstat(xdr, result->fattr, &result->op_status);
...@@ -1034,7 +1060,7 @@ static int decode_info(struct xdr_stream *xdr, struct nfs2_fsstat *result) ...@@ -1034,7 +1060,7 @@ static int decode_info(struct xdr_stream *xdr, struct nfs2_fsstat *result)
} }
static int nfs2_xdr_dec_statfsres(struct rpc_rqst *req, struct xdr_stream *xdr, static int nfs2_xdr_dec_statfsres(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs2_fsstat *result) void *result)
{ {
enum nfs_stat status; enum nfs_stat status;
int error; int error;
...@@ -1118,15 +1144,15 @@ static int nfs_stat_to_errno(enum nfs_stat status) ...@@ -1118,15 +1144,15 @@ static int nfs_stat_to_errno(enum nfs_stat status)
#define PROC(proc, argtype, restype, timer) \ #define PROC(proc, argtype, restype, timer) \
[NFSPROC_##proc] = { \ [NFSPROC_##proc] = { \
.p_proc = NFSPROC_##proc, \ .p_proc = NFSPROC_##proc, \
.p_encode = (kxdreproc_t)nfs2_xdr_enc_##argtype, \ .p_encode = nfs2_xdr_enc_##argtype, \
.p_decode = (kxdrdproc_t)nfs2_xdr_dec_##restype, \ .p_decode = nfs2_xdr_dec_##restype, \
.p_arglen = NFS_##argtype##_sz, \ .p_arglen = NFS_##argtype##_sz, \
.p_replen = NFS_##restype##_sz, \ .p_replen = NFS_##restype##_sz, \
.p_timer = timer, \ .p_timer = timer, \
.p_statidx = NFSPROC_##proc, \ .p_statidx = NFSPROC_##proc, \
.p_name = #proc, \ .p_name = #proc, \
} }
struct rpc_procinfo nfs_procedures[] = { const struct rpc_procinfo nfs_procedures[] = {
PROC(GETATTR, fhandle, attrstat, 1), PROC(GETATTR, fhandle, attrstat, 1),
PROC(SETATTR, sattrargs, attrstat, 0), PROC(SETATTR, sattrargs, attrstat, 0),
PROC(LOOKUP, diropargs, diropres, 2), PROC(LOOKUP, diropargs, diropres, 2),
...@@ -1144,8 +1170,10 @@ struct rpc_procinfo nfs_procedures[] = { ...@@ -1144,8 +1170,10 @@ struct rpc_procinfo nfs_procedures[] = {
PROC(STATFS, fhandle, statfsres, 0), PROC(STATFS, fhandle, statfsres, 0),
}; };
static unsigned int nfs_version2_counts[ARRAY_SIZE(nfs_procedures)];
const struct rpc_version nfs_version2 = { const struct rpc_version nfs_version2 = {
.number = 2, .number = 2,
.nrprocs = ARRAY_SIZE(nfs_procedures), .nrprocs = ARRAY_SIZE(nfs_procedures),
.procs = nfs_procedures .procs = nfs_procedures,
.counts = nfs_version2_counts,
}; };
This diff is collapsed.
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
decode_getattr_maxsz) decode_getattr_maxsz)
static void encode_fallocate(struct xdr_stream *xdr, static void encode_fallocate(struct xdr_stream *xdr,
struct nfs42_falloc_args *args) const struct nfs42_falloc_args *args)
{ {
encode_nfs4_stateid(xdr, &args->falloc_stateid); encode_nfs4_stateid(xdr, &args->falloc_stateid);
encode_uint64(xdr, args->falloc_offset); encode_uint64(xdr, args->falloc_offset);
...@@ -120,7 +120,7 @@ static void encode_fallocate(struct xdr_stream *xdr, ...@@ -120,7 +120,7 @@ static void encode_fallocate(struct xdr_stream *xdr,
} }
static void encode_allocate(struct xdr_stream *xdr, static void encode_allocate(struct xdr_stream *xdr,
struct nfs42_falloc_args *args, const struct nfs42_falloc_args *args,
struct compound_hdr *hdr) struct compound_hdr *hdr)
{ {
encode_op_hdr(xdr, OP_ALLOCATE, decode_allocate_maxsz, hdr); encode_op_hdr(xdr, OP_ALLOCATE, decode_allocate_maxsz, hdr);
...@@ -128,7 +128,7 @@ static void encode_allocate(struct xdr_stream *xdr, ...@@ -128,7 +128,7 @@ static void encode_allocate(struct xdr_stream *xdr,
} }
static void encode_copy(struct xdr_stream *xdr, static void encode_copy(struct xdr_stream *xdr,
struct nfs42_copy_args *args, const struct nfs42_copy_args *args,
struct compound_hdr *hdr) struct compound_hdr *hdr)
{ {
encode_op_hdr(xdr, OP_COPY, decode_copy_maxsz, hdr); encode_op_hdr(xdr, OP_COPY, decode_copy_maxsz, hdr);
...@@ -145,7 +145,7 @@ static void encode_copy(struct xdr_stream *xdr, ...@@ -145,7 +145,7 @@ static void encode_copy(struct xdr_stream *xdr,
} }
static void encode_deallocate(struct xdr_stream *xdr, static void encode_deallocate(struct xdr_stream *xdr,
struct nfs42_falloc_args *args, const struct nfs42_falloc_args *args,
struct compound_hdr *hdr) struct compound_hdr *hdr)
{ {
encode_op_hdr(xdr, OP_DEALLOCATE, decode_deallocate_maxsz, hdr); encode_op_hdr(xdr, OP_DEALLOCATE, decode_deallocate_maxsz, hdr);
...@@ -153,7 +153,7 @@ static void encode_deallocate(struct xdr_stream *xdr, ...@@ -153,7 +153,7 @@ static void encode_deallocate(struct xdr_stream *xdr,
} }
static void encode_seek(struct xdr_stream *xdr, static void encode_seek(struct xdr_stream *xdr,
struct nfs42_seek_args *args, const struct nfs42_seek_args *args,
struct compound_hdr *hdr) struct compound_hdr *hdr)
{ {
encode_op_hdr(xdr, OP_SEEK, decode_seek_maxsz, hdr); encode_op_hdr(xdr, OP_SEEK, decode_seek_maxsz, hdr);
...@@ -163,7 +163,7 @@ static void encode_seek(struct xdr_stream *xdr, ...@@ -163,7 +163,7 @@ static void encode_seek(struct xdr_stream *xdr,
} }
static void encode_layoutstats(struct xdr_stream *xdr, static void encode_layoutstats(struct xdr_stream *xdr,
struct nfs42_layoutstat_args *args, const struct nfs42_layoutstat_args *args,
struct nfs42_layoutstat_devinfo *devinfo, struct nfs42_layoutstat_devinfo *devinfo,
struct compound_hdr *hdr) struct compound_hdr *hdr)
{ {
...@@ -191,7 +191,7 @@ static void encode_layoutstats(struct xdr_stream *xdr, ...@@ -191,7 +191,7 @@ static void encode_layoutstats(struct xdr_stream *xdr,
} }
static void encode_clone(struct xdr_stream *xdr, static void encode_clone(struct xdr_stream *xdr,
struct nfs42_clone_args *args, const struct nfs42_clone_args *args,
struct compound_hdr *hdr) struct compound_hdr *hdr)
{ {
__be32 *p; __be32 *p;
...@@ -210,8 +210,9 @@ static void encode_clone(struct xdr_stream *xdr, ...@@ -210,8 +210,9 @@ static void encode_clone(struct xdr_stream *xdr,
*/ */
static void nfs4_xdr_enc_allocate(struct rpc_rqst *req, static void nfs4_xdr_enc_allocate(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfs42_falloc_args *args) const void *data)
{ {
const struct nfs42_falloc_args *args = data;
struct compound_hdr hdr = { struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args), .minorversion = nfs4_xdr_minorversion(&args->seq_args),
}; };
...@@ -225,7 +226,7 @@ static void nfs4_xdr_enc_allocate(struct rpc_rqst *req, ...@@ -225,7 +226,7 @@ static void nfs4_xdr_enc_allocate(struct rpc_rqst *req,
} }
static void encode_copy_commit(struct xdr_stream *xdr, static void encode_copy_commit(struct xdr_stream *xdr,
struct nfs42_copy_args *args, const struct nfs42_copy_args *args,
struct compound_hdr *hdr) struct compound_hdr *hdr)
{ {
__be32 *p; __be32 *p;
...@@ -241,8 +242,9 @@ static void encode_copy_commit(struct xdr_stream *xdr, ...@@ -241,8 +242,9 @@ static void encode_copy_commit(struct xdr_stream *xdr,
*/ */
static void nfs4_xdr_enc_copy(struct rpc_rqst *req, static void nfs4_xdr_enc_copy(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfs42_copy_args *args) const void *data)
{ {
const struct nfs42_copy_args *args = data;
struct compound_hdr hdr = { struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args), .minorversion = nfs4_xdr_minorversion(&args->seq_args),
}; };
...@@ -262,8 +264,9 @@ static void nfs4_xdr_enc_copy(struct rpc_rqst *req, ...@@ -262,8 +264,9 @@ static void nfs4_xdr_enc_copy(struct rpc_rqst *req,
*/ */
static void nfs4_xdr_enc_deallocate(struct rpc_rqst *req, static void nfs4_xdr_enc_deallocate(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfs42_falloc_args *args) const void *data)
{ {
const struct nfs42_falloc_args *args = data;
struct compound_hdr hdr = { struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args), .minorversion = nfs4_xdr_minorversion(&args->seq_args),
}; };
...@@ -281,8 +284,9 @@ static void nfs4_xdr_enc_deallocate(struct rpc_rqst *req, ...@@ -281,8 +284,9 @@ static void nfs4_xdr_enc_deallocate(struct rpc_rqst *req,
*/ */
static void nfs4_xdr_enc_seek(struct rpc_rqst *req, static void nfs4_xdr_enc_seek(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfs42_seek_args *args) const void *data)
{ {
const struct nfs42_seek_args *args = data;
struct compound_hdr hdr = { struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args), .minorversion = nfs4_xdr_minorversion(&args->seq_args),
}; };
...@@ -299,8 +303,9 @@ static void nfs4_xdr_enc_seek(struct rpc_rqst *req, ...@@ -299,8 +303,9 @@ static void nfs4_xdr_enc_seek(struct rpc_rqst *req,
*/ */
static void nfs4_xdr_enc_layoutstats(struct rpc_rqst *req, static void nfs4_xdr_enc_layoutstats(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfs42_layoutstat_args *args) const void *data)
{ {
const struct nfs42_layoutstat_args *args = data;
int i; int i;
struct compound_hdr hdr = { struct compound_hdr hdr = {
...@@ -321,8 +326,9 @@ static void nfs4_xdr_enc_layoutstats(struct rpc_rqst *req, ...@@ -321,8 +326,9 @@ static void nfs4_xdr_enc_layoutstats(struct rpc_rqst *req,
*/ */
static void nfs4_xdr_enc_clone(struct rpc_rqst *req, static void nfs4_xdr_enc_clone(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfs42_clone_args *args) const void *data)
{ {
const struct nfs42_clone_args *args = data;
struct compound_hdr hdr = { struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args), .minorversion = nfs4_xdr_minorversion(&args->seq_args),
}; };
...@@ -448,8 +454,9 @@ static int decode_clone(struct xdr_stream *xdr) ...@@ -448,8 +454,9 @@ static int decode_clone(struct xdr_stream *xdr)
*/ */
static int nfs4_xdr_dec_allocate(struct rpc_rqst *rqstp, static int nfs4_xdr_dec_allocate(struct rpc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfs42_falloc_res *res) void *data)
{ {
struct nfs42_falloc_res *res = data;
struct compound_hdr hdr; struct compound_hdr hdr;
int status; int status;
...@@ -475,8 +482,9 @@ static int nfs4_xdr_dec_allocate(struct rpc_rqst *rqstp, ...@@ -475,8 +482,9 @@ static int nfs4_xdr_dec_allocate(struct rpc_rqst *rqstp,
*/ */
static int nfs4_xdr_dec_copy(struct rpc_rqst *rqstp, static int nfs4_xdr_dec_copy(struct rpc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfs42_copy_res *res) void *data)
{ {
struct nfs42_copy_res *res = data;
struct compound_hdr hdr; struct compound_hdr hdr;
int status; int status;
...@@ -508,8 +516,9 @@ static int nfs4_xdr_dec_copy(struct rpc_rqst *rqstp, ...@@ -508,8 +516,9 @@ static int nfs4_xdr_dec_copy(struct rpc_rqst *rqstp,
*/ */
static int nfs4_xdr_dec_deallocate(struct rpc_rqst *rqstp, static int nfs4_xdr_dec_deallocate(struct rpc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfs42_falloc_res *res) void *data)
{ {
struct nfs42_falloc_res *res = data;
struct compound_hdr hdr; struct compound_hdr hdr;
int status; int status;
...@@ -535,8 +544,9 @@ static int nfs4_xdr_dec_deallocate(struct rpc_rqst *rqstp, ...@@ -535,8 +544,9 @@ static int nfs4_xdr_dec_deallocate(struct rpc_rqst *rqstp,
*/ */
static int nfs4_xdr_dec_seek(struct rpc_rqst *rqstp, static int nfs4_xdr_dec_seek(struct rpc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfs42_seek_res *res) void *data)
{ {
struct nfs42_seek_res *res = data;
struct compound_hdr hdr; struct compound_hdr hdr;
int status; int status;
...@@ -559,8 +569,9 @@ static int nfs4_xdr_dec_seek(struct rpc_rqst *rqstp, ...@@ -559,8 +569,9 @@ static int nfs4_xdr_dec_seek(struct rpc_rqst *rqstp,
*/ */
static int nfs4_xdr_dec_layoutstats(struct rpc_rqst *rqstp, static int nfs4_xdr_dec_layoutstats(struct rpc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfs42_layoutstat_res *res) void *data)
{ {
struct nfs42_layoutstat_res *res = data;
struct compound_hdr hdr; struct compound_hdr hdr;
int status, i; int status, i;
...@@ -589,8 +600,9 @@ static int nfs4_xdr_dec_layoutstats(struct rpc_rqst *rqstp, ...@@ -589,8 +600,9 @@ static int nfs4_xdr_dec_layoutstats(struct rpc_rqst *rqstp,
*/ */
static int nfs4_xdr_dec_clone(struct rpc_rqst *rqstp, static int nfs4_xdr_dec_clone(struct rpc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfs42_clone_res *res) void *data)
{ {
struct nfs42_clone_res *res = data;
struct compound_hdr hdr; struct compound_hdr hdr;
int status; int status;
......
...@@ -493,13 +493,13 @@ static inline void nfs4_unregister_sysctl(void) ...@@ -493,13 +493,13 @@ static inline void nfs4_unregister_sysctl(void)
#endif #endif
/* nfs4xdr.c */ /* nfs4xdr.c */
extern struct rpc_procinfo nfs4_procedures[]; extern const struct rpc_procinfo nfs4_procedures[];
struct nfs4_mount_data; struct nfs4_mount_data;
/* callback_xdr.c */ /* callback_xdr.c */
extern struct svc_version nfs4_callback_version1; extern const struct svc_version nfs4_callback_version1;
extern struct svc_version nfs4_callback_version4; extern const struct svc_version nfs4_callback_version4;
static inline void nfs4_stateid_copy(nfs4_stateid *dst, const nfs4_stateid *src) static inline void nfs4_stateid_copy(nfs4_stateid *dst, const nfs4_stateid *src)
{ {
......
This diff is collapsed.
...@@ -8,21 +8,33 @@ extern void clear_current_stateid(struct nfsd4_compound_state *cstate); ...@@ -8,21 +8,33 @@ extern void clear_current_stateid(struct nfsd4_compound_state *cstate);
/* /*
* functions to set current state id * functions to set current state id
*/ */
extern void nfsd4_set_opendowngradestateid(struct nfsd4_compound_state *cstate, struct nfsd4_open_downgrade *); extern void nfsd4_set_opendowngradestateid(struct nfsd4_compound_state *,
extern void nfsd4_set_openstateid(struct nfsd4_compound_state *, struct nfsd4_open *); union nfsd4_op_u *);
extern void nfsd4_set_lockstateid(struct nfsd4_compound_state *, struct nfsd4_lock *); extern void nfsd4_set_openstateid(struct nfsd4_compound_state *,
extern void nfsd4_set_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *); union nfsd4_op_u *);
extern void nfsd4_set_lockstateid(struct nfsd4_compound_state *,
union nfsd4_op_u *);
extern void nfsd4_set_closestateid(struct nfsd4_compound_state *,
union nfsd4_op_u *);
/* /*
* functions to consume current state id * functions to consume current state id
*/ */
extern void nfsd4_get_opendowngradestateid(struct nfsd4_compound_state *cstate, struct nfsd4_open_downgrade *); extern void nfsd4_get_opendowngradestateid(struct nfsd4_compound_state *,
extern void nfsd4_get_delegreturnstateid(struct nfsd4_compound_state *, struct nfsd4_delegreturn *); union nfsd4_op_u *);
extern void nfsd4_get_freestateid(struct nfsd4_compound_state *, struct nfsd4_free_stateid *); extern void nfsd4_get_delegreturnstateid(struct nfsd4_compound_state *,
extern void nfsd4_get_setattrstateid(struct nfsd4_compound_state *, struct nfsd4_setattr *); union nfsd4_op_u *);
extern void nfsd4_get_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *); extern void nfsd4_get_freestateid(struct nfsd4_compound_state *,
extern void nfsd4_get_lockustateid(struct nfsd4_compound_state *, struct nfsd4_locku *); union nfsd4_op_u *);
extern void nfsd4_get_readstateid(struct nfsd4_compound_state *, struct nfsd4_read *); extern void nfsd4_get_setattrstateid(struct nfsd4_compound_state *,
extern void nfsd4_get_writestateid(struct nfsd4_compound_state *, struct nfsd4_write *); union nfsd4_op_u *);
extern void nfsd4_get_closestateid(struct nfsd4_compound_state *,
union nfsd4_op_u *);
extern void nfsd4_get_lockustateid(struct nfsd4_compound_state *,
union nfsd4_op_u *);
extern void nfsd4_get_readstateid(struct nfsd4_compound_state *,
union nfsd4_op_u *);
extern void nfsd4_get_writestateid(struct nfsd4_compound_state *,
union nfsd4_op_u *);
#endif /* _NFSD4_CURRENT_STATE_H */ #endif /* _NFSD4_CURRENT_STATE_H */
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* NULL call. * NULL call.
*/ */
static __be32 static __be32
nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) nfsacld_proc_null(struct svc_rqst *rqstp)
{ {
return nfs_ok; return nfs_ok;
} }
...@@ -27,9 +27,10 @@ nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) ...@@ -27,9 +27,10 @@ nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
/* /*
* Get the Access and/or Default ACL of a file. * Get the Access and/or Default ACL of a file.
*/ */
static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp, static __be32 nfsacld_proc_getacl(struct svc_rqst *rqstp)
struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp)
{ {
struct nfsd3_getaclargs *argp = rqstp->rq_argp;
struct nfsd3_getaclres *resp = rqstp->rq_resp;
struct posix_acl *acl; struct posix_acl *acl;
struct inode *inode; struct inode *inode;
svc_fh *fh; svc_fh *fh;
...@@ -87,10 +88,10 @@ static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp, ...@@ -87,10 +88,10 @@ static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp,
/* /*
* Set the Access and/or Default ACL of a file. * Set the Access and/or Default ACL of a file.
*/ */
static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp, static __be32 nfsacld_proc_setacl(struct svc_rqst *rqstp)
struct nfsd3_setaclargs *argp,
struct nfsd_attrstat *resp)
{ {
struct nfsd3_setaclargs *argp = rqstp->rq_argp;
struct nfsd_attrstat *resp = rqstp->rq_resp;
struct inode *inode; struct inode *inode;
svc_fh *fh; svc_fh *fh;
__be32 nfserr = 0; __be32 nfserr = 0;
...@@ -141,9 +142,10 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp, ...@@ -141,9 +142,10 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp,
/* /*
* Check file attributes * Check file attributes
*/ */
static __be32 nfsacld_proc_getattr(struct svc_rqst * rqstp, static __be32 nfsacld_proc_getattr(struct svc_rqst *rqstp)
struct nfsd_fhandle *argp, struct nfsd_attrstat *resp)
{ {
struct nfsd_fhandle *argp = rqstp->rq_argp;
struct nfsd_attrstat *resp = rqstp->rq_resp;
__be32 nfserr; __be32 nfserr;
dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh));
...@@ -158,9 +160,10 @@ static __be32 nfsacld_proc_getattr(struct svc_rqst * rqstp, ...@@ -158,9 +160,10 @@ static __be32 nfsacld_proc_getattr(struct svc_rqst * rqstp,
/* /*
* Check file access * Check file access
*/ */
static __be32 nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp, static __be32 nfsacld_proc_access(struct svc_rqst *rqstp)
struct nfsd3_accessres *resp)
{ {
struct nfsd3_accessargs *argp = rqstp->rq_argp;
struct nfsd3_accessres *resp = rqstp->rq_resp;
__be32 nfserr; __be32 nfserr;
dprintk("nfsd: ACCESS(2acl) %s 0x%x\n", dprintk("nfsd: ACCESS(2acl) %s 0x%x\n",
...@@ -179,9 +182,10 @@ static __be32 nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessarg ...@@ -179,9 +182,10 @@ static __be32 nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessarg
/* /*
* XDR decode functions * XDR decode functions
*/ */
static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p, static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p)
struct nfsd3_getaclargs *argp)
{ {
struct nfsd3_getaclargs *argp = rqstp->rq_argp;
p = nfs2svc_decode_fh(p, &argp->fh); p = nfs2svc_decode_fh(p, &argp->fh);
if (!p) if (!p)
return 0; return 0;
...@@ -191,9 +195,9 @@ static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p, ...@@ -191,9 +195,9 @@ static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
} }
static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p, static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p)
struct nfsd3_setaclargs *argp)
{ {
struct nfsd3_setaclargs *argp = rqstp->rq_argp;
struct kvec *head = rqstp->rq_arg.head; struct kvec *head = rqstp->rq_arg.head;
unsigned int base; unsigned int base;
int n; int n;
...@@ -217,18 +221,20 @@ static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p, ...@@ -217,18 +221,20 @@ static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
return (n > 0); return (n > 0);
} }
static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p, static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p)
struct nfsd_fhandle *argp)
{ {
struct nfsd_fhandle *argp = rqstp->rq_argp;
p = nfs2svc_decode_fh(p, &argp->fh); p = nfs2svc_decode_fh(p, &argp->fh);
if (!p) if (!p)
return 0; return 0;
return xdr_argsize_check(rqstp, p); return xdr_argsize_check(rqstp, p);
} }
static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p)
struct nfsd3_accessargs *argp)
{ {
struct nfsd3_accessargs *argp = rqstp->rq_argp;
p = nfs2svc_decode_fh(p, &argp->fh); p = nfs2svc_decode_fh(p, &argp->fh);
if (!p) if (!p)
return 0; return 0;
...@@ -245,15 +251,15 @@ static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, ...@@ -245,15 +251,15 @@ static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
* There must be an encoding function for void results so svc_process * There must be an encoding function for void results so svc_process
* will work properly. * will work properly.
*/ */
static int nfsaclsvc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) static int nfsaclsvc_encode_voidres(struct svc_rqst *rqstp, __be32 *p)
{ {
return xdr_ressize_check(rqstp, p); return xdr_ressize_check(rqstp, p);
} }
/* GETACL */ /* GETACL */
static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p)
struct nfsd3_getaclres *resp)
{ {
struct nfsd3_getaclres *resp = rqstp->rq_resp;
struct dentry *dentry = resp->fh.fh_dentry; struct dentry *dentry = resp->fh.fh_dentry;
struct inode *inode; struct inode *inode;
struct kvec *head = rqstp->rq_res.head; struct kvec *head = rqstp->rq_res.head;
...@@ -296,17 +302,19 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, ...@@ -296,17 +302,19 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
return (n > 0); return (n > 0);
} }
static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, __be32 *p, static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, __be32 *p)
struct nfsd_attrstat *resp)
{ {
struct nfsd_attrstat *resp = rqstp->rq_resp;
p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat); p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat);
return xdr_ressize_check(rqstp, p); return xdr_ressize_check(rqstp, p);
} }
/* ACCESS */ /* ACCESS */
static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p, static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p)
struct nfsd3_accessres *resp)
{ {
struct nfsd3_accessres *resp = rqstp->rq_resp;
p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat); p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat);
*p++ = htonl(resp->access); *p++ = htonl(resp->access);
return xdr_ressize_check(rqstp, p); return xdr_ressize_check(rqstp, p);
...@@ -315,27 +323,27 @@ static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p, ...@@ -315,27 +323,27 @@ static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p,
/* /*
* XDR release functions * XDR release functions
*/ */
static int nfsaclsvc_release_getacl(struct svc_rqst *rqstp, __be32 *p, static void nfsaclsvc_release_getacl(struct svc_rqst *rqstp)
struct nfsd3_getaclres *resp)
{ {
struct nfsd3_getaclres *resp = rqstp->rq_resp;
fh_put(&resp->fh); fh_put(&resp->fh);
posix_acl_release(resp->acl_access); posix_acl_release(resp->acl_access);
posix_acl_release(resp->acl_default); posix_acl_release(resp->acl_default);
return 1;
} }
static int nfsaclsvc_release_attrstat(struct svc_rqst *rqstp, __be32 *p, static void nfsaclsvc_release_attrstat(struct svc_rqst *rqstp)
struct nfsd_attrstat *resp)
{ {
struct nfsd_attrstat *resp = rqstp->rq_resp;
fh_put(&resp->fh); fh_put(&resp->fh);
return 1;
} }
static int nfsaclsvc_release_access(struct svc_rqst *rqstp, __be32 *p, static void nfsaclsvc_release_access(struct svc_rqst *rqstp)
struct nfsd3_accessres *resp)
{ {
struct nfsd3_accessres *resp = rqstp->rq_resp;
fh_put(&resp->fh); fh_put(&resp->fh);
return 1;
} }
#define nfsaclsvc_decode_voidargs NULL #define nfsaclsvc_decode_voidargs NULL
...@@ -346,23 +354,23 @@ static int nfsaclsvc_release_access(struct svc_rqst *rqstp, __be32 *p, ...@@ -346,23 +354,23 @@ static int nfsaclsvc_release_access(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_voidargs { int dummy; }; struct nfsd3_voidargs { int dummy; };
#define PROC(name, argt, rest, relt, cache, respsize) \ #define PROC(name, argt, rest, relt, cache, respsize) \
{ (svc_procfunc) nfsacld_proc_##name, \ { \
(kxdrproc_t) nfsaclsvc_decode_##argt##args, \ .pc_func = nfsacld_proc_##name, \
(kxdrproc_t) nfsaclsvc_encode_##rest##res, \ .pc_decode = nfsaclsvc_decode_##argt##args, \
(kxdrproc_t) nfsaclsvc_release_##relt, \ .pc_encode = nfsaclsvc_encode_##rest##res, \
sizeof(struct nfsd3_##argt##args), \ .pc_release = nfsaclsvc_release_##relt, \
sizeof(struct nfsd3_##rest##res), \ .pc_argsize = sizeof(struct nfsd3_##argt##args), \
0, \ .pc_ressize = sizeof(struct nfsd3_##rest##res), \
cache, \ .pc_cachetype = cache, \
respsize, \ .pc_xdrressize = respsize, \
} }
#define ST 1 /* status*/ #define ST 1 /* status*/
#define AT 21 /* attributes */ #define AT 21 /* attributes */
#define pAT (1+AT) /* post attributes - conditional */ #define pAT (1+AT) /* post attributes - conditional */
#define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */ #define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */
static struct svc_procedure nfsd_acl_procedures2[] = { static const struct svc_procedure nfsd_acl_procedures2[] = {
PROC(null, void, void, void, RC_NOCACHE, ST), PROC(null, void, void, void, RC_NOCACHE, ST),
PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)), PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)),
PROC(setacl, setacl, attrstat, attrstat, RC_NOCACHE, ST+AT), PROC(setacl, setacl, attrstat, attrstat, RC_NOCACHE, ST+AT),
...@@ -370,10 +378,12 @@ static struct svc_procedure nfsd_acl_procedures2[] = { ...@@ -370,10 +378,12 @@ static struct svc_procedure nfsd_acl_procedures2[] = {
PROC(access, access, access, access, RC_NOCACHE, ST+AT+1), PROC(access, access, access, access, RC_NOCACHE, ST+AT+1),
}; };
struct svc_version nfsd_acl_version2 = { static unsigned int nfsd_acl_count2[ARRAY_SIZE(nfsd_acl_procedures2)];
const struct svc_version nfsd_acl_version2 = {
.vs_vers = 2, .vs_vers = 2,
.vs_nproc = 5, .vs_nproc = 5,
.vs_proc = nfsd_acl_procedures2, .vs_proc = nfsd_acl_procedures2,
.vs_count = nfsd_acl_count2,
.vs_dispatch = nfsd_dispatch, .vs_dispatch = nfsd_dispatch,
.vs_xdrsize = NFS3_SVC_XDRSIZE, .vs_xdrsize = NFS3_SVC_XDRSIZE,
}; };
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* NULL call. * NULL call.
*/ */
static __be32 static __be32
nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) nfsd3_proc_null(struct svc_rqst *rqstp)
{ {
return nfs_ok; return nfs_ok;
} }
...@@ -26,9 +26,10 @@ nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) ...@@ -26,9 +26,10 @@ nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
/* /*
* Get the Access and/or Default ACL of a file. * Get the Access and/or Default ACL of a file.
*/ */
static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp, static __be32 nfsd3_proc_getacl(struct svc_rqst *rqstp)
struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp)
{ {
struct nfsd3_getaclargs *argp = rqstp->rq_argp;
struct nfsd3_getaclres *resp = rqstp->rq_resp;
struct posix_acl *acl; struct posix_acl *acl;
struct inode *inode; struct inode *inode;
svc_fh *fh; svc_fh *fh;
...@@ -80,10 +81,10 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp, ...@@ -80,10 +81,10 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp,
/* /*
* Set the Access and/or Default ACL of a file. * Set the Access and/or Default ACL of a file.
*/ */
static __be32 nfsd3_proc_setacl(struct svc_rqst * rqstp, static __be32 nfsd3_proc_setacl(struct svc_rqst *rqstp)
struct nfsd3_setaclargs *argp,
struct nfsd3_attrstat *resp)
{ {
struct nfsd3_setaclargs *argp = rqstp->rq_argp;
struct nfsd3_attrstat *resp = rqstp->rq_resp;
struct inode *inode; struct inode *inode;
svc_fh *fh; svc_fh *fh;
__be32 nfserr = 0; __be32 nfserr = 0;
...@@ -123,9 +124,10 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst * rqstp, ...@@ -123,9 +124,10 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst * rqstp,
/* /*
* XDR decode functions * XDR decode functions
*/ */
static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p, static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p)
struct nfsd3_getaclargs *args)
{ {
struct nfsd3_getaclargs *args = rqstp->rq_argp;
p = nfs3svc_decode_fh(p, &args->fh); p = nfs3svc_decode_fh(p, &args->fh);
if (!p) if (!p)
return 0; return 0;
...@@ -135,9 +137,9 @@ static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p, ...@@ -135,9 +137,9 @@ static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
} }
static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p, static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p)
struct nfsd3_setaclargs *args)
{ {
struct nfsd3_setaclargs *args = rqstp->rq_argp;
struct kvec *head = rqstp->rq_arg.head; struct kvec *head = rqstp->rq_arg.head;
unsigned int base; unsigned int base;
int n; int n;
...@@ -166,9 +168,9 @@ static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p, ...@@ -166,9 +168,9 @@ static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
*/ */
/* GETACL */ /* GETACL */
static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p)
struct nfsd3_getaclres *resp)
{ {
struct nfsd3_getaclres *resp = rqstp->rq_resp;
struct dentry *dentry = resp->fh.fh_dentry; struct dentry *dentry = resp->fh.fh_dentry;
p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh);
...@@ -211,9 +213,10 @@ static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, ...@@ -211,9 +213,10 @@ static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
} }
/* SETACL */ /* SETACL */
static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, __be32 *p, static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, __be32 *p)
struct nfsd3_attrstat *resp)
{ {
struct nfsd3_attrstat *resp = rqstp->rq_resp;
p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh);
return xdr_ressize_check(rqstp, p); return xdr_ressize_check(rqstp, p);
...@@ -222,13 +225,13 @@ static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, __be32 *p, ...@@ -222,13 +225,13 @@ static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, __be32 *p,
/* /*
* XDR release functions * XDR release functions
*/ */
static int nfs3svc_release_getacl(struct svc_rqst *rqstp, __be32 *p, static void nfs3svc_release_getacl(struct svc_rqst *rqstp)
struct nfsd3_getaclres *resp)
{ {
struct nfsd3_getaclres *resp = rqstp->rq_resp;
fh_put(&resp->fh); fh_put(&resp->fh);
posix_acl_release(resp->acl_access); posix_acl_release(resp->acl_access);
posix_acl_release(resp->acl_default); posix_acl_release(resp->acl_default);
return 1;
} }
#define nfs3svc_decode_voidargs NULL #define nfs3svc_decode_voidargs NULL
...@@ -238,32 +241,34 @@ static int nfs3svc_release_getacl(struct svc_rqst *rqstp, __be32 *p, ...@@ -238,32 +241,34 @@ static int nfs3svc_release_getacl(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_voidargs { int dummy; }; struct nfsd3_voidargs { int dummy; };
#define PROC(name, argt, rest, relt, cache, respsize) \ #define PROC(name, argt, rest, relt, cache, respsize) \
{ (svc_procfunc) nfsd3_proc_##name, \ { \
(kxdrproc_t) nfs3svc_decode_##argt##args, \ .pc_func = nfsd3_proc_##name, \
(kxdrproc_t) nfs3svc_encode_##rest##res, \ .pc_decode = nfs3svc_decode_##argt##args, \
(kxdrproc_t) nfs3svc_release_##relt, \ .pc_encode = nfs3svc_encode_##rest##res, \
sizeof(struct nfsd3_##argt##args), \ .pc_release = nfs3svc_release_##relt, \
sizeof(struct nfsd3_##rest##res), \ .pc_argsize = sizeof(struct nfsd3_##argt##args), \
0, \ .pc_ressize = sizeof(struct nfsd3_##rest##res), \
cache, \ .pc_cachetype = cache, \
respsize, \ .pc_xdrressize = respsize, \
} }
#define ST 1 /* status*/ #define ST 1 /* status*/
#define AT 21 /* attributes */ #define AT 21 /* attributes */
#define pAT (1+AT) /* post attributes - conditional */ #define pAT (1+AT) /* post attributes - conditional */
#define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */ #define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */
static struct svc_procedure nfsd_acl_procedures3[] = { static const struct svc_procedure nfsd_acl_procedures3[] = {
PROC(null, void, void, void, RC_NOCACHE, ST), PROC(null, void, void, void, RC_NOCACHE, ST),
PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)), PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)),
PROC(setacl, setacl, setacl, fhandle, RC_NOCACHE, ST+pAT), PROC(setacl, setacl, setacl, fhandle, RC_NOCACHE, ST+pAT),
}; };
struct svc_version nfsd_acl_version3 = { static unsigned int nfsd_acl_count3[ARRAY_SIZE(nfsd_acl_procedures3)];
const struct svc_version nfsd_acl_version3 = {
.vs_vers = 3, .vs_vers = 3,
.vs_nproc = 3, .vs_nproc = 3,
.vs_proc = nfsd_acl_procedures3, .vs_proc = nfsd_acl_procedures3,
.vs_count = nfsd_acl_count3,
.vs_dispatch = nfsd_dispatch, .vs_dispatch = nfsd_dispatch,
.vs_xdrsize = NFS3_SVC_XDRSIZE, .vs_xdrsize = NFS3_SVC_XDRSIZE,
}; };
......
This diff is collapsed.
This diff is collapsed.
...@@ -468,7 +468,7 @@ static int decode_cb_sequence4res(struct xdr_stream *xdr, ...@@ -468,7 +468,7 @@ static int decode_cb_sequence4res(struct xdr_stream *xdr,
* NB: Without this zero space reservation, callbacks over krb5p fail * NB: Without this zero space reservation, callbacks over krb5p fail
*/ */
static void nfs4_xdr_enc_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr, static void nfs4_xdr_enc_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr,
void *__unused) const void *__unused)
{ {
xdr_reserve_space(xdr, 0); xdr_reserve_space(xdr, 0);
} }
...@@ -477,8 +477,9 @@ static void nfs4_xdr_enc_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -477,8 +477,9 @@ static void nfs4_xdr_enc_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr,
* 20.2. Operation 4: CB_RECALL - Recall a Delegation * 20.2. Operation 4: CB_RECALL - Recall a Delegation
*/ */
static void nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, struct xdr_stream *xdr, static void nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfsd4_callback *cb) const void *data)
{ {
const struct nfsd4_callback *cb = data;
const struct nfs4_delegation *dp = cb_to_delegation(cb); const struct nfs4_delegation *dp = cb_to_delegation(cb);
struct nfs4_cb_compound_hdr hdr = { struct nfs4_cb_compound_hdr hdr = {
.ident = cb->cb_clp->cl_cb_ident, .ident = cb->cb_clp->cl_cb_ident,
...@@ -512,8 +513,9 @@ static int nfs4_xdr_dec_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -512,8 +513,9 @@ static int nfs4_xdr_dec_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr,
*/ */
static int nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, static int nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfsd4_callback *cb) void *data)
{ {
struct nfsd4_callback *cb = data;
struct nfs4_cb_compound_hdr hdr; struct nfs4_cb_compound_hdr hdr;
int status; int status;
...@@ -585,8 +587,9 @@ static void encode_cb_layout4args(struct xdr_stream *xdr, ...@@ -585,8 +587,9 @@ static void encode_cb_layout4args(struct xdr_stream *xdr,
static void nfs4_xdr_enc_cb_layout(struct rpc_rqst *req, static void nfs4_xdr_enc_cb_layout(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nfsd4_callback *cb) const void *data)
{ {
const struct nfsd4_callback *cb = data;
const struct nfs4_layout_stateid *ls = const struct nfs4_layout_stateid *ls =
container_of(cb, struct nfs4_layout_stateid, ls_recall); container_of(cb, struct nfs4_layout_stateid, ls_recall);
struct nfs4_cb_compound_hdr hdr = { struct nfs4_cb_compound_hdr hdr = {
...@@ -602,8 +605,9 @@ static void nfs4_xdr_enc_cb_layout(struct rpc_rqst *req, ...@@ -602,8 +605,9 @@ static void nfs4_xdr_enc_cb_layout(struct rpc_rqst *req,
static int nfs4_xdr_dec_cb_layout(struct rpc_rqst *rqstp, static int nfs4_xdr_dec_cb_layout(struct rpc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfsd4_callback *cb) void *data)
{ {
struct nfsd4_callback *cb = data;
struct nfs4_cb_compound_hdr hdr; struct nfs4_cb_compound_hdr hdr;
int status; int status;
...@@ -631,8 +635,9 @@ static void encode_stateowner(struct xdr_stream *xdr, struct nfs4_stateowner *so ...@@ -631,8 +635,9 @@ static void encode_stateowner(struct xdr_stream *xdr, struct nfs4_stateowner *so
static void nfs4_xdr_enc_cb_notify_lock(struct rpc_rqst *req, static void nfs4_xdr_enc_cb_notify_lock(struct rpc_rqst *req,
struct xdr_stream *xdr, struct xdr_stream *xdr,
const struct nfsd4_callback *cb) const void *data)
{ {
const struct nfsd4_callback *cb = data;
const struct nfsd4_blocked_lock *nbl = const struct nfsd4_blocked_lock *nbl =
container_of(cb, struct nfsd4_blocked_lock, nbl_cb); container_of(cb, struct nfsd4_blocked_lock, nbl_cb);
struct nfs4_lockowner *lo = (struct nfs4_lockowner *)nbl->nbl_lock.fl_owner; struct nfs4_lockowner *lo = (struct nfs4_lockowner *)nbl->nbl_lock.fl_owner;
...@@ -659,8 +664,9 @@ static void nfs4_xdr_enc_cb_notify_lock(struct rpc_rqst *req, ...@@ -659,8 +664,9 @@ static void nfs4_xdr_enc_cb_notify_lock(struct rpc_rqst *req,
static int nfs4_xdr_dec_cb_notify_lock(struct rpc_rqst *rqstp, static int nfs4_xdr_dec_cb_notify_lock(struct rpc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct nfsd4_callback *cb) void *data)
{ {
struct nfsd4_callback *cb = data;
struct nfs4_cb_compound_hdr hdr; struct nfs4_cb_compound_hdr hdr;
int status; int status;
...@@ -682,15 +688,15 @@ static int nfs4_xdr_dec_cb_notify_lock(struct rpc_rqst *rqstp, ...@@ -682,15 +688,15 @@ static int nfs4_xdr_dec_cb_notify_lock(struct rpc_rqst *rqstp,
#define PROC(proc, call, argtype, restype) \ #define PROC(proc, call, argtype, restype) \
[NFSPROC4_CLNT_##proc] = { \ [NFSPROC4_CLNT_##proc] = { \
.p_proc = NFSPROC4_CB_##call, \ .p_proc = NFSPROC4_CB_##call, \
.p_encode = (kxdreproc_t)nfs4_xdr_enc_##argtype, \ .p_encode = nfs4_xdr_enc_##argtype, \
.p_decode = (kxdrdproc_t)nfs4_xdr_dec_##restype, \ .p_decode = nfs4_xdr_dec_##restype, \
.p_arglen = NFS4_enc_##argtype##_sz, \ .p_arglen = NFS4_enc_##argtype##_sz, \
.p_replen = NFS4_dec_##restype##_sz, \ .p_replen = NFS4_dec_##restype##_sz, \
.p_statidx = NFSPROC4_CB_##call, \ .p_statidx = NFSPROC4_CB_##call, \
.p_name = #proc, \ .p_name = #proc, \
} }
static struct rpc_procinfo nfs4_cb_procedures[] = { static const struct rpc_procinfo nfs4_cb_procedures[] = {
PROC(CB_NULL, NULL, cb_null, cb_null), PROC(CB_NULL, NULL, cb_null, cb_null),
PROC(CB_RECALL, COMPOUND, cb_recall, cb_recall), PROC(CB_RECALL, COMPOUND, cb_recall, cb_recall),
#ifdef CONFIG_NFSD_PNFS #ifdef CONFIG_NFSD_PNFS
...@@ -699,7 +705,8 @@ static struct rpc_procinfo nfs4_cb_procedures[] = { ...@@ -699,7 +705,8 @@ static struct rpc_procinfo nfs4_cb_procedures[] = {
PROC(CB_NOTIFY_LOCK, COMPOUND, cb_notify_lock, cb_notify_lock), PROC(CB_NOTIFY_LOCK, COMPOUND, cb_notify_lock, cb_notify_lock),
}; };
static struct rpc_version nfs_cb_version4 = { static unsigned int nfs4_cb_counts[ARRAY_SIZE(nfs4_cb_procedures)];
static const struct rpc_version nfs_cb_version4 = {
/* /*
* Note on the callback rpc program version number: despite language in rfc * Note on the callback rpc program version number: despite language in rfc
* 5661 section 18.36.3 requiring servers to use 4 in this field, the * 5661 section 18.36.3 requiring servers to use 4 in this field, the
...@@ -709,7 +716,8 @@ static struct rpc_version nfs_cb_version4 = { ...@@ -709,7 +716,8 @@ static struct rpc_version nfs_cb_version4 = {
*/ */
.number = 1, .number = 1,
.nrprocs = ARRAY_SIZE(nfs4_cb_procedures), .nrprocs = ARRAY_SIZE(nfs4_cb_procedures),
.procs = nfs4_cb_procedures .procs = nfs4_cb_procedures,
.counts = nfs4_cb_counts,
}; };
static const struct rpc_version *nfs_cb_version[] = { static const struct rpc_version *nfs_cb_version[] = {
......
This diff is collapsed.
This diff is collapsed.
...@@ -1973,7 +1973,7 @@ static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode, ...@@ -1973,7 +1973,7 @@ static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode,
*p++ = cpu_to_be32(convert_to_wallclock(exp->cd->flush_time)); *p++ = cpu_to_be32(convert_to_wallclock(exp->cd->flush_time));
*p++ = 0; *p++ = 0;
} else if (IS_I_VERSION(inode)) { } else if (IS_I_VERSION(inode)) {
p = xdr_encode_hyper(p, inode->i_version); p = xdr_encode_hyper(p, nfsd4_change_attribute(inode));
} else { } else {
*p++ = cpu_to_be32(stat->ctime.tv_sec); *p++ = cpu_to_be32(stat->ctime.tv_sec);
*p++ = cpu_to_be32(stat->ctime.tv_nsec); *p++ = cpu_to_be32(stat->ctime.tv_nsec);
...@@ -4538,14 +4538,13 @@ nfsd4_encode_replay(struct xdr_stream *xdr, struct nfsd4_op *op) ...@@ -4538,14 +4538,13 @@ nfsd4_encode_replay(struct xdr_stream *xdr, struct nfsd4_op *op)
} }
int int
nfs4svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) nfs4svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p)
{ {
return xdr_ressize_check(rqstp, p); return xdr_ressize_check(rqstp, p);
} }
int nfsd4_release_compoundargs(void *rq, __be32 *p, void *resp) void nfsd4_release_compoundargs(struct svc_rqst *rqstp)
{ {
struct svc_rqst *rqstp = rq;
struct nfsd4_compoundargs *args = rqstp->rq_argp; struct nfsd4_compoundargs *args = rqstp->rq_argp;
if (args->ops != args->iops) { if (args->ops != args->iops) {
...@@ -4559,12 +4558,13 @@ int nfsd4_release_compoundargs(void *rq, __be32 *p, void *resp) ...@@ -4559,12 +4558,13 @@ int nfsd4_release_compoundargs(void *rq, __be32 *p, void *resp)
args->to_free = tb->next; args->to_free = tb->next;
kfree(tb); kfree(tb);
} }
return 1;
} }
int int
nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compoundargs *args) nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nfsd4_compoundargs *args = rqstp->rq_argp;
if (rqstp->rq_arg.head[0].iov_len % 4) { if (rqstp->rq_arg.head[0].iov_len % 4) {
/* client is nuts */ /* client is nuts */
dprintk("%s: compound not properly padded! (peeraddr=%pISc xid=0x%x)", dprintk("%s: compound not properly padded! (peeraddr=%pISc xid=0x%x)",
...@@ -4584,11 +4584,12 @@ nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_comp ...@@ -4584,11 +4584,12 @@ nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_comp
} }
int int
nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compoundres *resp) nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p)
{ {
/* /*
* All that remains is to write the tag and operation count... * All that remains is to write the tag and operation count...
*/ */
struct nfsd4_compoundres *resp = rqstp->rq_resp;
struct xdr_buf *buf = resp->xdr.buf; struct xdr_buf *buf = resp->xdr.buf;
WARN_ON_ONCE(buf->len != buf->head[0].iov_len + buf->page_len + WARN_ON_ONCE(buf->len != buf->head[0].iov_len + buf->page_len +
......
...@@ -60,7 +60,7 @@ struct readdir_cd { ...@@ -60,7 +60,7 @@ struct readdir_cd {
extern struct svc_program nfsd_program; extern struct svc_program nfsd_program;
extern struct svc_version nfsd_version2, nfsd_version3, extern const struct svc_version nfsd_version2, nfsd_version3,
nfsd_version4; nfsd_version4;
extern struct mutex nfsd_mutex; extern struct mutex nfsd_mutex;
extern spinlock_t nfsd_drc_lock; extern spinlock_t nfsd_drc_lock;
...@@ -86,12 +86,12 @@ void nfsd_destroy(struct net *net); ...@@ -86,12 +86,12 @@ void nfsd_destroy(struct net *net);
#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
#ifdef CONFIG_NFSD_V2_ACL #ifdef CONFIG_NFSD_V2_ACL
extern struct svc_version nfsd_acl_version2; extern const struct svc_version nfsd_acl_version2;
#else #else
#define nfsd_acl_version2 NULL #define nfsd_acl_version2 NULL
#endif #endif
#ifdef CONFIG_NFSD_V3_ACL #ifdef CONFIG_NFSD_V3_ACL
extern struct svc_version nfsd_acl_version3; extern const struct svc_version nfsd_acl_version3;
#else #else
#define nfsd_acl_version3 NULL #define nfsd_acl_version3 NULL
#endif #endif
......
...@@ -240,6 +240,28 @@ fh_clear_wcc(struct svc_fh *fhp) ...@@ -240,6 +240,28 @@ fh_clear_wcc(struct svc_fh *fhp)
fhp->fh_pre_saved = false; fhp->fh_pre_saved = false;
} }
/*
* We could use i_version alone as the change attribute. However,
* i_version can go backwards after a reboot. On its own that doesn't
* necessarily cause a problem, but if i_version goes backwards and then
* is incremented again it could reuse a value that was previously used
* before boot, and a client who queried the two values might
* incorrectly assume nothing changed.
*
* By using both ctime and the i_version counter we guarantee that as
* long as time doesn't go backwards we never reuse an old value.
*/
static inline u64 nfsd4_change_attribute(struct inode *inode)
{
u64 chattr;
chattr = inode->i_ctime.tv_sec;
chattr <<= 30;
chattr += inode->i_ctime.tv_nsec;
chattr += inode->i_version;
return chattr;
}
/* /*
* Fill in the pre_op attr for the wcc data * Fill in the pre_op attr for the wcc data
*/ */
...@@ -253,7 +275,7 @@ fill_pre_wcc(struct svc_fh *fhp) ...@@ -253,7 +275,7 @@ fill_pre_wcc(struct svc_fh *fhp)
fhp->fh_pre_mtime = inode->i_mtime; fhp->fh_pre_mtime = inode->i_mtime;
fhp->fh_pre_ctime = inode->i_ctime; fhp->fh_pre_ctime = inode->i_ctime;
fhp->fh_pre_size = inode->i_size; fhp->fh_pre_size = inode->i_size;
fhp->fh_pre_change = inode->i_version; fhp->fh_pre_change = nfsd4_change_attribute(inode);
fhp->fh_pre_saved = true; fhp->fh_pre_saved = true;
} }
} }
......
This diff is collapsed.
...@@ -68,14 +68,14 @@ unsigned long nfsd_drc_mem_used; ...@@ -68,14 +68,14 @@ unsigned long nfsd_drc_mem_used;
#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
static struct svc_stat nfsd_acl_svcstats; static struct svc_stat nfsd_acl_svcstats;
static struct svc_version * nfsd_acl_version[] = { static const struct svc_version *nfsd_acl_version[] = {
[2] = &nfsd_acl_version2, [2] = &nfsd_acl_version2,
[3] = &nfsd_acl_version3, [3] = &nfsd_acl_version3,
}; };
#define NFSD_ACL_MINVERS 2 #define NFSD_ACL_MINVERS 2
#define NFSD_ACL_NRVERS ARRAY_SIZE(nfsd_acl_version) #define NFSD_ACL_NRVERS ARRAY_SIZE(nfsd_acl_version)
static struct svc_version *nfsd_acl_versions[NFSD_ACL_NRVERS]; static const struct svc_version *nfsd_acl_versions[NFSD_ACL_NRVERS];
static struct svc_program nfsd_acl_program = { static struct svc_program nfsd_acl_program = {
.pg_prog = NFS_ACL_PROGRAM, .pg_prog = NFS_ACL_PROGRAM,
...@@ -92,7 +92,7 @@ static struct svc_stat nfsd_acl_svcstats = { ...@@ -92,7 +92,7 @@ static struct svc_stat nfsd_acl_svcstats = {
}; };
#endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */ #endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */
static struct svc_version * nfsd_version[] = { static const struct svc_version *nfsd_version[] = {
[2] = &nfsd_version2, [2] = &nfsd_version2,
#if defined(CONFIG_NFSD_V3) #if defined(CONFIG_NFSD_V3)
[3] = &nfsd_version3, [3] = &nfsd_version3,
...@@ -104,7 +104,7 @@ static struct svc_version * nfsd_version[] = { ...@@ -104,7 +104,7 @@ static struct svc_version * nfsd_version[] = {
#define NFSD_MINVERS 2 #define NFSD_MINVERS 2
#define NFSD_NRVERS ARRAY_SIZE(nfsd_version) #define NFSD_NRVERS ARRAY_SIZE(nfsd_version)
static struct svc_version *nfsd_versions[NFSD_NRVERS]; static const struct svc_version *nfsd_versions[NFSD_NRVERS];
struct svc_program nfsd_program = { struct svc_program nfsd_program = {
#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
...@@ -756,7 +756,7 @@ static __be32 map_new_errors(u32 vers, __be32 nfserr) ...@@ -756,7 +756,7 @@ static __be32 map_new_errors(u32 vers, __be32 nfserr)
* problem, we enforce these assumptions here: * problem, we enforce these assumptions here:
*/ */
static bool nfs_request_too_big(struct svc_rqst *rqstp, static bool nfs_request_too_big(struct svc_rqst *rqstp,
struct svc_procedure *proc) const struct svc_procedure *proc)
{ {
/* /*
* The ACL code has more careful bounds-checking and is not * The ACL code has more careful bounds-checking and is not
...@@ -781,8 +781,7 @@ static bool nfs_request_too_big(struct svc_rqst *rqstp, ...@@ -781,8 +781,7 @@ static bool nfs_request_too_big(struct svc_rqst *rqstp,
int int
nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
{ {
struct svc_procedure *proc; const struct svc_procedure *proc;
kxdrproc_t xdr;
__be32 nfserr; __be32 nfserr;
__be32 *nfserrp; __be32 *nfserrp;
...@@ -801,9 +800,8 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) ...@@ -801,9 +800,8 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
*/ */
rqstp->rq_cachetype = proc->pc_cachetype; rqstp->rq_cachetype = proc->pc_cachetype;
/* Decode arguments */ /* Decode arguments */
xdr = proc->pc_decode; if (proc->pc_decode &&
if (xdr && !xdr(rqstp, (__be32*)rqstp->rq_arg.head[0].iov_base, !proc->pc_decode(rqstp, (__be32*)rqstp->rq_arg.head[0].iov_base)) {
rqstp->rq_argp)) {
dprintk("nfsd: failed to decode arguments!\n"); dprintk("nfsd: failed to decode arguments!\n");
*statp = rpc_garbage_args; *statp = rpc_garbage_args;
return 1; return 1;
...@@ -827,7 +825,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) ...@@ -827,7 +825,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
rqstp->rq_res.head[0].iov_len += sizeof(__be32); rqstp->rq_res.head[0].iov_len += sizeof(__be32);
/* Now call the procedure handler, and encode NFS status. */ /* Now call the procedure handler, and encode NFS status. */
nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp); nfserr = proc->pc_func(rqstp);
nfserr = map_new_errors(rqstp->rq_vers, nfserr); nfserr = map_new_errors(rqstp->rq_vers, nfserr);
if (nfserr == nfserr_dropit || test_bit(RQ_DROPME, &rqstp->rq_flags)) { if (nfserr == nfserr_dropit || test_bit(RQ_DROPME, &rqstp->rq_flags)) {
dprintk("nfsd: Dropping request; may be revisited later\n"); dprintk("nfsd: Dropping request; may be revisited later\n");
...@@ -842,9 +840,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) ...@@ -842,9 +840,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
* For NFSv2, additional info is never returned in case of an error. * For NFSv2, additional info is never returned in case of an error.
*/ */
if (!(nfserr && rqstp->rq_vers == 2)) { if (!(nfserr && rqstp->rq_vers == 2)) {
xdr = proc->pc_encode; if (proc->pc_encode && !proc->pc_encode(rqstp, nfserrp)) {
if (xdr && !xdr(rqstp, nfserrp,
rqstp->rq_resp)) {
/* Failed to encode result. Release cache entry */ /* Failed to encode result. Release cache entry */
dprintk("nfsd: failed to encode result!\n"); dprintk("nfsd: failed to encode result!\n");
nfsd_cache_update(rqstp, RC_NOCACHE, NULL); nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -192,9 +192,9 @@ struct nlm_block { ...@@ -192,9 +192,9 @@ struct nlm_block {
* Global variables * Global variables
*/ */
extern const struct rpc_program nlm_program; extern const struct rpc_program nlm_program;
extern struct svc_procedure nlmsvc_procedures[]; extern const struct svc_procedure nlmsvc_procedures[];
#ifdef CONFIG_LOCKD_V4 #ifdef CONFIG_LOCKD_V4
extern struct svc_procedure nlmsvc_procedures4[]; extern const struct svc_procedure nlmsvc_procedures4[];
#endif #endif
extern int nlmsvc_grace_period; extern int nlmsvc_grace_period;
extern unsigned long nlmsvc_timeout; extern unsigned long nlmsvc_timeout;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
*/ */
struct rpc_procinfo; struct rpc_procinfo;
struct rpc_message { struct rpc_message {
struct rpc_procinfo * rpc_proc; /* Procedure information */ const struct rpc_procinfo *rpc_proc; /* Procedure information */
void * rpc_argp; /* Arguments */ void * rpc_argp; /* Arguments */
void * rpc_resp; /* Result */ void * rpc_resp; /* Result */
struct rpc_cred * rpc_cred; /* Credentials */ struct rpc_cred * rpc_cred; /* Credentials */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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