diff options
author | Jeff Layton <jeff.layton@primarydata.com> | 2017-06-29 09:34:52 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2017-07-13 16:00:15 -0400 |
commit | 5b5faaf6df73412af0278997db36dbcb51011d9d (patch) | |
tree | 62c1824135b12d6d393b853c07717c718e8f01b3 /fs/nfs/nfs4xdr.c | |
parent | f174ff7a0ab6a097455a94abfc99517940041c07 (diff) |
nfs4: add NFSv4 LOOKUPP handlers
This will be needed in order to implement the get_parent export op
for nfsd.
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 495d493d3a35..fa3eb361d4f8 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -159,6 +159,8 @@ static int nfs4_stat_to_errno(int); | |||
159 | (op_decode_hdr_maxsz) | 159 | (op_decode_hdr_maxsz) |
160 | #define encode_lookup_maxsz (op_encode_hdr_maxsz + nfs4_name_maxsz) | 160 | #define encode_lookup_maxsz (op_encode_hdr_maxsz + nfs4_name_maxsz) |
161 | #define decode_lookup_maxsz (op_decode_hdr_maxsz) | 161 | #define decode_lookup_maxsz (op_decode_hdr_maxsz) |
162 | #define encode_lookupp_maxsz (op_encode_hdr_maxsz) | ||
163 | #define decode_lookupp_maxsz (op_decode_hdr_maxsz) | ||
162 | #define encode_share_access_maxsz \ | 164 | #define encode_share_access_maxsz \ |
163 | (2) | 165 | (2) |
164 | #define encode_createmode_maxsz (1 + encode_attrs_maxsz + encode_verifier_maxsz) | 166 | #define encode_createmode_maxsz (1 + encode_attrs_maxsz + encode_verifier_maxsz) |
@@ -618,6 +620,18 @@ static int nfs4_stat_to_errno(int); | |||
618 | decode_lookup_maxsz + \ | 620 | decode_lookup_maxsz + \ |
619 | decode_getattr_maxsz + \ | 621 | decode_getattr_maxsz + \ |
620 | decode_getfh_maxsz) | 622 | decode_getfh_maxsz) |
623 | #define NFS4_enc_lookupp_sz (compound_encode_hdr_maxsz + \ | ||
624 | encode_sequence_maxsz + \ | ||
625 | encode_putfh_maxsz + \ | ||
626 | encode_lookupp_maxsz + \ | ||
627 | encode_getattr_maxsz + \ | ||
628 | encode_getfh_maxsz) | ||
629 | #define NFS4_dec_lookupp_sz (compound_decode_hdr_maxsz + \ | ||
630 | decode_sequence_maxsz + \ | ||
631 | decode_putfh_maxsz + \ | ||
632 | decode_lookupp_maxsz + \ | ||
633 | decode_getattr_maxsz + \ | ||
634 | decode_getfh_maxsz) | ||
621 | #define NFS4_enc_lookup_root_sz (compound_encode_hdr_maxsz + \ | 635 | #define NFS4_enc_lookup_root_sz (compound_encode_hdr_maxsz + \ |
622 | encode_sequence_maxsz + \ | 636 | encode_sequence_maxsz + \ |
623 | encode_putrootfh_maxsz + \ | 637 | encode_putrootfh_maxsz + \ |
@@ -1368,6 +1382,11 @@ static void encode_lookup(struct xdr_stream *xdr, const struct qstr *name, struc | |||
1368 | encode_string(xdr, name->len, name->name); | 1382 | encode_string(xdr, name->len, name->name); |
1369 | } | 1383 | } |
1370 | 1384 | ||
1385 | static void encode_lookupp(struct xdr_stream *xdr, struct compound_hdr *hdr) | ||
1386 | { | ||
1387 | encode_op_hdr(xdr, OP_LOOKUPP, decode_lookupp_maxsz, hdr); | ||
1388 | } | ||
1389 | |||
1371 | static void encode_share_access(struct xdr_stream *xdr, u32 share_access) | 1390 | static void encode_share_access(struct xdr_stream *xdr, u32 share_access) |
1372 | { | 1391 | { |
1373 | __be32 *p; | 1392 | __be32 *p; |
@@ -2123,6 +2142,26 @@ static void nfs4_xdr_enc_lookup(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
2123 | } | 2142 | } |
2124 | 2143 | ||
2125 | /* | 2144 | /* |
2145 | * Encode LOOKUPP request | ||
2146 | */ | ||
2147 | static void nfs4_xdr_enc_lookupp(struct rpc_rqst *req, struct xdr_stream *xdr, | ||
2148 | const void *data) | ||
2149 | { | ||
2150 | const struct nfs4_lookupp_arg *args = data; | ||
2151 | struct compound_hdr hdr = { | ||
2152 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | ||
2153 | }; | ||
2154 | |||
2155 | encode_compound_hdr(xdr, req, &hdr); | ||
2156 | encode_sequence(xdr, &args->seq_args, &hdr); | ||
2157 | encode_putfh(xdr, args->fh, &hdr); | ||
2158 | encode_lookupp(xdr, &hdr); | ||
2159 | encode_getfh(xdr, &hdr); | ||
2160 | encode_getfattr(xdr, args->bitmask, &hdr); | ||
2161 | encode_nops(&hdr); | ||
2162 | } | ||
2163 | |||
2164 | /* | ||
2126 | * Encode LOOKUP_ROOT request | 2165 | * Encode LOOKUP_ROOT request |
2127 | */ | 2166 | */ |
2128 | static void nfs4_xdr_enc_lookup_root(struct rpc_rqst *req, | 2167 | static void nfs4_xdr_enc_lookup_root(struct rpc_rqst *req, |
@@ -5058,6 +5097,11 @@ static int decode_lookup(struct xdr_stream *xdr) | |||
5058 | return decode_op_hdr(xdr, OP_LOOKUP); | 5097 | return decode_op_hdr(xdr, OP_LOOKUP); |
5059 | } | 5098 | } |
5060 | 5099 | ||
5100 | static int decode_lookupp(struct xdr_stream *xdr) | ||
5101 | { | ||
5102 | return decode_op_hdr(xdr, OP_LOOKUPP); | ||
5103 | } | ||
5104 | |||
5061 | /* This is too sick! */ | 5105 | /* This is too sick! */ |
5062 | static int decode_space_limit(struct xdr_stream *xdr, | 5106 | static int decode_space_limit(struct xdr_stream *xdr, |
5063 | unsigned long *pagemod_limit) | 5107 | unsigned long *pagemod_limit) |
@@ -6238,6 +6282,36 @@ out: | |||
6238 | } | 6282 | } |
6239 | 6283 | ||
6240 | /* | 6284 | /* |
6285 | * Decode LOOKUPP response | ||
6286 | */ | ||
6287 | static int nfs4_xdr_dec_lookupp(struct rpc_rqst *rqstp, struct xdr_stream *xdr, | ||
6288 | void *data) | ||
6289 | { | ||
6290 | struct nfs4_lookupp_res *res = data; | ||
6291 | struct compound_hdr hdr; | ||
6292 | int status; | ||
6293 | |||
6294 | status = decode_compound_hdr(xdr, &hdr); | ||
6295 | if (status) | ||
6296 | goto out; | ||
6297 | status = decode_sequence(xdr, &res->seq_res, rqstp); | ||
6298 | if (status) | ||
6299 | goto out; | ||
6300 | status = decode_putfh(xdr); | ||
6301 | if (status) | ||
6302 | goto out; | ||
6303 | status = decode_lookupp(xdr); | ||
6304 | if (status) | ||
6305 | goto out; | ||
6306 | status = decode_getfh(xdr, res->fh); | ||
6307 | if (status) | ||
6308 | goto out; | ||
6309 | status = decode_getfattr_label(xdr, res->fattr, res->label, res->server); | ||
6310 | out: | ||
6311 | return status; | ||
6312 | } | ||
6313 | |||
6314 | /* | ||
6241 | * Decode LOOKUP_ROOT response | 6315 | * Decode LOOKUP_ROOT response |
6242 | */ | 6316 | */ |
6243 | static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, | 6317 | static int nfs4_xdr_dec_lookup_root(struct rpc_rqst *rqstp, |
@@ -7614,6 +7688,7 @@ const struct rpc_procinfo nfs4_procedures[] = { | |||
7614 | PROC(ACCESS, enc_access, dec_access), | 7688 | PROC(ACCESS, enc_access, dec_access), |
7615 | PROC(GETATTR, enc_getattr, dec_getattr), | 7689 | PROC(GETATTR, enc_getattr, dec_getattr), |
7616 | PROC(LOOKUP, enc_lookup, dec_lookup), | 7690 | PROC(LOOKUP, enc_lookup, dec_lookup), |
7691 | PROC(LOOKUPP, enc_lookupp, dec_lookupp), | ||
7617 | PROC(LOOKUP_ROOT, enc_lookup_root, dec_lookup_root), | 7692 | PROC(LOOKUP_ROOT, enc_lookup_root, dec_lookup_root), |
7618 | PROC(REMOVE, enc_remove, dec_remove), | 7693 | PROC(REMOVE, enc_remove, dec_remove), |
7619 | PROC(RENAME, enc_rename, dec_rename), | 7694 | PROC(RENAME, enc_rename, dec_rename), |