Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * V9FS VFS extensions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *  Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #ifndef FS_9P_V9FS_VFS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #define FS_9P_V9FS_VFS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) /* plan9 semantics are that created files are implicitly opened.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  * But linux semantics are that you call create, then open.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  * the plan9 approach is superior as it provides an atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  * open.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  * we track the create fid here. When the file is opened, if fidopen is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  * non-zero, we use the fid and can skip some steps.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  * there may be a better way to do this, but I don't know it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  * one BAD way is to clunk the fid on create, then open it again:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)  * you lose the atomicity of file open
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /* special case:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)  * unlink calls remove, which is an implicit clunk. So we have to track
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)  * that kind of thing so that we don't try to clunk a dead fid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define P9_LOCK_TIMEOUT (30*HZ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /* flags for v9fs_stat2inode() & v9fs_stat2inode_dotl() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define V9FS_STAT2INODE_KEEP_ISIZE 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) extern struct file_system_type v9fs_fs_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) extern const struct address_space_operations v9fs_addr_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) extern const struct file_operations v9fs_file_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) extern const struct file_operations v9fs_file_operations_dotl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) extern const struct file_operations v9fs_dir_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) extern const struct file_operations v9fs_dir_operations_dotl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) extern const struct dentry_operations v9fs_dentry_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) extern const struct dentry_operations v9fs_cached_dentry_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) extern const struct file_operations v9fs_cached_file_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) extern const struct file_operations v9fs_cached_file_operations_dotl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) extern const struct file_operations v9fs_mmap_file_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) extern const struct file_operations v9fs_mmap_file_operations_dotl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) extern struct kmem_cache *v9fs_inode_cache;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct inode *v9fs_alloc_inode(struct super_block *sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void v9fs_free_inode(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) int v9fs_init_inode(struct v9fs_session_info *v9ses,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 		    struct inode *inode, umode_t mode, dev_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) void v9fs_evict_inode(struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) ino_t v9fs_qid2ino(struct p9_qid *qid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) void v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 		      struct super_block *sb, unsigned int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) void v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 			   unsigned int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) int v9fs_dir_release(struct inode *inode, struct file *filp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) int v9fs_file_open(struct inode *inode, struct file *file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) void v9fs_inode2stat(struct inode *inode, struct p9_wstat *stat);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) int v9fs_uflags2omode(int uflags, int extended);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) void v9fs_blank_wstat(struct p9_wstat *wstat);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) int v9fs_vfs_setattr_dotl(struct dentry *, struct iattr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) int v9fs_file_fsync_dotl(struct file *filp, loff_t start, loff_t end,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 			 int datasync);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) static inline void v9fs_invalidate_inode_attr(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	struct v9fs_inode *v9inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	v9inode = V9FS_I(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	v9inode->cache_validity |= V9FS_INO_INVALID_ATTR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) int v9fs_open_to_dotl_flags(int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) static inline void v9fs_i_size_write(struct inode *inode, loff_t i_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 	 * 32-bit need the lock, concurrent updates could break the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 	 * sequences and make i_size_read() loop forever.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 	 * 64-bit updates are atomic and can skip the locking.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) 	if (sizeof(i_size) > sizeof(long))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 		spin_lock(&inode->i_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) 	i_size_write(inode, i_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) 	if (sizeof(i_size) > sizeof(long))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 		spin_unlock(&inode->i_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #endif