aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2009-12-03 13:30:56 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-12-14 18:12:12 -0500
commit9a74af21330c8d46efa977d088a62cc1bfa954e9 (patch)
tree6f2e4b775738ae93da05ad475b244785bf40461e /fs
parent68590c382b875cc9a76b06097f3dff6730d787c1 (diff)
nfsd: Move private headers to source directory
Lots of include/linux/nfsd/* headers are only used by nfsd module. Move them to the source directory Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/auth.c2
-rw-r--r--fs/nfsd/cache.h85
-rw-r--r--fs/nfsd/export.c3
-rw-r--r--fs/nfsd/lockd.c2
-rw-r--r--fs/nfsd/nfs2acl.c7
-rw-r--r--fs/nfsd/nfs3acl.c7
-rw-r--r--fs/nfsd/nfs3proc.c4
-rw-r--r--fs/nfsd/nfs3xdr.c2
-rw-r--r--fs/nfsd/nfs4callback.c4
-rw-r--r--fs/nfsd/nfs4proc.c4
-rw-r--r--fs/nfsd/nfs4recover.c5
-rw-r--r--fs/nfsd/nfs4state.c2
-rw-r--r--fs/nfsd/nfs4xdr.c3
-rw-r--r--fs/nfsd/nfscache.c4
-rw-r--r--fs/nfsd/nfsctl.c5
-rw-r--r--fs/nfsd/nfsd.h335
-rw-r--r--fs/nfsd/nfsfh.c2
-rw-r--r--fs/nfsd/nfsproc.c4
-rw-r--r--fs/nfsd/nfssvc.c4
-rw-r--r--fs/nfsd/nfsxdr.c2
-rw-r--r--fs/nfsd/state.h409
-rw-r--r--fs/nfsd/stats.c4
-rw-r--r--fs/nfsd/vfs.c18
-rw-r--r--fs/nfsd/xdr.h176
-rw-r--r--fs/nfsd/xdr3.h346
-rw-r--r--fs/nfsd/xdr4.h564
26 files changed, 1963 insertions, 40 deletions
diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c
index ad354d284cf8..71209d4993d0 100644
--- a/fs/nfsd/auth.c
+++ b/fs/nfsd/auth.c
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/nfsd/nfsd.h> 8#include "nfsd.h"
9#include "auth.h" 9#include "auth.h"
10 10
11int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp) 11int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp)
diff --git a/fs/nfsd/cache.h b/fs/nfsd/cache.h
new file mode 100644
index 000000000000..a165425dea41
--- /dev/null
+++ b/fs/nfsd/cache.h
@@ -0,0 +1,85 @@
1/*
2 * include/linux/nfsd/cache.h
3 *
4 * Request reply cache. This was heavily inspired by the
5 * implementation in 4.3BSD/4.4BSD.
6 *
7 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
8 */
9
10#ifndef NFSCACHE_H
11#define NFSCACHE_H
12
13#include <linux/sunrpc/svc.h>
14
15/*
16 * Representation of a reply cache entry.
17 */
18struct svc_cacherep {
19 struct hlist_node c_hash;
20 struct list_head c_lru;
21
22 unsigned char c_state, /* unused, inprog, done */
23 c_type, /* status, buffer */
24 c_secure : 1; /* req came from port < 1024 */
25 struct sockaddr_in c_addr;
26 __be32 c_xid;
27 u32 c_prot;
28 u32 c_proc;
29 u32 c_vers;
30 unsigned long c_timestamp;
31 union {
32 struct kvec u_vec;
33 __be32 u_status;
34 } c_u;
35};
36
37#define c_replvec c_u.u_vec
38#define c_replstat c_u.u_status
39
40/* cache entry states */
41enum {
42 RC_UNUSED,
43 RC_INPROG,
44 RC_DONE
45};
46
47/* return values */
48enum {
49 RC_DROPIT,
50 RC_REPLY,
51 RC_DOIT,
52 RC_INTR
53};
54
55/*
56 * Cache types.
57 * We may want to add more types one day, e.g. for diropres and
58 * attrstat replies. Using cache entries with fixed length instead
59 * of buffer pointers may be more efficient.
60 */
61enum {
62 RC_NOCACHE,
63 RC_REPLSTAT,
64 RC_REPLBUFF,
65};
66
67/*
68 * If requests are retransmitted within this interval, they're dropped.
69 */
70#define RC_DELAY (HZ/5)
71
72int nfsd_reply_cache_init(void);
73void nfsd_reply_cache_shutdown(void);
74int nfsd_cache_lookup(struct svc_rqst *, int);
75void nfsd_cache_update(struct svc_rqst *, int, __be32 *);
76
77#ifdef CONFIG_NFSD_V4
78void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp);
79#else /* CONFIG_NFSD_V4 */
80static inline void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp)
81{
82}
83#endif /* CONFIG_NFSD_V4 */
84
85#endif /* NFSCACHE_H */
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 68e63f441444..cb3dae2fcd86 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -18,10 +18,11 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/exportfs.h> 19#include <linux/exportfs.h>
20 20
21#include <linux/nfsd/nfsd.h>
22#include <linux/nfsd/syscall.h> 21#include <linux/nfsd/syscall.h>
23#include <net/ipv6.h> 22#include <net/ipv6.h>
24 23
24#include "nfsd.h"
25
25#define NFSDDBG_FACILITY NFSDDBG_EXPORT 26#define NFSDDBG_FACILITY NFSDDBG_EXPORT
26 27
27typedef struct auth_domain svc_client; 28typedef struct auth_domain svc_client;
diff --git a/fs/nfsd/lockd.c b/fs/nfsd/lockd.c
index 801ef7104ff4..6f12777ed227 100644
--- a/fs/nfsd/lockd.c
+++ b/fs/nfsd/lockd.c
@@ -9,8 +9,8 @@
9 */ 9 */
10 10
11#include <linux/file.h> 11#include <linux/file.h>
12#include <linux/nfsd/nfsd.h>
13#include <linux/lockd/bind.h> 12#include <linux/lockd/bind.h>
13#include "nfsd.h"
14#include "vfs.h" 14#include "vfs.h"
15 15
16#define NFSDDBG_FACILITY NFSDDBG_LOCKD 16#define NFSDDBG_FACILITY NFSDDBG_LOCKD
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c
index a54628de7715..874e2a94bf4f 100644
--- a/fs/nfsd/nfs2acl.c
+++ b/fs/nfsd/nfs2acl.c
@@ -6,10 +6,11 @@
6 * Copyright (C) 2002-2003 Andreas Gruenbacher <agruen@suse.de> 6 * Copyright (C) 2002-2003 Andreas Gruenbacher <agruen@suse.de>
7 */ 7 */
8 8
9#include <linux/nfsd/nfsd.h> 9#include "nfsd.h"
10#include <linux/nfsd/cache.h> 10/* FIXME: nfsacl.h is a broken header */
11#include <linux/nfsd/xdr3.h>
12#include <linux/nfsacl.h> 11#include <linux/nfsacl.h>
12#include "cache.h"
13#include "xdr3.h"
13#include "vfs.h" 14#include "vfs.h"
14 15
15#define NFSDDBG_FACILITY NFSDDBG_PROC 16#define NFSDDBG_FACILITY NFSDDBG_PROC
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c
index 2f5c61bea908..c6011ddbadc0 100644
--- a/fs/nfsd/nfs3acl.c
+++ b/fs/nfsd/nfs3acl.c
@@ -6,10 +6,11 @@
6 * Copyright (C) 2002-2003 Andreas Gruenbacher <agruen@suse.de> 6 * Copyright (C) 2002-2003 Andreas Gruenbacher <agruen@suse.de>
7 */ 7 */
8 8
9#include <linux/nfsd/nfsd.h> 9#include "nfsd.h"
10#include <linux/nfsd/cache.h> 10/* FIXME: nfsacl.h is a broken header */
11#include <linux/nfsd/xdr3.h>
12#include <linux/nfsacl.h> 11#include <linux/nfsacl.h>
12#include "cache.h"
13#include "xdr3.h"
13#include "vfs.h" 14#include "vfs.h"
14 15
15#define RETURN_STATUS(st) { resp->status = (st); return (st); } 16#define RETURN_STATUS(st) { resp->status = (st); return (st); }
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index b694b4304544..90b19ca75b34 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -10,8 +10,8 @@
10#include <linux/ext2_fs.h> 10#include <linux/ext2_fs.h>
11#include <linux/magic.h> 11#include <linux/magic.h>
12 12
13#include <linux/nfsd/cache.h> 13#include "cache.h"
14#include <linux/nfsd/xdr3.h> 14#include "xdr3.h"
15#include "vfs.h" 15#include "vfs.h"
16 16
17#define NFSDDBG_FACILITY NFSDDBG_PROC 17#define NFSDDBG_FACILITY NFSDDBG_PROC
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 623e13aa6259..c523bb88c10b 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11#include <linux/namei.h> 11#include <linux/namei.h>
12#include <linux/nfsd/xdr3.h> 12#include "xdr3.h"
13#include "auth.h" 13#include "auth.h"
14 14
15#define NFSDDBG_FACILITY NFSDDBG_XDR 15#define NFSDDBG_FACILITY NFSDDBG_XDR
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 4fe396071b61..f7a315827638 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -34,8 +34,8 @@
34 */ 34 */
35 35
36#include <linux/sunrpc/clnt.h> 36#include <linux/sunrpc/clnt.h>
37#include <linux/nfsd/nfsd.h> 37#include "nfsd.h"
38#include <linux/nfsd/state.h> 38#include "state.h"
39 39
40#define NFSDDBG_FACILITY NFSDDBG_PROC 40#define NFSDDBG_FACILITY NFSDDBG_PROC
41 41
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 61f682c77e7f..e2b5666f25d1 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -36,8 +36,8 @@
36 */ 36 */
37#include <linux/file.h> 37#include <linux/file.h>
38 38
39#include <linux/nfsd/cache.h> 39#include "cache.h"
40#include <linux/nfsd/xdr4.h> 40#include "xdr4.h"
41#include "vfs.h" 41#include "vfs.h"
42 42
43#define NFSDDBG_FACILITY NFSDDBG_PROC 43#define NFSDDBG_FACILITY NFSDDBG_PROC
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 48742f243c25..6744e7f2da0e 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -33,12 +33,13 @@
33* 33*
34*/ 34*/
35 35
36#include <linux/nfsd/nfsd.h>
37#include <linux/nfsd/state.h>
38#include <linux/file.h> 36#include <linux/file.h>
39#include <linux/namei.h> 37#include <linux/namei.h>
40#include <linux/crypto.h> 38#include <linux/crypto.h>
41#include <linux/sched.h> 39#include <linux/sched.h>
40
41#include "nfsd.h"
42#include "state.h"
42#include "vfs.h" 43#include "vfs.h"
43 44
44#define NFSDDBG_FACILITY NFSDDBG_PROC 45#define NFSDDBG_FACILITY NFSDDBG_PROC
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 1fe6e29fd500..2923e6c1da18 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -36,11 +36,11 @@
36 36
37#include <linux/file.h> 37#include <linux/file.h>
38#include <linux/smp_lock.h> 38#include <linux/smp_lock.h>
39#include <linux/nfsd/xdr4.h>
40#include <linux/namei.h> 39#include <linux/namei.h>
41#include <linux/swap.h> 40#include <linux/swap.h>
42#include <linux/sunrpc/svcauth_gss.h> 41#include <linux/sunrpc/svcauth_gss.h>
43#include <linux/sunrpc/clnt.h> 42#include <linux/sunrpc/clnt.h>
43#include "xdr4.h"
44#include "vfs.h" 44#include "vfs.h"
45 45
46#define NFSDDBG_FACILITY NFSDDBG_PROC 46#define NFSDDBG_FACILITY NFSDDBG_PROC
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 2fa96821f5b5..cab978031100 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -43,10 +43,11 @@
43#include <linux/namei.h> 43#include <linux/namei.h>
44#include <linux/statfs.h> 44#include <linux/statfs.h>
45#include <linux/utsname.h> 45#include <linux/utsname.h>
46#include <linux/nfsd/xdr4.h>
47#include <linux/nfsd_idmap.h> 46#include <linux/nfsd_idmap.h>
48#include <linux/nfs4_acl.h> 47#include <linux/nfs4_acl.h>
49#include <linux/sunrpc/svcauth_gss.h> 48#include <linux/sunrpc/svcauth_gss.h>
49
50#include "xdr4.h"
50#include "vfs.h" 51#include "vfs.h"
51 52
52#define NFSDDBG_FACILITY NFSDDBG_XDR 53#define NFSDDBG_FACILITY NFSDDBG_XDR
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
index 96694b8345ef..18aa9729a380 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -10,8 +10,8 @@
10 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> 10 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
11 */ 11 */
12 12
13#include <linux/nfsd/nfsd.h> 13#include "nfsd.h"
14#include <linux/nfsd/cache.h> 14#include "cache.h"
15 15
16/* Size of reply cache. Common values are: 16/* Size of reply cache. Common values are:
17 * 4.3BSD: 128 17 * 4.3BSD: 128
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index e4f49fd6af44..0415680d3f58 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -11,12 +11,13 @@
11 11
12#include <linux/nfsd_idmap.h> 12#include <linux/nfsd_idmap.h>
13#include <linux/sunrpc/svcsock.h> 13#include <linux/sunrpc/svcsock.h>
14#include <linux/nfsd/nfsd.h>
15#include <linux/nfsd/cache.h>
16#include <linux/nfsd/syscall.h> 14#include <linux/nfsd/syscall.h>
17#include <linux/lockd/lockd.h> 15#include <linux/lockd/lockd.h>
18#include <linux/sunrpc/clnt.h> 16#include <linux/sunrpc/clnt.h>
19 17
18#include "nfsd.h"
19#include "cache.h"
20
20/* 21/*
21 * We have a single directory with 9 nodes in it. 22 * We have a single directory with 9 nodes in it.
22 */ 23 */
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
new file mode 100644
index 000000000000..74f67c2aca34
--- /dev/null
+++ b/fs/nfsd/nfsd.h
@@ -0,0 +1,335 @@
1/*
2 * linux/include/linux/nfsd/nfsd.h
3 *
4 * Hodge-podge collection of knfsd-related stuff.
5 * I will sort this out later.
6 *
7 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
8 */
9
10#ifndef LINUX_NFSD_NFSD_H
11#define LINUX_NFSD_NFSD_H
12
13#include <linux/types.h>
14#include <linux/mount.h>
15
16#include <linux/nfsd/debug.h>
17#include <linux/nfsd/export.h>
18#include <linux/nfsd/stats.h>
19/*
20 * nfsd version
21 */
22#define NFSD_SUPPORTED_MINOR_VERSION 1
23
24struct readdir_cd {
25 __be32 err; /* 0, nfserr, or nfserr_eof */
26};
27
28
29extern struct svc_program nfsd_program;
30extern struct svc_version nfsd_version2, nfsd_version3,
31 nfsd_version4;
32extern u32 nfsd_supported_minorversion;
33extern struct mutex nfsd_mutex;
34extern struct svc_serv *nfsd_serv;
35extern spinlock_t nfsd_drc_lock;
36extern unsigned int nfsd_drc_max_mem;
37extern unsigned int nfsd_drc_mem_used;
38
39extern const struct seq_operations nfs_exports_op;
40
41/*
42 * Function prototypes.
43 */
44int nfsd_svc(unsigned short port, int nrservs);
45int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp);
46
47int nfsd_nrthreads(void);
48int nfsd_nrpools(void);
49int nfsd_get_nrthreads(int n, int *);
50int nfsd_set_nrthreads(int n, int *);
51
52#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
53#ifdef CONFIG_NFSD_V2_ACL
54extern struct svc_version nfsd_acl_version2;
55#else
56#define nfsd_acl_version2 NULL
57#endif
58#ifdef CONFIG_NFSD_V3_ACL
59extern struct svc_version nfsd_acl_version3;
60#else
61#define nfsd_acl_version3 NULL
62#endif
63#endif
64
65enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL };
66int nfsd_vers(int vers, enum vers_op change);
67int nfsd_minorversion(u32 minorversion, enum vers_op change);
68void nfsd_reset_versions(void);
69int nfsd_create_serv(void);
70
71extern int nfsd_max_blksize;
72
73/*
74 * NFSv4 State
75 */
76#ifdef CONFIG_NFSD_V4
77extern unsigned int max_delegations;
78int nfs4_state_init(void);
79void nfsd4_free_slabs(void);
80int nfs4_state_start(void);
81void nfs4_state_shutdown(void);
82time_t nfs4_lease_time(void);
83void nfs4_reset_lease(time_t leasetime);
84int nfs4_reset_recoverydir(char *recdir);
85#else
86static inline int nfs4_state_init(void) { return 0; }
87static inline void nfsd4_free_slabs(void) { }
88static inline int nfs4_state_start(void) { return 0; }
89static inline void nfs4_state_shutdown(void) { }
90static inline time_t nfs4_lease_time(void) { return 0; }
91static inline void nfs4_reset_lease(time_t leasetime) { }
92static inline int nfs4_reset_recoverydir(char *recdir) { return 0; }
93#endif
94
95/*
96 * lockd binding
97 */
98void nfsd_lockd_init(void);
99void nfsd_lockd_shutdown(void);
100
101
102/*
103 * These macros provide pre-xdr'ed values for faster operation.
104 */
105#define nfs_ok cpu_to_be32(NFS_OK)
106#define nfserr_perm cpu_to_be32(NFSERR_PERM)
107#define nfserr_noent cpu_to_be32(NFSERR_NOENT)
108#define nfserr_io cpu_to_be32(NFSERR_IO)
109#define nfserr_nxio cpu_to_be32(NFSERR_NXIO)
110#define nfserr_eagain cpu_to_be32(NFSERR_EAGAIN)
111#define nfserr_acces cpu_to_be32(NFSERR_ACCES)
112#define nfserr_exist cpu_to_be32(NFSERR_EXIST)
113#define nfserr_xdev cpu_to_be32(NFSERR_XDEV)
114#define nfserr_nodev cpu_to_be32(NFSERR_NODEV)
115#define nfserr_notdir cpu_to_be32(NFSERR_NOTDIR)
116#define nfserr_isdir cpu_to_be32(NFSERR_ISDIR)
117#define nfserr_inval cpu_to_be32(NFSERR_INVAL)
118#define nfserr_fbig cpu_to_be32(NFSERR_FBIG)
119#define nfserr_nospc cpu_to_be32(NFSERR_NOSPC)
120#define nfserr_rofs cpu_to_be32(NFSERR_ROFS)
121#define nfserr_mlink cpu_to_be32(NFSERR_MLINK)
122#define nfserr_opnotsupp cpu_to_be32(NFSERR_OPNOTSUPP)
123#define nfserr_nametoolong cpu_to_be32(NFSERR_NAMETOOLONG)
124#define nfserr_notempty cpu_to_be32(NFSERR_NOTEMPTY)
125#define nfserr_dquot cpu_to_be32(NFSERR_DQUOT)
126#define nfserr_stale cpu_to_be32(NFSERR_STALE)
127#define nfserr_remote cpu_to_be32(NFSERR_REMOTE)
128#define nfserr_wflush cpu_to_be32(NFSERR_WFLUSH)
129#define nfserr_badhandle cpu_to_be32(NFSERR_BADHANDLE)
130#define nfserr_notsync cpu_to_be32(NFSERR_NOT_SYNC)
131#define nfserr_badcookie cpu_to_be32(NFSERR_BAD_COOKIE)
132#define nfserr_notsupp cpu_to_be32(NFSERR_NOTSUPP)
133#define nfserr_toosmall cpu_to_be32(NFSERR_TOOSMALL)
134#define nfserr_serverfault cpu_to_be32(NFSERR_SERVERFAULT)
135#define nfserr_badtype cpu_to_be32(NFSERR_BADTYPE)
136#define nfserr_jukebox cpu_to_be32(NFSERR_JUKEBOX)
137#define nfserr_denied cpu_to_be32(NFSERR_DENIED)
138#define nfserr_deadlock cpu_to_be32(NFSERR_DEADLOCK)
139#define nfserr_expired cpu_to_be32(NFSERR_EXPIRED)
140#define nfserr_bad_cookie cpu_to_be32(NFSERR_BAD_COOKIE)
141#define nfserr_same cpu_to_be32(NFSERR_SAME)
142#define nfserr_clid_inuse cpu_to_be32(NFSERR_CLID_INUSE)
143#define nfserr_stale_clientid cpu_to_be32(NFSERR_STALE_CLIENTID)
144#define nfserr_resource cpu_to_be32(NFSERR_RESOURCE)
145#define nfserr_moved cpu_to_be32(NFSERR_MOVED)
146#define nfserr_nofilehandle cpu_to_be32(NFSERR_NOFILEHANDLE)
147#define nfserr_minor_vers_mismatch cpu_to_be32(NFSERR_MINOR_VERS_MISMATCH)
148#define nfserr_share_denied cpu_to_be32(NFSERR_SHARE_DENIED)
149#define nfserr_stale_stateid cpu_to_be32(NFSERR_STALE_STATEID)
150#define nfserr_old_stateid cpu_to_be32(NFSERR_OLD_STATEID)
151#define nfserr_bad_stateid cpu_to_be32(NFSERR_BAD_STATEID)
152#define nfserr_bad_seqid cpu_to_be32(NFSERR_BAD_SEQID)
153#define nfserr_symlink cpu_to_be32(NFSERR_SYMLINK)
154#define nfserr_not_same cpu_to_be32(NFSERR_NOT_SAME)
155#define nfserr_restorefh cpu_to_be32(NFSERR_RESTOREFH)
156#define nfserr_attrnotsupp cpu_to_be32(NFSERR_ATTRNOTSUPP)
157#define nfserr_bad_xdr cpu_to_be32(NFSERR_BAD_XDR)
158#define nfserr_openmode cpu_to_be32(NFSERR_OPENMODE)
159#define nfserr_locks_held cpu_to_be32(NFSERR_LOCKS_HELD)
160#define nfserr_op_illegal cpu_to_be32(NFSERR_OP_ILLEGAL)
161#define nfserr_grace cpu_to_be32(NFSERR_GRACE)
162#define nfserr_no_grace cpu_to_be32(NFSERR_NO_GRACE)
163#define nfserr_reclaim_bad cpu_to_be32(NFSERR_RECLAIM_BAD)
164#define nfserr_badname cpu_to_be32(NFSERR_BADNAME)
165#define nfserr_cb_path_down cpu_to_be32(NFSERR_CB_PATH_DOWN)
166#define nfserr_locked cpu_to_be32(NFSERR_LOCKED)
167#define nfserr_wrongsec cpu_to_be32(NFSERR_WRONGSEC)
168#define nfserr_badiomode cpu_to_be32(NFS4ERR_BADIOMODE)
169#define nfserr_badlayout cpu_to_be32(NFS4ERR_BADLAYOUT)
170#define nfserr_bad_session_digest cpu_to_be32(NFS4ERR_BAD_SESSION_DIGEST)
171#define nfserr_badsession cpu_to_be32(NFS4ERR_BADSESSION)
172#define nfserr_badslot cpu_to_be32(NFS4ERR_BADSLOT)
173#define nfserr_complete_already cpu_to_be32(NFS4ERR_COMPLETE_ALREADY)
174#define nfserr_conn_not_bound_to_session cpu_to_be32(NFS4ERR_CONN_NOT_BOUND_TO_SESSION)
175#define nfserr_deleg_already_wanted cpu_to_be32(NFS4ERR_DELEG_ALREADY_WANTED)
176#define nfserr_back_chan_busy cpu_to_be32(NFS4ERR_BACK_CHAN_BUSY)
177#define nfserr_layouttrylater cpu_to_be32(NFS4ERR_LAYOUTTRYLATER)
178#define nfserr_layoutunavailable cpu_to_be32(NFS4ERR_LAYOUTUNAVAILABLE)
179#define nfserr_nomatching_layout cpu_to_be32(NFS4ERR_NOMATCHING_LAYOUT)
180#define nfserr_recallconflict cpu_to_be32(NFS4ERR_RECALLCONFLICT)
181#define nfserr_unknown_layouttype cpu_to_be32(NFS4ERR_UNKNOWN_LAYOUTTYPE)
182#define nfserr_seq_misordered cpu_to_be32(NFS4ERR_SEQ_MISORDERED)
183#define nfserr_sequence_pos cpu_to_be32(NFS4ERR_SEQUENCE_POS)
184#define nfserr_req_too_big cpu_to_be32(NFS4ERR_REQ_TOO_BIG)
185#define nfserr_rep_too_big cpu_to_be32(NFS4ERR_REP_TOO_BIG)
186#define nfserr_rep_too_big_to_cache cpu_to_be32(NFS4ERR_REP_TOO_BIG_TO_CACHE)
187#define nfserr_retry_uncached_rep cpu_to_be32(NFS4ERR_RETRY_UNCACHED_REP)
188#define nfserr_unsafe_compound cpu_to_be32(NFS4ERR_UNSAFE_COMPOUND)
189#define nfserr_too_many_ops cpu_to_be32(NFS4ERR_TOO_MANY_OPS)
190#define nfserr_op_not_in_session cpu_to_be32(NFS4ERR_OP_NOT_IN_SESSION)
191#define nfserr_hash_alg_unsupp cpu_to_be32(NFS4ERR_HASH_ALG_UNSUPP)
192#define nfserr_clientid_busy cpu_to_be32(NFS4ERR_CLIENTID_BUSY)
193#define nfserr_pnfs_io_hole cpu_to_be32(NFS4ERR_PNFS_IO_HOLE)
194#define nfserr_seq_false_retry cpu_to_be32(NFS4ERR_SEQ_FALSE_RETRY)
195#define nfserr_bad_high_slot cpu_to_be32(NFS4ERR_BAD_HIGH_SLOT)
196#define nfserr_deadsession cpu_to_be32(NFS4ERR_DEADSESSION)
197#define nfserr_encr_alg_unsupp cpu_to_be32(NFS4ERR_ENCR_ALG_UNSUPP)
198#define nfserr_pnfs_no_layout cpu_to_be32(NFS4ERR_PNFS_NO_LAYOUT)
199#define nfserr_not_only_op cpu_to_be32(NFS4ERR_NOT_ONLY_OP)
200#define nfserr_wrong_cred cpu_to_be32(NFS4ERR_WRONG_CRED)
201#define nfserr_wrong_type cpu_to_be32(NFS4ERR_WRONG_TYPE)
202#define nfserr_dirdeleg_unavail cpu_to_be32(NFS4ERR_DIRDELEG_UNAVAIL)
203#define nfserr_reject_deleg cpu_to_be32(NFS4ERR_REJECT_DELEG)
204#define nfserr_returnconflict cpu_to_be32(NFS4ERR_RETURNCONFLICT)
205#define nfserr_deleg_revoked cpu_to_be32(NFS4ERR_DELEG_REVOKED)
206
207/* error codes for internal use */
208/* if a request fails due to kmalloc failure, it gets dropped.
209 * Client should resend eventually
210 */
211#define nfserr_dropit cpu_to_be32(30000)
212/* end-of-file indicator in readdir */
213#define nfserr_eof cpu_to_be32(30001)
214/* replay detected */
215#define nfserr_replay_me cpu_to_be32(11001)
216/* nfs41 replay detected */
217#define nfserr_replay_cache cpu_to_be32(11002)
218
219/* Check for dir entries '.' and '..' */
220#define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.'))
221
222/*
223 * Time of server startup
224 */
225extern struct timeval nfssvc_boot;
226
227#ifdef CONFIG_NFSD_V4
228
229/* before processing a COMPOUND operation, we have to check that there
230 * is enough space in the buffer for XDR encode to succeed. otherwise,
231 * we might process an operation with side effects, and be unable to
232 * tell the client that the operation succeeded.
233 *
234 * COMPOUND_SLACK_SPACE - this is the minimum bytes of buffer space
235 * needed to encode an "ordinary" _successful_ operation. (GETATTR,
236 * READ, READDIR, and READLINK have their own buffer checks.) if we
237 * fall below this level, we fail the next operation with NFS4ERR_RESOURCE.
238 *
239 * COMPOUND_ERR_SLACK_SPACE - this is the minimum bytes of buffer space
240 * needed to encode an operation which has failed with NFS4ERR_RESOURCE.
241 * care is taken to ensure that we never fall below this level for any
242 * reason.
243 */
244#define COMPOUND_SLACK_SPACE 140 /* OP_GETFH */
245#define COMPOUND_ERR_SLACK_SPACE 12 /* OP_SETATTR */
246
247#define NFSD_LEASE_TIME (nfs4_lease_time())
248#define NFSD_LAUNDROMAT_MINTIMEOUT 10 /* seconds */
249
250/*
251 * The following attributes are currently not supported by the NFSv4 server:
252 * ARCHIVE (deprecated anyway)
253 * HIDDEN (unlikely to be supported any time soon)
254 * MIMETYPE (unlikely to be supported any time soon)
255 * QUOTA_* (will be supported in a forthcoming patch)
256 * SYSTEM (unlikely to be supported any time soon)
257 * TIME_BACKUP (unlikely to be supported any time soon)
258 * TIME_CREATE (unlikely to be supported any time soon)
259 */
260#define NFSD4_SUPPORTED_ATTRS_WORD0 \
261(FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_TYPE | FATTR4_WORD0_FH_EXPIRE_TYPE \
262 | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_LINK_SUPPORT \
263 | FATTR4_WORD0_SYMLINK_SUPPORT | FATTR4_WORD0_NAMED_ATTR | FATTR4_WORD0_FSID \
264 | FATTR4_WORD0_UNIQUE_HANDLES | FATTR4_WORD0_LEASE_TIME | FATTR4_WORD0_RDATTR_ERROR \
265 | FATTR4_WORD0_ACLSUPPORT | FATTR4_WORD0_CANSETTIME | FATTR4_WORD0_CASE_INSENSITIVE \
266 | FATTR4_WORD0_CASE_PRESERVING | FATTR4_WORD0_CHOWN_RESTRICTED \
267 | FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FILEID | FATTR4_WORD0_FILES_AVAIL \
268 | FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_HOMOGENEOUS \
269 | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \
270 | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL)
271
272#define NFSD4_SUPPORTED_ATTRS_WORD1 \
273(FATTR4_WORD1_MODE | FATTR4_WORD1_NO_TRUNC | FATTR4_WORD1_NUMLINKS \
274 | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \
275 | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \
276 | FATTR4_WORD1_SPACE_USED | FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_ACCESS_SET \
277 | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \
278 | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID)
279
280#define NFSD4_SUPPORTED_ATTRS_WORD2 0
281
282#define NFSD4_1_SUPPORTED_ATTRS_WORD0 \
283 NFSD4_SUPPORTED_ATTRS_WORD0
284
285#define NFSD4_1_SUPPORTED_ATTRS_WORD1 \
286 NFSD4_SUPPORTED_ATTRS_WORD1
287
288#define NFSD4_1_SUPPORTED_ATTRS_WORD2 \
289 (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT)
290
291static inline u32 nfsd_suppattrs0(u32 minorversion)
292{
293 return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0
294 : NFSD4_SUPPORTED_ATTRS_WORD0;
295}
296
297static inline u32 nfsd_suppattrs1(u32 minorversion)
298{
299 return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD1
300 : NFSD4_SUPPORTED_ATTRS_WORD1;
301}
302
303static inline u32 nfsd_suppattrs2(u32 minorversion)
304{
305 return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD2
306 : NFSD4_SUPPORTED_ATTRS_WORD2;
307}
308
309/* These will return ERR_INVAL if specified in GETATTR or READDIR. */
310#define NFSD_WRITEONLY_ATTRS_WORD1 \
311(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)
312
313/* These are the only attrs allowed in CREATE/OPEN/SETATTR. */
314#define NFSD_WRITEABLE_ATTRS_WORD0 \
315(FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL )
316#define NFSD_WRITEABLE_ATTRS_WORD1 \
317(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \
318 | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)
319#define NFSD_WRITEABLE_ATTRS_WORD2 0
320
321#define NFSD_SUPPATTR_EXCLCREAT_WORD0 \
322 NFSD_WRITEABLE_ATTRS_WORD0
323/*
324 * we currently store the exclusive create verifier in the v_{a,m}time
325 * attributes so the client can't set these at create time using EXCLUSIVE4_1
326 */
327#define NFSD_SUPPATTR_EXCLCREAT_WORD1 \
328 (NFSD_WRITEABLE_ATTRS_WORD1 & \
329 ~(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET))
330#define NFSD_SUPPATTR_EXCLCREAT_WORD2 \
331 NFSD_WRITEABLE_ATTRS_WORD2
332
333#endif /* CONFIG_NFSD_V4 */
334
335#endif /* LINUX_NFSD_NFSD_H */
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 739948165034..0eb1c59f5ab8 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -12,7 +12,7 @@
12#include <linux/exportfs.h> 12#include <linux/exportfs.h>
13 13
14#include <linux/sunrpc/svcauth_gss.h> 14#include <linux/sunrpc/svcauth_gss.h>
15#include <linux/nfsd/nfsd.h> 15#include "nfsd.h"
16#include "vfs.h" 16#include "vfs.h"
17#include "auth.h" 17#include "auth.h"
18 18
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index b6bd9e0d7cd0..21a5f793c3d1 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -9,8 +9,8 @@
9 9
10#include <linux/namei.h> 10#include <linux/namei.h>
11 11
12#include <linux/nfsd/cache.h> 12#include "cache.h"
13#include <linux/nfsd/xdr.h> 13#include "xdr.h"
14#include "vfs.h" 14#include "vfs.h"
15 15
16typedef struct svc_rqst svc_rqst; 16typedef struct svc_rqst svc_rqst;
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index b2d7ffac0357..b520ce10bd15 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -15,11 +15,11 @@
15 15
16#include <linux/sunrpc/stats.h> 16#include <linux/sunrpc/stats.h>
17#include <linux/sunrpc/svcsock.h> 17#include <linux/sunrpc/svcsock.h>
18#include <linux/nfsd/nfsd.h>
19#include <linux/nfsd/cache.h>
20#include <linux/lockd/bind.h> 18#include <linux/lockd/bind.h>
21#include <linux/nfsacl.h> 19#include <linux/nfsacl.h>
22#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include "nfsd.h"
22#include "cache.h"
23#include "vfs.h" 23#include "vfs.h"
24 24
25#define NFSDDBG_FACILITY NFSDDBG_SVC 25#define NFSDDBG_FACILITY NFSDDBG_SVC
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 5e0603da39e7..3bec831704af 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> 6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
7 */ 7 */
8 8
9#include <linux/nfsd/xdr.h> 9#include "xdr.h"
10#include "auth.h" 10#include "auth.h"
11 11
12#define NFSDDBG_FACILITY NFSDDBG_XDR 12#define NFSDDBG_FACILITY NFSDDBG_XDR
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
new file mode 100644
index 000000000000..2af75686e0d3
--- /dev/null
+++ b/fs/nfsd/state.h
@@ -0,0 +1,409 @@
1/*
2 * linux/include/nfsd/state.h
3 *
4 * Copyright (c) 2001 The Regents of the University of Michigan.
5 * All rights reserved.
6 *
7 * Kendrick Smith <kmsmith@umich.edu>
8 * Andy Adamson <andros@umich.edu>
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
24 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 */
36
37#ifndef _NFSD4_STATE_H
38#define _NFSD4_STATE_H
39
40#include <linux/nfsd/nfsfh.h>
41
42typedef struct {
43 u32 cl_boot;
44 u32 cl_id;
45} clientid_t;
46
47typedef struct {
48 u32 so_boot;
49 u32 so_stateownerid;
50 u32 so_fileid;
51} stateid_opaque_t;
52
53typedef struct {
54 u32 si_generation;
55 stateid_opaque_t si_opaque;
56} stateid_t;
57#define si_boot si_opaque.so_boot
58#define si_stateownerid si_opaque.so_stateownerid
59#define si_fileid si_opaque.so_fileid
60
61#define STATEID_FMT "(%08x/%08x/%08x/%08x)"
62#define STATEID_VAL(s) \
63 (s)->si_boot, \
64 (s)->si_stateownerid, \
65 (s)->si_fileid, \
66 (s)->si_generation
67
68struct nfsd4_cb_sequence {
69 /* args/res */
70 u32 cbs_minorversion;
71 struct nfs4_client *cbs_clp;
72};
73
74struct nfs4_delegation {
75 struct list_head dl_perfile;
76 struct list_head dl_perclnt;
77 struct list_head dl_recall_lru; /* delegation recalled */
78 atomic_t dl_count; /* ref count */
79 struct nfs4_client *dl_client;
80 struct nfs4_file *dl_file;
81 struct file_lock *dl_flock;
82 struct file *dl_vfs_file;
83 u32 dl_type;
84 time_t dl_time;
85/* For recall: */
86 u32 dl_ident;
87 stateid_t dl_stateid;
88 struct knfsd_fh dl_fh;
89 int dl_retries;
90};
91
92/* client delegation callback info */
93struct nfs4_cb_conn {
94 /* SETCLIENTID info */
95 struct sockaddr_storage cb_addr;
96 size_t cb_addrlen;
97 u32 cb_prog;
98 u32 cb_minorversion;
99 u32 cb_ident; /* minorversion 0 only */
100 /* RPC client info */
101 atomic_t cb_set; /* successful CB_NULL call */
102 struct rpc_clnt * cb_client;
103};
104
105/* Maximum number of slots per session. 160 is useful for long haul TCP */
106#define NFSD_MAX_SLOTS_PER_SESSION 160
107/* Maximum number of operations per session compound */
108#define NFSD_MAX_OPS_PER_COMPOUND 16
109/* Maximum session per slot cache size */
110#define NFSD_SLOT_CACHE_SIZE 1024
111/* Maximum number of NFSD_SLOT_CACHE_SIZE slots per session */
112#define NFSD_CACHE_SIZE_SLOTS_PER_SESSION 32
113#define NFSD_MAX_MEM_PER_SESSION \
114 (NFSD_CACHE_SIZE_SLOTS_PER_SESSION * NFSD_SLOT_CACHE_SIZE)
115
116struct nfsd4_slot {
117 bool sl_inuse;
118 bool sl_cachethis;
119 u16 sl_opcnt;
120 u32 sl_seqid;
121 __be32 sl_status;
122 u32 sl_datalen;
123 char sl_data[];
124};
125
126struct nfsd4_channel_attrs {
127 u32 headerpadsz;
128 u32 maxreq_sz;
129 u32 maxresp_sz;
130 u32 maxresp_cached;
131 u32 maxops;
132 u32 maxreqs;
133 u32 nr_rdma_attrs;
134 u32 rdma_attrs;
135};
136
137struct nfsd4_create_session {
138 clientid_t clientid;
139 struct nfs4_sessionid sessionid;
140 u32 seqid;
141 u32 flags;
142 struct nfsd4_channel_attrs fore_channel;
143 struct nfsd4_channel_attrs back_channel;
144 u32 callback_prog;
145 u32 uid;
146 u32 gid;
147};
148
149/* The single slot clientid cache structure */
150struct nfsd4_clid_slot {
151 u32 sl_seqid;
152 __be32 sl_status;
153 struct nfsd4_create_session sl_cr_ses;
154};
155
156struct nfsd4_session {
157 struct kref se_ref;
158 struct list_head se_hash; /* hash by sessionid */
159 struct list_head se_perclnt;
160 u32 se_flags;
161 struct nfs4_client *se_client; /* for expire_client */
162 struct nfs4_sessionid se_sessionid;
163 struct nfsd4_channel_attrs se_fchannel;
164 struct nfsd4_channel_attrs se_bchannel;
165 struct nfsd4_slot *se_slots[]; /* forward channel slots */
166};
167
168static inline void
169nfsd4_put_session(struct nfsd4_session *ses)
170{
171 extern void free_session(struct kref *kref);
172 kref_put(&ses->se_ref, free_session);
173}
174
175static inline void
176nfsd4_get_session(struct nfsd4_session *ses)
177{
178 kref_get(&ses->se_ref);
179}
180
181/* formatted contents of nfs4_sessionid */
182struct nfsd4_sessionid {
183 clientid_t clientid;
184 u32 sequence;
185 u32 reserved;
186};
187
188#define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */
189
190/*
191 * struct nfs4_client - one per client. Clientids live here.
192 * o Each nfs4_client is hashed by clientid.
193 *
194 * o Each nfs4_clients is also hashed by name
195 * (the opaque quantity initially sent by the client to identify itself).
196 *
197 * o cl_perclient list is used to ensure no dangling stateowner references
198 * when we expire the nfs4_client
199 */
200struct nfs4_client {
201 struct list_head cl_idhash; /* hash by cl_clientid.id */
202 struct list_head cl_strhash; /* hash by cl_name */
203 struct list_head cl_openowners;
204 struct list_head cl_delegations;
205 struct list_head cl_lru; /* tail queue */
206 struct xdr_netobj cl_name; /* id generated by client */
207 char cl_recdir[HEXDIR_LEN]; /* recovery dir */
208 nfs4_verifier cl_verifier; /* generated by client */
209 time_t cl_time; /* time of last lease renewal */
210 struct sockaddr_storage cl_addr; /* client ipaddress */
211 u32 cl_flavor; /* setclientid pseudoflavor */
212 char *cl_principal; /* setclientid principal name */
213 struct svc_cred cl_cred; /* setclientid principal */
214 clientid_t cl_clientid; /* generated by server */
215 nfs4_verifier cl_confirm; /* generated by server */
216 struct nfs4_cb_conn cl_cb_conn; /* callback info */
217 atomic_t cl_count; /* ref count */
218 u32 cl_firststate; /* recovery dir creation */
219
220 /* for nfs41 */
221 struct list_head cl_sessions;
222 struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */
223 u32 cl_exchange_flags;
224 struct nfs4_sessionid cl_sessionid;
225
226 /* for nfs41 callbacks */
227 /* We currently support a single back channel with a single slot */
228 unsigned long cl_cb_slot_busy;
229 u32 cl_cb_seq_nr;
230 struct svc_xprt *cl_cb_xprt; /* 4.1 callback transport */
231 struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */
232 /* wait here for slots */
233};
234
235/* struct nfs4_client_reset
236 * one per old client. Populates reset_str_hashtbl. Filled from conf_id_hashtbl
237 * upon lease reset, or from upcall to state_daemon (to read in state
238 * from non-volitile storage) upon reboot.
239 */
240struct nfs4_client_reclaim {
241 struct list_head cr_strhash; /* hash by cr_name */
242 char cr_recdir[HEXDIR_LEN]; /* recover dir */
243};
244
245static inline void
246update_stateid(stateid_t *stateid)
247{
248 stateid->si_generation++;
249}
250
251/* A reasonable value for REPLAY_ISIZE was estimated as follows:
252 * The OPEN response, typically the largest, requires
253 * 4(status) + 8(stateid) + 20(changeinfo) + 4(rflags) + 8(verifier) +
254 * 4(deleg. type) + 8(deleg. stateid) + 4(deleg. recall flag) +
255 * 20(deleg. space limit) + ~32(deleg. ace) = 112 bytes
256 */
257
258#define NFSD4_REPLAY_ISIZE 112
259
260/*
261 * Replay buffer, where the result of the last seqid-mutating operation
262 * is cached.
263 */
264struct nfs4_replay {
265 __be32 rp_status;
266 unsigned int rp_buflen;
267 char *rp_buf;
268 unsigned intrp_allocated;
269 struct knfsd_fh rp_openfh;
270 char rp_ibuf[NFSD4_REPLAY_ISIZE];
271};
272
273/*
274* nfs4_stateowner can either be an open_owner, or a lock_owner
275*
276* so_idhash: stateid_hashtbl[] for open owner, lockstateid_hashtbl[]
277* for lock_owner
278* so_strhash: ownerstr_hashtbl[] for open_owner, lock_ownerstr_hashtbl[]
279* for lock_owner
280* so_perclient: nfs4_client->cl_perclient entry - used when nfs4_client
281* struct is reaped.
282* so_perfilestate: heads the list of nfs4_stateid (either open or lock)
283* and is used to ensure no dangling nfs4_stateid references when we
284* release a stateowner.
285* so_perlockowner: (open) nfs4_stateid->st_perlockowner entry - used when
286* close is called to reap associated byte-range locks
287* so_close_lru: (open) stateowner is placed on this list instead of being
288* reaped (when so_perfilestate is empty) to hold the last close replay.
289* reaped by laundramat thread after lease period.
290*/
291struct nfs4_stateowner {
292 struct kref so_ref;
293 struct list_head so_idhash; /* hash by so_id */
294 struct list_head so_strhash; /* hash by op_name */
295 struct list_head so_perclient;
296 struct list_head so_stateids;
297 struct list_head so_perstateid; /* for lockowners only */
298 struct list_head so_close_lru; /* tail queue */
299 time_t so_time; /* time of placement on so_close_lru */
300 int so_is_open_owner; /* 1=openowner,0=lockowner */
301 u32 so_id;
302 struct nfs4_client * so_client;
303 /* after increment in ENCODE_SEQID_OP_TAIL, represents the next
304 * sequence id expected from the client: */
305 u32 so_seqid;
306 struct xdr_netobj so_owner; /* open owner name */
307 int so_confirmed; /* successful OPEN_CONFIRM? */
308 struct nfs4_replay so_replay;
309};
310
311/*
312* nfs4_file: a file opened by some number of (open) nfs4_stateowners.
313* o fi_perfile list is used to search for conflicting
314* share_acces, share_deny on the file.
315*/
316struct nfs4_file {
317 atomic_t fi_ref;
318 struct list_head fi_hash; /* hash by "struct inode *" */
319 struct list_head fi_stateids;
320 struct list_head fi_delegations;
321 struct inode *fi_inode;
322 u32 fi_id; /* used with stateowner->so_id
323 * for stateid_hashtbl hash */
324 bool fi_had_conflict;
325};
326
327/*
328* nfs4_stateid can either be an open stateid or (eventually) a lock stateid
329*
330* (open)nfs4_stateid: one per (open)nfs4_stateowner, nfs4_file
331*
332* st_hash: stateid_hashtbl[] entry or lockstateid_hashtbl entry
333* st_perfile: file_hashtbl[] entry.
334* st_perfile_state: nfs4_stateowner->so_perfilestate
335* st_perlockowner: (open stateid) list of lock nfs4_stateowners
336* st_access_bmap: used only for open stateid
337* st_deny_bmap: used only for open stateid
338* st_openstp: open stateid lock stateid was derived from
339*
340* XXX: open stateids and lock stateids have diverged sufficiently that
341* we should consider defining separate structs for the two cases.
342*/
343
344struct nfs4_stateid {
345 struct list_head st_hash;
346 struct list_head st_perfile;
347 struct list_head st_perstateowner;
348 struct list_head st_lockowners;
349 struct nfs4_stateowner * st_stateowner;
350 struct nfs4_file * st_file;
351 stateid_t st_stateid;
352 struct file * st_vfs_file;
353 unsigned long st_access_bmap;
354 unsigned long st_deny_bmap;
355 struct nfs4_stateid * st_openstp;
356};
357
358/* flags for preprocess_seqid_op() */
359#define HAS_SESSION 0x00000001
360#define CONFIRM 0x00000002
361#define OPEN_STATE 0x00000004
362#define LOCK_STATE 0x00000008
363#define RD_STATE 0x00000010
364#define WR_STATE 0x00000020
365#define CLOSE_STATE 0x00000040
366
367#define seqid_mutating_err(err) \
368 (((err) != nfserr_stale_clientid) && \
369 ((err) != nfserr_bad_seqid) && \
370 ((err) != nfserr_stale_stateid) && \
371 ((err) != nfserr_bad_stateid))
372
373struct nfsd4_compound_state;
374
375extern __be32 nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
376 stateid_t *stateid, int flags, struct file **filp);
377extern void nfs4_lock_state(void);
378extern void nfs4_unlock_state(void);
379extern int nfs4_in_grace(void);
380extern __be32 nfs4_check_open_reclaim(clientid_t *clid);
381extern void put_nfs4_client(struct nfs4_client *clp);
382extern void nfs4_free_stateowner(struct kref *kref);
383extern int set_callback_cred(void);
384extern void nfsd4_probe_callback(struct nfs4_client *clp);
385extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
386extern void nfs4_put_delegation(struct nfs4_delegation *dp);
387extern __be32 nfs4_make_rec_clidname(char *clidname, struct xdr_netobj *clname);
388extern void nfsd4_init_recdir(char *recdir_name);
389extern int nfsd4_recdir_load(void);
390extern void nfsd4_shutdown_recdir(void);
391extern int nfs4_client_to_reclaim(const char *name);
392extern int nfs4_has_reclaimed_state(const char *name, bool use_exchange_id);
393extern void nfsd4_recdir_purge_old(void);
394extern int nfsd4_create_clid_dir(struct nfs4_client *clp);
395extern void nfsd4_remove_clid_dir(struct nfs4_client *clp);
396
397static inline void
398nfs4_put_stateowner(struct nfs4_stateowner *so)
399{
400 kref_put(&so->so_ref, nfs4_free_stateowner);
401}
402
403static inline void
404nfs4_get_stateowner(struct nfs4_stateowner *so)
405{
406 kref_get(&so->so_ref);
407}
408
409#endif /* NFSD4_STATE_H */
diff --git a/fs/nfsd/stats.c b/fs/nfsd/stats.c
index e3e411e9fe4a..3fc69dfd3091 100644
--- a/fs/nfsd/stats.c
+++ b/fs/nfsd/stats.c
@@ -25,11 +25,11 @@
25 25
26#include <linux/seq_file.h> 26#include <linux/seq_file.h>
27#include <linux/module.h> 27#include <linux/module.h>
28
29#include <linux/sunrpc/stats.h> 28#include <linux/sunrpc/stats.h>
30#include <linux/nfsd/nfsd.h>
31#include <linux/nfsd/stats.h> 29#include <linux/nfsd/stats.h>
32 30
31#include "nfsd.h"
32
33struct nfsd_stats nfsdstats; 33struct nfsd_stats nfsdstats;
34struct svc_stat nfsd_svcstats = { 34struct svc_stat nfsd_svcstats = {
35 .program = &nfsd_program, 35 .program = &nfsd_program,
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 81ce108c114e..04bdba12d21b 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -22,23 +22,25 @@
22#include <linux/fcntl.h> 22#include <linux/fcntl.h>
23#include <linux/namei.h> 23#include <linux/namei.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/nfsd/nfsd.h>
26#ifdef CONFIG_NFSD_V3
27#include <linux/nfsd/xdr3.h>
28#endif /* CONFIG_NFSD_V3 */
29#include <linux/quotaops.h> 25#include <linux/quotaops.h>
30#include <linux/fsnotify.h> 26#include <linux/fsnotify.h>
31#include <linux/posix_acl_xattr.h> 27#include <linux/posix_acl_xattr.h>
32#include <linux/xattr.h> 28#include <linux/xattr.h>
29#include <linux/jhash.h>
30#include <linux/ima.h>
31#include <asm/uaccess.h>
32
33#ifdef CONFIG_NFSD_V3
34#include "xdr3.h"
35#endif /* CONFIG_NFSD_V3 */
36
33#ifdef CONFIG_NFSD_V4 37#ifdef CONFIG_NFSD_V4
34#include <linux/nfs4_acl.h> 38#include <linux/nfs4_acl.h>
35#include <linux/nfsd_idmap.h> 39#include <linux/nfsd_idmap.h>
36#endif /* CONFIG_NFSD_V4 */ 40#endif /* CONFIG_NFSD_V4 */
37#include <linux/jhash.h>
38#include <linux/ima.h>
39#include "vfs.h"
40 41
41#include <asm/uaccess.h> 42#include "nfsd.h"
43#include "vfs.h"
42 44
43#define NFSDDBG_FACILITY NFSDDBG_FILEOP 45#define NFSDDBG_FACILITY NFSDDBG_FILEOP
44 46
diff --git a/fs/nfsd/xdr.h b/fs/nfsd/xdr.h
new file mode 100644
index 000000000000..235ee5c3be54
--- /dev/null
+++ b/fs/nfsd/xdr.h
@@ -0,0 +1,176 @@
1/*
2 * linux/include/linux/nfsd/xdr.h
3 *
4 * XDR types for nfsd. This is mainly a typing exercise.
5 */
6
7#ifndef LINUX_NFSD_H
8#define LINUX_NFSD_H
9
10#include <linux/vfs.h>
11#include "nfsd.h"
12
13struct nfsd_fhandle {
14 struct svc_fh fh;
15};
16
17struct nfsd_sattrargs {
18 struct svc_fh fh;
19 struct iattr attrs;
20};
21
22struct nfsd_diropargs {
23 struct svc_fh fh;
24 char * name;
25 unsigned int len;
26};
27
28struct nfsd_readargs {
29 struct svc_fh fh;
30 __u32 offset;
31 __u32 count;
32 int vlen;
33};
34
35struct nfsd_writeargs {
36 svc_fh fh;
37 __u32 offset;
38 int len;
39 int vlen;
40};
41
42struct nfsd_createargs {
43 struct svc_fh fh;
44 char * name;
45 unsigned int len;
46 struct iattr attrs;
47};
48
49struct nfsd_renameargs {
50 struct svc_fh ffh;
51 char * fname;
52 unsigned int flen;
53 struct svc_fh tfh;
54 char * tname;
55 unsigned int tlen;
56};
57
58struct nfsd_readlinkargs {
59 struct svc_fh fh;
60 char * buffer;
61};
62
63struct nfsd_linkargs {
64 struct svc_fh ffh;
65 struct svc_fh tfh;
66 char * tname;
67 unsigned int tlen;
68};
69
70struct nfsd_symlinkargs {
71 struct svc_fh ffh;
72 char * fname;
73 unsigned int flen;
74 char * tname;
75 unsigned int tlen;
76 struct iattr attrs;
77};
78
79struct nfsd_readdirargs {
80 struct svc_fh fh;
81 __u32 cookie;
82 __u32 count;
83 __be32 * buffer;
84};
85
86struct nfsd_attrstat {
87 struct svc_fh fh;
88 struct kstat stat;
89};
90
91struct nfsd_diropres {
92 struct svc_fh fh;
93 struct kstat stat;
94};
95
96struct nfsd_readlinkres {
97 int len;
98};
99
100struct nfsd_readres {
101 struct svc_fh fh;
102 unsigned long count;
103 struct kstat stat;
104};
105
106struct nfsd_readdirres {
107 int count;
108
109 struct readdir_cd common;
110 __be32 * buffer;
111 int buflen;
112 __be32 * offset;
113};
114
115struct nfsd_statfsres {
116 struct kstatfs stats;
117};
118
119/*
120 * Storage requirements for XDR arguments and results.
121 */
122union nfsd_xdrstore {
123 struct nfsd_sattrargs sattr;
124 struct nfsd_diropargs dirop;
125 struct nfsd_readargs read;
126 struct nfsd_writeargs write;
127 struct nfsd_createargs create;
128 struct nfsd_renameargs rename;
129 struct nfsd_linkargs link;
130 struct nfsd_symlinkargs symlink;
131 struct nfsd_readdirargs readdir;
132};
133
134#define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore)
135
136
137int nfssvc_decode_void(struct svc_rqst *, __be32 *, void *);
138int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
139int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *,
140 struct nfsd_sattrargs *);
141int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *,
142 struct nfsd_diropargs *);
143int nfssvc_decode_readargs(struct svc_rqst *, __be32 *,
144 struct nfsd_readargs *);
145int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *,
146 struct nfsd_writeargs *);
147int nfssvc_decode_createargs(struct svc_rqst *, __be32 *,
148 struct nfsd_createargs *);
149int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *,
150 struct nfsd_renameargs *);
151int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *,
152 struct nfsd_readlinkargs *);
153int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *,
154 struct nfsd_linkargs *);
155int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *,
156 struct nfsd_symlinkargs *);
157int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *,
158 struct nfsd_readdirargs *);
159int nfssvc_encode_void(struct svc_rqst *, __be32 *, void *);
160int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *, struct nfsd_attrstat *);
161int nfssvc_encode_diropres(struct svc_rqst *, __be32 *, struct nfsd_diropres *);
162int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *, struct nfsd_readlinkres *);
163int nfssvc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd_readres *);
164int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *);
165int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *);
166
167int nfssvc_encode_entry(void *, const char *name,
168 int namlen, loff_t offset, u64 ino, unsigned int);
169
170int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
171
172/* Helper functions for NFSv2 ACL code */
173__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp);
174__be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp);
175
176#endif /* LINUX_NFSD_H */
diff --git a/fs/nfsd/xdr3.h b/fs/nfsd/xdr3.h
new file mode 100644
index 000000000000..b330756973cf
--- /dev/null
+++ b/fs/nfsd/xdr3.h
@@ -0,0 +1,346 @@
1/*
2 * linux/include/linux/nfsd/xdr3.h
3 *
4 * XDR types for NFSv3 in nfsd.
5 *
6 * Copyright (C) 1996-1998, Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef _LINUX_NFSD_XDR3_H
10#define _LINUX_NFSD_XDR3_H
11
12#include "xdr.h"
13
14struct nfsd3_sattrargs {
15 struct svc_fh fh;
16 struct iattr attrs;
17 int check_guard;
18 time_t guardtime;
19};
20
21struct nfsd3_diropargs {
22 struct svc_fh fh;
23 char * name;
24 unsigned int len;
25};
26
27struct nfsd3_accessargs {
28 struct svc_fh fh;
29 unsigned int access;
30};
31
32struct nfsd3_readargs {
33 struct svc_fh fh;
34 __u64 offset;
35 __u32 count;
36 int vlen;
37};
38
39struct nfsd3_writeargs {
40 svc_fh fh;
41 __u64 offset;
42 __u32 count;
43 int stable;
44 __u32 len;
45 int vlen;
46};
47
48struct nfsd3_createargs {
49 struct svc_fh fh;
50 char * name;
51 unsigned int len;
52 int createmode;
53 struct iattr attrs;
54 __be32 * verf;
55};
56
57struct nfsd3_mknodargs {
58 struct svc_fh fh;
59 char * name;
60 unsigned int len;
61 __u32 ftype;
62 __u32 major, minor;
63 struct iattr attrs;
64};
65
66struct nfsd3_renameargs {
67 struct svc_fh ffh;
68 char * fname;
69 unsigned int flen;
70 struct svc_fh tfh;
71 char * tname;
72 unsigned int tlen;
73};
74
75struct nfsd3_readlinkargs {
76 struct svc_fh fh;
77 char * buffer;
78};
79
80struct nfsd3_linkargs {
81 struct svc_fh ffh;
82 struct svc_fh tfh;
83 char * tname;
84 unsigned int tlen;
85};
86
87struct nfsd3_symlinkargs {
88 struct svc_fh ffh;
89 char * fname;
90 unsigned int flen;
91 char * tname;
92 unsigned int tlen;
93 struct iattr attrs;
94};
95
96struct nfsd3_readdirargs {
97 struct svc_fh fh;
98 __u64 cookie;
99 __u32 dircount;
100 __u32 count;
101 __be32 * verf;
102 __be32 * buffer;
103};
104
105struct nfsd3_commitargs {
106 struct svc_fh fh;
107 __u64 offset;
108 __u32 count;
109};
110
111struct nfsd3_getaclargs {
112 struct svc_fh fh;
113 int mask;
114};
115
116struct posix_acl;
117struct nfsd3_setaclargs {
118 struct svc_fh fh;
119 int mask;
120 struct posix_acl *acl_access;
121 struct posix_acl *acl_default;
122};
123
124struct nfsd3_attrstat {
125 __be32 status;
126 struct svc_fh fh;
127 struct kstat stat;
128};
129
130/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
131struct nfsd3_diropres {
132 __be32 status;
133 struct svc_fh dirfh;
134 struct svc_fh fh;
135};
136
137struct nfsd3_accessres {
138 __be32 status;
139 struct svc_fh fh;
140 __u32 access;
141};
142
143struct nfsd3_readlinkres {
144 __be32 status;
145 struct svc_fh fh;
146 __u32 len;
147};
148
149struct nfsd3_readres {
150 __be32 status;
151 struct svc_fh fh;
152 unsigned long count;
153 int eof;
154};
155
156struct nfsd3_writeres {
157 __be32 status;
158 struct svc_fh fh;
159 unsigned long count;
160 int committed;
161};
162
163struct nfsd3_renameres {
164 __be32 status;
165 struct svc_fh ffh;
166 struct svc_fh tfh;
167};
168
169struct nfsd3_linkres {
170 __be32 status;
171 struct svc_fh tfh;
172 struct svc_fh fh;
173};
174
175struct nfsd3_readdirres {
176 __be32 status;
177 struct svc_fh fh;
178 int count;
179 __be32 verf[2];
180
181 struct readdir_cd common;
182 __be32 * buffer;
183 int buflen;
184 __be32 * offset;
185 __be32 * offset1;
186 struct svc_rqst * rqstp;
187
188};
189
190struct nfsd3_fsstatres {
191 __be32 status;
192 struct kstatfs stats;
193 __u32 invarsec;
194};
195
196struct nfsd3_fsinfores {
197 __be32 status;
198 __u32 f_rtmax;
199 __u32 f_rtpref;
200 __u32 f_rtmult;
201 __u32 f_wtmax;
202 __u32 f_wtpref;
203 __u32 f_wtmult;
204 __u32 f_dtpref;
205 __u64 f_maxfilesize;
206 __u32 f_properties;
207};
208
209struct nfsd3_pathconfres {
210 __be32 status;
211 __u32 p_link_max;
212 __u32 p_name_max;
213 __u32 p_no_trunc;
214 __u32 p_chown_restricted;
215 __u32 p_case_insensitive;
216 __u32 p_case_preserving;
217};
218
219struct nfsd3_commitres {
220 __be32 status;
221 struct svc_fh fh;
222};
223
224struct nfsd3_getaclres {
225 __be32 status;
226 struct svc_fh fh;
227 int mask;
228 struct posix_acl *acl_access;
229 struct posix_acl *acl_default;
230};
231
232/* dummy type for release */
233struct nfsd3_fhandle_pair {
234 __u32 dummy;
235 struct svc_fh fh1;
236 struct svc_fh fh2;
237};
238
239/*
240 * Storage requirements for XDR arguments and results.
241 */
242union nfsd3_xdrstore {
243 struct nfsd3_sattrargs sattrargs;
244 struct nfsd3_diropargs diropargs;
245 struct nfsd3_readargs readargs;
246 struct nfsd3_writeargs writeargs;
247 struct nfsd3_createargs createargs;
248 struct nfsd3_renameargs renameargs;
249 struct nfsd3_linkargs linkargs;
250 struct nfsd3_symlinkargs symlinkargs;
251 struct nfsd3_readdirargs readdirargs;
252 struct nfsd3_diropres diropres;
253 struct nfsd3_accessres accessres;
254 struct nfsd3_readlinkres readlinkres;
255 struct nfsd3_readres readres;
256 struct nfsd3_writeres writeres;
257 struct nfsd3_renameres renameres;
258 struct nfsd3_linkres linkres;
259 struct nfsd3_readdirres readdirres;
260 struct nfsd3_fsstatres fsstatres;
261 struct nfsd3_fsinfores fsinfores;
262 struct nfsd3_pathconfres pathconfres;
263 struct nfsd3_commitres commitres;
264 struct nfsd3_getaclres getaclres;
265};
266
267#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore)
268
269int nfs3svc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
270int nfs3svc_decode_sattrargs(struct svc_rqst *, __be32 *,
271 struct nfsd3_sattrargs *);
272int nfs3svc_decode_diropargs(struct svc_rqst *, __be32 *,
273 struct nfsd3_diropargs *);
274int nfs3svc_decode_accessargs(struct svc_rqst *, __be32 *,
275 struct nfsd3_accessargs *);
276int nfs3svc_decode_readargs(struct svc_rqst *, __be32 *,
277 struct nfsd3_readargs *);
278int nfs3svc_decode_writeargs(struct svc_rqst *, __be32 *,
279 struct nfsd3_writeargs *);
280int nfs3svc_decode_createargs(struct svc_rqst *, __be32 *,
281 struct nfsd3_createargs *);
282int nfs3svc_decode_mkdirargs(struct svc_rqst *, __be32 *,
283 struct nfsd3_createargs *);
284int nfs3svc_decode_mknodargs(struct svc_rqst *, __be32 *,
285 struct nfsd3_mknodargs *);
286int nfs3svc_decode_renameargs(struct svc_rqst *, __be32 *,
287 struct nfsd3_renameargs *);
288int nfs3svc_decode_readlinkargs(struct svc_rqst *, __be32 *,
289 struct nfsd3_readlinkargs *);
290int nfs3svc_decode_linkargs(struct svc_rqst *, __be32 *,
291 struct nfsd3_linkargs *);
292int nfs3svc_decode_symlinkargs(struct svc_rqst *, __be32 *,
293 struct nfsd3_symlinkargs *);
294int nfs3svc_decode_readdirargs(struct svc_rqst *, __be32 *,
295 struct nfsd3_readdirargs *);
296int nfs3svc_decode_readdirplusargs(struct svc_rqst *, __be32 *,
297 struct nfsd3_readdirargs *);
298int nfs3svc_decode_commitargs(struct svc_rqst *, __be32 *,
299 struct nfsd3_commitargs *);
300int nfs3svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
301int nfs3svc_encode_attrstat(struct svc_rqst *, __be32 *,
302 struct nfsd3_attrstat *);
303int nfs3svc_encode_wccstat(struct svc_rqst *, __be32 *,
304 struct nfsd3_attrstat *);
305int nfs3svc_encode_diropres(struct svc_rqst *, __be32 *,
306 struct nfsd3_diropres *);
307int nfs3svc_encode_accessres(struct svc_rqst *, __be32 *,
308 struct nfsd3_accessres *);
309int nfs3svc_encode_readlinkres(struct svc_rqst *, __be32 *,
310 struct nfsd3_readlinkres *);
311int nfs3svc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd3_readres *);
312int nfs3svc_encode_writeres(struct svc_rqst *, __be32 *, struct nfsd3_writeres *);
313int nfs3svc_encode_createres(struct svc_rqst *, __be32 *,
314 struct nfsd3_diropres *);
315int nfs3svc_encode_renameres(struct svc_rqst *, __be32 *,
316 struct nfsd3_renameres *);
317int nfs3svc_encode_linkres(struct svc_rqst *, __be32 *,
318 struct nfsd3_linkres *);
319int nfs3svc_encode_readdirres(struct svc_rqst *, __be32 *,
320 struct nfsd3_readdirres *);
321int nfs3svc_encode_fsstatres(struct svc_rqst *, __be32 *,
322 struct nfsd3_fsstatres *);
323int nfs3svc_encode_fsinfores(struct svc_rqst *, __be32 *,
324 struct nfsd3_fsinfores *);
325int nfs3svc_encode_pathconfres(struct svc_rqst *, __be32 *,
326 struct nfsd3_pathconfres *);
327int nfs3svc_encode_commitres(struct svc_rqst *, __be32 *,
328 struct nfsd3_commitres *);
329
330int nfs3svc_release_fhandle(struct svc_rqst *, __be32 *,
331 struct nfsd3_attrstat *);
332int nfs3svc_release_fhandle2(struct svc_rqst *, __be32 *,
333 struct nfsd3_fhandle_pair *);
334int nfs3svc_encode_entry(void *, const char *name,
335 int namlen, loff_t offset, u64 ino,
336 unsigned int);
337int nfs3svc_encode_entry_plus(void *, const char *name,
338 int namlen, loff_t offset, u64 ino,
339 unsigned int);
340/* Helper functions for NFSv3 ACL code */
341__be32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p,
342 struct svc_fh *fhp);
343__be32 *nfs3svc_decode_fh(__be32 *p, struct svc_fh *fhp);
344
345
346#endif /* _LINUX_NFSD_XDR3_H */
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
new file mode 100644
index 000000000000..83202a1cf07b
--- /dev/null
+++ b/fs/nfsd/xdr4.h
@@ -0,0 +1,564 @@
1/*
2 * include/linux/nfsd/xdr4.h
3 *
4 * Server-side types for NFSv4.
5 *
6 * Copyright (c) 2002 The Regents of the University of Michigan.
7 * All rights reserved.
8 *
9 * Kendrick Smith <kmsmith@umich.edu>
10 * Andy Adamson <andros@umich.edu>
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 *
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. Neither the name of the University nor the names of its
22 * contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
26 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 */
38
39#ifndef _LINUX_NFSD_XDR4_H
40#define _LINUX_NFSD_XDR4_H
41
42#include "state.h"
43#include "nfsd.h"
44
45#define NFSD4_MAX_TAGLEN 128
46#define XDR_LEN(n) (((n) + 3) & ~3)
47
48struct nfsd4_compound_state {
49 struct svc_fh current_fh;
50 struct svc_fh save_fh;
51 struct nfs4_stateowner *replay_owner;
52 /* For sessions DRC */
53 struct nfsd4_session *session;
54 struct nfsd4_slot *slot;
55 __be32 *datap;
56 size_t iovlen;
57 u32 minorversion;
58 u32 status;
59};
60
61static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs)
62{
63 return cs->slot != NULL;
64}
65
66struct nfsd4_change_info {
67 u32 atomic;
68 bool change_supported;
69 u32 before_ctime_sec;
70 u32 before_ctime_nsec;
71 u64 before_change;
72 u32 after_ctime_sec;
73 u32 after_ctime_nsec;
74 u64 after_change;
75};
76
77struct nfsd4_access {
78 u32 ac_req_access; /* request */
79 u32 ac_supported; /* response */
80 u32 ac_resp_access; /* response */
81};
82
83struct nfsd4_close {
84 u32 cl_seqid; /* request */
85 stateid_t cl_stateid; /* request+response */
86 struct nfs4_stateowner * cl_stateowner; /* response */
87};
88
89struct nfsd4_commit {
90 u64 co_offset; /* request */
91 u32 co_count; /* request */
92 nfs4_verifier co_verf; /* response */
93};
94
95struct nfsd4_create {
96 u32 cr_namelen; /* request */
97 char * cr_name; /* request */
98 u32 cr_type; /* request */
99 union { /* request */
100 struct {
101 u32 namelen;
102 char *name;
103 } link; /* NF4LNK */
104 struct {
105 u32 specdata1;
106 u32 specdata2;
107 } dev; /* NF4BLK, NF4CHR */
108 } u;
109 u32 cr_bmval[3]; /* request */
110 struct iattr cr_iattr; /* request */
111 struct nfsd4_change_info cr_cinfo; /* response */
112 struct nfs4_acl *cr_acl;
113};
114#define cr_linklen u.link.namelen
115#define cr_linkname u.link.name
116#define cr_specdata1 u.dev.specdata1
117#define cr_specdata2 u.dev.specdata2
118
119struct nfsd4_delegreturn {
120 stateid_t dr_stateid;
121};
122
123struct nfsd4_getattr {
124 u32 ga_bmval[3]; /* request */
125 struct svc_fh *ga_fhp; /* response */
126};
127
128struct nfsd4_link {
129 u32 li_namelen; /* request */
130 char * li_name; /* request */
131 struct nfsd4_change_info li_cinfo; /* response */
132};
133
134struct nfsd4_lock_denied {
135 clientid_t ld_clientid;
136 struct nfs4_stateowner *ld_sop;
137 u64 ld_start;
138 u64 ld_length;
139 u32 ld_type;
140};
141
142struct nfsd4_lock {
143 /* request */
144 u32 lk_type;
145 u32 lk_reclaim; /* boolean */
146 u64 lk_offset;
147 u64 lk_length;
148 u32 lk_is_new;
149 union {
150 struct {
151 u32 open_seqid;
152 stateid_t open_stateid;
153 u32 lock_seqid;
154 clientid_t clientid;
155 struct xdr_netobj owner;
156 } new;
157 struct {
158 stateid_t lock_stateid;
159 u32 lock_seqid;
160 } old;
161 } v;
162
163 /* response */
164 union {
165 struct {
166 stateid_t stateid;
167 } ok;
168 struct nfsd4_lock_denied denied;
169 } u;
170 /* The lk_replay_owner is the open owner in the open_to_lock_owner
171 * case and the lock owner otherwise: */
172 struct nfs4_stateowner *lk_replay_owner;
173};
174#define lk_new_open_seqid v.new.open_seqid
175#define lk_new_open_stateid v.new.open_stateid
176#define lk_new_lock_seqid v.new.lock_seqid
177#define lk_new_clientid v.new.clientid
178#define lk_new_owner v.new.owner
179#define lk_old_lock_stateid v.old.lock_stateid
180#define lk_old_lock_seqid v.old.lock_seqid
181
182#define lk_rflags u.ok.rflags
183#define lk_resp_stateid u.ok.stateid
184#define lk_denied u.denied
185
186
187struct nfsd4_lockt {
188 u32 lt_type;
189 clientid_t lt_clientid;
190 struct xdr_netobj lt_owner;
191 u64 lt_offset;
192 u64 lt_length;
193 struct nfs4_stateowner * lt_stateowner;
194 struct nfsd4_lock_denied lt_denied;
195};
196
197
198struct nfsd4_locku {
199 u32 lu_type;
200 u32 lu_seqid;
201 stateid_t lu_stateid;
202 u64 lu_offset;
203 u64 lu_length;
204 struct nfs4_stateowner *lu_stateowner;
205};
206
207
208struct nfsd4_lookup {
209 u32 lo_len; /* request */
210 char * lo_name; /* request */
211};
212
213struct nfsd4_putfh {
214 u32 pf_fhlen; /* request */
215 char *pf_fhval; /* request */
216};
217
218struct nfsd4_open {
219 u32 op_claim_type; /* request */
220 struct xdr_netobj op_fname; /* request - everything but CLAIM_PREV */
221 u32 op_delegate_type; /* request - CLAIM_PREV only */
222 stateid_t op_delegate_stateid; /* request - response */
223 u32 op_create; /* request */
224 u32 op_createmode; /* request */
225 u32 op_bmval[3]; /* request */
226 struct iattr iattr; /* UNCHECKED4, GUARDED4, EXCLUSIVE4_1 */
227 nfs4_verifier verf; /* EXCLUSIVE4 */
228 clientid_t op_clientid; /* request */
229 struct xdr_netobj op_owner; /* request */
230 u32 op_seqid; /* request */
231 u32 op_share_access; /* request */
232 u32 op_share_deny; /* request */
233 stateid_t op_stateid; /* response */
234 u32 op_recall; /* recall */
235 struct nfsd4_change_info op_cinfo; /* response */
236 u32 op_rflags; /* response */
237 int op_truncate; /* used during processing */
238 struct nfs4_stateowner *op_stateowner; /* used during processing */
239 struct nfs4_acl *op_acl;
240};
241#define op_iattr iattr
242#define op_verf verf
243
244struct nfsd4_open_confirm {
245 stateid_t oc_req_stateid /* request */;
246 u32 oc_seqid /* request */;
247 stateid_t oc_resp_stateid /* response */;
248 struct nfs4_stateowner * oc_stateowner; /* response */
249};
250
251struct nfsd4_open_downgrade {
252 stateid_t od_stateid;
253 u32 od_seqid;
254 u32 od_share_access;
255 u32 od_share_deny;
256 struct nfs4_stateowner *od_stateowner;
257};
258
259
260struct nfsd4_read {
261 stateid_t rd_stateid; /* request */
262 u64 rd_offset; /* request */
263 u32 rd_length; /* request */
264 int rd_vlen;
265 struct file *rd_filp;
266
267 struct svc_rqst *rd_rqstp; /* response */
268 struct svc_fh * rd_fhp; /* response */
269};
270
271struct nfsd4_readdir {
272 u64 rd_cookie; /* request */
273 nfs4_verifier rd_verf; /* request */
274 u32 rd_dircount; /* request */
275 u32 rd_maxcount; /* request */
276 u32 rd_bmval[3]; /* request */
277 struct svc_rqst *rd_rqstp; /* response */
278 struct svc_fh * rd_fhp; /* response */
279
280 struct readdir_cd common;
281 __be32 * buffer;
282 int buflen;
283 __be32 * offset;
284};
285
286struct nfsd4_release_lockowner {
287 clientid_t rl_clientid;
288 struct xdr_netobj rl_owner;
289};
290struct nfsd4_readlink {
291 struct svc_rqst *rl_rqstp; /* request */
292 struct svc_fh * rl_fhp; /* request */
293};
294
295struct nfsd4_remove {
296 u32 rm_namelen; /* request */
297 char * rm_name; /* request */
298 struct nfsd4_change_info rm_cinfo; /* response */
299};
300
301struct nfsd4_rename {
302 u32 rn_snamelen; /* request */
303 char * rn_sname; /* request */
304 u32 rn_tnamelen; /* request */
305 char * rn_tname; /* request */
306 struct nfsd4_change_info rn_sinfo; /* response */
307 struct nfsd4_change_info rn_tinfo; /* response */
308};
309
310struct nfsd4_secinfo {
311 u32 si_namelen; /* request */
312 char *si_name; /* request */
313 struct svc_export *si_exp; /* response */
314};
315
316struct nfsd4_setattr {
317 stateid_t sa_stateid; /* request */
318 u32 sa_bmval[3]; /* request */
319 struct iattr sa_iattr; /* request */
320 struct nfs4_acl *sa_acl;
321};
322
323struct nfsd4_setclientid {
324 nfs4_verifier se_verf; /* request */
325 u32 se_namelen; /* request */
326 char * se_name; /* request */
327 u32 se_callback_prog; /* request */
328 u32 se_callback_netid_len; /* request */
329 char * se_callback_netid_val; /* request */
330 u32 se_callback_addr_len; /* request */
331 char * se_callback_addr_val; /* request */
332 u32 se_callback_ident; /* request */
333 clientid_t se_clientid; /* response */
334 nfs4_verifier se_confirm; /* response */
335};
336
337struct nfsd4_setclientid_confirm {
338 clientid_t sc_clientid;
339 nfs4_verifier sc_confirm;
340};
341
342/* also used for NVERIFY */
343struct nfsd4_verify {
344 u32 ve_bmval[3]; /* request */
345 u32 ve_attrlen; /* request */
346 char * ve_attrval; /* request */
347};
348
349struct nfsd4_write {
350 stateid_t wr_stateid; /* request */
351 u64 wr_offset; /* request */
352 u32 wr_stable_how; /* request */
353 u32 wr_buflen; /* request */
354 int wr_vlen;
355
356 u32 wr_bytes_written; /* response */
357 u32 wr_how_written; /* response */
358 nfs4_verifier wr_verifier; /* response */
359};
360
361struct nfsd4_exchange_id {
362 nfs4_verifier verifier;
363 struct xdr_netobj clname;
364 u32 flags;
365 clientid_t clientid;
366 u32 seqid;
367 int spa_how;
368};
369
370struct nfsd4_sequence {
371 struct nfs4_sessionid sessionid; /* request/response */
372 u32 seqid; /* request/response */
373 u32 slotid; /* request/response */
374 u32 maxslots; /* request/response */
375 u32 cachethis; /* request */
376#if 0
377 u32 target_maxslots; /* response */
378 u32 status_flags; /* response */
379#endif /* not yet */
380};
381
382struct nfsd4_destroy_session {
383 struct nfs4_sessionid sessionid;
384};
385
386struct nfsd4_op {
387 int opnum;
388 __be32 status;
389 union {
390 struct nfsd4_access access;
391 struct nfsd4_close close;
392 struct nfsd4_commit commit;
393 struct nfsd4_create create;
394 struct nfsd4_delegreturn delegreturn;
395 struct nfsd4_getattr getattr;
396 struct svc_fh * getfh;
397 struct nfsd4_link link;
398 struct nfsd4_lock lock;
399 struct nfsd4_lockt lockt;
400 struct nfsd4_locku locku;
401 struct nfsd4_lookup lookup;
402 struct nfsd4_verify nverify;
403 struct nfsd4_open open;
404 struct nfsd4_open_confirm open_confirm;
405 struct nfsd4_open_downgrade open_downgrade;
406 struct nfsd4_putfh putfh;
407 struct nfsd4_read read;
408 struct nfsd4_readdir readdir;
409 struct nfsd4_readlink readlink;
410 struct nfsd4_remove remove;
411 struct nfsd4_rename rename;
412 clientid_t renew;
413 struct nfsd4_secinfo secinfo;
414 struct nfsd4_setattr setattr;
415 struct nfsd4_setclientid setclientid;
416 struct nfsd4_setclientid_confirm setclientid_confirm;
417 struct nfsd4_verify verify;
418 struct nfsd4_write write;
419 struct nfsd4_release_lockowner release_lockowner;
420
421 /* NFSv4.1 */
422 struct nfsd4_exchange_id exchange_id;
423 struct nfsd4_create_session create_session;
424 struct nfsd4_destroy_session destroy_session;
425 struct nfsd4_sequence sequence;
426 } u;
427 struct nfs4_replay * replay;
428};
429
430struct nfsd4_compoundargs {
431 /* scratch variables for XDR decode */
432 __be32 * p;
433 __be32 * end;
434 struct page ** pagelist;
435 int pagelen;
436 __be32 tmp[8];
437 __be32 * tmpp;
438 struct tmpbuf {
439 struct tmpbuf *next;
440 void (*release)(const void *);
441 void *buf;
442 } *to_free;
443
444 struct svc_rqst *rqstp;
445
446 u32 taglen;
447 char * tag;
448 u32 minorversion;
449 u32 opcnt;
450 struct nfsd4_op *ops;
451 struct nfsd4_op iops[8];
452};
453
454struct nfsd4_compoundres {
455 /* scratch variables for XDR encode */
456 __be32 * p;
457 __be32 * end;
458 struct xdr_buf * xbuf;
459 struct svc_rqst * rqstp;
460
461 u32 taglen;
462 char * tag;
463 u32 opcnt;
464 __be32 * tagp; /* tag, opcount encode location */
465 struct nfsd4_compound_state cstate;
466};
467
468static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp)
469{
470 struct nfsd4_compoundargs *args = resp->rqstp->rq_argp;
471 return resp->opcnt == 1 && args->ops[0].opnum == OP_SEQUENCE;
472}
473
474static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)
475{
476 return !resp->cstate.slot->sl_cachethis || nfsd4_is_solo_sequence(resp);
477}
478
479#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
480
481static inline void
482set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
483{
484 BUG_ON(!fhp->fh_pre_saved || !fhp->fh_post_saved);
485 cinfo->atomic = 1;
486 cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode);
487 if (cinfo->change_supported) {
488 cinfo->before_change = fhp->fh_pre_change;
489 cinfo->after_change = fhp->fh_post_change;
490 } else {
491 cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec;
492 cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec;
493 cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec;
494 cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec;
495 }
496}
497
498int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
499int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *,
500 struct nfsd4_compoundargs *);
501int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *,
502 struct nfsd4_compoundres *);
503void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
504void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op);
505__be32 nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
506 struct dentry *dentry, __be32 *buffer, int *countp,
507 u32 *bmval, struct svc_rqst *, int ignore_crossmnt);
508extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp,
509 struct nfsd4_compound_state *,
510 struct nfsd4_setclientid *setclid);
511extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
512 struct nfsd4_compound_state *,
513 struct nfsd4_setclientid_confirm *setclientid_confirm);
514extern void nfsd4_store_cache_entry(struct nfsd4_compoundres *resp);
515extern __be32 nfsd4_replay_cache_entry(struct nfsd4_compoundres *resp,
516 struct nfsd4_sequence *seq);
517extern __be32 nfsd4_exchange_id(struct svc_rqst *rqstp,
518 struct nfsd4_compound_state *,
519struct nfsd4_exchange_id *);
520 extern __be32 nfsd4_create_session(struct svc_rqst *,
521 struct nfsd4_compound_state *,
522 struct nfsd4_create_session *);
523extern __be32 nfsd4_sequence(struct svc_rqst *,
524 struct nfsd4_compound_state *,
525 struct nfsd4_sequence *);
526extern __be32 nfsd4_destroy_session(struct svc_rqst *,
527 struct nfsd4_compound_state *,
528 struct nfsd4_destroy_session *);
529extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *,
530 struct nfsd4_open *open);
531extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp,
532 struct svc_fh *current_fh, struct nfsd4_open *open);
533extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp,
534 struct nfsd4_compound_state *, struct nfsd4_open_confirm *oc);
535extern __be32 nfsd4_close(struct svc_rqst *rqstp,
536 struct nfsd4_compound_state *,
537 struct nfsd4_close *close);
538extern __be32 nfsd4_open_downgrade(struct svc_rqst *rqstp,
539 struct nfsd4_compound_state *,
540 struct nfsd4_open_downgrade *od);
541extern __be32 nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
542 struct nfsd4_lock *lock);
543extern __be32 nfsd4_lockt(struct svc_rqst *rqstp,
544 struct nfsd4_compound_state *,
545 struct nfsd4_lockt *lockt);
546extern __be32 nfsd4_locku(struct svc_rqst *rqstp,
547 struct nfsd4_compound_state *,
548 struct nfsd4_locku *locku);
549extern __be32
550nfsd4_release_lockowner(struct svc_rqst *rqstp,
551 struct nfsd4_compound_state *,
552 struct nfsd4_release_lockowner *rlockowner);
553extern void nfsd4_release_compoundargs(struct nfsd4_compoundargs *);
554extern __be32 nfsd4_delegreturn(struct svc_rqst *rqstp,
555 struct nfsd4_compound_state *, struct nfsd4_delegreturn *dr);
556extern __be32 nfsd4_renew(struct svc_rqst *rqstp,
557 struct nfsd4_compound_state *, clientid_t *clid);
558#endif
559
560/*
561 * Local variables:
562 * c-basic-offset: 8
563 * End:
564 */