Whamcloud - gitweb
- remove non-needed CERROR
[fs/lustre-release.git] / lustre / smfs / smfs_api.h
index ec73811..25fb44f 100644 (file)
@@ -1,12 +1,19 @@
 /* SMFS plugin stuff */
-#define SMFS_PLG_DUMMY  0
-#define SMFS_PLG_KML    1
-#define SMFS_PLG_LRU    2
-#define SMFS_PLG_COW    3
-#define SMFS_PLG_MAX    4
-
-typedef int (*smfs_plg_hook)(int hook_code, void *arg, void * priv);
-typedef int (*smfs_plg_func) (int help_code, void *arg, void * priv);
+#define SMFS_PLG_KML    0x0001L
+#define SMFS_PLG_LRU    0x0004L
+#define SMFS_PLG_COW    0x0020L
+#define SMFS_PLG_UNDO   0x0100L
+#define SMFS_PLG_DUMMY  0x1000L
+#define SMFS_PLG_ALL    (~0L)
+
+#define SMFS_SET(flags, mask) (flags |= mask)
+#define SMFS_IS(flags, mask) (flags & mask)
+#define SMFS_CLEAR(flags, mask) (flags &= ~mask)
+
+typedef int (*smfs_plg_hook)(int hook_code, struct inode *,
+                             void *arg, int rc, void * priv);
+typedef int (*smfs_plg_func)(int help_code, struct super_block *,
+                             void *arg, void * priv);
 
 struct smfs_plugin {
         struct list_head plg_list;
@@ -18,6 +25,19 @@ struct smfs_plugin {
         void *           plg_private;
 };
 
+#define KML_LOG_NAME    "smfs_kml"
+
+struct kml_priv {
+        /* llog pack function */
+        int (* pack_fn)(int, char *, struct dentry*,
+                        struct inode *, void *, void *);
+};
+
+#define UNDO_LOG_NAME   "smfs_undo"
+struct undo_priv {
+        struct llog_ctxt *undo_ctxt;
+};
+
 #define HOOK_CREATE       1
 #define HOOK_LOOKUP       2
 #define HOOK_LINK         3
@@ -30,81 +50,82 @@ struct smfs_plugin {
 #define HOOK_SETATTR      10
 #define HOOK_WRITE        11
 #define HOOK_READDIR      12
-#define HOOK_MAX          13
+#define HOOK_F_SETATTR    13
+#define HOOK_SETXATTR     14
+#define HOOK_F_SETXATTR   15
+#define HOOK_MAX          16
+
+struct hook_msg {
+        struct dentry * dentry;
+
+};
+
+struct hook_link_msg {
+        struct dentry * dentry;
+        struct dentry * new_dentry;
+};
+struct hook_unlink_msg {
+        struct dentry * dentry;
+        int mode;
+};
 
-struct hook_data {
-        struct inode * dir;
+struct hook_symlink_msg {
         struct dentry * dentry;
-        int ret_code;
+        int tgt_len;
+        char * symname;
 };
 
-struct hook_data_rename {
-        struct hook_data data;
+struct hook_rename_msg {
+        struct dentry * dentry;
         struct inode * new_dir;
-        struct inode * new_dentry;
+        struct dentry * new_dentry;
 };
 
-struct hook_data_readdir {
-        struct hook_data data;
+struct hook_readdir_msg {
+        struct dentry * dentry;
         struct file * filp;
         void * dirent;
         filldir_t filldir;
 };
 
-struct hook_data_setattr {
-        struct hook_data data;
+struct hook_write_msg {
+        struct dentry * dentry;
+        size_t count;
+        loff_t pos;
+};
+
+struct hook_setattr_msg {
+        struct dentry * dentry;
         struct iattr *attr;
 };
 
+void smfs_pre_hook (struct inode*, int, void*);
+void smfs_post_hook(struct inode*,int, void*, int);
 
-#define SMFS_PRE_HOOK (op, data)                               \
-do {                                                           \
-        struct list_head *hlist = &smfs_plg_list;              \
-        struct smfs_plugin *plugin;                            \
-                                                               \
-        list_for_each_entry(plugin, hlist, plg_list) {         \
-                if (plugin->plg_pre_op)                        \
-                        plugin->plg_pre_op(op, data,           \
-                                           plg->plg_private);  \
-        }                                                      \
-} while(0)
-
-#define SMFS_POST_HOOK (op, data, rc)                          \
-do {                                                           \
-        struct list_head *hlist = &smfs_plg_list;              \
-        struct smfs_plugin *plugin;                            \
-                                                               \
-        list_for_each_entry(plugin, hlist, plg_list) {         \
-                if (plugin->plg_post_op)                       \
-                        plugin->plg_post_op(op, data,          \
-                                            plg->plg_private); \
-        }                                                      \
-} while(0)
+#define SMFS_PRE_HOOK(inode, op, msg) smfs_pre_hook (inode, op, msg)
+#define SMFS_POST_HOOK(inode, op, msg, rc) smfs_post_hook(inode, op, msg, rc)
 
 #define PLG_EXIT        0
 #define PLG_TRANS_SIZE  1
 #define PLG_TEST_INODE  2
 #define PLG_SET_INODE   3
-#define PLG_HELPER_MAX  4
-
-#define SMFS_PLG_HELP (op, data)                              \
-do {                                                          \
-        struct list_head *hlist = &smfs_plg_list;             \
-        struct smfs_plugin *plugin;                           \
-                                                              \
-        list_for_each_entry(plugin, hlist, plg_list) {        \
-                if (plugin->plg_helper)                       \
-                        plugin->plg_helper(op, data,          \
-                                           plg->plg_private); \
-        }                                                     \
-} while(0)
-
-int smfs_register_plugin(struct smfs_plugin *);
-void * smfs_deregister_plugin(int);
-
-
+#define PLG_START       4
+#define PLG_STOP        5
+#define PLG_HELPER_MAX  6
 
+struct plg_hmsg {
+        __u32 data;
+        __u32 result;        
+};
 
+int smfs_helper (struct super_block *, int, void *);
+#define SMFS_PLG_HELP(sb, op, data)  smfs_helper(sb, op, data)
 
+int smfs_register_plugin(struct super_block *, struct smfs_plugin *);
+void * smfs_deregister_plugin(struct super_block *, int);
 
+int smfs_init_dummy(struct super_block *);
+int smfs_init_kml(struct super_block *);
+int smfs_init_lru(struct super_block *);
+int smfs_init_cow(struct super_block *);