Whamcloud - gitweb
b4445 some fix for smfs_delete_inode
[fs/lustre-release.git] / lustre / smfs / smfs_internal.h
index 7efefbd..ebca06e 100644 (file)
@@ -123,16 +123,16 @@ struct smfs_hook_ops *smfs_alloc_hook_ops(char *name,
                                           smfs_hook_func post_hook);
 
 void smfs_free_hook_ops(struct smfs_hook_ops *hops);
-int smfs_register_hook_ops(struct super_block *sb, 
+int smfs_register_hook_ops(struct smfs_super_info *smb, 
                            struct smfs_hook_ops *smh_ops);
 
-struct smfs_hook_ops *smfs_unregister_hook_ops(struct super_block *sb, 
+struct smfs_hook_ops *smfs_unregister_hook_ops(struct smfs_super_info *smb, 
                                                char *name);
-/*super.c*/
-extern int init_smfs(void);
-extern int cleanup_smfs(void);
-extern void smfs_put_super(struct super_block *sb);
-extern struct super_block *smfs_get_sb_by_path(char *path, int len);
+/*smfs_lib.c*/
+void smfs_put_super(struct super_block *sb);
+int smfs_fill_super(struct super_block *sb, void *data, int silent);
+
+void smfs_cleanup_hooks(struct smfs_super_info *smb);
 /*sysctl.c*/
 extern int sm_debug_level;
 extern int sm_inodes;
@@ -159,16 +159,20 @@ extern int smfs_release(struct inode * inode, struct file * filp);
 /*inode.c*/
 struct inode *smfs_get_inode(struct super_block *sb, ino_t hash, 
                              struct inode *dir, int index);
+
 extern struct super_operations smfs_super_ops;
+
+struct smfs_iget_args {
+        struct inode *s_inode;
+        int           s_index;
+        int           s_ino;
+};
 /*symlink.c*/
 extern struct inode_operations smfs_sym_iops;
 extern struct file_operations smfs_sym_fops;
 /*journal.c */
-extern void *smfs_trans_start(struct inode *inode, int op, void *desc_private);
-extern void smfs_trans_commit(struct inode *inode, void *handle,
-                              int force_sync);
-extern int  smfs_post_kml_rec(struct inode *dir, struct dentry *dst_dentry,
-                              void   *data1, void *data2, int op);
+void *smfs_trans_start(struct inode *inode, int op, void *desc_private);
+void smfs_trans_commit(struct inode *inode, void *handle, int force_sync);
 
 extern int smfs_post_rec_write(struct inode *dir, struct dentry *dentry,
                                void   *data1, void *data2);
@@ -177,19 +181,19 @@ extern int smfs_post_rec_setattr(struct inode *dir, struct dentry *dentry,
 extern int smfs_post_rec_create(struct inode *dir, struct dentry *dentry,
                                 void   *data1, void   *data2);
 /*kml.c*/
-extern int smfs_kml_init(struct super_block *sb);
-extern int smfs_do_rec(struct inode *inode);
-extern int smfs_rec_cleanup(struct super_block *sb);
-extern int smfs_rec_init(struct super_block *sb);
+int smfs_do_rec(struct inode *inode);
+int smfs_rec_cleanup(struct smfs_super_info *sb);
+int smfs_rec_init(struct super_block *sb);
+
 extern int smfs_rec_unpack(struct smfs_proc_args *args, char *record,
                            char **pbuf, int *opcode);
 extern int smfs_process_rec(struct super_block *sb, int count,
                             char *dir, int flags);
-extern smfs_pack_rec_func smfs_get_rec_pack_type(struct super_block *sb);
 
-extern int ost_rec_pack_init(struct super_block *sb);
+/*mds_kml.c*/
+int mds_rec_pack_init(struct smfs_super_info *smb);
 /*ost_kml.c*/
-extern int mds_rec_pack_init(struct super_block *sb);
+int ost_rec_pack_init(struct smfs_super_info *smb);
 
 /*smfs_llog.c*/
 extern int smfs_llog_setup(struct super_block *sb, struct vfsmount *mnt);
@@ -223,10 +227,10 @@ extern int cache_space_post(int op, void *handle, struct inode *old_dir,
                             struct dentry *old_dentry, struct inode *new_dir,
                             struct dentry *new_dentry);
 
-extern int cache_space_hook_setup(struct super_block *);
-extern int cache_space_hook_cleanup(void);
-extern int cache_space_hook_init(struct super_block *);
-extern int cache_space_hook_exit(struct super_block *);
+int cache_space_hook_setup(struct super_block *);
+int cache_space_hook_cleanup(void);
+int cache_space_hook_init(struct super_block *sb);
+int cache_space_hook_exit(struct smfs_super_info *smfs_info);
 
 #define XATTR_SMFS_HOARD_MARK           "hoard"
 #define XATTR_SMFS_CACHE_LOGCOOKIE      "cache"
@@ -285,7 +289,8 @@ static inline int get_active_entry(struct inode *dir, __u64 *active_entry)
 #define HOOK_RENAME       9
 #define HOOK_SETATTR      10
 #define HOOK_WRITE        11 
-#define HOOK_MAX          11 
+#define HOOK_READDIR      12
+#define HOOK_MAX          12 
 
 #define PRE_HOOK 0
 #define POST_HOOK 1
@@ -315,11 +320,20 @@ do {                                                                           \
                 GOTO(label, rc);                                               \
 } while(0)                                                                     \
 
+#define SMFS_GET_INODE(sb, cache_inode, dir, inode, rc, label)          \
+do {                                                                    \
+        LASSERT(cache_inode);                                           \
+        inode = smfs_get_inode(sb, cache_inode->i_ino, dir, 0);         \
+        iput(cache_inode);                                              \
+        if (!inode)                                                     \
+                GOTO(label, rc = -ENOENT);                              \
+} while(0)        
+
+
 #if CONFIG_SNAPFS
-extern int smfs_cow_init(struct super_block *sb);
-extern int smfs_cow_cleanup(struct super_block *sb);
-extern int smfs_init_snap_inode_info(struct inode *inode, 
-                                     struct snap_inode_info *sn_info); 
+int smfs_cow_init(struct super_block *sb);
+int smfs_cow_cleanup(struct smfs_super_info *smb);
+int smfs_snap_test_inode(struct inode *inode, void *args);
 #else
 #define SMFS_PRE_COW(dir, dentry, new_dir, new_dentry, op, name, rc, label)                 
 #endif