1 /* SMFS plugin stuff */
2 #define SMFS_PLG_KML 0x0001L
3 #define SMFS_PLG_LRU 0x0004L
4 #define SMFS_PLG_COW 0x0020L
5 #define SMFS_PLG_DUMMY 0x1000L
6 #define SMFS_PLG_ALL (~0L)
8 #define SMFS_SET(flags, mask) (flags |= mask)
9 #define SMFS_IS(flags, mask) (flags & mask)
10 #define SMFS_CLEAR(flags, mask) (flags &= ~mask)
12 typedef int (*smfs_plg_hook)(int hook_code, struct inode *,
13 void *arg, int rc, void * priv);
14 typedef int (*smfs_plg_func)(int help_code, struct super_block *,
15 void *arg, void * priv);
18 struct list_head plg_list;
21 smfs_plg_hook plg_pre_op;
22 smfs_plg_hook plg_post_op;
23 smfs_plg_func plg_helper;
31 #define HOOK_SYMLINK 5
36 #define HOOK_SETATTR 10
38 #define HOOK_READDIR 12
39 #define HOOK_F_SETATTR 13
43 struct dentry * dentry;
46 struct hook_link_msg {
47 struct dentry * dentry;
48 struct dentry * new_dentry;
50 struct hook_unlink_msg {
51 struct dentry * dentry;
55 struct hook_symlink_msg {
56 struct dentry * dentry;
61 struct hook_rename_msg {
62 struct dentry * dentry;
63 struct inode * new_dir;
64 struct dentry * new_dentry;
67 struct hook_readdir_msg {
68 struct dentry * dentry;
74 struct hook_write_msg {
75 struct dentry * dentry;
80 struct hook_setattr_msg {
81 struct dentry * dentry;
85 void smfs_pre_hook (struct inode*, int, void*);
86 void smfs_post_hook(struct inode*,int, void*, int);
88 #define SMFS_PRE_HOOK(inode, op, msg) smfs_pre_hook (inode, op, msg)
91 struct smfs_super_info *smb = S2SMI(inode->i_sb); \
92 struct list_head *hlist = &smb->smsi_plg_list; \
93 struct smfs_plugin *plg; \
95 list_for_each_entry(plg, hlist, plg_list) { \
96 if (plg->plg_pre_op) \
97 plg->plg_pre_op(op, inode, msg, 0, \
103 #define SMFS_POST_HOOK(inode, op, msg, rc) smfs_post_hook(inode, op, msg, rc)
106 struct smfs_super_info *smb = S2SMI(inode->i_sb); \
107 struct list_head *hlist = &smb->smsi_plg_list; \
108 struct smfs_plugin *plg; \
110 list_for_each_entry(plg, hlist, plg_list) { \
111 if (plg->plg_post_op) \
112 plg->plg_post_op(op, inode, msg, rc, \
118 #define PLG_TRANS_SIZE 1
119 #define PLG_TEST_INODE 2
120 #define PLG_SET_INODE 3
123 #define PLG_HELPER_MAX 6
130 int smfs_helper (struct super_block *, int, void *);
131 #define SMFS_PLG_HELP(sb, op, data) smfs_helper(sb, op, data)
133 int smfs_register_plugin(struct super_block *, struct smfs_plugin *);
134 void * smfs_deregister_plugin(struct super_block *, int);
136 int smfs_init_dummy(struct super_block *);
137 int smfs_init_kml(struct super_block *);
138 int smfs_init_lru(struct super_block *);
139 int smfs_init_cow(struct super_block *);