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, struct inode *,
12 void *arg, int rc, void * priv);
13 typedef int (*smfs_plg_func)(int help_code, struct super_block *,
14 void *arg, void * priv);
17 struct list_head plg_list;
20 smfs_plg_hook plg_pre_op;
21 smfs_plg_hook plg_post_op;
22 smfs_plg_func plg_helper;
30 #define HOOK_SYMLINK 5
35 #define HOOK_SETATTR 10
37 #define HOOK_READDIR 12
41 struct dentry * dentry;
44 struct hook_unlink_msg {
45 struct dentry * dentry;
49 struct hook_symlink_msg {
50 struct dentry * dentry;
55 struct hook_rename_msg {
56 struct dentry * dentry;
57 struct inode * new_dir;
58 struct dentry * new_dentry;
61 struct hook_readdir_msg {
62 struct dentry * dentry;
68 struct hook_write_msg {
69 struct dentry * dentry;
74 struct hook_setattr_msg {
75 struct dentry * dentry;
79 #define SMFS_PRE_HOOK(inode, op, msg) \
81 struct smfs_super_info *smb = S2SMI(inode->i_sb); \
82 struct list_head *hlist = &smb->smsi_plg_list; \
83 struct smfs_plugin *plg; \
85 list_for_each_entry(plg, hlist, plg_list) { \
86 if (plg->plg_pre_op) \
87 plg->plg_pre_op(op, inode, msg, 0, \
92 #define SMFS_POST_HOOK(inode, op, msg, rc) \
94 struct smfs_super_info *smb = S2SMI(inode->i_sb); \
95 struct list_head *hlist = &smb->smsi_plg_list; \
96 struct smfs_plugin *plg; \
98 list_for_each_entry(plg, hlist, plg_list) { \
99 if (plg->plg_post_op) \
100 plg->plg_post_op(op, inode, msg, rc, \
106 #define PLG_TRANS_SIZE 1
107 #define PLG_TEST_INODE 2
108 #define PLG_SET_INODE 3
109 #define PLG_HELPER_MAX 4
111 #define SMFS_PLG_HELP(sb, op, data) \
113 struct list_head *hlist = &S2SMI(sb)->smsi_plg_list; \
114 struct smfs_plugin *plugin, *tmp; \
116 list_for_each_entry_safe(plugin, tmp, hlist, plg_list) { \
117 if (plugin->plg_helper) \
118 plugin->plg_helper(op, sb, data, \
119 plugin->plg_private); \
123 int smfs_register_plugin(struct super_block *, struct smfs_plugin *);
124 void * smfs_deregister_plugin(struct super_block *, int);
126 int smfs_init_dummy(struct super_block *);
127 int smfs_init_kml(struct super_block *);
128 int smfs_init_lru(struct super_block *);
129 int smfs_init_cow(struct super_block *);