Whamcloud - gitweb
smash the HEAD with the contents of b_cmd. HEAD_PRE_CMD_SMASH and
[fs/lustre-release.git] / lustre / smfs / smfs_internal.h
1 #ifndef __LINUX_SMFS_H
2 #define __LINUX_SMFS_H
3
4 struct smfs_inode_info {
5         struct inode *smi_inode;
6 };
7
8 struct smfs_super_info {
9         struct super_block *smsi_sb;
10         struct vfsmount *smsi_mnt;      /* mount the cache kern with kern_do_mount (like MDS) */
11         __u32 flags;                    /* flags*/
12         struct llog_ctxt *kml_llog;     /*smfs kml llog*/ 
13         int ops_check;
14 };
15
16 #define I2SMI(inode)  ((struct smfs_inode_info *) (&(inode->u.generic_ip)))
17 #define S2SMI(sb)   ((struct smfs_super_info *) (&(sb->u.generic_sbp)))
18 #define S2CSB(sb)   (((struct smfs_super_info *) (&(sb->u.generic_sbp)))->smsi_sb) 
19 #define I2CI(inode) (((struct smfs_inode_info*) (&(inode->u.generic_ip)))->smi_inode)
20
21 #define SB_OPS_CHECK            0x1
22 #define INODE_OPS_CHECK         0x2 
23 #define FILE_OPS_CHECK          0x4 
24 #define DENTRY_OPS_CHECK        0x8 
25 #define DEV_OPS_CHECK           0x10 
26 #define SYMLINK_OPS_CHECK       0x20 
27 #define DIR_OPS_CHECK           0x40 
28
29 #define SM_DO_KML               0x1
30  
31 #include "smfs_support.h"
32
33 struct journal_operations {
34         void *(*tr_start)(struct inode *, int op);
35         void (*tr_commit)(void *handle);
36 };
37
38 struct sm_ops {
39         /* operations on the file store */
40         struct super_operations sm_sb_ops;
41                                                                                                                                                                                                      
42         struct inode_operations sm_dir_iops;
43         struct inode_operations sm_file_iops;
44         struct inode_operations sm_sym_iops;
45                                                                                                                                                                                                      
46         struct file_operations sm_dir_fops;
47         struct file_operations sm_file_fops;
48         struct file_operations sm_sym_fops;
49                                                                                                                                                                                                      
50         struct dentry_operations sm_dentry_ops;
51         struct journal_operations sm_journal_ops;
52
53 };
54 struct option {
55         char *opt;
56         char *value;
57         struct list_head list;
58 };
59
60 extern int init_smfs_proc_sys(void);
61 /*options.c*/
62 extern int get_opt(struct option **option, char **pos);
63 extern void cleanup_option(void);
64 extern int init_option(char *data);
65 /*cache.c*/
66 void sm_set_inode_ops(struct inode *cache_inode, struct inode *inode);
67 void sm_set_sb_ops(struct super_block *cache_sb, struct super_block *sb);
68 void init_smfs_cache(void);
69 void cleanup_smfs_cache(void);
70 void setup_sm_journal_ops(char * cache_type);
71 /*super.c*/
72 extern int init_smfs(void);
73 extern int cleanup_smfs(void);
74 extern void smfs_put_super(struct super_block *sb);
75 extern void duplicate_sb(struct super_block *csb, struct super_block *sb);
76 /*sysctl.c*/
77 extern int sm_debug_level;
78 extern int sm_inodes;
79 extern long sm_kmemory;
80 extern int sm_stack;
81 /*dir.c*/
82 extern struct inode_operations smfs_dir_iops; 
83 extern struct file_operations smfs_dir_fops; 
84
85 extern void d_unalloc(struct dentry *dentry);
86 /*inode.c*/
87 extern void duplicate_inode(struct inode *cache_inode, struct inode *inode);
88 /*file.c*/
89 extern void smfs_prepare_cachefile(struct inode *inode,
90                                    struct file *file, 
91                                    struct inode *cache_inode,
92                                    struct file *cache_file,
93                                    struct dentry *cache_dentry);
94 extern int smfs_ioctl(struct inode * inode, struct file * filp,  unsigned int cmd,
95                       unsigned long arg);
96 extern int smfs_fsync(struct file * file, struct dentry *dentry, int datasync);
97 extern int smfs_setattr(struct dentry *dentry, struct iattr *attr); 
98 extern int smfs_setxattr(struct dentry *dentry, const char *name,
99                          const void *value, size_t size, int flags);
100 extern int smfs_getxattr(struct dentry *dentry, const char *name,
101                          void *buffer, size_t size);
102 extern ssize_t smfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
103 extern int smfs_removexattr(struct dentry *dentry, const char *name);
104 extern void smfs_update_file(struct file *file, struct file *cache_file);
105 /*journal.c */
106 extern void *smfs_trans_start(struct inode *inode, int op);
107 extern void smfs_trans_commit(void *handle);
108 extern int smfs_journal_mkdir(struct dentry *dentry,
109                        struct smfs_version *tgt_dir_ver,
110                        struct smfs_version *new_dir_ver, 
111                        int mode);
112 /*journal_ext3.c*/
113 extern struct journal_operations smfs_ext3_journal_ops;
114 /*kml.c*/
115 extern int smfs_kml_init(struct super_block *sb);
116 extern int smfs_do_kml(struct inode *dir);
117 extern void smfs_getversion(struct smfs_version * smfs_version, struct inode * inode); 
118 extern int post_kml_mkdir(struct inode *dir, struct dentry *dentry);
119 /*smfs_llog.c*/
120 extern int smfs_llog_setup(struct llog_ctxt **ctxt);
121 #endif /* __LINUX_SMFS_H */