1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- 2 * vim:expandtab:shiftwidth=8:tabstop=8: 3 */ 4 5 #ifndef __FILTER_H_ 6 #define __FILTER_H_ 1 7 8 #ifdef __KERNEL__ 9 10 /* cachetype.c */ 11 12 /* 13 * it is important that things like inode, super and file operations 14 * for intermezzo are not defined statically. If methods are NULL 15 * the VFS takes special action based on that. Given that different 16 * cache types have NULL ops at different slots, we must install opeation 17 * talbes for InterMezzo with NULL's in the same spot 18 */ 19 20 struct filter_ops { 21 struct super_operations filter_sops; 22 23 struct inode_operations filter_dir_iops; 24 struct inode_operations filter_file_iops; 25 struct inode_operations filter_sym_iops; 26 27 struct file_operations filter_dir_fops; 28 struct file_operations filter_file_fops; 29 struct file_operations filter_sym_fops; 30 31 struct dentry_operations filter_dentry_ops; 32 }; 33 34 struct cache_ops { 35 /* operations on the file store */ 36 struct super_operations *cache_sops; 37 38 struct inode_operations *cache_dir_iops; 39 struct inode_operations *cache_file_iops; 40 struct inode_operations *cache_sym_iops; 41 42 struct file_operations *cache_dir_fops; 43 struct file_operations *cache_file_fops; 44 struct file_operations *cache_sym_fops; 45 46 struct dentry_operations *cache_dentry_ops; 47 }; 48 49 50 #define FILTER_DID_SUPER_OPS 0x1 51 #define FILTER_DID_INODE_OPS 0x2 52 #define FILTER_DID_FILE_OPS 0x4 53 #define FILTER_DID_DENTRY_OPS 0x8 54 #define FILTER_DID_DEV_OPS 0x10 55 #define FILTER_DID_SYMLINK_OPS 0x20 56 #define FILTER_DID_DIR_OPS 0x40 57 58 struct filter_fs { 59 int o_flags; 60 struct filter_ops o_fops; 61 struct cache_ops o_caops; 62 struct journal_ops *o_trops; 63 struct snapshot_ops *o_snops; 64 }; 65 66 #define FILTER_FS_TYPES 6 67 #define FILTER_FS_EXT2 0 68 #define FILTER_FS_EXT3 1 69 #define FILTER_FS_REISERFS 2 70 #define FILTER_FS_XFS 3 71 #define FILTER_FS_OBDFS 4 72 #define FILTER_FS_TMPFS 5 73 74 struct filter_fs *filter_get_filter_fs(const char *cache_type); 75 void filter_setup_journal_ops(struct filter_fs *ops, char *cache_type); 76 struct super_operations *filter_c2usops(struct filter_fs *cache); 77 struct inode_operations *filter_c2ufiops(struct filter_fs *cache); 78 struct inode_operations *filter_c2udiops(struct filter_fs *cache); 79 struct inode_operations *filter_c2usiops(struct filter_fs *cache); 80 struct file_operations *filter_c2uffops(struct filter_fs *cache); 81 struct file_operations *filter_c2udfops(struct filter_fs *cache); 82 struct file_operations *filter_c2usfops(struct filter_fs *cache); 83 struct super_operations *filter_c2csops(struct filter_fs *cache); 84 struct inode_operations *filter_c2cfiops(struct filter_fs *cache); 85 struct inode_operations *filter_c2cdiops(struct filter_fs *cache); 86 struct inode_operations *filter_c2csiops(struct filter_fs *cache); 87 struct file_operations *filter_c2cffops(struct filter_fs *cache); 88 struct file_operations *filter_c2cdfops(struct filter_fs *cache); 89 struct file_operations *filter_c2csfops(struct filter_fs *cache); 90 struct dentry_operations *filter_c2cdops(struct filter_fs *cache); 91 struct dentry_operations *filter_c2udops(struct filter_fs *cache); 92 93 void filter_setup_super_ops(struct filter_fs *cache, struct super_operations *cache_ops, struct super_operations *filter_sops); 94 void filter_setup_dir_ops(struct filter_fs *cache, struct inode *cache_inode, struct inode_operations *filter_iops, struct file_operations *ffops); 95 void filter_setup_file_ops(struct filter_fs *cache, struct inode *cache_inode, struct inode_operations *filter_iops, struct file_operations *filter_op); 96 void filter_setup_symlink_ops(struct filter_fs *cache, struct inode *cache_inode, struct inode_operations *filter_iops, struct file_operations *filter_op); 97 void filter_setup_dentry_ops(struct filter_fs *cache, struct dentry_operations *cache_dop, struct dentry_operations *filter_dop); 98 99 100 #define PRESTO_DEBUG 101 #ifdef PRESTO_DEBUG 102 /* debugging masks */ 103 #define D_SUPER 1 104 #define D_INODE 2 /* print entry and exit into procedure */ 105 #define D_FILE 4 106 #define D_CACHE 8 /* cache debugging */ 107 #define D_MALLOC 16 /* print malloc, de-alloc information */ 108 #define D_JOURNAL 32 109 #define D_UPCALL 64 /* up and downcall debugging */ 110 #define D_PSDEV 128 111 #define D_PIOCTL 256 112 #define D_SPECIAL 512 113 #define D_TIMING 1024 114 #define D_DOWNCALL 2048 115 116 #define FDEBUG(mask, format, a...) \ 117 do { \ 118 if (filter_debug & mask) { \ 119 printk("(%s,l. %d): ", __FUNCTION__, __LINE__); \ 120 printk(format, ##a); } \ 121 } while (0) 122 123 #define FENTRY \ 124 if(filter_print_entry) \ 125 printk("Process %d entered %s\n", current->pid, __FUNCTION__) 126 127 #define FEXIT \ 128 if(filter_print_entry) \ 129 printk("Process %d leaving %s at %d\n", current->pid, \ 130 __FUNCTION__,__LINE__) 131 #endif 132 #endif 133 #endif 134