Whamcloud - gitweb
update smfs, some minor fix about symlink, link and rename
[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 kere with kern_do_mount (like MDS) */
11         int ops_check;
12 };
13
14 #define I2SMI(inode)  ((struct smfs_inode_info *) (&(inode->u.generic_ip)))
15 #define S2SMI(sb)   ((struct smfs_super_info *) (&(sb->u.generic_sbp)))
16 #define S2CSB(sb)   (((struct smfs_super_info *) (&(sb->u.generic_sbp)))->smsi_sb) 
17 #define I2CI(inode) (((struct smfs_inode_info*) (&(inode->u.generic_ip)))->smi_inode)
18
19 #define SB_OPS_CHECK            0x1
20 #define INODE_OPS_CHECK         0x2 
21 #define FILE_OPS_CHECK          0x4 
22 #define DENTRY_OPS_CHECK        0x8 
23 #define DEV_OPS_CHECK           0x10 
24 #define SYMLINK_OPS_CHECK       0x20 
25 #define DIR_OPS_CHECK           0x40 
26
27 #include "smfs_support.h"
28 struct sm_ops {
29         /* operations on the file store */
30         struct super_operations sm_sb_ops;
31                                                                                                                                                                                                      
32         struct inode_operations sm_dir_iops;
33         struct inode_operations sm_file_iops;
34         struct inode_operations sm_sym_iops;
35                                                                                                                                                                                                      
36         struct file_operations sm_dir_fops;
37         struct file_operations sm_file_fops;
38         struct file_operations sm_sym_fops;
39                                                                                                                                                                                                      
40         struct address_space_operations sm_file_aops;
41         struct dentry_operations sm_dentry_ops;
42 };
43
44 struct option {
45         char *opt;
46         char *value;
47         struct list_head list;
48 };
49
50 extern int init_smfs_proc_sys(void);
51 /*options.c*/
52 extern int get_opt(struct option **option, char **pos);
53 extern void cleanup_option(void);
54 extern int init_option(char *data);
55 /*cache.c*/
56 void sm_set_inode_ops(struct inode *cache_inode, struct inode *inode);
57 void sm_set_sb_ops(struct super_block *cache_sb, struct super_block *sb);
58 void init_smfs_cache(void);
59 void cleanup_smfs_cache(void);
60 /*super.c*/
61 extern int init_smfs(void);
62 extern int cleanup_smfs(void);
63 extern void smfs_put_super(struct super_block *sb);
64 extern void duplicate_sb(struct super_block *csb, struct super_block *sb);
65 /*sysctl.c*/
66 extern int sm_debug_level;
67 extern int sm_inodes;
68 extern long sm_kmemory;
69 extern int sm_stack;
70 /*dir.c*/
71 extern struct inode_operations smfs_dir_iops; 
72 extern struct file_operations smfs_dir_fops; 
73 extern int smfs_prepare_dentry(struct dentry *dentry, 
74                                struct dentry *parent,
75                                struct qstr *name);
76
77 void smfs_clear_dentry(struct dentry *dentry);
78 /*inode.c*/
79 extern void duplicate_inode(struct inode *cache_inode, struct inode *inode);
80 /*file.c*/
81 extern void smfs_prepare_cachefile(struct inode *inode,
82                                    struct file *file, 
83                                    struct inode *cache_inode,
84                                    struct file *cache_file,
85                                    struct dentry *cache_dentry);
86 extern int smfs_ioctl(struct inode * inode, struct file * filp,  unsigned int cmd,
87                       unsigned long arg);
88 extern int smfs_fsync(struct file * file, struct dentry *dentry, int datasync);
89 extern int smfs_setattr(struct dentry *dentry, struct iattr *attr); 
90 extern int smfs_setxattr(struct dentry *dentry, const char *name,
91                          const void *value, size_t size, int flags);
92 extern int smfs_getxattr(struct dentry *dentry, const char *name,
93                          void *buffer, size_t size);
94 extern ssize_t smfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
95 extern int smfs_removexattr(struct dentry *dentry, const char *name);
96 extern void smfs_update_file(struct file *file, struct file *cache_file);
97 #endif /* __LINUX_SMFS_H */