Subversion Repositories shark

Rev

Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 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
extern struct filter_fs filter_oppar[FILTER_FS_TYPES];
74
 
75
struct filter_fs *filter_get_filter_fs(const char *cache_type);
76
void filter_setup_journal_ops(struct filter_fs *ops, char *cache_type);
77
inline struct super_operations *filter_c2usops(struct filter_fs *cache);
78
inline struct inode_operations *filter_c2ufiops(struct filter_fs *cache);
79
inline struct inode_operations *filter_c2udiops(struct filter_fs *cache);
80
inline struct inode_operations *filter_c2usiops(struct filter_fs *cache);
81
inline struct file_operations *filter_c2uffops(struct filter_fs *cache);
82
inline struct file_operations *filter_c2udfops(struct filter_fs *cache);
83
inline struct file_operations *filter_c2usfops(struct filter_fs *cache);
84
inline struct super_operations *filter_c2csops(struct filter_fs *cache);
85
inline struct inode_operations *filter_c2cfiops(struct filter_fs *cache);
86
inline struct inode_operations *filter_c2cdiops(struct filter_fs *cache);
87
inline struct inode_operations *filter_c2csiops(struct filter_fs *cache);
88
inline struct file_operations *filter_c2cffops(struct filter_fs *cache);
89
inline struct file_operations *filter_c2cdfops(struct filter_fs *cache);
90
inline struct file_operations *filter_c2csfops(struct filter_fs *cache);
91
inline struct dentry_operations *filter_c2cdops(struct filter_fs *cache);
92
inline struct dentry_operations *filter_c2udops(struct filter_fs *cache);
93
 
94
void filter_setup_super_ops(struct filter_fs *cache, struct super_operations *cache_ops, struct super_operations *filter_sops);
95
void filter_setup_dir_ops(struct filter_fs *cache, struct inode *cache_inode, struct inode_operations *filter_iops, struct file_operations *ffops);
96
void filter_setup_file_ops(struct filter_fs *cache, struct inode *cache_inode, struct inode_operations *filter_iops, struct file_operations *filter_op);
97
void filter_setup_symlink_ops(struct filter_fs *cache, struct inode *cache_inode, struct inode_operations *filter_iops, struct file_operations *filter_op);
98
void filter_setup_dentry_ops(struct filter_fs *cache, struct dentry_operations *cache_dop,  struct dentry_operations *filter_dop);
99
 
100
 
101
#define PRESTO_DEBUG
102
#ifdef PRESTO_DEBUG
103
/* debugging masks */
104
#define D_SUPER     1  
105
#define D_INODE     2   /* print entry and exit into procedure */
106
#define D_FILE      4
107
#define D_CACHE     8   /* cache debugging */
108
#define D_MALLOC    16  /* print malloc, de-alloc information */
109
#define D_JOURNAL   32
110
#define D_UPCALL    64  /* up and downcall debugging */
111
#define D_PSDEV    128
112
#define D_PIOCTL   256
113
#define D_SPECIAL  512
114
#define D_TIMING  1024
115
#define D_DOWNCALL 2048
116
 
117
#define FDEBUG(mask, format, a...)                                      \
118
        do {                                                            \
119
                if (filter_debug & mask) {                              \
120
                        printk("(%s,l. %d): ", __FUNCTION__, __LINE__); \
121
                        printk(format, ##a); }                          \
122
        } while (0)
123
 
124
#define FENTRY                                                          \
125
        if(filter_print_entry)                                          \
126
                printk("Process %d entered %s\n", current->pid, __FUNCTION__)
127
 
128
#define FEXIT                                                           \
129
        if(filter_print_entry)                                          \
130
                printk("Process %d leaving %s at %d\n", current->pid,   \
131
                       __FUNCTION__,__LINE__)
132
#endif
133
#endif
134
#endif