diff options
Diffstat (limited to 'fs/nfsd/nfsd.h')
| -rw-r--r-- | fs/nfsd/nfsd.h | 138 | 
1 files changed, 103 insertions, 35 deletions
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h index 6b641cf2c19..847daf37e56 100644 --- a/fs/nfsd/nfsd.h +++ b/fs/nfsd/nfsd.h @@ -11,13 +11,48 @@  #include <linux/types.h>  #include <linux/mount.h> -#include <linux/nfsd/debug.h> -#include <linux/nfsd/export.h> -#include <linux/nfsd/stats.h> +#include <linux/nfs.h> +#include <linux/nfs2.h> +#include <linux/nfs3.h> +#include <linux/nfs4.h> +#include <linux/sunrpc/svc.h> +#include <linux/sunrpc/msg_prot.h> + +#include <uapi/linux/nfsd/debug.h> + +#include "stats.h" +#include "export.h" + +#undef ifdebug +#ifdef NFSD_DEBUG +# define ifdebug(flag)		if (nfsd_debug & NFSDDBG_##flag) +#else +# define ifdebug(flag)		if (0) +#endif +  /*   * nfsd version   */ -#define NFSD_SUPPORTED_MINOR_VERSION	1 +#define NFSD_SUPPORTED_MINOR_VERSION	2 +/* + * Maximum blocksizes supported by daemon under various circumstances. + */ +#define NFSSVC_MAXBLKSIZE       RPCSVC_MAXPAYLOAD +/* NFSv2 is limited by the protocol specification, see RFC 1094 */ +#define NFSSVC_MAXBLKSIZE_V2    (8*1024) + + +/* + * Largest number of bytes we need to allocate for an NFS + * call or reply.  Used to control buffer sizes.  We use + * the length of v3 WRITE, READDIR and READDIR replies + * which are an RPC header, up to 26 XDR units of reply + * data, and some page data. + * + * Note that accuracy here doesn't matter too much as the + * size is rounded up to a page size when allocating space. + */ +#define NFSD_BUFSIZE            ((RPC_MAX_HEADER_WITH_AUTH+26)*XDR_UNIT + NFSSVC_MAXBLKSIZE)  struct readdir_cd {  	__be32			err;	/* 0, nfserr, or nfserr_eof */ @@ -27,25 +62,27 @@ struct readdir_cd {  extern struct svc_program	nfsd_program;  extern struct svc_version	nfsd_version2, nfsd_version3,  				nfsd_version4; -extern u32			nfsd_supported_minorversion;  extern struct mutex		nfsd_mutex; -extern struct svc_serv		*nfsd_serv;  extern spinlock_t		nfsd_drc_lock; -extern unsigned int		nfsd_drc_max_mem; -extern unsigned int		nfsd_drc_mem_used; +extern unsigned long		nfsd_drc_max_mem; +extern unsigned long		nfsd_drc_mem_used;  extern const struct seq_operations nfs_exports_op;  /*   * Function prototypes.   */ -int		nfsd_svc(unsigned short port, int nrservs); +int		nfsd_svc(int nrservs, struct net *net);  int		nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp); -int		nfsd_nrthreads(void); -int		nfsd_nrpools(void); -int		nfsd_get_nrthreads(int n, int *); -int		nfsd_set_nrthreads(int n, int *); +int		nfsd_nrthreads(struct net *); +int		nfsd_nrpools(struct net *); +int		nfsd_get_nrthreads(int n, int *, struct net *); +int		nfsd_set_nrthreads(int n, int *, struct net *); +int		nfsd_pool_stats_open(struct inode *, struct file *); +int		nfsd_pool_stats_release(struct inode *, struct file *); + +void		nfsd_destroy(struct net *net);  #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)  #ifdef CONFIG_NFSD_V2_ACL @@ -64,7 +101,7 @@ enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL };  int nfsd_vers(int vers, enum vers_op change);  int nfsd_minorversion(u32 minorversion, enum vers_op change);  void nfsd_reset_versions(void); -int nfsd_create_serv(void); +int nfsd_create_serv(struct net *net);  extern int nfsd_max_blksize; @@ -77,20 +114,26 @@ static inline int nfsd_v4client(struct svc_rqst *rq)   * NFSv4 State   */  #ifdef CONFIG_NFSD_V4 -extern unsigned int max_delegations; -int nfs4_state_init(void); +extern unsigned long max_delegations; +int nfsd4_init_slabs(void);  void nfsd4_free_slabs(void);  int nfs4_state_start(void); +int nfs4_state_start_net(struct net *net);  void nfs4_state_shutdown(void); +void nfs4_state_shutdown_net(struct net *net);  void nfs4_reset_lease(time_t leasetime);  int nfs4_reset_recoverydir(char *recdir); +char * nfs4_recoverydir(void);  #else -static inline int nfs4_state_init(void) { return 0; } +static inline int nfsd4_init_slabs(void) { return 0; }  static inline void nfsd4_free_slabs(void) { }  static inline int nfs4_state_start(void) { return 0; } +static inline int nfs4_state_start_net(struct net *net) { return 0; }  static inline void nfs4_state_shutdown(void) { } +static inline void nfs4_state_shutdown_net(struct net *net) { }  static inline void nfs4_reset_lease(time_t leasetime) { }  static inline int nfs4_reset_recoverydir(char *recdir) { return 0; } +static inline char * nfs4_recoverydir(void) {return NULL; }  #endif  /* @@ -158,6 +201,7 @@ void		nfsd_lockd_shutdown(void);  #define	nfserr_attrnotsupp	cpu_to_be32(NFSERR_ATTRNOTSUPP)  #define	nfserr_bad_xdr		cpu_to_be32(NFSERR_BAD_XDR)  #define	nfserr_openmode		cpu_to_be32(NFSERR_OPENMODE) +#define	nfserr_badowner		cpu_to_be32(NFSERR_BADOWNER)  #define	nfserr_locks_held	cpu_to_be32(NFSERR_LOCKS_HELD)  #define	nfserr_op_illegal	cpu_to_be32(NFSERR_OP_ILLEGAL)  #define	nfserr_grace		cpu_to_be32(NFSERR_GRACE) @@ -205,6 +249,12 @@ void		nfsd_lockd_shutdown(void);  #define nfserr_reject_deleg		cpu_to_be32(NFS4ERR_REJECT_DELEG)  #define nfserr_returnconflict		cpu_to_be32(NFS4ERR_RETURNCONFLICT)  #define nfserr_deleg_revoked		cpu_to_be32(NFS4ERR_DELEG_REVOKED) +#define nfserr_partner_notsupp		cpu_to_be32(NFS4ERR_PARTNER_NOTSUPP) +#define nfserr_partner_no_auth		cpu_to_be32(NFS4ERR_PARTNER_NO_AUTH) +#define nfserr_metadata_notsupp		cpu_to_be32(NFS4ERR_METADATA_NOTSUPP) +#define nfserr_offload_denied		cpu_to_be32(NFS4ERR_OFFLOAD_DENIED) +#define nfserr_wrong_lfs		cpu_to_be32(NFS4ERR_WRONG_LFS) +#define nfserr_badlabel		cpu_to_be32(NFS4ERR_BADLABEL)  /* error codes for internal use */  /* if a request fails due to kmalloc failure, it gets dropped. @@ -221,16 +271,8 @@ void		nfsd_lockd_shutdown(void);  /* Check for dir entries '.' and '..' */  #define isdotent(n, l)	(l < 3 && n[0] == '.' && (l == 1 || n[1] == '.')) -/* - * Time of server startup - */ -extern struct timeval	nfssvc_boot; -  #ifdef CONFIG_NFSD_V4 -extern time_t nfsd4_lease; -extern time_t nfsd4_grace; -  /* before processing a COMPOUND operation, we have to check that there   * is enough space in the buffer for XDR encode to succeed.  otherwise,   * we might process an operation with side effects, and be unable to @@ -247,7 +289,7 @@ extern time_t nfsd4_grace;   * reason.   */  #define	COMPOUND_SLACK_SPACE		140    /* OP_GETFH */ -#define COMPOUND_ERR_SLACK_SPACE	12     /* OP_SETATTR */ +#define COMPOUND_ERR_SLACK_SPACE	16     /* OP_SETATTR */  #define NFSD_LAUNDROMAT_MINTIMEOUT      1   /* seconds */ @@ -292,6 +334,13 @@ extern time_t nfsd4_grace;  #define NFSD4_1_SUPPORTED_ATTRS_WORD2 \  	(NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT) +#ifdef CONFIG_NFSD_V4_SECURITY_LABEL +#define NFSD4_2_SUPPORTED_ATTRS_WORD2 \ +	(NFSD4_1_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SECURITY_LABEL) +#else +#define NFSD4_2_SUPPORTED_ATTRS_WORD2 0 +#endif +  static inline u32 nfsd_suppattrs0(u32 minorversion)  {  	return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0 @@ -306,21 +355,28 @@ static inline u32 nfsd_suppattrs1(u32 minorversion)  static inline u32 nfsd_suppattrs2(u32 minorversion)  { -	return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD2 -			    : NFSD4_SUPPORTED_ATTRS_WORD2; +	switch (minorversion) { +	default: return NFSD4_2_SUPPORTED_ATTRS_WORD2; +	case 1:  return NFSD4_1_SUPPORTED_ATTRS_WORD2; +	case 0:  return NFSD4_SUPPORTED_ATTRS_WORD2; +	}  }  /* These will return ERR_INVAL if specified in GETATTR or READDIR. */ -#define NFSD_WRITEONLY_ATTRS_WORD1							    \ -(FATTR4_WORD1_TIME_ACCESS_SET   | FATTR4_WORD1_TIME_MODIFY_SET) +#define NFSD_WRITEONLY_ATTRS_WORD1 \ +	(FATTR4_WORD1_TIME_ACCESS_SET   | FATTR4_WORD1_TIME_MODIFY_SET)  /* These are the only attrs allowed in CREATE/OPEN/SETATTR. */ -#define NFSD_WRITEABLE_ATTRS_WORD0                                                          \ -(FATTR4_WORD0_SIZE              | FATTR4_WORD0_ACL                                         ) -#define NFSD_WRITEABLE_ATTRS_WORD1                                                          \ -(FATTR4_WORD1_MODE              | FATTR4_WORD1_OWNER         | FATTR4_WORD1_OWNER_GROUP     \ - | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) +#define NFSD_WRITEABLE_ATTRS_WORD0 \ +	(FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL) +#define NFSD_WRITEABLE_ATTRS_WORD1 \ +	(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ +	| FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) +#ifdef CONFIG_NFSD_V4_SECURITY_LABEL +#define NFSD_WRITEABLE_ATTRS_WORD2 FATTR4_WORD2_SECURITY_LABEL +#else  #define NFSD_WRITEABLE_ATTRS_WORD2 0 +#endif  #define NFSD_SUPPATTR_EXCLCREAT_WORD0 \  	NFSD_WRITEABLE_ATTRS_WORD0 @@ -334,6 +390,18 @@ static inline u32 nfsd_suppattrs2(u32 minorversion)  #define NFSD_SUPPATTR_EXCLCREAT_WORD2 \  	NFSD_WRITEABLE_ATTRS_WORD2 +extern int nfsd4_is_junction(struct dentry *dentry); +extern int register_cld_notifier(void); +extern void unregister_cld_notifier(void); +#else /* CONFIG_NFSD_V4 */ +static inline int nfsd4_is_junction(struct dentry *dentry) +{ +	return 0; +} + +#define register_cld_notifier() 0 +#define unregister_cld_notifier() do { } while(0) +  #endif /* CONFIG_NFSD_V4 */  #endif /* LINUX_NFSD_NFSD_H */  | 
