From 9501e4c48e1561443e1a16c2c9917ec6c63118a4 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 12 Jan 2011 16:25:02 -0500 Subject: switch coda Coda ->d_revalidate() actually checks for root, ->d_delete() is irrelevant. So we can use the same d_op for all coda dentries Signed-off-by: Al Viro --- fs/coda/dir.c | 4 +--- fs/coda/inode.c | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'fs/coda') diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 29badd91360f..9df71f0eb218 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c @@ -61,7 +61,7 @@ static int coda_return_EIO(void) } #define CODA_EIO_ERROR ((void *) (coda_return_EIO)) -static const struct dentry_operations coda_dentry_operations = +const struct dentry_operations coda_dentry_operations = { .d_revalidate = coda_dentry_revalidate, .d_delete = coda_dentry_delete, @@ -126,8 +126,6 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struc return ERR_PTR(error); exit: - d_set_d_op(entry, &coda_dentry_operations); - if (inode && (type & CODA_NOCACHE)) coda_flag_inode(inode, C_VATTR | C_PURGE); diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 50dc7d189f56..bd7fde2721a8 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c @@ -193,6 +193,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) sb->s_blocksize_bits = 12; sb->s_magic = CODA_SUPER_MAGIC; sb->s_op = &coda_super_operations; + sb->s_d_op = &coda_dentry_operations; sb->s_bdi = &vc->bdi; /* get root fid from Venus: this needs the root inode */ -- cgit v1.2.3-58-ga151 From 31a203df9c109480fc6d48ba0a68763e89199acb Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 12 Jan 2011 16:36:09 -0500 Subject: take coda-private headers out of include/linux Signed-off-by: Al Viro --- Documentation/magic-number.txt | 2 +- fs/coda/cache.c | 5 +- fs/coda/cnode.c | 3 +- fs/coda/coda_cache.h | 22 +++++++++ fs/coda/coda_fs_i.h | 58 +++++++++++++++++++++++ fs/coda/coda_linux.c | 3 +- fs/coda/coda_linux.h | 101 +++++++++++++++++++++++++++++++++++++++++ fs/coda/dir.c | 5 +- fs/coda/file.c | 3 +- fs/coda/inode.c | 5 +- fs/coda/pioctl.c | 4 +- fs/coda/psdev.c | 4 +- fs/coda/symlink.c | 4 +- fs/coda/upcall.c | 5 +- include/linux/coda_cache.h | 22 --------- include/linux/coda_fs_i.h | 58 ----------------------- include/linux/coda_linux.h | 101 ----------------------------------------- 17 files changed, 199 insertions(+), 206 deletions(-) create mode 100644 fs/coda/coda_cache.h create mode 100644 fs/coda/coda_fs_i.h create mode 100644 fs/coda/coda_linux.h delete mode 100644 include/linux/coda_cache.h delete mode 100644 include/linux/coda_fs_i.h delete mode 100644 include/linux/coda_linux.h (limited to 'fs/coda') diff --git a/Documentation/magic-number.txt b/Documentation/magic-number.txt index 505f19607542..4b12abcb2ad3 100644 --- a/Documentation/magic-number.txt +++ b/Documentation/magic-number.txt @@ -150,7 +150,7 @@ NBD_REPLY_MAGIC 0x96744668 nbd_reply include/linux/nbd.h STL_BOARDMAGIC 0xa2267f52 stlbrd include/linux/stallion.h ENI155_MAGIC 0xa54b872d midway_eprom drivers/atm/eni.h SCI_MAGIC 0xbabeface gs_port drivers/char/sh-sci.h -CODA_MAGIC 0xC0DAC0DA coda_file_info include/linux/coda_fs_i.h +CODA_MAGIC 0xC0DAC0DA coda_file_info fs/coda/coda_fs_i.h DPMEM_MAGIC 0xc0ffee11 gdt_pci_sram drivers/scsi/gdth.h STLI_PORTMAGIC 0xe671c7a1 stliport include/linux/istallion.h YAM_MAGIC 0xF10A7654 yam_port drivers/net/hamradio/yam.c diff --git a/fs/coda/cache.c b/fs/coda/cache.c index 5525e1c660fd..690157876184 100644 --- a/fs/coda/cache.c +++ b/fs/coda/cache.c @@ -20,10 +20,9 @@ #include #include -#include #include -#include -#include +#include "coda_linux.h" +#include "coda_cache.h" static atomic_t permission_epoch = ATOMIC_INIT(0); diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c index 602240569c89..6475877b0763 100644 --- a/fs/coda/cnode.c +++ b/fs/coda/cnode.c @@ -7,9 +7,8 @@ #include #include -#include -#include #include +#include "coda_linux.h" static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2) { diff --git a/fs/coda/coda_cache.h b/fs/coda/coda_cache.h new file mode 100644 index 000000000000..c910b5eb1ceb --- /dev/null +++ b/fs/coda/coda_cache.h @@ -0,0 +1,22 @@ +/* Coda filesystem -- Linux Minicache + * + * Copyright (C) 1989 - 1997 Carnegie Mellon University + * + * Carnegie Mellon University encourages users of this software to + * contribute improvements to the Coda project. Contact Peter Braam + * + */ + +#ifndef _CFSNC_HEADER_ +#define _CFSNC_HEADER_ + +/* credential cache */ +void coda_cache_enter(struct inode *inode, int mask); +void coda_cache_clear_inode(struct inode *); +void coda_cache_clear_all(struct super_block *sb); +int coda_cache_check(struct inode *inode, int mask); + +/* for downcalls and attributes and lookups */ +void coda_flag_inode_children(struct inode *inode, int flag); + +#endif /* _CFSNC_HEADER_ */ diff --git a/fs/coda/coda_fs_i.h b/fs/coda/coda_fs_i.h new file mode 100644 index 000000000000..e35071b1de0e --- /dev/null +++ b/fs/coda/coda_fs_i.h @@ -0,0 +1,58 @@ +/* + * coda_fs_i.h + * + * Copyright (C) 1998 Carnegie Mellon University + * + */ + +#ifndef _LINUX_CODA_FS_I +#define _LINUX_CODA_FS_I + +#include +#include +#include +#include + +/* + * coda fs inode data + * c_lock protects accesses to c_flags, c_mapcount, c_cached_epoch, c_uid and + * c_cached_perm. + * vfs_inode is set only when the inode is created and never changes. + * c_fid is set when the inode is created and should be considered immutable. + */ +struct coda_inode_info { + struct CodaFid c_fid; /* Coda identifier */ + u_short c_flags; /* flags (see below) */ + unsigned int c_mapcount; /* nr of times this inode is mapped */ + unsigned int c_cached_epoch; /* epoch for cached permissions */ + vuid_t c_uid; /* fsuid for cached permissions */ + unsigned int c_cached_perm; /* cached access permissions */ + spinlock_t c_lock; + struct inode vfs_inode; +}; + +/* + * coda fs file private data + */ +#define CODA_MAGIC 0xC0DAC0DA +struct coda_file_info { + int cfi_magic; /* magic number */ + struct file *cfi_container; /* container file for this cnode */ + unsigned int cfi_mapcount; /* nr of times this file is mapped */ +}; + +#define CODA_FTOC(file) ((struct coda_file_info *)((file)->private_data)) + +/* flags */ +#define C_VATTR 0x1 /* Validity of vattr in inode */ +#define C_FLUSH 0x2 /* used after a flush */ +#define C_DYING 0x4 /* from venus (which died) */ +#define C_PURGE 0x8 + +int coda_cnode_make(struct inode **, struct CodaFid *, struct super_block *); +struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr); +int coda_cnode_makectl(struct inode **inode, struct super_block *sb); +struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb); +void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *); + +#endif diff --git a/fs/coda/coda_linux.c b/fs/coda/coda_linux.c index bf4a3fd3c8e3..2bdbcc11b373 100644 --- a/fs/coda/coda_linux.c +++ b/fs/coda/coda_linux.c @@ -17,9 +17,8 @@ #include #include -#include #include -#include +#include "coda_linux.h" /* initialize the debugging variables */ int coda_fake_statfs; diff --git a/fs/coda/coda_linux.h b/fs/coda/coda_linux.h new file mode 100644 index 000000000000..9b0c5323890b --- /dev/null +++ b/fs/coda/coda_linux.h @@ -0,0 +1,101 @@ +/* + * Coda File System, Linux Kernel module + * + * Original version, adapted from cfs_mach.c, (C) Carnegie Mellon University + * Linux modifications (C) 1996, Peter J. Braam + * Rewritten for Linux 2.1 (C) 1997 Carnegie Mellon University + * + * Carnegie Mellon University encourages users of this software to + * contribute improvements to the Coda project. + */ + +#ifndef _LINUX_CODA_FS +#define _LINUX_CODA_FS + +#include +#include +#include +#include +#include +#include +#include +#include +#include "coda_fs_i.h" + +/* operations */ +extern const struct inode_operations coda_dir_inode_operations; +extern const struct inode_operations coda_file_inode_operations; +extern const struct inode_operations coda_ioctl_inode_operations; + +extern const struct dentry_operations coda_dentry_operations; + +extern const struct address_space_operations coda_file_aops; +extern const struct address_space_operations coda_symlink_aops; + +extern const struct file_operations coda_dir_operations; +extern const struct file_operations coda_file_operations; +extern const struct file_operations coda_ioctl_operations; + +/* operations shared over more than one file */ +int coda_open(struct inode *i, struct file *f); +int coda_release(struct inode *i, struct file *f); +int coda_permission(struct inode *inode, int mask, unsigned int flags); +int coda_revalidate_inode(struct dentry *); +int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *); +int coda_setattr(struct dentry *, struct iattr *); + +/* this file: heloers */ +char *coda_f2s(struct CodaFid *f); +int coda_isroot(struct inode *i); +int coda_iscontrol(const char *name, size_t length); + +void coda_vattr_to_iattr(struct inode *, struct coda_vattr *); +void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *); +unsigned short coda_flags_to_cflags(unsigned short); + +/* sysctl.h */ +void coda_sysctl_init(void); +void coda_sysctl_clean(void); + +#define CODA_ALLOC(ptr, cast, size) do { \ + if (size < PAGE_SIZE) \ + ptr = kmalloc((unsigned long) size, GFP_KERNEL); \ + else \ + ptr = (cast)vmalloc((unsigned long) size); \ + if (!ptr) \ + printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ + else memset( ptr, 0, size ); \ +} while (0) + + +#define CODA_FREE(ptr,size) \ + do { if (size < PAGE_SIZE) kfree((ptr)); else vfree((ptr)); } while (0) + +/* inode to cnode access functions */ + +static inline struct coda_inode_info *ITOC(struct inode *inode) +{ + return list_entry(inode, struct coda_inode_info, vfs_inode); +} + +static __inline__ struct CodaFid *coda_i2f(struct inode *inode) +{ + return &(ITOC(inode)->c_fid); +} + +static __inline__ char *coda_i2s(struct inode *inode) +{ + return coda_f2s(&(ITOC(inode)->c_fid)); +} + +/* this will not zap the inode away */ +static __inline__ void coda_flag_inode(struct inode *inode, int flag) +{ + struct coda_inode_info *cii = ITOC(inode); + + spin_lock(&cii->c_lock); + cii->c_flags |= flag; + spin_unlock(&cii->c_lock); +} + +#endif diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 9df71f0eb218..2b8dae4d121e 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c @@ -23,10 +23,9 @@ #include #include -#include #include -#include -#include +#include "coda_linux.h" +#include "coda_cache.h" #include "coda_int.h" diff --git a/fs/coda/file.c b/fs/coda/file.c index c8b50ba4366a..0433057be330 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c @@ -21,10 +21,9 @@ #include #include -#include -#include #include +#include "coda_linux.h" #include "coda_int.h" static ssize_t diff --git a/fs/coda/inode.c b/fs/coda/inode.c index bd7fde2721a8..261d86f9caec 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c @@ -28,10 +28,9 @@ #include #include -#include #include -#include -#include +#include "coda_linux.h" +#include "coda_cache.h" #include "coda_int.h" diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c index 741f0bd03918..6cbb3afb36dc 100644 --- a/fs/coda/pioctl.c +++ b/fs/coda/pioctl.c @@ -19,10 +19,10 @@ #include #include -#include -#include #include +#include "coda_linux.h" + /* pioctl ops */ static int coda_ioctl_permission(struct inode *inode, int mask, unsigned int flags); static long coda_pioctl(struct file *filp, unsigned int cmd, diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index 62647a8595e4..8f616e0e252c 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c @@ -43,10 +43,10 @@ #include #include -#include -#include #include +#include "coda_linux.h" + #include "coda_int.h" /* statistics */ diff --git a/fs/coda/symlink.c b/fs/coda/symlink.c index af78f007a2b0..ab94ef63caef 100644 --- a/fs/coda/symlink.c +++ b/fs/coda/symlink.c @@ -16,9 +16,9 @@ #include #include -#include #include -#include + +#include "coda_linux.h" static int coda_symlink_filler(struct file *file, struct page *page) { diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c index c3563cab9758..9727e0c52579 100644 --- a/fs/coda/upcall.c +++ b/fs/coda/upcall.c @@ -33,10 +33,9 @@ #include #include -#include #include -#include -#include +#include "coda_linux.h" +#include "coda_cache.h" #include "coda_int.h" diff --git a/include/linux/coda_cache.h b/include/linux/coda_cache.h deleted file mode 100644 index c910b5eb1ceb..000000000000 --- a/include/linux/coda_cache.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Coda filesystem -- Linux Minicache - * - * Copyright (C) 1989 - 1997 Carnegie Mellon University - * - * Carnegie Mellon University encourages users of this software to - * contribute improvements to the Coda project. Contact Peter Braam - * - */ - -#ifndef _CFSNC_HEADER_ -#define _CFSNC_HEADER_ - -/* credential cache */ -void coda_cache_enter(struct inode *inode, int mask); -void coda_cache_clear_inode(struct inode *); -void coda_cache_clear_all(struct super_block *sb); -int coda_cache_check(struct inode *inode, int mask); - -/* for downcalls and attributes and lookups */ -void coda_flag_inode_children(struct inode *inode, int flag); - -#endif /* _CFSNC_HEADER_ */ diff --git a/include/linux/coda_fs_i.h b/include/linux/coda_fs_i.h deleted file mode 100644 index e35071b1de0e..000000000000 --- a/include/linux/coda_fs_i.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * coda_fs_i.h - * - * Copyright (C) 1998 Carnegie Mellon University - * - */ - -#ifndef _LINUX_CODA_FS_I -#define _LINUX_CODA_FS_I - -#include -#include -#include -#include - -/* - * coda fs inode data - * c_lock protects accesses to c_flags, c_mapcount, c_cached_epoch, c_uid and - * c_cached_perm. - * vfs_inode is set only when the inode is created and never changes. - * c_fid is set when the inode is created and should be considered immutable. - */ -struct coda_inode_info { - struct CodaFid c_fid; /* Coda identifier */ - u_short c_flags; /* flags (see below) */ - unsigned int c_mapcount; /* nr of times this inode is mapped */ - unsigned int c_cached_epoch; /* epoch for cached permissions */ - vuid_t c_uid; /* fsuid for cached permissions */ - unsigned int c_cached_perm; /* cached access permissions */ - spinlock_t c_lock; - struct inode vfs_inode; -}; - -/* - * coda fs file private data - */ -#define CODA_MAGIC 0xC0DAC0DA -struct coda_file_info { - int cfi_magic; /* magic number */ - struct file *cfi_container; /* container file for this cnode */ - unsigned int cfi_mapcount; /* nr of times this file is mapped */ -}; - -#define CODA_FTOC(file) ((struct coda_file_info *)((file)->private_data)) - -/* flags */ -#define C_VATTR 0x1 /* Validity of vattr in inode */ -#define C_FLUSH 0x2 /* used after a flush */ -#define C_DYING 0x4 /* from venus (which died) */ -#define C_PURGE 0x8 - -int coda_cnode_make(struct inode **, struct CodaFid *, struct super_block *); -struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr); -int coda_cnode_makectl(struct inode **inode, struct super_block *sb); -struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb); -void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *); - -#endif diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h deleted file mode 100644 index 490c56b40864..000000000000 --- a/include/linux/coda_linux.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Coda File System, Linux Kernel module - * - * Original version, adapted from cfs_mach.c, (C) Carnegie Mellon University - * Linux modifications (C) 1996, Peter J. Braam - * Rewritten for Linux 2.1 (C) 1997 Carnegie Mellon University - * - * Carnegie Mellon University encourages users of this software to - * contribute improvements to the Coda project. - */ - -#ifndef _LINUX_CODA_FS -#define _LINUX_CODA_FS - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* operations */ -extern const struct inode_operations coda_dir_inode_operations; -extern const struct inode_operations coda_file_inode_operations; -extern const struct inode_operations coda_ioctl_inode_operations; - -extern const struct dentry_operations coda_dentry_operations; - -extern const struct address_space_operations coda_file_aops; -extern const struct address_space_operations coda_symlink_aops; - -extern const struct file_operations coda_dir_operations; -extern const struct file_operations coda_file_operations; -extern const struct file_operations coda_ioctl_operations; - -/* operations shared over more than one file */ -int coda_open(struct inode *i, struct file *f); -int coda_release(struct inode *i, struct file *f); -int coda_permission(struct inode *inode, int mask, unsigned int flags); -int coda_revalidate_inode(struct dentry *); -int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *); -int coda_setattr(struct dentry *, struct iattr *); - -/* this file: heloers */ -char *coda_f2s(struct CodaFid *f); -int coda_isroot(struct inode *i); -int coda_iscontrol(const char *name, size_t length); - -void coda_vattr_to_iattr(struct inode *, struct coda_vattr *); -void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *); -unsigned short coda_flags_to_cflags(unsigned short); - -/* sysctl.h */ -void coda_sysctl_init(void); -void coda_sysctl_clean(void); - -#define CODA_ALLOC(ptr, cast, size) do { \ - if (size < PAGE_SIZE) \ - ptr = kmalloc((unsigned long) size, GFP_KERNEL); \ - else \ - ptr = (cast)vmalloc((unsigned long) size); \ - if (!ptr) \ - printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ - else memset( ptr, 0, size ); \ -} while (0) - - -#define CODA_FREE(ptr,size) \ - do { if (size < PAGE_SIZE) kfree((ptr)); else vfree((ptr)); } while (0) - -/* inode to cnode access functions */ - -static inline struct coda_inode_info *ITOC(struct inode *inode) -{ - return list_entry(inode, struct coda_inode_info, vfs_inode); -} - -static __inline__ struct CodaFid *coda_i2f(struct inode *inode) -{ - return &(ITOC(inode)->c_fid); -} - -static __inline__ char *coda_i2s(struct inode *inode) -{ - return coda_f2s(&(ITOC(inode)->c_fid)); -} - -/* this will not zap the inode away */ -static __inline__ void coda_flag_inode(struct inode *inode, int flag) -{ - struct coda_inode_info *cii = ITOC(inode); - - spin_lock(&cii->c_lock); - cii->c_flags |= flag; - spin_unlock(&cii->c_lock); -} - -#endif -- cgit v1.2.3-58-ga151