aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nfsd
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/nfsd
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/linux/nfsd')
-rw-r--r--include/linux/nfsd/auth.h27
-rw-r--r--include/linux/nfsd/cache.h81
-rw-r--r--include/linux/nfsd/const.h45
-rw-r--r--include/linux/nfsd/debug.h48
-rw-r--r--include/linux/nfsd/export.h137
-rw-r--r--include/linux/nfsd/interface.h13
-rw-r--r--include/linux/nfsd/nfsd.h311
-rw-r--r--include/linux/nfsd/nfsfh.h343
-rw-r--r--include/linux/nfsd/state.h298
-rw-r--r--include/linux/nfsd/stats.h44
-rw-r--r--include/linux/nfsd/syscall.h125
-rw-r--r--include/linux/nfsd/xdr.h172
-rw-r--r--include/linux/nfsd/xdr3.h321
-rw-r--r--include/linux/nfsd/xdr4.h463
14 files changed, 2428 insertions, 0 deletions
diff --git a/include/linux/nfsd/auth.h b/include/linux/nfsd/auth.h
new file mode 100644
index 000000000000..0fb9f7212195
--- /dev/null
+++ b/include/linux/nfsd/auth.h
@@ -0,0 +1,27 @@
1/*
2 * include/linux/nfsd/auth.h
3 *
4 * nfsd-specific authentication stuff.
5 * uid/gid mapping not yet implemented.
6 *
7 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
8 */
9
10#ifndef LINUX_NFSD_AUTH_H
11#define LINUX_NFSD_AUTH_H
12
13#ifdef __KERNEL__
14
15#define nfsd_luid(rq, uid) ((u32)(uid))
16#define nfsd_lgid(rq, gid) ((u32)(gid))
17#define nfsd_ruid(rq, uid) ((u32)(uid))
18#define nfsd_rgid(rq, gid) ((u32)(gid))
19
20/*
21 * Set the current process's fsuid/fsgid etc to those of the NFS
22 * client user
23 */
24int nfsd_setuser(struct svc_rqst *, struct svc_export *);
25
26#endif /* __KERNEL__ */
27#endif /* LINUX_NFSD_AUTH_H */
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h
new file mode 100644
index 000000000000..c3a3557c2a5b
--- /dev/null
+++ b/include/linux/nfsd/cache.h
@@ -0,0 +1,81 @@
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#ifdef __KERNEL__
14#include <linux/in.h>
15#include <linux/uio.h>
16
17/*
18 * Representation of a reply cache entry. The first two members *must*
19 * be hash_next and hash_prev.
20 */
21struct svc_cacherep {
22 struct hlist_node c_hash;
23 struct list_head c_lru;
24
25 unsigned char c_state, /* unused, inprog, done */
26 c_type, /* status, buffer */
27 c_secure : 1; /* req came from port < 1024 */
28 struct sockaddr_in c_addr;
29 u32 c_xid;
30 u32 c_prot;
31 u32 c_proc;
32 u32 c_vers;
33 unsigned long c_timestamp;
34 union {
35 struct kvec u_vec;
36 u32 u_status;
37 } c_u;
38};
39
40#define c_replvec c_u.u_vec
41#define c_replstat c_u.u_status
42
43/* cache entry states */
44enum {
45 RC_UNUSED,
46 RC_INPROG,
47 RC_DONE
48};
49
50/* return values */
51enum {
52 RC_DROPIT,
53 RC_REPLY,
54 RC_DOIT,
55 RC_INTR
56};
57
58/*
59 * Cache types.
60 * We may want to add more types one day, e.g. for diropres and
61 * attrstat replies. Using cache entries with fixed length instead
62 * of buffer pointers may be more efficient.
63 */
64enum {
65 RC_NOCACHE,
66 RC_REPLSTAT,
67 RC_REPLBUFF,
68};
69
70/*
71 * If requests are retransmitted within this interval, they're dropped.
72 */
73#define RC_DELAY (HZ/5)
74
75void nfsd_cache_init(void);
76void nfsd_cache_shutdown(void);
77int nfsd_cache_lookup(struct svc_rqst *, int);
78void nfsd_cache_update(struct svc_rqst *, int, u32 *);
79
80#endif /* __KERNEL__ */
81#endif /* NFSCACHE_H */
diff --git a/include/linux/nfsd/const.h b/include/linux/nfsd/const.h
new file mode 100644
index 000000000000..b75bb1b38d09
--- /dev/null
+++ b/include/linux/nfsd/const.h
@@ -0,0 +1,45 @@
1/*
2 * include/linux/nfsd/const.h
3 *
4 * Various constants related to NFS.
5 *
6 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef _LINUX_NFSD_CONST_H
10#define _LINUX_NFSD_CONST_H
11
12#include <linux/nfs.h>
13#include <linux/nfs2.h>
14#include <linux/nfs3.h>
15#include <linux/nfs4.h>
16
17/*
18 * Maximum protocol version supported by knfsd
19 */
20#define NFSSVC_MAXVERS 3
21
22/*
23 * Maximum blocksize supported by daemon currently at 32K
24 */
25#define NFSSVC_MAXBLKSIZE (32*1024)
26
27#ifdef __KERNEL__
28
29#ifndef NFS_SUPER_MAGIC
30# define NFS_SUPER_MAGIC 0x6969
31#endif
32
33#define NFSD_BUFSIZE (1024 + NFSSVC_MAXBLKSIZE)
34
35#ifdef CONFIG_NFSD_V4
36# define NFSSVC_XDRSIZE NFS4_SVC_XDRSIZE
37#elif defined(CONFIG_NFSD_V3)
38# define NFSSVC_XDRSIZE NFS3_SVC_XDRSIZE
39#else
40# define NFSSVC_XDRSIZE NFS2_SVC_XDRSIZE
41#endif
42
43#endif /* __KERNEL__ */
44
45#endif /* _LINUX_NFSD_CONST_H */
diff --git a/include/linux/nfsd/debug.h b/include/linux/nfsd/debug.h
new file mode 100644
index 000000000000..ee4aa91788e7
--- /dev/null
+++ b/include/linux/nfsd/debug.h
@@ -0,0 +1,48 @@
1/*
2 * linux/include/linux/nfsd/debug.h
3 *
4 * Debugging-related stuff for nfsd
5 *
6 * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef LINUX_NFSD_DEBUG_H
10#define LINUX_NFSD_DEBUG_H
11
12#include <linux/sunrpc/debug.h>
13
14/*
15 * Enable debugging for nfsd.
16 * Requires RPC_DEBUG.
17 */
18#ifdef RPC_DEBUG
19# define NFSD_DEBUG 1
20#endif
21
22/*
23 * knfsd debug flags
24 */
25#define NFSDDBG_SOCK 0x0001
26#define NFSDDBG_FH 0x0002
27#define NFSDDBG_EXPORT 0x0004
28#define NFSDDBG_SVC 0x0008
29#define NFSDDBG_PROC 0x0010
30#define NFSDDBG_FILEOP 0x0020
31#define NFSDDBG_AUTH 0x0040
32#define NFSDDBG_REPCACHE 0x0080
33#define NFSDDBG_XDR 0x0100
34#define NFSDDBG_LOCKD 0x0200
35#define NFSDDBG_ALL 0x7FFF
36#define NFSDDBG_NOCHANGE 0xFFFF
37
38
39#ifdef __KERNEL__
40# undef ifdebug
41# ifdef NFSD_DEBUG
42# define ifdebug(flag) if (nfsd_debug & NFSDDBG_##flag)
43# else
44# define ifdebug(flag) if (0)
45# endif
46#endif /* __KERNEL__ */
47
48#endif /* LINUX_NFSD_DEBUG_H */
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
new file mode 100644
index 000000000000..6bad4766d3d9
--- /dev/null
+++ b/include/linux/nfsd/export.h
@@ -0,0 +1,137 @@
1/*
2 * include/linux/nfsd/export.h
3 *
4 * Public declarations for NFS exports. The definitions for the
5 * syscall interface are in nfsctl.h
6 *
7 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
8 */
9
10#ifndef NFSD_EXPORT_H
11#define NFSD_EXPORT_H
12
13#include <asm/types.h>
14#ifdef __KERNEL__
15# include <linux/types.h>
16# include <linux/in.h>
17#endif
18
19/*
20 * Important limits for the exports stuff.
21 */
22#define NFSCLNT_IDMAX 1024
23#define NFSCLNT_ADDRMAX 16
24#define NFSCLNT_KEYMAX 32
25
26/*
27 * Export flags.
28 */
29#define NFSEXP_READONLY 0x0001
30#define NFSEXP_INSECURE_PORT 0x0002
31#define NFSEXP_ROOTSQUASH 0x0004
32#define NFSEXP_ALLSQUASH 0x0008
33#define NFSEXP_ASYNC 0x0010
34#define NFSEXP_GATHERED_WRITES 0x0020
35/* 40 80 100 currently unused */
36#define NFSEXP_NOHIDE 0x0200
37#define NFSEXP_NOSUBTREECHECK 0x0400
38#define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */
39#define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect */
40#define NFSEXP_FSID 0x2000
41#define NFSEXP_CROSSMOUNT 0x4000
42#define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */
43#define NFSEXP_ALLFLAGS 0xFE3F
44
45
46#ifdef __KERNEL__
47
48struct svc_export {
49 struct cache_head h;
50 struct auth_domain * ex_client;
51 int ex_flags;
52 struct vfsmount * ex_mnt;
53 struct dentry * ex_dentry;
54 uid_t ex_anon_uid;
55 gid_t ex_anon_gid;
56 int ex_fsid;
57};
58
59/* an "export key" (expkey) maps a filehandlefragement to an
60 * svc_export for a given client. There can be two per export, one
61 * for type 0 (dev/ino), one for type 1 (fsid)
62 */
63struct svc_expkey {
64 struct cache_head h;
65
66 struct auth_domain * ek_client;
67 int ek_fsidtype;
68 u32 ek_fsid[3];
69
70 struct svc_export * ek_export;
71};
72
73#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT))
74#define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC))
75#define EX_RDONLY(exp) ((exp)->ex_flags & NFSEXP_READONLY)
76#define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE)
77#define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES)
78
79
80/*
81 * Function declarations
82 */
83void nfsd_export_init(void);
84void nfsd_export_shutdown(void);
85void nfsd_export_flush(void);
86void exp_readlock(void);
87void exp_readunlock(void);
88struct svc_expkey * exp_find_key(struct auth_domain *clp,
89 int fsid_type, u32 *fsidv,
90 struct cache_req *reqp);
91struct svc_export * exp_get_by_name(struct auth_domain *clp,
92 struct vfsmount *mnt,
93 struct dentry *dentry,
94 struct cache_req *reqp);
95struct svc_export * exp_parent(struct auth_domain *clp,
96 struct vfsmount *mnt,
97 struct dentry *dentry,
98 struct cache_req *reqp);
99int exp_rootfh(struct auth_domain *,
100 char *path, struct knfsd_fh *, int maxsize);
101int exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq);
102int nfserrno(int errno);
103
104extern void expkey_put(struct cache_head *item, struct cache_detail *cd);
105extern void svc_export_put(struct cache_head *item, struct cache_detail *cd);
106extern struct cache_detail svc_export_cache, svc_expkey_cache;
107
108static inline void exp_put(struct svc_export *exp)
109{
110 svc_export_put(&exp->h, &svc_export_cache);
111}
112
113static inline void exp_get(struct svc_export *exp)
114{
115 cache_get(&exp->h);
116}
117static inline struct svc_export *
118exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv,
119 struct cache_req *reqp)
120{
121 struct svc_expkey *ek = exp_find_key(clp, fsid_type, fsidv, reqp);
122 if (ek && !IS_ERR(ek)) {
123 struct svc_export *exp = ek->ek_export;
124 int err;
125 exp_get(exp);
126 expkey_put(&ek->h, &svc_expkey_cache);
127 if ((err = cache_check(&svc_export_cache, &exp->h, reqp)))
128 exp = ERR_PTR(err);
129 return exp;
130 } else
131 return ERR_PTR(PTR_ERR(ek));
132}
133
134#endif /* __KERNEL__ */
135
136#endif /* NFSD_EXPORT_H */
137
diff --git a/include/linux/nfsd/interface.h b/include/linux/nfsd/interface.h
new file mode 100644
index 000000000000..af0979704afb
--- /dev/null
+++ b/include/linux/nfsd/interface.h
@@ -0,0 +1,13 @@
1/*
2 * include/linux/nfsd/interface.h
3 *
4 * defines interface between nfsd and other bits of
5 * the kernel. Particularly filesystems (eventually).
6 *
7 * Copyright (C) 2000 Neil Brown <neilb@cse.unsw.edu.au>
8 */
9
10#ifndef LINUX_NFSD_INTERFACE_H
11#define LINUX_NFSD_INTERFACE_H
12
13#endif /* LINUX_NFSD_INTERFACE_H */
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
new file mode 100644
index 000000000000..8f85d9a59607
--- /dev/null
+++ b/include/linux/nfsd/nfsd.h
@@ -0,0 +1,311 @@
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/config.h>
14#include <linux/types.h>
15#include <linux/unistd.h>
16#include <linux/dirent.h>
17#include <linux/fs.h>
18#include <linux/mount.h>
19
20#include <linux/nfsd/debug.h>
21#include <linux/nfsd/nfsfh.h>
22#include <linux/nfsd/export.h>
23#include <linux/nfsd/auth.h>
24#include <linux/nfsd/stats.h>
25#include <linux/nfsd/interface.h>
26/*
27 * nfsd version
28 */
29#define NFSD_VERSION "0.5"
30#define NFSD_SUPPORTED_MINOR_VERSION 0
31
32#ifdef __KERNEL__
33/*
34 * Special flags for nfsd_permission. These must be different from MAY_READ,
35 * MAY_WRITE, and MAY_EXEC.
36 */
37#define MAY_NOP 0
38#define MAY_SATTR 8
39#define MAY_TRUNC 16
40#define MAY_LOCK 32
41#define MAY_OWNER_OVERRIDE 64
42#define MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/
43#if (MAY_SATTR | MAY_TRUNC | MAY_LOCK | MAY_OWNER_OVERRIDE | MAY_LOCAL_ACCESS) & (MAY_READ | MAY_WRITE | MAY_EXEC)
44# error "please use a different value for MAY_SATTR or MAY_TRUNC or MAY_LOCK or MAY_LOCAL_ACCESS or MAY_OWNER_OVERRIDE."
45#endif
46#define MAY_CREATE (MAY_EXEC|MAY_WRITE)
47#define MAY_REMOVE (MAY_EXEC|MAY_WRITE|MAY_TRUNC)
48
49/*
50 * Callback function for readdir
51 */
52struct readdir_cd {
53 int err; /* 0, nfserr, or nfserr_eof */
54};
55typedef int (*encode_dent_fn)(struct readdir_cd *, const char *,
56 int, loff_t, ino_t, unsigned int);
57typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int);
58
59extern struct svc_program nfsd_program;
60extern struct svc_version nfsd_version2, nfsd_version3,
61 nfsd_version4;
62
63/*
64 * Function prototypes.
65 */
66int nfsd_svc(unsigned short port, int nrservs);
67int nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp);
68
69/* nfsd/vfs.c */
70int fh_lock_parent(struct svc_fh *, struct dentry *);
71int nfsd_racache_init(int);
72void nfsd_racache_shutdown(void);
73int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
74 struct svc_export **expp);
75int nfsd_lookup(struct svc_rqst *, struct svc_fh *,
76 const char *, int, struct svc_fh *);
77int nfsd_setattr(struct svc_rqst *, struct svc_fh *,
78 struct iattr *, int, time_t);
79#ifdef CONFIG_NFSD_V4
80int nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *,
81 struct nfs4_acl *);
82int nfsd4_get_nfs4_acl(struct svc_rqst *, struct dentry *, struct nfs4_acl **);
83#endif /* CONFIG_NFSD_V4 */
84int nfsd_create(struct svc_rqst *, struct svc_fh *,
85 char *name, int len, struct iattr *attrs,
86 int type, dev_t rdev, struct svc_fh *res);
87#ifdef CONFIG_NFSD_V3
88int nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *);
89int nfsd_create_v3(struct svc_rqst *, struct svc_fh *,
90 char *name, int len, struct iattr *attrs,
91 struct svc_fh *res, int createmode,
92 u32 *verifier, int *truncp);
93int nfsd_commit(struct svc_rqst *, struct svc_fh *,
94 loff_t, unsigned long);
95#endif /* CONFIG_NFSD_V3 */
96int nfsd_open(struct svc_rqst *, struct svc_fh *, int,
97 int, struct file **);
98void nfsd_close(struct file *);
99int nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *,
100 loff_t, struct kvec *, int, unsigned long *);
101int nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *,
102 loff_t, struct kvec *,int, unsigned long, int *);
103int nfsd_readlink(struct svc_rqst *, struct svc_fh *,
104 char *, int *);
105int nfsd_symlink(struct svc_rqst *, struct svc_fh *,
106 char *name, int len, char *path, int plen,
107 struct svc_fh *res, struct iattr *);
108int nfsd_link(struct svc_rqst *, struct svc_fh *,
109 char *, int, struct svc_fh *);
110int nfsd_rename(struct svc_rqst *,
111 struct svc_fh *, char *, int,
112 struct svc_fh *, char *, int);
113int nfsd_remove(struct svc_rqst *,
114 struct svc_fh *, char *, int);
115int nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type,
116 char *name, int len);
117int nfsd_truncate(struct svc_rqst *, struct svc_fh *,
118 unsigned long size);
119int nfsd_readdir(struct svc_rqst *, struct svc_fh *,
120 loff_t *, struct readdir_cd *, encode_dent_fn);
121int nfsd_statfs(struct svc_rqst *, struct svc_fh *,
122 struct kstatfs *);
123
124int nfsd_notify_change(struct inode *, struct iattr *);
125int nfsd_permission(struct svc_export *, struct dentry *, int);
126
127
128/*
129 * NFSv4 State
130 */
131#ifdef CONFIG_NFSD_V4
132int nfs4_state_init(void);
133void nfs4_state_shutdown(void);
134time_t nfs4_lease_time(void);
135void nfs4_reset_lease(time_t leasetime);
136#else
137static inline int nfs4_state_init(void){return 0;}
138static inline void nfs4_state_shutdown(void){}
139static inline time_t nfs4_lease_time(void){return 0;}
140static inline void nfs4_reset_lease(time_t leasetime){}
141#endif
142
143/*
144 * lockd binding
145 */
146void nfsd_lockd_init(void);
147void nfsd_lockd_shutdown(void);
148
149
150/*
151 * These macros provide pre-xdr'ed values for faster operation.
152 */
153#define nfs_ok __constant_htonl(NFS_OK)
154#define nfserr_perm __constant_htonl(NFSERR_PERM)
155#define nfserr_noent __constant_htonl(NFSERR_NOENT)
156#define nfserr_io __constant_htonl(NFSERR_IO)
157#define nfserr_nxio __constant_htonl(NFSERR_NXIO)
158#define nfserr_eagain __constant_htonl(NFSERR_EAGAIN)
159#define nfserr_acces __constant_htonl(NFSERR_ACCES)
160#define nfserr_exist __constant_htonl(NFSERR_EXIST)
161#define nfserr_xdev __constant_htonl(NFSERR_XDEV)
162#define nfserr_nodev __constant_htonl(NFSERR_NODEV)
163#define nfserr_notdir __constant_htonl(NFSERR_NOTDIR)
164#define nfserr_isdir __constant_htonl(NFSERR_ISDIR)
165#define nfserr_inval __constant_htonl(NFSERR_INVAL)
166#define nfserr_fbig __constant_htonl(NFSERR_FBIG)
167#define nfserr_nospc __constant_htonl(NFSERR_NOSPC)
168#define nfserr_rofs __constant_htonl(NFSERR_ROFS)
169#define nfserr_mlink __constant_htonl(NFSERR_MLINK)
170#define nfserr_opnotsupp __constant_htonl(NFSERR_OPNOTSUPP)
171#define nfserr_nametoolong __constant_htonl(NFSERR_NAMETOOLONG)
172#define nfserr_notempty __constant_htonl(NFSERR_NOTEMPTY)
173#define nfserr_dquot __constant_htonl(NFSERR_DQUOT)
174#define nfserr_stale __constant_htonl(NFSERR_STALE)
175#define nfserr_remote __constant_htonl(NFSERR_REMOTE)
176#define nfserr_wflush __constant_htonl(NFSERR_WFLUSH)
177#define nfserr_badhandle __constant_htonl(NFSERR_BADHANDLE)
178#define nfserr_notsync __constant_htonl(NFSERR_NOT_SYNC)
179#define nfserr_badcookie __constant_htonl(NFSERR_BAD_COOKIE)
180#define nfserr_notsupp __constant_htonl(NFSERR_NOTSUPP)
181#define nfserr_toosmall __constant_htonl(NFSERR_TOOSMALL)
182#define nfserr_serverfault __constant_htonl(NFSERR_SERVERFAULT)
183#define nfserr_badtype __constant_htonl(NFSERR_BADTYPE)
184#define nfserr_jukebox __constant_htonl(NFSERR_JUKEBOX)
185#define nfserr_denied __constant_htonl(NFSERR_DENIED)
186#define nfserr_deadlock __constant_htonl(NFSERR_DEADLOCK)
187#define nfserr_expired __constant_htonl(NFSERR_EXPIRED)
188#define nfserr_bad_cookie __constant_htonl(NFSERR_BAD_COOKIE)
189#define nfserr_same __constant_htonl(NFSERR_SAME)
190#define nfserr_clid_inuse __constant_htonl(NFSERR_CLID_INUSE)
191#define nfserr_stale_clientid __constant_htonl(NFSERR_STALE_CLIENTID)
192#define nfserr_resource __constant_htonl(NFSERR_RESOURCE)
193#define nfserr_nofilehandle __constant_htonl(NFSERR_NOFILEHANDLE)
194#define nfserr_minor_vers_mismatch __constant_htonl(NFSERR_MINOR_VERS_MISMATCH)
195#define nfserr_share_denied __constant_htonl(NFSERR_SHARE_DENIED)
196#define nfserr_stale_stateid __constant_htonl(NFSERR_STALE_STATEID)
197#define nfserr_old_stateid __constant_htonl(NFSERR_OLD_STATEID)
198#define nfserr_bad_stateid __constant_htonl(NFSERR_BAD_STATEID)
199#define nfserr_bad_seqid __constant_htonl(NFSERR_BAD_SEQID)
200#define nfserr_symlink __constant_htonl(NFSERR_SYMLINK)
201#define nfserr_not_same __constant_htonl(NFSERR_NOT_SAME)
202#define nfserr_restorefh __constant_htonl(NFSERR_RESTOREFH)
203#define nfserr_attrnotsupp __constant_htonl(NFSERR_ATTRNOTSUPP)
204#define nfserr_bad_xdr __constant_htonl(NFSERR_BAD_XDR)
205#define nfserr_openmode __constant_htonl(NFSERR_OPENMODE)
206#define nfserr_locks_held __constant_htonl(NFSERR_LOCKS_HELD)
207#define nfserr_op_illegal __constant_htonl(NFSERR_OP_ILLEGAL)
208#define nfserr_grace __constant_htonl(NFSERR_GRACE)
209#define nfserr_no_grace __constant_htonl(NFSERR_NO_GRACE)
210#define nfserr_reclaim_bad __constant_htonl(NFSERR_RECLAIM_BAD)
211#define nfserr_badname __constant_htonl(NFSERR_BADNAME)
212#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN)
213
214/* error codes for internal use */
215/* if a request fails due to kmalloc failure, it gets dropped.
216 * Client should resend eventually
217 */
218#define nfserr_dropit __constant_htonl(30000)
219/* end-of-file indicator in readdir */
220#define nfserr_eof __constant_htonl(30001)
221
222/* Check for dir entries '.' and '..' */
223#define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.'))
224
225/*
226 * Time of server startup
227 */
228extern struct timeval nfssvc_boot;
229
230static inline int is_fsid(struct svc_fh *fh, struct knfsd_fh *reffh)
231{
232 if (fh->fh_export->ex_flags & NFSEXP_FSID) {
233 struct vfsmount *mnt = fh->fh_export->ex_mnt;
234 if (!old_valid_dev(mnt->mnt_sb->s_dev) ||
235 (reffh->fh_version == 1 && reffh->fh_fsid_type == 1))
236 return 1;
237 }
238 return 0;
239}
240
241
242#ifdef CONFIG_NFSD_V4
243
244/* before processing a COMPOUND operation, we have to check that there
245 * is enough space in the buffer for XDR encode to succeed. otherwise,
246 * we might process an operation with side effects, and be unable to
247 * tell the client that the operation succeeded.
248 *
249 * COMPOUND_SLACK_SPACE - this is the minimum amount of buffer space
250 * needed to encode an "ordinary" _successful_ operation. (GETATTR,
251 * READ, READDIR, and READLINK have their own buffer checks.) if we
252 * fall below this level, we fail the next operation with NFS4ERR_RESOURCE.
253 *
254 * COMPOUND_ERR_SLACK_SPACE - this is the minimum amount of buffer space
255 * needed to encode an operation which has failed with NFS4ERR_RESOURCE.
256 * care is taken to ensure that we never fall below this level for any
257 * reason.
258 */
259#define COMPOUND_SLACK_SPACE 140 /* OP_GETFH */
260#define COMPOUND_ERR_SLACK_SPACE 12 /* OP_SETATTR */
261
262#define NFSD_LEASE_TIME (nfs4_lease_time())
263#define NFSD_LAUNDROMAT_MINTIMEOUT 10 /* seconds */
264
265/*
266 * The following attributes are currently not supported by the NFSv4 server:
267 * ARCHIVE (deprecated anyway)
268 * FS_LOCATIONS (will be supported eventually)
269 * HIDDEN (unlikely to be supported any time soon)
270 * MIMETYPE (unlikely to be supported any time soon)
271 * QUOTA_* (will be supported in a forthcoming patch)
272 * SYSTEM (unlikely to be supported any time soon)
273 * TIME_BACKUP (unlikely to be supported any time soon)
274 * TIME_CREATE (unlikely to be supported any time soon)
275 */
276#define NFSD_SUPPORTED_ATTRS_WORD0 \
277(FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_TYPE | FATTR4_WORD0_FH_EXPIRE_TYPE \
278 | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_LINK_SUPPORT \
279 | FATTR4_WORD0_SYMLINK_SUPPORT | FATTR4_WORD0_NAMED_ATTR | FATTR4_WORD0_FSID \
280 | FATTR4_WORD0_UNIQUE_HANDLES | FATTR4_WORD0_LEASE_TIME | FATTR4_WORD0_RDATTR_ERROR \
281 | FATTR4_WORD0_ACLSUPPORT | FATTR4_WORD0_CANSETTIME | FATTR4_WORD0_CASE_INSENSITIVE \
282 | FATTR4_WORD0_CASE_PRESERVING | FATTR4_WORD0_CHOWN_RESTRICTED \
283 | FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FILEID | FATTR4_WORD0_FILES_AVAIL \
284 | FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | FATTR4_WORD0_HOMOGENEOUS \
285 | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \
286 | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL)
287
288#define NFSD_SUPPORTED_ATTRS_WORD1 \
289(FATTR4_WORD1_MODE | FATTR4_WORD1_NO_TRUNC | FATTR4_WORD1_NUMLINKS \
290 | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \
291 | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \
292 | FATTR4_WORD1_SPACE_USED | FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_ACCESS_SET \
293 | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \
294 | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID)
295
296/* These will return ERR_INVAL if specified in GETATTR or READDIR. */
297#define NFSD_WRITEONLY_ATTRS_WORD1 \
298(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)
299
300/* These are the only attrs allowed in CREATE/OPEN/SETATTR. */
301#define NFSD_WRITEABLE_ATTRS_WORD0 \
302(FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL )
303#define NFSD_WRITEABLE_ATTRS_WORD1 \
304(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \
305 | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_METADATA | FATTR4_WORD1_TIME_MODIFY_SET)
306
307#endif /* CONFIG_NFSD_V4 */
308
309#endif /* __KERNEL__ */
310
311#endif /* LINUX_NFSD_NFSD_H */
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
new file mode 100644
index 000000000000..bb842ea41033
--- /dev/null
+++ b/include/linux/nfsd/nfsfh.h
@@ -0,0 +1,343 @@
1/*
2 * include/linux/nfsd/nfsfh.h
3 *
4 * This file describes the layout of the file handles as passed
5 * over the wire.
6 *
7 * Earlier versions of knfsd used to sign file handles using keyed MD5
8 * or SHA. I've removed this code, because it doesn't give you more
9 * security than blocking external access to port 2049 on your firewall.
10 *
11 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
12 */
13
14#ifndef _LINUX_NFSD_FH_H
15#define _LINUX_NFSD_FH_H
16
17#include <asm/types.h>
18#ifdef __KERNEL__
19# include <linux/config.h>
20# include <linux/types.h>
21# include <linux/string.h>
22# include <linux/fs.h>
23#endif
24#include <linux/nfsd/const.h>
25#include <linux/nfsd/debug.h>
26
27/*
28 * This is the old "dentry style" Linux NFSv2 file handle.
29 *
30 * The xino and xdev fields are currently used to transport the
31 * ino/dev of the exported inode.
32 */
33struct nfs_fhbase_old {
34 __u32 fb_dcookie; /* dentry cookie - always 0xfeebbaca */
35 __u32 fb_ino; /* our inode number */
36 __u32 fb_dirino; /* dir inode number, 0 for directories */
37 __u32 fb_dev; /* our device */
38 __u32 fb_xdev;
39 __u32 fb_xino;
40 __u32 fb_generation;
41};
42
43/*
44 * This is the new flexible, extensible style NFSv2/v3 file handle.
45 * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000
46 *
47 * The file handle is seens as a list of 4byte words.
48 * The first word contains a version number (1) and four descriptor bytes
49 * that tell how the remaining 3 variable length fields should be handled.
50 * These three bytes are auth_type, fsid_type and fileid_type.
51 *
52 * All 4byte values are in host-byte-order.
53 *
54 * The auth_type field specifies how the filehandle can be authenticated
55 * This might allow a file to be confirmed to be in a writable part of a
56 * filetree without checking the path from it upto the root.
57 * Current values:
58 * 0 - No authentication. fb_auth is 0 bytes long
59 * Possible future values:
60 * 1 - 4 bytes taken from MD5 hash of the remainer of the file handle
61 * prefixed by a secret and with the important export flags.
62 *
63 * The fsid_type identifies how the filesystem (or export point) is
64 * encoded.
65 * Current values:
66 * 0 - 4 byte device id (ms-2-bytes major, ls-2-bytes minor), 4byte inode number
67 * NOTE: we cannot use the kdev_t device id value, because kdev_t.h
68 * says we mustn't. We must break it up and reassemble.
69 * 1 - 4 byte user specified identifier
70 * 2 - 4 byte major, 4 byte minor, 4 byte inode number - DEPRECATED
71 * 3 - 4 byte device id, encoded for user-space, 4 byte inode number
72 *
73 * The fileid_type identified how the file within the filesystem is encoded.
74 * This is (will be) passed to, and set by, the underlying filesystem if it supports
75 * filehandle operations. The filesystem must not use the value '0' or '0xff' and may
76 * only use the values 1 and 2 as defined below:
77 * Current values:
78 * 0 - The root, or export point, of the filesystem. fb_fileid is 0 bytes.
79 * 1 - 32bit inode number, 32 bit generation number.
80 * 2 - 32bit inode number, 32 bit generation number, 32 bit parent directory inode number.
81 *
82 */
83struct nfs_fhbase_new {
84 __u8 fb_version; /* == 1, even => nfs_fhbase_old */
85 __u8 fb_auth_type;
86 __u8 fb_fsid_type;
87 __u8 fb_fileid_type;
88 __u32 fb_auth[1];
89/* __u32 fb_fsid[0]; floating */
90/* __u32 fb_fileid[0]; floating */
91};
92
93struct knfsd_fh {
94 unsigned int fh_size; /* significant for NFSv3.
95 * Points to the current size while building
96 * a new file handle
97 */
98 union {
99 struct nfs_fhbase_old fh_old;
100 __u32 fh_pad[NFS4_FHSIZE/4];
101 struct nfs_fhbase_new fh_new;
102 } fh_base;
103};
104
105#define ofh_dcookie fh_base.fh_old.fb_dcookie
106#define ofh_ino fh_base.fh_old.fb_ino
107#define ofh_dirino fh_base.fh_old.fb_dirino
108#define ofh_dev fh_base.fh_old.fb_dev
109#define ofh_xdev fh_base.fh_old.fb_xdev
110#define ofh_xino fh_base.fh_old.fb_xino
111#define ofh_generation fh_base.fh_old.fb_generation
112
113#define fh_version fh_base.fh_new.fb_version
114#define fh_fsid_type fh_base.fh_new.fb_fsid_type
115#define fh_auth_type fh_base.fh_new.fb_auth_type
116#define fh_fileid_type fh_base.fh_new.fb_fileid_type
117#define fh_auth fh_base.fh_new.fb_auth
118#define fh_fsid fh_base.fh_new.fb_auth
119
120#ifdef __KERNEL__
121
122static inline __u32 ino_t_to_u32(ino_t ino)
123{
124 return (__u32) ino;
125}
126
127static inline ino_t u32_to_ino_t(__u32 uino)
128{
129 return (ino_t) uino;
130}
131
132/*
133 * This is the internal representation of an NFS handle used in knfsd.
134 * pre_mtime/post_version will be used to support wcc_attr's in NFSv3.
135 */
136typedef struct svc_fh {
137 struct knfsd_fh fh_handle; /* FH data */
138 struct dentry * fh_dentry; /* validated dentry */
139 struct svc_export * fh_export; /* export pointer */
140 int fh_maxsize; /* max size for fh_handle */
141
142 unsigned char fh_locked; /* inode locked by us */
143
144#ifdef CONFIG_NFSD_V3
145 unsigned char fh_post_saved; /* post-op attrs saved */
146 unsigned char fh_pre_saved; /* pre-op attrs saved */
147
148 /* Pre-op attributes saved during fh_lock */
149 __u64 fh_pre_size; /* size before operation */
150 struct timespec fh_pre_mtime; /* mtime before oper */
151 struct timespec fh_pre_ctime; /* ctime before oper */
152
153 /* Post-op attributes saved in fh_unlock */
154 umode_t fh_post_mode; /* i_mode */
155 nlink_t fh_post_nlink; /* i_nlink */
156 uid_t fh_post_uid; /* i_uid */
157 gid_t fh_post_gid; /* i_gid */
158 __u64 fh_post_size; /* i_size */
159 unsigned long fh_post_blocks; /* i_blocks */
160 unsigned long fh_post_blksize;/* i_blksize */
161 __u32 fh_post_rdev[2];/* i_rdev */
162 struct timespec fh_post_atime; /* i_atime */
163 struct timespec fh_post_mtime; /* i_mtime */
164 struct timespec fh_post_ctime; /* i_ctime */
165#endif /* CONFIG_NFSD_V3 */
166
167} svc_fh;
168
169static inline void mk_fsid_v0(u32 *fsidv, dev_t dev, ino_t ino)
170{
171 fsidv[0] = htonl((MAJOR(dev)<<16) |
172 MINOR(dev));
173 fsidv[1] = ino_t_to_u32(ino);
174}
175
176static inline void mk_fsid_v1(u32 *fsidv, u32 fsid)
177{
178 fsidv[0] = fsid;
179}
180
181static inline void mk_fsid_v2(u32 *fsidv, dev_t dev, ino_t ino)
182{
183 fsidv[0] = htonl(MAJOR(dev));
184 fsidv[1] = htonl(MINOR(dev));
185 fsidv[2] = ino_t_to_u32(ino);
186}
187
188static inline void mk_fsid_v3(u32 *fsidv, dev_t dev, ino_t ino)
189{
190 fsidv[0] = new_encode_dev(dev);
191 fsidv[1] = ino_t_to_u32(ino);
192}
193
194static inline int key_len(int type)
195{
196 switch(type) {
197 case 0: return 8;
198 case 1: return 4;
199 case 2: return 12;
200 case 3: return 8;
201 default: return 0;
202 }
203}
204
205/*
206 * Shorthand for dprintk()'s
207 */
208extern char * SVCFH_fmt(struct svc_fh *fhp);
209
210/*
211 * Function prototypes
212 */
213u32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int);
214int fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *);
215int fh_update(struct svc_fh *);
216void fh_put(struct svc_fh *);
217
218static __inline__ struct svc_fh *
219fh_copy(struct svc_fh *dst, struct svc_fh *src)
220{
221 if (src->fh_dentry || src->fh_locked) {
222 struct dentry *dentry = src->fh_dentry;
223 printk(KERN_ERR "fh_copy: copying %s/%s, already verified!\n",
224 dentry->d_parent->d_name.name, dentry->d_name.name);
225 }
226
227 *dst = *src;
228 return dst;
229}
230
231static __inline__ struct svc_fh *
232fh_init(struct svc_fh *fhp, int maxsize)
233{
234 memset(fhp, 0, sizeof(*fhp));
235 fhp->fh_maxsize = maxsize;
236 return fhp;
237}
238
239#ifdef CONFIG_NFSD_V3
240/*
241 * Fill in the pre_op attr for the wcc data
242 */
243static inline void
244fill_pre_wcc(struct svc_fh *fhp)
245{
246 struct inode *inode;
247
248 inode = fhp->fh_dentry->d_inode;
249 if (!fhp->fh_pre_saved) {
250 fhp->fh_pre_mtime = inode->i_mtime;
251 fhp->fh_pre_ctime = inode->i_ctime;
252 fhp->fh_pre_size = inode->i_size;
253 fhp->fh_pre_saved = 1;
254 }
255}
256
257/*
258 * Fill in the post_op attr for the wcc data
259 */
260static inline void
261fill_post_wcc(struct svc_fh *fhp)
262{
263 struct inode *inode = fhp->fh_dentry->d_inode;
264
265 if (fhp->fh_post_saved)
266 printk("nfsd: inode locked twice during operation.\n");
267
268 fhp->fh_post_mode = inode->i_mode;
269 fhp->fh_post_nlink = inode->i_nlink;
270 fhp->fh_post_uid = inode->i_uid;
271 fhp->fh_post_gid = inode->i_gid;
272 fhp->fh_post_size = inode->i_size;
273 if (inode->i_blksize) {
274 fhp->fh_post_blksize = inode->i_blksize;
275 fhp->fh_post_blocks = inode->i_blocks;
276 } else {
277 fhp->fh_post_blksize = BLOCK_SIZE;
278 /* how much do we care for accuracy with MinixFS? */
279 fhp->fh_post_blocks = (inode->i_size+511) >> 9;
280 }
281 fhp->fh_post_rdev[0] = htonl((u32)imajor(inode));
282 fhp->fh_post_rdev[1] = htonl((u32)iminor(inode));
283 fhp->fh_post_atime = inode->i_atime;
284 fhp->fh_post_mtime = inode->i_mtime;
285 fhp->fh_post_ctime = inode->i_ctime;
286 fhp->fh_post_saved = 1;
287}
288#else
289#define fill_pre_wcc(ignored)
290#define fill_post_wcc(notused)
291#endif /* CONFIG_NFSD_V3 */
292
293
294/*
295 * Lock a file handle/inode
296 * NOTE: both fh_lock and fh_unlock are done "by hand" in
297 * vfs.c:nfsd_rename as it needs to grab 2 i_sem's at once
298 * so, any changes here should be reflected there.
299 */
300static inline void
301fh_lock(struct svc_fh *fhp)
302{
303 struct dentry *dentry = fhp->fh_dentry;
304 struct inode *inode;
305
306 dfprintk(FILEOP, "nfsd: fh_lock(%s) locked = %d\n",
307 SVCFH_fmt(fhp), fhp->fh_locked);
308
309 if (!fhp->fh_dentry) {
310 printk(KERN_ERR "fh_lock: fh not verified!\n");
311 return;
312 }
313 if (fhp->fh_locked) {
314 printk(KERN_WARNING "fh_lock: %s/%s already locked!\n",
315 dentry->d_parent->d_name.name, dentry->d_name.name);
316 return;
317 }
318
319 inode = dentry->d_inode;
320 down(&inode->i_sem);
321 fill_pre_wcc(fhp);
322 fhp->fh_locked = 1;
323}
324
325/*
326 * Unlock a file handle/inode
327 */
328static inline void
329fh_unlock(struct svc_fh *fhp)
330{
331 if (!fhp->fh_dentry)
332 printk(KERN_ERR "fh_unlock: fh not verified!\n");
333
334 if (fhp->fh_locked) {
335 fill_post_wcc(fhp);
336 up(&fhp->fh_dentry->d_inode->i_sem);
337 fhp->fh_locked = 0;
338 }
339}
340#endif /* __KERNEL__ */
341
342
343#endif /* _LINUX_NFSD_FH_H */
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
new file mode 100644
index 000000000000..b6b2fe1e7c63
--- /dev/null
+++ b/include/linux/nfsd/state.h
@@ -0,0 +1,298 @@
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/list.h>
41#include <linux/kref.h>
42#include <linux/sunrpc/clnt.h>
43
44#define NFS4_OPAQUE_LIMIT 1024
45typedef struct {
46 u32 cl_boot;
47 u32 cl_id;
48} clientid_t;
49
50typedef struct {
51 u32 so_boot;
52 u32 so_stateownerid;
53 u32 so_fileid;
54} stateid_opaque_t;
55
56typedef struct {
57 u32 si_generation;
58 stateid_opaque_t si_opaque;
59} stateid_t;
60#define si_boot si_opaque.so_boot
61#define si_stateownerid si_opaque.so_stateownerid
62#define si_fileid si_opaque.so_fileid
63
64extern stateid_t zerostateid;
65extern stateid_t onestateid;
66
67#define ZERO_STATEID(stateid) (!memcmp((stateid), &zerostateid, sizeof(stateid_t)))
68#define ONE_STATEID(stateid) (!memcmp((stateid), &onestateid, sizeof(stateid_t)))
69
70struct nfs4_cb_recall {
71 u32 cbr_ident;
72 int cbr_trunc;
73 stateid_t cbr_stateid;
74 u32 cbr_fhlen;
75 u32 cbr_fhval[NFS4_FHSIZE];
76 struct nfs4_delegation *cbr_dp;
77};
78
79struct nfs4_delegation {
80 struct list_head dl_del_perfile; /* nfs4_file->fi_del_perfile */
81 struct list_head dl_del_perclnt; /* nfs4_client->cl_del_perclnt*/
82 struct list_head dl_recall_lru; /* delegation recalled */
83 atomic_t dl_count; /* ref count */
84 struct nfs4_client *dl_client;
85 struct nfs4_file *dl_file;
86 struct file_lock *dl_flock;
87 struct file *dl_vfs_file;
88 u32 dl_type;
89 time_t dl_time;
90 struct nfs4_cb_recall dl_recall;
91};
92
93#define dl_stateid dl_recall.cbr_stateid
94#define dl_fhlen dl_recall.cbr_fhlen
95#define dl_fhval dl_recall.cbr_fhval
96
97/* client delegation callback info */
98struct nfs4_callback {
99 /* SETCLIENTID info */
100 u32 cb_parsed; /* addr parsed */
101 u32 cb_addr;
102 unsigned short cb_port;
103 u32 cb_prog;
104 u32 cb_ident;
105 /* RPC client info */
106 atomic_t cb_set; /* successful CB_NULL call */
107 struct rpc_program cb_program;
108 struct rpc_stat cb_stat;
109 struct rpc_clnt * cb_client;
110};
111
112/*
113 * struct nfs4_client - one per client. Clientids live here.
114 * o Each nfs4_client is hashed by clientid.
115 *
116 * o Each nfs4_clients is also hashed by name
117 * (the opaque quantity initially sent by the client to identify itself).
118 *
119 * o cl_perclient list is used to ensure no dangling stateowner references
120 * when we expire the nfs4_client
121 */
122struct nfs4_client {
123 struct list_head cl_idhash; /* hash by cl_clientid.id */
124 struct list_head cl_strhash; /* hash by cl_name */
125 struct list_head cl_perclient; /* list: stateowners */
126 struct list_head cl_del_perclnt; /* list: delegations */
127 struct list_head cl_lru; /* tail queue */
128 struct xdr_netobj cl_name; /* id generated by client */
129 nfs4_verifier cl_verifier; /* generated by client */
130 time_t cl_time; /* time of last lease renewal */
131 u32 cl_addr; /* client ipaddress */
132 struct svc_cred cl_cred; /* setclientid principal */
133 clientid_t cl_clientid; /* generated by server */
134 nfs4_verifier cl_confirm; /* generated by server */
135 struct nfs4_callback cl_callback; /* callback info */
136 atomic_t cl_count; /* ref count */
137};
138
139/* struct nfs4_client_reset
140 * one per old client. Populates reset_str_hashtbl. Filled from conf_id_hashtbl
141 * upon lease reset, or from upcall to state_daemon (to read in state
142 * from non-volitile storage) upon reboot.
143 */
144struct nfs4_client_reclaim {
145 struct list_head cr_strhash; /* hash by cr_name */
146 struct xdr_netobj cr_name; /* id generated by client */
147};
148
149static inline void
150update_stateid(stateid_t *stateid)
151{
152 stateid->si_generation++;
153}
154
155/* A reasonable value for REPLAY_ISIZE was estimated as follows:
156 * The OPEN response, typically the largest, requires
157 * 4(status) + 8(stateid) + 20(changeinfo) + 4(rflags) + 8(verifier) +
158 * 4(deleg. type) + 8(deleg. stateid) + 4(deleg. recall flag) +
159 * 20(deleg. space limit) + ~32(deleg. ace) = 112 bytes
160 */
161
162#define NFSD4_REPLAY_ISIZE 112
163
164/*
165 * Replay buffer, where the result of the last seqid-mutating operation
166 * is cached.
167 */
168struct nfs4_replay {
169 u32 rp_status;
170 unsigned int rp_buflen;
171 char *rp_buf;
172 unsigned intrp_allocated;
173 int rp_openfh_len;
174 char rp_openfh[NFS4_FHSIZE];
175 char rp_ibuf[NFSD4_REPLAY_ISIZE];
176};
177
178/*
179* nfs4_stateowner can either be an open_owner, or a lock_owner
180*
181* so_idhash: stateid_hashtbl[] for open owner, lockstateid_hashtbl[]
182* for lock_owner
183* so_strhash: ownerstr_hashtbl[] for open_owner, lock_ownerstr_hashtbl[]
184* for lock_owner
185* so_perclient: nfs4_client->cl_perclient entry - used when nfs4_client
186* struct is reaped.
187* so_perfilestate: heads the list of nfs4_stateid (either open or lock)
188* and is used to ensure no dangling nfs4_stateid references when we
189* release a stateowner.
190* so_perlockowner: (open) nfs4_stateid->st_perlockowner entry - used when
191* close is called to reap associated byte-range locks
192* so_close_lru: (open) stateowner is placed on this list instead of being
193* reaped (when so_perfilestate is empty) to hold the last close replay.
194* reaped by laundramat thread after lease period.
195*/
196struct nfs4_stateowner {
197 struct kref so_ref;
198 struct list_head so_idhash; /* hash by so_id */
199 struct list_head so_strhash; /* hash by op_name */
200 struct list_head so_perclient; /* nfs4_client->cl_perclient */
201 struct list_head so_perfilestate; /* list: nfs4_stateid */
202 struct list_head so_perlockowner; /* nfs4_stateid->st_perlockowner */
203 struct list_head so_close_lru; /* tail queue */
204 time_t so_time; /* time of placement on so_close_lru */
205 int so_is_open_owner; /* 1=openowner,0=lockowner */
206 u32 so_id;
207 struct nfs4_client * so_client;
208 u32 so_seqid;
209 struct xdr_netobj so_owner; /* open owner name */
210 int so_confirmed; /* successful OPEN_CONFIRM? */
211 struct nfs4_replay so_replay;
212};
213
214/*
215* nfs4_file: a file opened by some number of (open) nfs4_stateowners.
216* o fi_perfile list is used to search for conflicting
217* share_acces, share_deny on the file.
218*/
219struct nfs4_file {
220 struct list_head fi_hash; /* hash by "struct inode *" */
221 struct list_head fi_perfile; /* list: nfs4_stateid */
222 struct list_head fi_del_perfile; /* list: nfs4_delegation */
223 struct inode *fi_inode;
224 u32 fi_id; /* used with stateowner->so_id
225 * for stateid_hashtbl hash */
226};
227
228/*
229* nfs4_stateid can either be an open stateid or (eventually) a lock stateid
230*
231* (open)nfs4_stateid: one per (open)nfs4_stateowner, nfs4_file
232*
233* st_hash: stateid_hashtbl[] entry or lockstateid_hashtbl entry
234* st_perfile: file_hashtbl[] entry.
235* st_perfile_state: nfs4_stateowner->so_perfilestate
236* st_perlockowner: (open stateid) list of lock nfs4_stateowners
237* st_access_bmap: used only for open stateid
238* st_deny_bmap: used only for open stateid
239*/
240
241struct nfs4_stateid {
242 struct list_head st_hash;
243 struct list_head st_perfile;
244 struct list_head st_perfilestate;
245 struct list_head st_perlockowner;
246 struct nfs4_stateowner * st_stateowner;
247 struct nfs4_file * st_file;
248 stateid_t st_stateid;
249 struct file * st_vfs_file;
250 unsigned long st_access_bmap;
251 unsigned long st_deny_bmap;
252};
253
254/* flags for preprocess_seqid_op() */
255#define CHECK_FH 0x00000001
256#define CONFIRM 0x00000002
257#define OPEN_STATE 0x00000004
258#define LOCK_STATE 0x00000008
259#define RD_STATE 0x00000010
260#define WR_STATE 0x00000020
261#define CLOSE_STATE 0x00000040
262#define DELEG_RET 0x00000080
263
264#define seqid_mutating_err(err) \
265 (((err) != nfserr_stale_clientid) && \
266 ((err) != nfserr_bad_seqid) && \
267 ((err) != nfserr_stale_stateid) && \
268 ((err) != nfserr_bad_stateid))
269
270extern time_t nfs4_laundromat(void);
271extern int nfsd4_renew(clientid_t *clid);
272extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh,
273 stateid_t *stateid, int flags, struct file **filp);
274extern int nfs4_share_conflict(struct svc_fh *current_fh,
275 unsigned int deny_type);
276extern void nfs4_lock_state(void);
277extern void nfs4_unlock_state(void);
278extern int nfs4_in_grace(void);
279extern int nfs4_check_open_reclaim(clientid_t *clid);
280extern void put_nfs4_client(struct nfs4_client *clp);
281extern void nfs4_free_stateowner(struct kref *kref);
282extern void nfsd4_probe_callback(struct nfs4_client *clp);
283extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
284extern void nfs4_put_delegation(struct nfs4_delegation *dp);
285
286static inline void
287nfs4_put_stateowner(struct nfs4_stateowner *so)
288{
289 kref_put(&so->so_ref, nfs4_free_stateowner);
290}
291
292static inline void
293nfs4_get_stateowner(struct nfs4_stateowner *so)
294{
295 kref_get(&so->so_ref);
296}
297
298#endif /* NFSD4_STATE_H */
diff --git a/include/linux/nfsd/stats.h b/include/linux/nfsd/stats.h
new file mode 100644
index 000000000000..b6f1e0cda4f2
--- /dev/null
+++ b/include/linux/nfsd/stats.h
@@ -0,0 +1,44 @@
1/*
2 * linux/include/nfsd/stats.h
3 *
4 * Statistics for NFS server.
5 *
6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef LINUX_NFSD_STATS_H
10#define LINUX_NFSD_STATS_H
11
12struct nfsd_stats {
13 unsigned int rchits; /* repcache hits */
14 unsigned int rcmisses; /* repcache hits */
15 unsigned int rcnocache; /* uncached reqs */
16 unsigned int fh_stale; /* FH stale error */
17 unsigned int fh_lookup; /* dentry cached */
18 unsigned int fh_anon; /* anon file dentry returned */
19 unsigned int fh_nocache_dir; /* filehandle not found in dcache */
20 unsigned int fh_nocache_nondir; /* filehandle not found in dcache */
21 unsigned int io_read; /* bytes returned to read requests */
22 unsigned int io_write; /* bytes passed in write requests */
23 unsigned int th_cnt; /* number of available threads */
24 unsigned int th_usage[10]; /* number of ticks during which n perdeciles
25 * of available threads were in use */
26 unsigned int th_fullcnt; /* number of times last free thread was used */
27 unsigned int ra_size; /* size of ra cache */
28 unsigned int ra_depth[11]; /* number of times ra entry was found that deep
29 * in the cache (10percentiles). [10] = not found */
30};
31
32/* thread usage wraps very million seconds (approx one fortnight) */
33#define NFSD_USAGE_WRAP (HZ*1000000)
34
35#ifdef __KERNEL__
36
37extern struct nfsd_stats nfsdstats;
38extern struct svc_stat nfsd_svcstats;
39
40void nfsd_stat_init(void);
41void nfsd_stat_shutdown(void);
42
43#endif /* __KERNEL__ */
44#endif /* LINUX_NFSD_STATS_H */
diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h
new file mode 100644
index 000000000000..e65c9db6d13f
--- /dev/null
+++ b/include/linux/nfsd/syscall.h
@@ -0,0 +1,125 @@
1/*
2 * include/linux/nfsd/syscall.h
3 *
4 * This file holds all declarations for the knfsd syscall interface.
5 *
6 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef NFSD_SYSCALL_H
10#define NFSD_SYSCALL_H
11
12#include <asm/types.h>
13#ifdef __KERNEL__
14# include <linux/config.h>
15# include <linux/types.h>
16# include <linux/in.h>
17#endif
18#include <linux/posix_types.h>
19#include <linux/nfsd/const.h>
20#include <linux/nfsd/export.h>
21#include <linux/nfsd/nfsfh.h>
22#include <linux/nfsd/auth.h>
23
24/*
25 * Version of the syscall interface
26 */
27#define NFSCTL_VERSION 0x0201
28
29/*
30 * These are the commands understood by nfsctl().
31 */
32#define NFSCTL_SVC 0 /* This is a server process. */
33#define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */
34#define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */
35#define NFSCTL_EXPORT 3 /* export a file system. */
36#define NFSCTL_UNEXPORT 4 /* unexport a file system. */
37/*#define NFSCTL_UGIDUPDATE 5 / * update a client's uid/gid map. DISCARDED */
38/*#define NFSCTL_GETFH 6 / * get an fh by ino DISCARDED */
39#define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */
40#define NFSCTL_GETFS 8 /* get an fh by path with max FH len */
41
42/* SVC */
43struct nfsctl_svc {
44 unsigned short svc_port;
45 int svc_nthreads;
46};
47
48/* ADDCLIENT/DELCLIENT */
49struct nfsctl_client {
50 char cl_ident[NFSCLNT_IDMAX+1];
51 int cl_naddr;
52 struct in_addr cl_addrlist[NFSCLNT_ADDRMAX];
53 int cl_fhkeytype;
54 int cl_fhkeylen;
55 unsigned char cl_fhkey[NFSCLNT_KEYMAX];
56};
57
58/* EXPORT/UNEXPORT */
59struct nfsctl_export {
60 char ex_client[NFSCLNT_IDMAX+1];
61 char ex_path[NFS_MAXPATHLEN+1];
62 __kernel_old_dev_t ex_dev;
63 __kernel_ino_t ex_ino;
64 int ex_flags;
65 __kernel_uid_t ex_anon_uid;
66 __kernel_gid_t ex_anon_gid;
67};
68
69/* GETFD */
70struct nfsctl_fdparm {
71 struct sockaddr gd_addr;
72 char gd_path[NFS_MAXPATHLEN+1];
73 int gd_version;
74};
75
76/* GETFS - GET Filehandle with Size */
77struct nfsctl_fsparm {
78 struct sockaddr gd_addr;
79 char gd_path[NFS_MAXPATHLEN+1];
80 int gd_maxlen;
81};
82
83/*
84 * This is the argument union.
85 */
86struct nfsctl_arg {
87 int ca_version; /* safeguard */
88 union {
89 struct nfsctl_svc u_svc;
90 struct nfsctl_client u_client;
91 struct nfsctl_export u_export;
92 struct nfsctl_fdparm u_getfd;
93 struct nfsctl_fsparm u_getfs;
94 /*
95 * The following dummy member is needed to preserve binary compatibility
96 * on platforms where alignof(void*)>alignof(int). It's needed because
97 * this union used to contain a member (u_umap) which contained a
98 * pointer.
99 */
100 void *u_ptr;
101 } u;
102#define ca_svc u.u_svc
103#define ca_client u.u_client
104#define ca_export u.u_export
105#define ca_getfd u.u_getfd
106#define ca_getfs u.u_getfs
107};
108
109union nfsctl_res {
110 __u8 cr_getfh[NFS_FHSIZE];
111 struct knfsd_fh cr_getfs;
112};
113
114#ifdef __KERNEL__
115/*
116 * Kernel syscall implementation.
117 */
118extern int exp_addclient(struct nfsctl_client *ncp);
119extern int exp_delclient(struct nfsctl_client *ncp);
120extern int exp_export(struct nfsctl_export *nxp);
121extern int exp_unexport(struct nfsctl_export *nxp);
122
123#endif /* __KERNEL__ */
124
125#endif /* NFSD_SYSCALL_H */
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
new file mode 100644
index 000000000000..ecccef777dae
--- /dev/null
+++ b/include/linux/nfsd/xdr.h
@@ -0,0 +1,172 @@
1/*
2 * linux/inxlude/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/fs.h>
11#include <linux/vfs.h>
12#include <linux/nfs.h>
13
14struct nfsd_fhandle {
15 struct svc_fh fh;
16};
17
18struct nfsd_sattrargs {
19 struct svc_fh fh;
20 struct iattr attrs;
21};
22
23struct nfsd_diropargs {
24 struct svc_fh fh;
25 char * name;
26 int len;
27};
28
29struct nfsd_readargs {
30 struct svc_fh fh;
31 __u32 offset;
32 __u32 count;
33 struct kvec vec[RPCSVC_MAXPAGES];
34 int vlen;
35};
36
37struct nfsd_writeargs {
38 svc_fh fh;
39 __u32 offset;
40 int len;
41 struct kvec vec[RPCSVC_MAXPAGES];
42 int vlen;
43};
44
45struct nfsd_createargs {
46 struct svc_fh fh;
47 char * name;
48 int len;
49 struct iattr attrs;
50};
51
52struct nfsd_renameargs {
53 struct svc_fh ffh;
54 char * fname;
55 int flen;
56 struct svc_fh tfh;
57 char * tname;
58 int tlen;
59};
60
61struct nfsd_readlinkargs {
62 struct svc_fh fh;
63 char * buffer;
64};
65
66struct nfsd_linkargs {
67 struct svc_fh ffh;
68 struct svc_fh tfh;
69 char * tname;
70 int tlen;
71};
72
73struct nfsd_symlinkargs {
74 struct svc_fh ffh;
75 char * fname;
76 int flen;
77 char * tname;
78 int tlen;
79 struct iattr attrs;
80};
81
82struct nfsd_readdirargs {
83 struct svc_fh fh;
84 __u32 cookie;
85 __u32 count;
86 u32 * buffer;
87};
88
89struct nfsd_attrstat {
90 struct svc_fh fh;
91};
92
93struct nfsd_diropres {
94 struct svc_fh fh;
95};
96
97struct nfsd_readlinkres {
98 int len;
99};
100
101struct nfsd_readres {
102 struct svc_fh fh;
103 unsigned long count;
104};
105
106struct nfsd_readdirres {
107 int count;
108
109 struct readdir_cd common;
110 u32 * buffer;
111 int buflen;
112 u32 * 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 *, u32 *, void *);
138int nfssvc_decode_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *);
139int nfssvc_decode_sattrargs(struct svc_rqst *, u32 *,
140 struct nfsd_sattrargs *);
141int nfssvc_decode_diropargs(struct svc_rqst *, u32 *,
142 struct nfsd_diropargs *);
143int nfssvc_decode_readargs(struct svc_rqst *, u32 *,
144 struct nfsd_readargs *);
145int nfssvc_decode_writeargs(struct svc_rqst *, u32 *,
146 struct nfsd_writeargs *);
147int nfssvc_decode_createargs(struct svc_rqst *, u32 *,
148 struct nfsd_createargs *);
149int nfssvc_decode_renameargs(struct svc_rqst *, u32 *,
150 struct nfsd_renameargs *);
151int nfssvc_decode_readlinkargs(struct svc_rqst *, u32 *,
152 struct nfsd_readlinkargs *);
153int nfssvc_decode_linkargs(struct svc_rqst *, u32 *,
154 struct nfsd_linkargs *);
155int nfssvc_decode_symlinkargs(struct svc_rqst *, u32 *,
156 struct nfsd_symlinkargs *);
157int nfssvc_decode_readdirargs(struct svc_rqst *, u32 *,
158 struct nfsd_readdirargs *);
159int nfssvc_encode_void(struct svc_rqst *, u32 *, void *);
160int nfssvc_encode_attrstat(struct svc_rqst *, u32 *, struct nfsd_attrstat *);
161int nfssvc_encode_diropres(struct svc_rqst *, u32 *, struct nfsd_diropres *);
162int nfssvc_encode_readlinkres(struct svc_rqst *, u32 *, struct nfsd_readlinkres *);
163int nfssvc_encode_readres(struct svc_rqst *, u32 *, struct nfsd_readres *);
164int nfssvc_encode_statfsres(struct svc_rqst *, u32 *, struct nfsd_statfsres *);
165int nfssvc_encode_readdirres(struct svc_rqst *, u32 *, struct nfsd_readdirres *);
166
167int nfssvc_encode_entry(struct readdir_cd *, const char *name,
168 int namlen, loff_t offset, ino_t ino, unsigned int);
169
170int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *);
171
172#endif /* LINUX_NFSD_H */
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
new file mode 100644
index 000000000000..0ae9e0ef5f68
--- /dev/null
+++ b/include/linux/nfsd/xdr3.h
@@ -0,0 +1,321 @@
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 <linux/nfsd/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 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 struct kvec vec[RPCSVC_MAXPAGES];
37 int vlen;
38};
39
40struct nfsd3_writeargs {
41 svc_fh fh;
42 __u64 offset;
43 __u32 count;
44 int stable;
45 int len;
46 struct kvec vec[RPCSVC_MAXPAGES];
47 int vlen;
48};
49
50struct nfsd3_createargs {
51 struct svc_fh fh;
52 char * name;
53 int len;
54 int createmode;
55 struct iattr attrs;
56 __u32 * verf;
57};
58
59struct nfsd3_mknodargs {
60 struct svc_fh fh;
61 char * name;
62 int len;
63 __u32 ftype;
64 __u32 major, minor;
65 struct iattr attrs;
66};
67
68struct nfsd3_renameargs {
69 struct svc_fh ffh;
70 char * fname;
71 int flen;
72 struct svc_fh tfh;
73 char * tname;
74 int tlen;
75};
76
77struct nfsd3_readlinkargs {
78 struct svc_fh fh;
79 char * buffer;
80};
81
82struct nfsd3_linkargs {
83 struct svc_fh ffh;
84 struct svc_fh tfh;
85 char * tname;
86 int tlen;
87};
88
89struct nfsd3_symlinkargs {
90 struct svc_fh ffh;
91 char * fname;
92 int flen;
93 char * tname;
94 int tlen;
95 struct iattr attrs;
96};
97
98struct nfsd3_readdirargs {
99 struct svc_fh fh;
100 __u64 cookie;
101 __u32 dircount;
102 __u32 count;
103 __u32 * verf;
104 u32 * buffer;
105};
106
107struct nfsd3_commitargs {
108 struct svc_fh fh;
109 __u64 offset;
110 __u32 count;
111};
112
113struct nfsd3_attrstat {
114 __u32 status;
115 struct svc_fh fh;
116};
117
118/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
119struct nfsd3_diropres {
120 __u32 status;
121 struct svc_fh dirfh;
122 struct svc_fh fh;
123};
124
125struct nfsd3_accessres {
126 __u32 status;
127 struct svc_fh fh;
128 __u32 access;
129};
130
131struct nfsd3_readlinkres {
132 __u32 status;
133 struct svc_fh fh;
134 __u32 len;
135};
136
137struct nfsd3_readres {
138 __u32 status;
139 struct svc_fh fh;
140 unsigned long count;
141 int eof;
142};
143
144struct nfsd3_writeres {
145 __u32 status;
146 struct svc_fh fh;
147 unsigned long count;
148 int committed;
149};
150
151struct nfsd3_renameres {
152 __u32 status;
153 struct svc_fh ffh;
154 struct svc_fh tfh;
155};
156
157struct nfsd3_linkres {
158 __u32 status;
159 struct svc_fh tfh;
160 struct svc_fh fh;
161};
162
163struct nfsd3_readdirres {
164 __u32 status;
165 struct svc_fh fh;
166 int count;
167 __u32 verf[2];
168
169 struct readdir_cd common;
170 u32 * buffer;
171 int buflen;
172 u32 * offset;
173 u32 * offset1;
174 struct svc_rqst * rqstp;
175
176};
177
178struct nfsd3_fsstatres {
179 __u32 status;
180 struct kstatfs stats;
181 __u32 invarsec;
182};
183
184struct nfsd3_fsinfores {
185 __u32 status;
186 __u32 f_rtmax;
187 __u32 f_rtpref;
188 __u32 f_rtmult;
189 __u32 f_wtmax;
190 __u32 f_wtpref;
191 __u32 f_wtmult;
192 __u32 f_dtpref;
193 __u64 f_maxfilesize;
194 __u32 f_properties;
195};
196
197struct nfsd3_pathconfres {
198 __u32 status;
199 __u32 p_link_max;
200 __u32 p_name_max;
201 __u32 p_no_trunc;
202 __u32 p_chown_restricted;
203 __u32 p_case_insensitive;
204 __u32 p_case_preserving;
205};
206
207struct nfsd3_commitres {
208 __u32 status;
209 struct svc_fh fh;
210};
211
212/* dummy type for release */
213struct nfsd3_fhandle_pair {
214 __u32 dummy;
215 struct svc_fh fh1;
216 struct svc_fh fh2;
217};
218
219/*
220 * Storage requirements for XDR arguments and results.
221 */
222union nfsd3_xdrstore {
223 struct nfsd3_sattrargs sattrargs;
224 struct nfsd3_diropargs diropargs;
225 struct nfsd3_readargs readargs;
226 struct nfsd3_writeargs writeargs;
227 struct nfsd3_createargs createargs;
228 struct nfsd3_renameargs renameargs;
229 struct nfsd3_linkargs linkargs;
230 struct nfsd3_symlinkargs symlinkargs;
231 struct nfsd3_readdirargs readdirargs;
232 struct nfsd3_diropres diropres;
233 struct nfsd3_accessres accessres;
234 struct nfsd3_readlinkres readlinkres;
235 struct nfsd3_readres readres;
236 struct nfsd3_writeres writeres;
237 struct nfsd3_renameres renameres;
238 struct nfsd3_linkres linkres;
239 struct nfsd3_readdirres readdirres;
240 struct nfsd3_fsstatres fsstatres;
241 struct nfsd3_fsinfores fsinfores;
242 struct nfsd3_pathconfres pathconfres;
243 struct nfsd3_commitres commitres;
244};
245
246#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore)
247
248int nfs3svc_decode_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *);
249int nfs3svc_decode_sattrargs(struct svc_rqst *, u32 *,
250 struct nfsd3_sattrargs *);
251int nfs3svc_decode_diropargs(struct svc_rqst *, u32 *,
252 struct nfsd3_diropargs *);
253int nfs3svc_decode_accessargs(struct svc_rqst *, u32 *,
254 struct nfsd3_accessargs *);
255int nfs3svc_decode_readargs(struct svc_rqst *, u32 *,
256 struct nfsd3_readargs *);
257int nfs3svc_decode_writeargs(struct svc_rqst *, u32 *,
258 struct nfsd3_writeargs *);
259int nfs3svc_decode_createargs(struct svc_rqst *, u32 *,
260 struct nfsd3_createargs *);
261int nfs3svc_decode_mkdirargs(struct svc_rqst *, u32 *,
262 struct nfsd3_createargs *);
263int nfs3svc_decode_mknodargs(struct svc_rqst *, u32 *,
264 struct nfsd3_mknodargs *);
265int nfs3svc_decode_renameargs(struct svc_rqst *, u32 *,
266 struct nfsd3_renameargs *);
267int nfs3svc_decode_readlinkargs(struct svc_rqst *, u32 *,
268 struct nfsd3_readlinkargs *);
269int nfs3svc_decode_linkargs(struct svc_rqst *, u32 *,
270 struct nfsd3_linkargs *);
271int nfs3svc_decode_symlinkargs(struct svc_rqst *, u32 *,
272 struct nfsd3_symlinkargs *);
273int nfs3svc_decode_readdirargs(struct svc_rqst *, u32 *,
274 struct nfsd3_readdirargs *);
275int nfs3svc_decode_readdirplusargs(struct svc_rqst *, u32 *,
276 struct nfsd3_readdirargs *);
277int nfs3svc_decode_commitargs(struct svc_rqst *, u32 *,
278 struct nfsd3_commitargs *);
279int nfs3svc_encode_voidres(struct svc_rqst *, u32 *, void *);
280int nfs3svc_encode_attrstat(struct svc_rqst *, u32 *,
281 struct nfsd3_attrstat *);
282int nfs3svc_encode_wccstat(struct svc_rqst *, u32 *,
283 struct nfsd3_attrstat *);
284int nfs3svc_encode_diropres(struct svc_rqst *, u32 *,
285 struct nfsd3_diropres *);
286int nfs3svc_encode_accessres(struct svc_rqst *, u32 *,
287 struct nfsd3_accessres *);
288int nfs3svc_encode_readlinkres(struct svc_rqst *, u32 *,
289 struct nfsd3_readlinkres *);
290int nfs3svc_encode_readres(struct svc_rqst *, u32 *, struct nfsd3_readres *);
291int nfs3svc_encode_writeres(struct svc_rqst *, u32 *, struct nfsd3_writeres *);
292int nfs3svc_encode_createres(struct svc_rqst *, u32 *,
293 struct nfsd3_diropres *);
294int nfs3svc_encode_renameres(struct svc_rqst *, u32 *,
295 struct nfsd3_renameres *);
296int nfs3svc_encode_linkres(struct svc_rqst *, u32 *,
297 struct nfsd3_linkres *);
298int nfs3svc_encode_readdirres(struct svc_rqst *, u32 *,
299 struct nfsd3_readdirres *);
300int nfs3svc_encode_fsstatres(struct svc_rqst *, u32 *,
301 struct nfsd3_fsstatres *);
302int nfs3svc_encode_fsinfores(struct svc_rqst *, u32 *,
303 struct nfsd3_fsinfores *);
304int nfs3svc_encode_pathconfres(struct svc_rqst *, u32 *,
305 struct nfsd3_pathconfres *);
306int nfs3svc_encode_commitres(struct svc_rqst *, u32 *,
307 struct nfsd3_commitres *);
308
309int nfs3svc_release_fhandle(struct svc_rqst *, u32 *,
310 struct nfsd3_attrstat *);
311int nfs3svc_release_fhandle2(struct svc_rqst *, u32 *,
312 struct nfsd3_fhandle_pair *);
313int nfs3svc_encode_entry(struct readdir_cd *, const char *name,
314 int namlen, loff_t offset, ino_t ino,
315 unsigned int);
316int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name,
317 int namlen, loff_t offset, ino_t ino,
318 unsigned int);
319
320
321#endif /* _LINUX_NFSD_XDR3_H */
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
new file mode 100644
index 000000000000..a1f5ad0be1bf
--- /dev/null
+++ b/include/linux/nfsd/xdr4.h
@@ -0,0 +1,463 @@
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 <linux/nfs4.h>
43
44#define NFSD4_MAX_TAGLEN 128
45#define XDR_LEN(n) (((n) + 3) & ~3)
46
47struct nfsd4_change_info {
48 u32 atomic;
49 u32 before_ctime_sec;
50 u32 before_ctime_nsec;
51 u32 after_ctime_sec;
52 u32 after_ctime_nsec;
53};
54
55struct nfsd4_access {
56 u32 ac_req_access; /* request */
57 u32 ac_supported; /* response */
58 u32 ac_resp_access; /* response */
59};
60
61struct nfsd4_close {
62 u32 cl_seqid; /* request */
63 stateid_t cl_stateid; /* request+response */
64 struct nfs4_stateowner * cl_stateowner; /* response */
65};
66
67struct nfsd4_commit {
68 u64 co_offset; /* request */
69 u32 co_count; /* request */
70 nfs4_verifier co_verf; /* response */
71};
72
73struct nfsd4_create {
74 u32 cr_namelen; /* request */
75 char * cr_name; /* request */
76 u32 cr_type; /* request */
77 union { /* request */
78 struct {
79 u32 namelen;
80 char *name;
81 } link; /* NF4LNK */
82 struct {
83 u32 specdata1;
84 u32 specdata2;
85 } dev; /* NF4BLK, NF4CHR */
86 } u;
87 u32 cr_bmval[2]; /* request */
88 struct iattr cr_iattr; /* request */
89 struct nfsd4_change_info cr_cinfo; /* response */
90 struct nfs4_acl *cr_acl;
91};
92#define cr_linklen u.link.namelen
93#define cr_linkname u.link.name
94#define cr_specdata1 u.dev.specdata1
95#define cr_specdata2 u.dev.specdata2
96
97struct nfsd4_delegreturn {
98 stateid_t dr_stateid;
99};
100
101struct nfsd4_getattr {
102 u32 ga_bmval[2]; /* request */
103 struct svc_fh *ga_fhp; /* response */
104};
105
106struct nfsd4_link {
107 u32 li_namelen; /* request */
108 char * li_name; /* request */
109 struct nfsd4_change_info li_cinfo; /* response */
110};
111
112struct nfsd4_lock_denied {
113 clientid_t ld_clientid;
114 struct nfs4_stateowner *ld_sop;
115 u64 ld_start;
116 u64 ld_length;
117 u32 ld_type;
118};
119
120struct nfsd4_lock {
121 /* request */
122 u32 lk_type;
123 u32 lk_reclaim; /* boolean */
124 u64 lk_offset;
125 u64 lk_length;
126 u32 lk_is_new;
127 union {
128 struct {
129 u32 open_seqid;
130 stateid_t open_stateid;
131 u32 lock_seqid;
132 clientid_t clientid;
133 struct xdr_netobj owner;
134 } new;
135 struct {
136 stateid_t lock_stateid;
137 u32 lock_seqid;
138 } old;
139 } v;
140
141 /* response */
142 union {
143 struct {
144 stateid_t stateid;
145 } ok;
146 struct nfsd4_lock_denied denied;
147 } u;
148
149 struct nfs4_stateowner *lk_stateowner;
150};
151#define lk_new_open_seqid v.new.open_seqid
152#define lk_new_open_stateid v.new.open_stateid
153#define lk_new_lock_seqid v.new.lock_seqid
154#define lk_new_clientid v.new.clientid
155#define lk_new_owner v.new.owner
156#define lk_old_lock_stateid v.old.lock_stateid
157#define lk_old_lock_seqid v.old.lock_seqid
158
159#define lk_rflags u.ok.rflags
160#define lk_resp_stateid u.ok.stateid
161#define lk_denied u.denied
162
163
164struct nfsd4_lockt {
165 u32 lt_type;
166 clientid_t lt_clientid;
167 struct xdr_netobj lt_owner;
168 u64 lt_offset;
169 u64 lt_length;
170 struct nfs4_stateowner * lt_stateowner;
171 struct nfsd4_lock_denied lt_denied;
172};
173
174
175struct nfsd4_locku {
176 u32 lu_type;
177 u32 lu_seqid;
178 stateid_t lu_stateid;
179 u64 lu_offset;
180 u64 lu_length;
181 struct nfs4_stateowner *lu_stateowner;
182};
183
184
185struct nfsd4_lookup {
186 u32 lo_len; /* request */
187 char * lo_name; /* request */
188};
189
190struct nfsd4_putfh {
191 u32 pf_fhlen; /* request */
192 char *pf_fhval; /* request */
193};
194
195struct nfsd4_open {
196 u32 op_claim_type; /* request */
197 struct xdr_netobj op_fname; /* request - everything but CLAIM_PREV */
198 u32 op_delegate_type; /* request - CLAIM_PREV only */
199 stateid_t op_delegate_stateid; /* request - response */
200 u32 op_create; /* request */
201 u32 op_createmode; /* request */
202 u32 op_bmval[2]; /* request */
203 union { /* request */
204 struct iattr iattr; /* UNCHECKED4,GUARDED4 */
205 nfs4_verifier verf; /* EXCLUSIVE4 */
206 } u;
207 clientid_t op_clientid; /* request */
208 struct xdr_netobj op_owner; /* request */
209 u32 op_seqid; /* request */
210 u32 op_share_access; /* request */
211 u32 op_share_deny; /* request */
212 stateid_t op_stateid; /* response */
213 struct nfsd4_change_info op_cinfo; /* response */
214 u32 op_rflags; /* response */
215 int op_truncate; /* used during processing */
216 struct nfs4_stateowner *op_stateowner; /* used during processing */
217 struct nfs4_acl *op_acl;
218};
219#define op_iattr u.iattr
220#define op_verf u.verf
221
222struct nfsd4_open_confirm {
223 stateid_t oc_req_stateid /* request */;
224 u32 oc_seqid /* request */;
225 stateid_t oc_resp_stateid /* response */;
226 struct nfs4_stateowner * oc_stateowner; /* response */
227};
228
229struct nfsd4_open_downgrade {
230 stateid_t od_stateid;
231 u32 od_seqid;
232 u32 od_share_access;
233 u32 od_share_deny;
234 struct nfs4_stateowner *od_stateowner;
235};
236
237
238struct nfsd4_read {
239 stateid_t rd_stateid; /* request */
240 u64 rd_offset; /* request */
241 u32 rd_length; /* request */
242 struct kvec rd_iov[RPCSVC_MAXPAGES];
243 int rd_vlen;
244 struct file *rd_filp;
245
246 struct svc_rqst *rd_rqstp; /* response */
247 struct svc_fh * rd_fhp; /* response */
248};
249
250struct nfsd4_readdir {
251 u64 rd_cookie; /* request */
252 nfs4_verifier rd_verf; /* request */
253 u32 rd_dircount; /* request */
254 u32 rd_maxcount; /* request */
255 u32 rd_bmval[2]; /* request */
256 struct svc_rqst *rd_rqstp; /* response */
257 struct svc_fh * rd_fhp; /* response */
258
259 struct readdir_cd common;
260 u32 * buffer;
261 int buflen;
262 u32 * offset;
263};
264
265struct nfsd4_release_lockowner {
266 clientid_t rl_clientid;
267 struct xdr_netobj rl_owner;
268};
269struct nfsd4_readlink {
270 struct svc_rqst *rl_rqstp; /* request */
271 struct svc_fh * rl_fhp; /* request */
272};
273
274struct nfsd4_remove {
275 u32 rm_namelen; /* request */
276 char * rm_name; /* request */
277 struct nfsd4_change_info rm_cinfo; /* response */
278};
279
280struct nfsd4_rename {
281 u32 rn_snamelen; /* request */
282 char * rn_sname; /* request */
283 u32 rn_tnamelen; /* request */
284 char * rn_tname; /* request */
285 struct nfsd4_change_info rn_sinfo; /* response */
286 struct nfsd4_change_info rn_tinfo; /* response */
287};
288
289struct nfsd4_setattr {
290 stateid_t sa_stateid; /* request */
291 u32 sa_bmval[2]; /* request */
292 struct iattr sa_iattr; /* request */
293 struct nfs4_acl *sa_acl;
294};
295
296struct nfsd4_setclientid {
297 nfs4_verifier se_verf; /* request */
298 u32 se_namelen; /* request */
299 char * se_name; /* request */
300 u32 se_callback_prog; /* request */
301 u32 se_callback_netid_len; /* request */
302 char * se_callback_netid_val; /* request */
303 u32 se_callback_addr_len; /* request */
304 char * se_callback_addr_val; /* request */
305 u32 se_callback_ident; /* request */
306 clientid_t se_clientid; /* response */
307 nfs4_verifier se_confirm; /* response */
308};
309
310struct nfsd4_setclientid_confirm {
311 clientid_t sc_clientid;
312 nfs4_verifier sc_confirm;
313};
314
315/* also used for NVERIFY */
316struct nfsd4_verify {
317 u32 ve_bmval[2]; /* request */
318 u32 ve_attrlen; /* request */
319 char * ve_attrval; /* request */
320};
321
322struct nfsd4_write {
323 stateid_t wr_stateid; /* request */
324 u64 wr_offset; /* request */
325 u32 wr_stable_how; /* request */
326 u32 wr_buflen; /* request */
327 struct kvec wr_vec[RPCSVC_MAXPAGES]; /* request */
328 int wr_vlen;
329
330 u32 wr_bytes_written; /* response */
331 u32 wr_how_written; /* response */
332 nfs4_verifier wr_verifier; /* response */
333};
334
335struct nfsd4_op {
336 int opnum;
337 int status;
338 union {
339 struct nfsd4_access access;
340 struct nfsd4_close close;
341 struct nfsd4_commit commit;
342 struct nfsd4_create create;
343 struct nfsd4_delegreturn delegreturn;
344 struct nfsd4_getattr getattr;
345 struct svc_fh * getfh;
346 struct nfsd4_link link;
347 struct nfsd4_lock lock;
348 struct nfsd4_lockt lockt;
349 struct nfsd4_locku locku;
350 struct nfsd4_lookup lookup;
351 struct nfsd4_verify nverify;
352 struct nfsd4_open open;
353 struct nfsd4_open_confirm open_confirm;
354 struct nfsd4_open_downgrade open_downgrade;
355 struct nfsd4_putfh putfh;
356 struct nfsd4_read read;
357 struct nfsd4_readdir readdir;
358 struct nfsd4_readlink readlink;
359 struct nfsd4_remove remove;
360 struct nfsd4_rename rename;
361 clientid_t renew;
362 struct nfsd4_setattr setattr;
363 struct nfsd4_setclientid setclientid;
364 struct nfsd4_setclientid_confirm setclientid_confirm;
365 struct nfsd4_verify verify;
366 struct nfsd4_write write;
367 struct nfsd4_release_lockowner release_lockowner;
368 } u;
369 struct nfs4_replay * replay;
370};
371
372struct nfsd4_compoundargs {
373 /* scratch variables for XDR decode */
374 u32 * p;
375 u32 * end;
376 struct page ** pagelist;
377 int pagelen;
378 u32 tmp[8];
379 u32 * tmpp;
380 struct tmpbuf {
381 struct tmpbuf *next;
382 void (*release)(const void *);
383 void *buf;
384 } *to_free;
385
386 struct svc_rqst *rqstp;
387
388 u32 taglen;
389 char * tag;
390 u32 minorversion;
391 u32 opcnt;
392 struct nfsd4_op *ops;
393 struct nfsd4_op iops[8];
394};
395
396struct nfsd4_compoundres {
397 /* scratch variables for XDR encode */
398 u32 * p;
399 u32 * end;
400 struct xdr_buf * xbuf;
401 struct svc_rqst * rqstp;
402
403 u32 taglen;
404 char * tag;
405 u32 opcnt;
406 u32 * tagp; /* where to encode tag and opcount */
407};
408
409#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
410
411static inline void
412set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
413{
414 BUG_ON(!fhp->fh_pre_saved || !fhp->fh_post_saved);
415 cinfo->atomic = 1;
416 cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec;
417 cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec;
418 cinfo->after_ctime_sec = fhp->fh_post_ctime.tv_sec;
419 cinfo->after_ctime_nsec = fhp->fh_post_ctime.tv_nsec;
420}
421
422int nfs4svc_encode_voidres(struct svc_rqst *, u32 *, void *);
423int nfs4svc_decode_compoundargs(struct svc_rqst *, u32 *,
424 struct nfsd4_compoundargs *);
425int nfs4svc_encode_compoundres(struct svc_rqst *, u32 *,
426 struct nfsd4_compoundres *);
427void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
428void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op);
429int nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
430 struct dentry *dentry, u32 *buffer, int *countp,
431 u32 *bmval, struct svc_rqst *);
432extern int nfsd4_setclientid(struct svc_rqst *rqstp,
433 struct nfsd4_setclientid *setclid);
434extern int nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
435 struct nfsd4_setclientid_confirm *setclientid_confirm);
436extern int nfsd4_process_open1(struct nfsd4_open *open);
437extern int nfsd4_process_open2(struct svc_rqst *rqstp,
438 struct svc_fh *current_fh, struct nfsd4_open *open);
439extern int nfsd4_open_confirm(struct svc_rqst *rqstp,
440 struct svc_fh *current_fh, struct nfsd4_open_confirm *oc);
441extern int nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh,
442 struct nfsd4_close *close);
443extern int nfsd4_open_downgrade(struct svc_rqst *rqstp,
444 struct svc_fh *current_fh, struct nfsd4_open_downgrade *od);
445extern int nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh,
446 struct nfsd4_lock *lock);
447extern int nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh,
448 struct nfsd4_lockt *lockt);
449extern int nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh,
450 struct nfsd4_locku *locku);
451extern int
452nfsd4_release_lockowner(struct svc_rqst *rqstp,
453 struct nfsd4_release_lockowner *rlockowner);
454extern void nfsd4_release_compoundargs(struct nfsd4_compoundargs *);
455extern int nfsd4_delegreturn(struct svc_rqst *rqstp,
456 struct svc_fh *current_fh, struct nfsd4_delegreturn *dr);
457#endif
458
459/*
460 * Local variables:
461 * c-basic-offset: 8
462 * End:
463 */