Blame view

include/linux/nfsd/export.h 4.47 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
  /*
   * include/linux/nfsd/export.h
   * 
   * Public declarations for NFS exports. The definitions for the
   * syscall interface are in nfsctl.h
   *
   * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
   */
  
  #ifndef NFSD_EXPORT_H
  #define NFSD_EXPORT_H
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
12
  # include <linux/types.h>
3187cedf1   Jaswinder Singh Rajput   headers_check fix...
13
  #ifdef __KERNEL__
72579ac9c   Boaz Harrosh   nfsd: Headers Ind...
14
  # include <linux/nfsd/nfsfh.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  #endif
  
  /*
   * Important limits for the exports stuff.
   */
  #define NFSCLNT_IDMAX		1024
  #define NFSCLNT_ADDRMAX		16
  #define NFSCLNT_KEYMAX		32
  
  /*
   * Export flags.
   */
  #define NFSEXP_READONLY		0x0001
  #define NFSEXP_INSECURE_PORT	0x0002
  #define NFSEXP_ROOTSQUASH	0x0004
  #define NFSEXP_ALLSQUASH	0x0008
  #define NFSEXP_ASYNC		0x0010
  #define NFSEXP_GATHERED_WRITES	0x0020
  /* 40 80 100 currently unused */
  #define NFSEXP_NOHIDE		0x0200
  #define NFSEXP_NOSUBTREECHECK	0x0400
  #define	NFSEXP_NOAUTHNLM	0x0800		/* Don't authenticate NLM requests - just trust */
9ce137eee   J. Bruce Fields   nfsd: don't suppo...
37
  #define NFSEXP_MSNFS		0x1000	/* do silly things that MS clients expect; no longer supported */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
38
39
40
  #define NFSEXP_FSID		0x2000
  #define	NFSEXP_CROSSMOUNT	0x4000
  #define	NFSEXP_NOACL		0x8000	/* reserved for possible ACL related use */
eb4c86c6a   Steve Dickson   nfsd: introduce e...
41
42
43
44
45
46
47
48
49
50
  /*
   * The NFSEXP_V4ROOT flag causes the kernel to give access only to NFSv4
   * clients, and only to the single directory that is the root of the
   * export; further lookup and readdir operations are treated as if every
   * subdirectory was a mountpoint, and ignored if they are not themselves
   * exported.  This is used by nfsd and mountd to construct the NFSv4
   * pseudofilesystem, which provides access only to paths leading to each
   * exported filesystem.
   */
  #define	NFSEXP_V4ROOT		0x10000
e8e8753f7   J. Bruce Fields   nfsd: new interfa...
51
  /* All flags that we claim to support.  (Note we don't support NOACL.) */
3d8986c75   J. Bruce Fields   nfsd: enable V4RO...
52
  #define NFSEXP_ALLFLAGS		0x17E3F
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
53

e677bfe4d   Andy Adamson   knfsd: nfsd4: par...
54
  /* The flags that may vary depending on security flavor: */
1269bc69b   J. Bruce Fields   knfsd: nfsd: enfo...
55
  #define NFSEXP_SECINFO_FLAGS	(NFSEXP_READONLY | NFSEXP_ROOTSQUASH \
12045a6ee   J. Bruce Fields   nfsd: let "insecu...
56
57
  					| NFSEXP_ALLSQUASH \
  					| NFSEXP_INSECURE_PORT)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
58
59
  
  #ifdef __KERNEL__
933469190   Manoj Naik   [PATCH] knfsd: nf...
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
  /*
   * FS Locations
   */
  
  #define MAX_FS_LOCATIONS	128
  
  struct nfsd4_fs_location {
  	char *hosts; /* colon separated list of hosts */
  	char *path;  /* slash separated list of path components */
  };
  
  struct nfsd4_fs_locations {
  	uint32_t locations_count;
  	struct nfsd4_fs_location *locations;
  /* If we're not actually serving this data ourselves (only providing a
   * list of replicas that do serve it) then we set "migrated": */
  	int migrated;
  };
e677bfe4d   Andy Adamson   knfsd: nfsd4: par...
78
79
  /*
   * We keep an array of pseudoflavors with the export, in order from most
25985edce   Lucas De Marchi   Fix common misspe...
80
   * to least preferred.  For the foreseeable future, we don't expect more
e677bfe4d   Andy Adamson   knfsd: nfsd4: par...
81
82
83
84
85
86
87
88
89
   * than the eight pseudoflavors null, unix, krb5, krb5i, krb5p, skpm3,
   * spkm3i, and spkm3p (and using all 8 at once should be rare).
   */
  #define MAX_SECINFO_LIST	8
  
  struct exp_flavor_info {
  	u32	pseudoflavor;
  	u32	flags;
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
90
91
92
93
  struct svc_export {
  	struct cache_head	h;
  	struct auth_domain *	ex_client;
  	int			ex_flags;
547754916   Jan Blunck   Use struct path i...
94
  	struct path		ex_path;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
95
96
97
  	uid_t			ex_anon_uid;
  	gid_t			ex_anon_gid;
  	int			ex_fsid;
af6a4e280   NeilBrown   [PATCH] knfsd: ad...
98
  	unsigned char *		ex_uuid; /* 16 byte fsid */
933469190   Manoj Naik   [PATCH] knfsd: nf...
99
  	struct nfsd4_fs_locations ex_fslocs;
e677bfe4d   Andy Adamson   knfsd: nfsd4: par...
100
101
  	int			ex_nflavors;
  	struct exp_flavor_info	ex_flavors[MAX_SECINFO_LIST];
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
102
103
104
  };
  
  /* an "export key" (expkey) maps a filehandlefragement to an
af6a4e280   NeilBrown   [PATCH] knfsd: ad...
105
106
   * svc_export for a given client.  There can be several per export,
   * for the different fsid types.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
107
108
109
110
111
112
   */
  struct svc_expkey {
  	struct cache_head	h;
  
  	struct auth_domain *	ek_client;
  	int			ek_fsidtype;
af6a4e280   NeilBrown   [PATCH] knfsd: ad...
113
  	u32			ek_fsid[6];
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
114

e83aece3a   Jan Blunck   Use struct path i...
115
  	struct path		ek_path;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
116
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
117
  #define EX_ISSYNC(exp)		(!((exp)->ex_flags & NFSEXP_ASYNC))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
118
119
  #define EX_NOHIDE(exp)		((exp)->ex_flags & NFSEXP_NOHIDE)
  #define EX_WGATHER(exp)		((exp)->ex_flags & NFSEXP_GATHERED_WRITES)
c7d51402d   J. Bruce Fields   knfsd: clean up E...
120
  int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp);
32c1eb0cd   Andy Adamson   knfsd: nfsd4: ret...
121
  __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
122
123
124
125
  
  /*
   * Function declarations
   */
dbf847ecb   J. Bruce Fields   knfsd: allow cach...
126
  int			nfsd_export_init(void);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
127
128
  void			nfsd_export_shutdown(void);
  void			nfsd_export_flush(void);
0989a7889   J. Bruce Fields   knfsd: nfsd: prov...
129
  struct svc_export *	rqst_exp_get_by_name(struct svc_rqst *,
91c9fa8f7   Al Viro   switch rqst_exp_g...
130
  					     struct path *);
0989a7889   J. Bruce Fields   knfsd: nfsd: prov...
131
  struct svc_export *	rqst_exp_parent(struct svc_rqst *,
e64c390ca   Al Viro   switch rqst_exp_p...
132
  					struct path *);
ed748aacb   Trond Myklebust   NFSD: Cleanup for...
133
  struct svc_export *	rqst_find_fsidzero_export(struct svc_rqst *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
134
135
  int			exp_rootfh(struct auth_domain *, 
  					char *path, struct knfsd_fh *, int maxsize);
df547efb0   J. Bruce Fields   knfsd: nfsd4: sim...
136
  __be32			exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
63f103111   Al Viro   [PATCH] nfsd: nfs...
137
  __be32			nfserrno(int errno);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
138

74cae61ab   Adrian Bunk   [PATCH] fs/nfsd/e...
139
  extern struct cache_detail svc_export_cache;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
140
141
142
  
  static inline void exp_put(struct svc_export *exp)
  {
baab935ff   NeilBrown   [PATCH] knfsd: Co...
143
  	cache_put(&exp->h, &svc_export_cache);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
144
145
146
147
148
149
  }
  
  static inline void exp_get(struct svc_export *exp)
  {
  	cache_get(&exp->h);
  }
0989a7889   J. Bruce Fields   knfsd: nfsd: prov...
150
  struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
151
152
153
154
  
  #endif /* __KERNEL__ */
  
  #endif /* NFSD_EXPORT_H */