^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Coda File System, Linux Kernel module
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Original version, adapted from cfs_mach.c, (C) Carnegie Mellon University
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Linux modifications (C) 1996, Peter J. Braam
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Rewritten for Linux 2.1 (C) 1997 Carnegie Mellon University
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Carnegie Mellon University encourages users of this software to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * contribute improvements to the Coda project.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #ifndef _LINUX_CODA_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define _LINUX_CODA_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #ifdef pr_fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #undef pr_fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/param.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/vmalloc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <linux/wait.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include "coda_fs_i.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /* operations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) extern const struct inode_operations coda_dir_inode_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) extern const struct inode_operations coda_file_inode_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) extern const struct inode_operations coda_ioctl_inode_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) extern const struct dentry_operations coda_dentry_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) extern const struct address_space_operations coda_file_aops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) extern const struct address_space_operations coda_symlink_aops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) extern const struct file_operations coda_dir_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) extern const struct file_operations coda_file_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) extern const struct file_operations coda_ioctl_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) /* operations shared over more than one file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) int coda_open(struct inode *i, struct file *f);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) int coda_release(struct inode *i, struct file *f);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) int coda_permission(struct inode *inode, int mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) int coda_revalidate_inode(struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int coda_getattr(const struct path *, struct kstat *, u32, unsigned int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int coda_setattr(struct dentry *, struct iattr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) /* this file: heloers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) char *coda_f2s(struct CodaFid *f);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) int coda_iscontrol(const char *name, size_t length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) void coda_vattr_to_iattr(struct inode *, struct coda_vattr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) unsigned short coda_flags_to_cflags(unsigned short);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) /* inode to cnode access functions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) static inline struct coda_inode_info *ITOC(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) return container_of(inode, struct coda_inode_info, vfs_inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) static __inline__ struct CodaFid *coda_i2f(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) return &(ITOC(inode)->c_fid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) static __inline__ char *coda_i2s(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) return coda_f2s(&(ITOC(inode)->c_fid));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) /* this will not zap the inode away */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) static __inline__ void coda_flag_inode(struct inode *inode, int flag)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) struct coda_inode_info *cii = ITOC(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) spin_lock(&cii->c_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) cii->c_flags |= flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) spin_unlock(&cii->c_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #endif