nfs_fs.h
来自「此工具是arm-linux-GCC交叉编译工具(cross-3.4.4)」· C头文件 代码 · 共 586 行 · 第 1/2 页
H
586 行
/* * linux/include/linux/nfs_fs.h * * Copyright (C) 1992 Rick Sladkey * * OS-specific nfs filesystem definitions and declarations */#ifndef _LINUX_NFS_FS_H#define _LINUX_NFS_FS_H#include <linux/config.h>#include <linux/in.h>#include <linux/mm.h>#include <linux/pagemap.h>#include <linux/rwsem.h>#include <linux/wait.h>#include <linux/nfs_fs_sb.h>#include <linux/sunrpc/debug.h>#include <linux/sunrpc/auth.h>#include <linux/sunrpc/clnt.h>#include <linux/nfs.h>#include <linux/nfs2.h>#include <linux/nfs3.h>#include <linux/nfs4.h>#include <linux/nfs_xdr.h>#include <linux/rwsem.h>#include <linux/mempool.h>/* * Enable debugging support for nfs client. * Requires RPC_DEBUG. */#ifdef RPC_DEBUG# define NFS_DEBUG#endif#define NFS_MAX_FILE_IO_BUFFER_SIZE 32768#define NFS_DEF_FILE_IO_BUFFER_SIZE 4096/* * superblock magic number for NFS */#define NFS_SUPER_MAGIC 0x6969/* * These are the default flags for swap requests */#define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS)/* * When flushing a cluster of dirty pages, there can be different * strategies: */#define FLUSH_AGING 0 /* only flush old buffers */#define FLUSH_SYNC 1 /* file being synced, or contention */#define FLUSH_WAIT 2 /* wait for completion */#define FLUSH_STABLE 4 /* commit to stable storage */#define FLUSH_LOWPRI 8 /* low priority background flush */#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */#ifdef __KERNEL__/* * NFSv3/v4 Access mode cache entry */struct nfs_access_entry { unsigned long jiffies; struct rpc_cred * cred; int mask;};struct nfs4_state;struct nfs_open_context { atomic_t count; struct dentry *dentry; struct rpc_cred *cred; struct nfs4_state *state; fl_owner_t lockowner; int mode; int error; struct list_head list; __u64 dir_cookie;};/* * NFSv4 delegation */struct nfs_delegation;struct posix_acl;/* * nfs fs inode data in memory */struct nfs_inode { /* * The 64bit 'inode number' */ __u64 fileid; /* * NFS file handle */ struct nfs_fh fh; /* * Various flags */ unsigned long flags; /* atomic bit ops */ unsigned long cache_validity; /* bit mask */ /* * read_cache_jiffies is when we started read-caching this inode, * and read_cache_mtime is the mtime of the inode at that time. * attrtimeo is for how long the cached information is assumed * to be valid. A successful attribute revalidation doubles * attrtimeo (up to acregmax/acdirmax), a failure resets it to * acregmin/acdirmin. * * We need to revalidate the cached attrs for this inode if * * jiffies - read_cache_jiffies > attrtimeo * * and invalidate any cached data/flush out any dirty pages if * we find that * * mtime != read_cache_mtime */ unsigned long read_cache_jiffies; unsigned long attrtimeo; unsigned long attrtimeo_timestamp; __u64 change_attr; /* v4 only */ /* "Generation counter" for the attribute cache. This is * bumped whenever we update the metadata on the * server. */ unsigned long cache_change_attribute; /* * Counter indicating the number of outstanding requests that * will cause a file data update. */ atomic_t data_updates; struct nfs_access_entry cache_access;#ifdef CONFIG_NFS_V3_ACL struct posix_acl *acl_access; struct posix_acl *acl_default;#endif /* * This is the cookie verifier used for NFSv3 readdir * operations */ __u32 cookieverf[2]; /* * This is the list of dirty unwritten pages. */ spinlock_t req_lock; struct list_head dirty; struct list_head commit; struct radix_tree_root nfs_page_tree; unsigned int ndirty, ncommit, npages; /* Open contexts for shared mmap writes */ struct list_head open_files;#ifdef CONFIG_NFS_V4 struct nfs4_cached_acl *nfs4_acl; /* NFSv4 state */ struct list_head open_states; struct nfs_delegation *delegation; int delegation_state; struct rw_semaphore rwsem;#endif /* CONFIG_NFS_V4*/ struct inode vfs_inode;};/* * Cache validity bit flags */#define NFS_INO_INVALID_ATTR 0x0001 /* cached attrs are invalid */#define NFS_INO_INVALID_DATA 0x0002 /* cached data is invalid */#define NFS_INO_INVALID_ATIME 0x0004 /* cached atime is invalid */#define NFS_INO_INVALID_ACCESS 0x0008 /* cached access cred invalid */#define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache *//* * Bit offsets in flags field */#define NFS_INO_REVALIDATING (0) /* revalidating attrs */#define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */#define NFS_INO_STALE (2) /* possible stale inode */static inline struct nfs_inode *NFS_I(struct inode *inode){ return container_of(inode, struct nfs_inode, vfs_inode);}#define NFS_SB(s) ((struct nfs_server *)(s->s_fs_info))#define NFS_FH(inode) (&NFS_I(inode)->fh)#define NFS_SERVER(inode) (NFS_SB(inode->i_sb))#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client)#define NFS_PROTO(inode) (NFS_SERVER(inode)->rpc_ops)#define NFS_ADDR(inode) (RPC_PEERADDR(NFS_CLIENT(inode)))#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf)#define NFS_READTIME(inode) (NFS_I(inode)->read_cache_jiffies)#define NFS_CHANGE_ATTR(inode) (NFS_I(inode)->change_attr)#define NFS_ATTRTIMEO(inode) (NFS_I(inode)->attrtimeo)#define NFS_MINATTRTIMEO(inode) \ (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \ : NFS_SERVER(inode)->acregmin)#define NFS_MAXATTRTIMEO(inode) \ (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \ : NFS_SERVER(inode)->acregmax)#define NFS_ATTRTIMEO_UPDATE(inode) (NFS_I(inode)->attrtimeo_timestamp)#define NFS_FLAGS(inode) (NFS_I(inode)->flags)#define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode)))#define NFS_FILEID(inode) (NFS_I(inode)->fileid)static inline int nfs_caches_unstable(struct inode *inode){ return atomic_read(&NFS_I(inode)->data_updates) != 0;}static inline void NFS_CACHEINV(struct inode *inode){ if (!nfs_caches_unstable(inode)) { spin_lock(&inode->i_lock); NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; spin_unlock(&inode->i_lock); }}static inline int nfs_server_capable(struct inode *inode, int cap){ return NFS_SERVER(inode)->caps & cap;}static inline int NFS_USE_READDIRPLUS(struct inode *inode){ return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode));}/** * nfs_save_change_attribute - Returns the inode attribute change cookie * @inode - pointer to inode * The "change attribute" is updated every time we finish an operation * that will result in a metadata change on the server. */static inline long nfs_save_change_attribute(struct inode *inode){ return NFS_I(inode)->cache_change_attribute;}/** * nfs_verify_change_attribute - Detects NFS inode cache updates * @inode - pointer to inode * @chattr - previously saved change attribute * Return "false" if metadata has been updated (or is in the process of * being updated) since the change attribute was saved. */static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long chattr){ return !nfs_caches_unstable(inode) && chattr == NFS_I(inode)->cache_change_attribute;}/* * linux/fs/nfs/inode.c */extern void nfs_zap_caches(struct inode *);extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, struct nfs_fattr *);extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);extern int nfs_permission(struct inode *, int, struct nameidata *);extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *);extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *);extern int nfs_open(struct inode *, struct file *);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?