1 /* SMFS plugin stuff */
2 #define SMFS_PLG_DUMMY 0x0001L
3 #define SMFS_PLG_KML 0x0002L
4 #define SMFS_PLG_LRU 0x0004L
5 #define SMFS_PLG_COW 0x0008L
7 #define SMFS_SET_PLG(flags, mask) (flags |= mask)
8 #define SMFS_IS_PLG(flags, mask) (flags & mask)
9 #define SMFS_CLEAR_PLG(flags, mask) (flags &= ~mask)
11 typedef int (*smfs_plg_hook)(int hook_code, void *arg, int, void * priv);
12 typedef int (*smfs_plg_func)(int help_code, void *arg, void * priv);
15 struct list_head plg_list;
18 smfs_plg_hook plg_pre_op;
19 smfs_plg_hook plg_post_op;
20 smfs_plg_func plg_helper;
28 #define HOOK_SYMLINK 5
33 #define HOOK_SETATTR 10
35 #define HOOK_READDIR 12
40 struct dentry * dentry;
43 struct hook_unlink_msg {
45 struct dentry * dentry;
49 struct hook_symlink_msg {
51 struct dentry * dentry;
56 struct hook_rename_msg {
58 struct dentry * dentry;
59 struct inode * new_dir;
60 struct dentry * new_dentry;
63 struct hook_readdir_msg {
65 struct dentry * dentry;
71 struct hook_write_msg {
73 struct dentry * dentry;
78 struct hook_setattr_msg {
80 struct dentry * dentry;
83 #define SMFS_HOOK(sb, op, msg, a,b,c,d,e,f) \
87 #define SMFS_PRE_HOOK(sb, op, msg) \
89 struct smfs_super_info *smb = S2SMI(sb); \
90 struct list_head *hlist = &smb->smsi_plg_list; \
91 struct smfs_plugin *plg; \
93 list_for_each_entry(plg, hlist, plg_list) { \
94 if (plg->plg_pre_op) \
95 plg->plg_pre_op(op, msg, 0, \
100 #define SMFS_POST_HOOK(sb, op, msg, rc) \
102 struct smfs_super_info *smb = S2SMI(sb); \
103 struct list_head *hlist = &smb->smsi_plg_list; \
104 struct smfs_plugin *plg; \
106 list_for_each_entry(plg, hlist, plg_list) { \
107 if (plg->plg_post_op) \
108 plg->plg_post_op(op, msg, rc, \
114 #define PLG_TRANS_SIZE 1
115 #define PLG_TEST_INODE 2
116 #define PLG_SET_INODE 3
117 #define PLG_HELPER_MAX 4
119 #define SMFS_PLG_HELP(sb, op, data) \
121 struct list_head *hlist = &S2SMI(sb)->smsi_plg_list; \
122 struct smfs_plugin *plugin, *tmp; \
124 list_for_each_entry_safe(plugin, tmp, hlist, plg_list) { \
125 if (plugin->plg_helper) \
126 plugin->plg_helper(op, data, \
127 plugin->plg_private); \
131 int smfs_register_plugin(struct super_block *, struct smfs_plugin *);
132 void * smfs_deregister_plugin(struct super_block *, int);
134 int smfs_init_dummy(struct super_block *);
135 int smfs_init_kml(struct super_block *);
136 int smfs_init_lru(struct super_block *);
137 int smfs_init_cow(struct super_block *);