19a74af21SBoaz Harrosh /* 29a74af21SBoaz Harrosh * linux/include/linux/nfsd/nfsd.h 39a74af21SBoaz Harrosh * 49a74af21SBoaz Harrosh * Hodge-podge collection of knfsd-related stuff. 59a74af21SBoaz Harrosh * I will sort this out later. 69a74af21SBoaz Harrosh * 79a74af21SBoaz Harrosh * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> 89a74af21SBoaz Harrosh */ 99a74af21SBoaz Harrosh 109a74af21SBoaz Harrosh #ifndef LINUX_NFSD_NFSD_H 119a74af21SBoaz Harrosh #define LINUX_NFSD_NFSD_H 129a74af21SBoaz Harrosh 139a74af21SBoaz Harrosh #include <linux/types.h> 149a74af21SBoaz Harrosh #include <linux/mount.h> 159a74af21SBoaz Harrosh 169a74af21SBoaz Harrosh #include <linux/nfsd/debug.h> 179a74af21SBoaz Harrosh #include <linux/nfsd/export.h> 189a74af21SBoaz Harrosh #include <linux/nfsd/stats.h> 199a74af21SBoaz Harrosh /* 209a74af21SBoaz Harrosh * nfsd version 219a74af21SBoaz Harrosh */ 229a74af21SBoaz Harrosh #define NFSD_SUPPORTED_MINOR_VERSION 1 239a74af21SBoaz Harrosh 249a74af21SBoaz Harrosh struct readdir_cd { 259a74af21SBoaz Harrosh __be32 err; /* 0, nfserr, or nfserr_eof */ 269a74af21SBoaz Harrosh }; 279a74af21SBoaz Harrosh 289a74af21SBoaz Harrosh 299a74af21SBoaz Harrosh extern struct svc_program nfsd_program; 309a74af21SBoaz Harrosh extern struct svc_version nfsd_version2, nfsd_version3, 319a74af21SBoaz Harrosh nfsd_version4; 329a74af21SBoaz Harrosh extern u32 nfsd_supported_minorversion; 339a74af21SBoaz Harrosh extern struct mutex nfsd_mutex; 349a74af21SBoaz Harrosh extern struct svc_serv *nfsd_serv; 359a74af21SBoaz Harrosh extern spinlock_t nfsd_drc_lock; 369a74af21SBoaz Harrosh extern unsigned int nfsd_drc_max_mem; 379a74af21SBoaz Harrosh extern unsigned int nfsd_drc_mem_used; 389a74af21SBoaz Harrosh 399a74af21SBoaz Harrosh extern const struct seq_operations nfs_exports_op; 409a74af21SBoaz Harrosh 419a74af21SBoaz Harrosh /* 429a74af21SBoaz Harrosh * Function prototypes. 439a74af21SBoaz Harrosh */ 449a74af21SBoaz Harrosh int nfsd_svc(unsigned short port, int nrservs); 459a74af21SBoaz Harrosh int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp); 469a74af21SBoaz Harrosh 479a74af21SBoaz Harrosh int nfsd_nrthreads(void); 489a74af21SBoaz Harrosh int nfsd_nrpools(void); 499a74af21SBoaz Harrosh int nfsd_get_nrthreads(int n, int *); 509a74af21SBoaz Harrosh int nfsd_set_nrthreads(int n, int *); 519a74af21SBoaz Harrosh 529a74af21SBoaz Harrosh #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 539a74af21SBoaz Harrosh #ifdef CONFIG_NFSD_V2_ACL 549a74af21SBoaz Harrosh extern struct svc_version nfsd_acl_version2; 559a74af21SBoaz Harrosh #else 569a74af21SBoaz Harrosh #define nfsd_acl_version2 NULL 579a74af21SBoaz Harrosh #endif 589a74af21SBoaz Harrosh #ifdef CONFIG_NFSD_V3_ACL 599a74af21SBoaz Harrosh extern struct svc_version nfsd_acl_version3; 609a74af21SBoaz Harrosh #else 619a74af21SBoaz Harrosh #define nfsd_acl_version3 NULL 629a74af21SBoaz Harrosh #endif 639a74af21SBoaz Harrosh #endif 649a74af21SBoaz Harrosh 659a74af21SBoaz Harrosh enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL }; 669a74af21SBoaz Harrosh int nfsd_vers(int vers, enum vers_op change); 679a74af21SBoaz Harrosh int nfsd_minorversion(u32 minorversion, enum vers_op change); 689a74af21SBoaz Harrosh void nfsd_reset_versions(void); 699a74af21SBoaz Harrosh int nfsd_create_serv(void); 709a74af21SBoaz Harrosh 719a74af21SBoaz Harrosh extern int nfsd_max_blksize; 729a74af21SBoaz Harrosh 739a74af21SBoaz Harrosh /* 749a74af21SBoaz Harrosh * NFSv4 State 759a74af21SBoaz Harrosh */ 769a74af21SBoaz Harrosh #ifdef CONFIG_NFSD_V4 779a74af21SBoaz Harrosh extern unsigned int max_delegations; 789a74af21SBoaz Harrosh int nfs4_state_init(void); 799a74af21SBoaz Harrosh void nfsd4_free_slabs(void); 809a74af21SBoaz Harrosh int nfs4_state_start(void); 819a74af21SBoaz Harrosh void nfs4_state_shutdown(void); 829a74af21SBoaz Harrosh time_t nfs4_lease_time(void); 839a74af21SBoaz Harrosh void nfs4_reset_lease(time_t leasetime); 849a74af21SBoaz Harrosh int nfs4_reset_recoverydir(char *recdir); 859a74af21SBoaz Harrosh #else 869a74af21SBoaz Harrosh static inline int nfs4_state_init(void) { return 0; } 879a74af21SBoaz Harrosh static inline void nfsd4_free_slabs(void) { } 889a74af21SBoaz Harrosh static inline int nfs4_state_start(void) { return 0; } 899a74af21SBoaz Harrosh static inline void nfs4_state_shutdown(void) { } 909a74af21SBoaz Harrosh static inline time_t nfs4_lease_time(void) { return 0; } 919a74af21SBoaz Harrosh static inline void nfs4_reset_lease(time_t leasetime) { } 929a74af21SBoaz Harrosh static inline int nfs4_reset_recoverydir(char *recdir) { return 0; } 939a74af21SBoaz Harrosh #endif 949a74af21SBoaz Harrosh 959a74af21SBoaz Harrosh /* 969a74af21SBoaz Harrosh * lockd binding 979a74af21SBoaz Harrosh */ 989a74af21SBoaz Harrosh void nfsd_lockd_init(void); 999a74af21SBoaz Harrosh void nfsd_lockd_shutdown(void); 1009a74af21SBoaz Harrosh 1019a74af21SBoaz Harrosh 1029a74af21SBoaz Harrosh /* 1039a74af21SBoaz Harrosh * These macros provide pre-xdr'ed values for faster operation. 1049a74af21SBoaz Harrosh */ 1059a74af21SBoaz Harrosh #define nfs_ok cpu_to_be32(NFS_OK) 1069a74af21SBoaz Harrosh #define nfserr_perm cpu_to_be32(NFSERR_PERM) 1079a74af21SBoaz Harrosh #define nfserr_noent cpu_to_be32(NFSERR_NOENT) 1089a74af21SBoaz Harrosh #define nfserr_io cpu_to_be32(NFSERR_IO) 1099a74af21SBoaz Harrosh #define nfserr_nxio cpu_to_be32(NFSERR_NXIO) 1109a74af21SBoaz Harrosh #define nfserr_eagain cpu_to_be32(NFSERR_EAGAIN) 1119a74af21SBoaz Harrosh #define nfserr_acces cpu_to_be32(NFSERR_ACCES) 1129a74af21SBoaz Harrosh #define nfserr_exist cpu_to_be32(NFSERR_EXIST) 1139a74af21SBoaz Harrosh #define nfserr_xdev cpu_to_be32(NFSERR_XDEV) 1149a74af21SBoaz Harrosh #define nfserr_nodev cpu_to_be32(NFSERR_NODEV) 1159a74af21SBoaz Harrosh #define nfserr_notdir cpu_to_be32(NFSERR_NOTDIR) 1169a74af21SBoaz Harrosh #define nfserr_isdir cpu_to_be32(NFSERR_ISDIR) 1179a74af21SBoaz Harrosh #define nfserr_inval cpu_to_be32(NFSERR_INVAL) 1189a74af21SBoaz Harrosh #define nfserr_fbig cpu_to_be32(NFSERR_FBIG) 1199a74af21SBoaz Harrosh #define nfserr_nospc cpu_to_be32(NFSERR_NOSPC) 1209a74af21SBoaz Harrosh #define nfserr_rofs cpu_to_be32(NFSERR_ROFS) 1219a74af21SBoaz Harrosh #define nfserr_mlink cpu_to_be32(NFSERR_MLINK) 1229a74af21SBoaz Harrosh #define nfserr_opnotsupp cpu_to_be32(NFSERR_OPNOTSUPP) 1239a74af21SBoaz Harrosh #define nfserr_nametoolong cpu_to_be32(NFSERR_NAMETOOLONG) 1249a74af21SBoaz Harrosh #define nfserr_notempty cpu_to_be32(NFSERR_NOTEMPTY) 1259a74af21SBoaz Harrosh #define nfserr_dquot cpu_to_be32(NFSERR_DQUOT) 1269a74af21SBoaz Harrosh #define nfserr_stale cpu_to_be32(NFSERR_STALE) 1279a74af21SBoaz Harrosh #define nfserr_remote cpu_to_be32(NFSERR_REMOTE) 1289a74af21SBoaz Harrosh #define nfserr_wflush cpu_to_be32(NFSERR_WFLUSH) 1299a74af21SBoaz Harrosh #define nfserr_badhandle cpu_to_be32(NFSERR_BADHANDLE) 1309a74af21SBoaz Harrosh #define nfserr_notsync cpu_to_be32(NFSERR_NOT_SYNC) 1319a74af21SBoaz Harrosh #define nfserr_badcookie cpu_to_be32(NFSERR_BAD_COOKIE) 1329a74af21SBoaz Harrosh #define nfserr_notsupp cpu_to_be32(NFSERR_NOTSUPP) 1339a74af21SBoaz Harrosh #define nfserr_toosmall cpu_to_be32(NFSERR_TOOSMALL) 1349a74af21SBoaz Harrosh #define nfserr_serverfault cpu_to_be32(NFSERR_SERVERFAULT) 1359a74af21SBoaz Harrosh #define nfserr_badtype cpu_to_be32(NFSERR_BADTYPE) 1369a74af21SBoaz Harrosh #define nfserr_jukebox cpu_to_be32(NFSERR_JUKEBOX) 1379a74af21SBoaz Harrosh #define nfserr_denied cpu_to_be32(NFSERR_DENIED) 1389a74af21SBoaz Harrosh #define nfserr_deadlock cpu_to_be32(NFSERR_DEADLOCK) 1399a74af21SBoaz Harrosh #define nfserr_expired cpu_to_be32(NFSERR_EXPIRED) 1409a74af21SBoaz Harrosh #define nfserr_bad_cookie cpu_to_be32(NFSERR_BAD_COOKIE) 1419a74af21SBoaz Harrosh #define nfserr_same cpu_to_be32(NFSERR_SAME) 1429a74af21SBoaz Harrosh #define nfserr_clid_inuse cpu_to_be32(NFSERR_CLID_INUSE) 1439a74af21SBoaz Harrosh #define nfserr_stale_clientid cpu_to_be32(NFSERR_STALE_CLIENTID) 1449a74af21SBoaz Harrosh #define nfserr_resource cpu_to_be32(NFSERR_RESOURCE) 1459a74af21SBoaz Harrosh #define nfserr_moved cpu_to_be32(NFSERR_MOVED) 1469a74af21SBoaz Harrosh #define nfserr_nofilehandle cpu_to_be32(NFSERR_NOFILEHANDLE) 1479a74af21SBoaz Harrosh #define nfserr_minor_vers_mismatch cpu_to_be32(NFSERR_MINOR_VERS_MISMATCH) 1489a74af21SBoaz Harrosh #define nfserr_share_denied cpu_to_be32(NFSERR_SHARE_DENIED) 1499a74af21SBoaz Harrosh #define nfserr_stale_stateid cpu_to_be32(NFSERR_STALE_STATEID) 1509a74af21SBoaz Harrosh #define nfserr_old_stateid cpu_to_be32(NFSERR_OLD_STATEID) 1519a74af21SBoaz Harrosh #define nfserr_bad_stateid cpu_to_be32(NFSERR_BAD_STATEID) 1529a74af21SBoaz Harrosh #define nfserr_bad_seqid cpu_to_be32(NFSERR_BAD_SEQID) 1539a74af21SBoaz Harrosh #define nfserr_symlink cpu_to_be32(NFSERR_SYMLINK) 1549a74af21SBoaz Harrosh #define nfserr_not_same cpu_to_be32(NFSERR_NOT_SAME) 1559a74af21SBoaz Harrosh #define nfserr_restorefh cpu_to_be32(NFSERR_RESTOREFH) 1569a74af21SBoaz Harrosh #define nfserr_attrnotsupp cpu_to_be32(NFSERR_ATTRNOTSUPP) 1579a74af21SBoaz Harrosh #define nfserr_bad_xdr cpu_to_be32(NFSERR_BAD_XDR) 1589a74af21SBoaz Harrosh #define nfserr_openmode cpu_to_be32(NFSERR_OPENMODE) 1599a74af21SBoaz Harrosh #define nfserr_locks_held cpu_to_be32(NFSERR_LOCKS_HELD) 1609a74af21SBoaz Harrosh #define nfserr_op_illegal cpu_to_be32(NFSERR_OP_ILLEGAL) 1619a74af21SBoaz Harrosh #define nfserr_grace cpu_to_be32(NFSERR_GRACE) 1629a74af21SBoaz Harrosh #define nfserr_no_grace cpu_to_be32(NFSERR_NO_GRACE) 1639a74af21SBoaz Harrosh #define nfserr_reclaim_bad cpu_to_be32(NFSERR_RECLAIM_BAD) 1649a74af21SBoaz Harrosh #define nfserr_badname cpu_to_be32(NFSERR_BADNAME) 1659a74af21SBoaz Harrosh #define nfserr_cb_path_down cpu_to_be32(NFSERR_CB_PATH_DOWN) 1669a74af21SBoaz Harrosh #define nfserr_locked cpu_to_be32(NFSERR_LOCKED) 1679a74af21SBoaz Harrosh #define nfserr_wrongsec cpu_to_be32(NFSERR_WRONGSEC) 1689a74af21SBoaz Harrosh #define nfserr_badiomode cpu_to_be32(NFS4ERR_BADIOMODE) 1699a74af21SBoaz Harrosh #define nfserr_badlayout cpu_to_be32(NFS4ERR_BADLAYOUT) 1709a74af21SBoaz Harrosh #define nfserr_bad_session_digest cpu_to_be32(NFS4ERR_BAD_SESSION_DIGEST) 1719a74af21SBoaz Harrosh #define nfserr_badsession cpu_to_be32(NFS4ERR_BADSESSION) 1729a74af21SBoaz Harrosh #define nfserr_badslot cpu_to_be32(NFS4ERR_BADSLOT) 1739a74af21SBoaz Harrosh #define nfserr_complete_already cpu_to_be32(NFS4ERR_COMPLETE_ALREADY) 1749a74af21SBoaz Harrosh #define nfserr_conn_not_bound_to_session cpu_to_be32(NFS4ERR_CONN_NOT_BOUND_TO_SESSION) 1759a74af21SBoaz Harrosh #define nfserr_deleg_already_wanted cpu_to_be32(NFS4ERR_DELEG_ALREADY_WANTED) 1769a74af21SBoaz Harrosh #define nfserr_back_chan_busy cpu_to_be32(NFS4ERR_BACK_CHAN_BUSY) 1779a74af21SBoaz Harrosh #define nfserr_layouttrylater cpu_to_be32(NFS4ERR_LAYOUTTRYLATER) 1789a74af21SBoaz Harrosh #define nfserr_layoutunavailable cpu_to_be32(NFS4ERR_LAYOUTUNAVAILABLE) 1799a74af21SBoaz Harrosh #define nfserr_nomatching_layout cpu_to_be32(NFS4ERR_NOMATCHING_LAYOUT) 1809a74af21SBoaz Harrosh #define nfserr_recallconflict cpu_to_be32(NFS4ERR_RECALLCONFLICT) 1819a74af21SBoaz Harrosh #define nfserr_unknown_layouttype cpu_to_be32(NFS4ERR_UNKNOWN_LAYOUTTYPE) 1829a74af21SBoaz Harrosh #define nfserr_seq_misordered cpu_to_be32(NFS4ERR_SEQ_MISORDERED) 1839a74af21SBoaz Harrosh #define nfserr_sequence_pos cpu_to_be32(NFS4ERR_SEQUENCE_POS) 1849a74af21SBoaz Harrosh #define nfserr_req_too_big cpu_to_be32(NFS4ERR_REQ_TOO_BIG) 1859a74af21SBoaz Harrosh #define nfserr_rep_too_big cpu_to_be32(NFS4ERR_REP_TOO_BIG) 1869a74af21SBoaz Harrosh #define nfserr_rep_too_big_to_cache cpu_to_be32(NFS4ERR_REP_TOO_BIG_TO_CACHE) 1879a74af21SBoaz Harrosh #define nfserr_retry_uncached_rep cpu_to_be32(NFS4ERR_RETRY_UNCACHED_REP) 1889a74af21SBoaz Harrosh #define nfserr_unsafe_compound cpu_to_be32(NFS4ERR_UNSAFE_COMPOUND) 1899a74af21SBoaz Harrosh #define nfserr_too_many_ops cpu_to_be32(NFS4ERR_TOO_MANY_OPS) 1909a74af21SBoaz Harrosh #define nfserr_op_not_in_session cpu_to_be32(NFS4ERR_OP_NOT_IN_SESSION) 1919a74af21SBoaz Harrosh #define nfserr_hash_alg_unsupp cpu_to_be32(NFS4ERR_HASH_ALG_UNSUPP) 1929a74af21SBoaz Harrosh #define nfserr_clientid_busy cpu_to_be32(NFS4ERR_CLIENTID_BUSY) 1939a74af21SBoaz Harrosh #define nfserr_pnfs_io_hole cpu_to_be32(NFS4ERR_PNFS_IO_HOLE) 1949a74af21SBoaz Harrosh #define nfserr_seq_false_retry cpu_to_be32(NFS4ERR_SEQ_FALSE_RETRY) 1959a74af21SBoaz Harrosh #define nfserr_bad_high_slot cpu_to_be32(NFS4ERR_BAD_HIGH_SLOT) 1969a74af21SBoaz Harrosh #define nfserr_deadsession cpu_to_be32(NFS4ERR_DEADSESSION) 1979a74af21SBoaz Harrosh #define nfserr_encr_alg_unsupp cpu_to_be32(NFS4ERR_ENCR_ALG_UNSUPP) 1989a74af21SBoaz Harrosh #define nfserr_pnfs_no_layout cpu_to_be32(NFS4ERR_PNFS_NO_LAYOUT) 1999a74af21SBoaz Harrosh #define nfserr_not_only_op cpu_to_be32(NFS4ERR_NOT_ONLY_OP) 2009a74af21SBoaz Harrosh #define nfserr_wrong_cred cpu_to_be32(NFS4ERR_WRONG_CRED) 2019a74af21SBoaz Harrosh #define nfserr_wrong_type cpu_to_be32(NFS4ERR_WRONG_TYPE) 2029a74af21SBoaz Harrosh #define nfserr_dirdeleg_unavail cpu_to_be32(NFS4ERR_DIRDELEG_UNAVAIL) 2039a74af21SBoaz Harrosh #define nfserr_reject_deleg cpu_to_be32(NFS4ERR_REJECT_DELEG) 2049a74af21SBoaz Harrosh #define nfserr_returnconflict cpu_to_be32(NFS4ERR_RETURNCONFLICT) 2059a74af21SBoaz Harrosh #define nfserr_deleg_revoked cpu_to_be32(NFS4ERR_DELEG_REVOKED) 2069a74af21SBoaz Harrosh 2079a74af21SBoaz Harrosh /* error codes for internal use */ 2089a74af21SBoaz Harrosh /* if a request fails due to kmalloc failure, it gets dropped. 2099a74af21SBoaz Harrosh * Client should resend eventually 2109a74af21SBoaz Harrosh */ 2119a74af21SBoaz Harrosh #define nfserr_dropit cpu_to_be32(30000) 2129a74af21SBoaz Harrosh /* end-of-file indicator in readdir */ 2139a74af21SBoaz Harrosh #define nfserr_eof cpu_to_be32(30001) 2149a74af21SBoaz Harrosh /* replay detected */ 2159a74af21SBoaz Harrosh #define nfserr_replay_me cpu_to_be32(11001) 2169a74af21SBoaz Harrosh /* nfs41 replay detected */ 2179a74af21SBoaz Harrosh #define nfserr_replay_cache cpu_to_be32(11002) 2189a74af21SBoaz Harrosh 2199a74af21SBoaz Harrosh /* Check for dir entries '.' and '..' */ 2209a74af21SBoaz Harrosh #define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.')) 2219a74af21SBoaz Harrosh 2229a74af21SBoaz Harrosh /* 2239a74af21SBoaz Harrosh * Time of server startup 2249a74af21SBoaz Harrosh */ 2259a74af21SBoaz Harrosh extern struct timeval nfssvc_boot; 2269a74af21SBoaz Harrosh 2279a74af21SBoaz Harrosh #ifdef CONFIG_NFSD_V4 2289a74af21SBoaz Harrosh 2299a74af21SBoaz Harrosh /* before processing a COMPOUND operation, we have to check that there 2309a74af21SBoaz Harrosh * is enough space in the buffer for XDR encode to succeed. otherwise, 2319a74af21SBoaz Harrosh * we might process an operation with side effects, and be unable to 2329a74af21SBoaz Harrosh * tell the client that the operation succeeded. 2339a74af21SBoaz Harrosh * 2349a74af21SBoaz Harrosh * COMPOUND_SLACK_SPACE - this is the minimum bytes of buffer space 2359a74af21SBoaz Harrosh * needed to encode an "ordinary" _successful_ operation. (GETATTR, 2369a74af21SBoaz Harrosh * READ, READDIR, and READLINK have their own buffer checks.) if we 2379a74af21SBoaz Harrosh * fall below this level, we fail the next operation with NFS4ERR_RESOURCE. 2389a74af21SBoaz Harrosh * 2399a74af21SBoaz Harrosh * COMPOUND_ERR_SLACK_SPACE - this is the minimum bytes of buffer space 2409a74af21SBoaz Harrosh * needed to encode an operation which has failed with NFS4ERR_RESOURCE. 2419a74af21SBoaz Harrosh * care is taken to ensure that we never fall below this level for any 2429a74af21SBoaz Harrosh * reason. 2439a74af21SBoaz Harrosh */ 2449a74af21SBoaz Harrosh #define COMPOUND_SLACK_SPACE 140 /* OP_GETFH */ 2459a74af21SBoaz Harrosh #define COMPOUND_ERR_SLACK_SPACE 12 /* OP_SETATTR */ 2469a74af21SBoaz Harrosh 2479a74af21SBoaz Harrosh #define NFSD_LEASE_TIME (nfs4_lease_time()) 2489a74af21SBoaz Harrosh #define NFSD_LAUNDROMAT_MINTIMEOUT 10 /* seconds */ 2499a74af21SBoaz Harrosh 2509a74af21SBoaz Harrosh /* 2519a74af21SBoaz Harrosh * The following attributes are currently not supported by the NFSv4 server: 2529a74af21SBoaz Harrosh * ARCHIVE (deprecated anyway) 2539a74af21SBoaz Harrosh * HIDDEN (unlikely to be supported any time soon) 2549a74af21SBoaz Harrosh * MIMETYPE (unlikely to be supported any time soon) 2559a74af21SBoaz Harrosh * QUOTA_* (will be supported in a forthcoming patch) 2569a74af21SBoaz Harrosh * SYSTEM (unlikely to be supported any time soon) 2579a74af21SBoaz Harrosh * TIME_BACKUP (unlikely to be supported any time soon) 2589a74af21SBoaz Harrosh * TIME_CREATE (unlikely to be supported any time soon) 2599a74af21SBoaz Harrosh */ 2609a74af21SBoaz Harrosh #define NFSD4_SUPPORTED_ATTRS_WORD0 \ 2619a74af21SBoaz Harrosh (FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_TYPE | FATTR4_WORD0_FH_EXPIRE_TYPE \ 2629a74af21SBoaz Harrosh | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_LINK_SUPPORT \ 2639a74af21SBoaz Harrosh | FATTR4_WORD0_SYMLINK_SUPPORT | FATTR4_WORD0_NAMED_ATTR | FATTR4_WORD0_FSID \ 2649a74af21SBoaz Harrosh | FATTR4_WORD0_UNIQUE_HANDLES | FATTR4_WORD0_LEASE_TIME | FATTR4_WORD0_RDATTR_ERROR \ 2659a74af21SBoaz Harrosh | FATTR4_WORD0_ACLSUPPORT | FATTR4_WORD0_CANSETTIME | FATTR4_WORD0_CASE_INSENSITIVE \ 2669a74af21SBoaz Harrosh | FATTR4_WORD0_CASE_PRESERVING | FATTR4_WORD0_CHOWN_RESTRICTED \ 2679a74af21SBoaz Harrosh | FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FILEID | FATTR4_WORD0_FILES_AVAIL \ 2689a74af21SBoaz Harrosh | FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_HOMOGENEOUS \ 2699a74af21SBoaz Harrosh | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \ 2709a74af21SBoaz Harrosh | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL) 2719a74af21SBoaz Harrosh 2729a74af21SBoaz Harrosh #define NFSD4_SUPPORTED_ATTRS_WORD1 \ 2739a74af21SBoaz Harrosh (FATTR4_WORD1_MODE | FATTR4_WORD1_NO_TRUNC | FATTR4_WORD1_NUMLINKS \ 2749a74af21SBoaz Harrosh | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \ 2759a74af21SBoaz Harrosh | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \ 2769a74af21SBoaz Harrosh | FATTR4_WORD1_SPACE_USED | FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_ACCESS_SET \ 2779a74af21SBoaz Harrosh | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \ 2789a74af21SBoaz Harrosh | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID) 2799a74af21SBoaz Harrosh 2809a74af21SBoaz Harrosh #define NFSD4_SUPPORTED_ATTRS_WORD2 0 2819a74af21SBoaz Harrosh 2829a74af21SBoaz Harrosh #define NFSD4_1_SUPPORTED_ATTRS_WORD0 \ 2839a74af21SBoaz Harrosh NFSD4_SUPPORTED_ATTRS_WORD0 2849a74af21SBoaz Harrosh 2859a74af21SBoaz Harrosh #define NFSD4_1_SUPPORTED_ATTRS_WORD1 \ 2869a74af21SBoaz Harrosh NFSD4_SUPPORTED_ATTRS_WORD1 2879a74af21SBoaz Harrosh 2889a74af21SBoaz Harrosh #define NFSD4_1_SUPPORTED_ATTRS_WORD2 \ 2899a74af21SBoaz Harrosh (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT) 2909a74af21SBoaz Harrosh 2919a74af21SBoaz Harrosh static inline u32 nfsd_suppattrs0(u32 minorversion) 2929a74af21SBoaz Harrosh { 2939a74af21SBoaz Harrosh return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0 2949a74af21SBoaz Harrosh : NFSD4_SUPPORTED_ATTRS_WORD0; 2959a74af21SBoaz Harrosh } 2969a74af21SBoaz Harrosh 2979a74af21SBoaz Harrosh static inline u32 nfsd_suppattrs1(u32 minorversion) 2989a74af21SBoaz Harrosh { 2999a74af21SBoaz Harrosh return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD1 3009a74af21SBoaz Harrosh : NFSD4_SUPPORTED_ATTRS_WORD1; 3019a74af21SBoaz Harrosh } 3029a74af21SBoaz Harrosh 3039a74af21SBoaz Harrosh static inline u32 nfsd_suppattrs2(u32 minorversion) 3049a74af21SBoaz Harrosh { 3059a74af21SBoaz Harrosh return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD2 3069a74af21SBoaz Harrosh : NFSD4_SUPPORTED_ATTRS_WORD2; 3079a74af21SBoaz Harrosh } 3089a74af21SBoaz Harrosh 3099a74af21SBoaz Harrosh /* These will return ERR_INVAL if specified in GETATTR or READDIR. */ 3109a74af21SBoaz Harrosh #define NFSD_WRITEONLY_ATTRS_WORD1 \ 3119a74af21SBoaz Harrosh (FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) 3129a74af21SBoaz Harrosh 3139a74af21SBoaz Harrosh /* These are the only attrs allowed in CREATE/OPEN/SETATTR. */ 3149a74af21SBoaz Harrosh #define NFSD_WRITEABLE_ATTRS_WORD0 \ 3159a74af21SBoaz Harrosh (FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL ) 3169a74af21SBoaz Harrosh #define NFSD_WRITEABLE_ATTRS_WORD1 \ 3179a74af21SBoaz Harrosh (FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ 3189a74af21SBoaz Harrosh | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) 3199a74af21SBoaz Harrosh #define NFSD_WRITEABLE_ATTRS_WORD2 0 3209a74af21SBoaz Harrosh 3219a74af21SBoaz Harrosh #define NFSD_SUPPATTR_EXCLCREAT_WORD0 \ 3229a74af21SBoaz Harrosh NFSD_WRITEABLE_ATTRS_WORD0 3239a74af21SBoaz Harrosh /* 3249a74af21SBoaz Harrosh * we currently store the exclusive create verifier in the v_{a,m}time 3259a74af21SBoaz Harrosh * attributes so the client can't set these at create time using EXCLUSIVE4_1 3269a74af21SBoaz Harrosh */ 3279a74af21SBoaz Harrosh #define NFSD_SUPPATTR_EXCLCREAT_WORD1 \ 3289a74af21SBoaz Harrosh (NFSD_WRITEABLE_ATTRS_WORD1 & \ 3299a74af21SBoaz Harrosh ~(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)) 3309a74af21SBoaz Harrosh #define NFSD_SUPPATTR_EXCLCREAT_WORD2 \ 3319a74af21SBoaz Harrosh NFSD_WRITEABLE_ATTRS_WORD2 3329a74af21SBoaz Harrosh 3339a74af21SBoaz Harrosh #endif /* CONFIG_NFSD_V4 */ 3349a74af21SBoaz Harrosh 3359a74af21SBoaz Harrosh #endif /* LINUX_NFSD_NFSD_H */ 336