Skip to content
Snippets Groups Projects
Commit b9128c5c authored by Mikhail Pershin's avatar Mikhail Pershin
Browse files

b=5881

r=alex

changes related to iopen support, fc3 compatibility and new smfs plugin API
parent df61394c
No related merge requests found
/* SMFS plugin stuff */ /* SMFS plugin stuff */
#define SMFS_PLG_DUMMY 0x0001L #define SMFS_PLG_KML 0x0001L
#define SMFS_PLG_KML 0x0002L
#define SMFS_PLG_LRU 0x0004L #define SMFS_PLG_LRU 0x0004L
#define SMFS_PLG_COW 0x0008L #define SMFS_PLG_COW 0x0020L
#define SMFS_PLG_DUMMY 0x1000L
#define SMFS_PLG_ALL (~0L)
#define SMFS_SET_PLG(flags, mask) (flags |= mask) #define SMFS_SET(flags, mask) (flags |= mask)
#define SMFS_IS_PLG(flags, mask) (flags & mask) #define SMFS_IS(flags, mask) (flags & mask)
#define SMFS_CLEAR_PLG(flags, mask) (flags &= ~mask) #define SMFS_CLEAR(flags, mask) (flags &= ~mask)
typedef int (*smfs_plg_hook)(int hook_code, struct inode *, typedef int (*smfs_plg_hook)(int hook_code, struct inode *,
void *arg, int rc, void * priv); void *arg, int rc, void * priv);
...@@ -35,12 +36,17 @@ struct smfs_plugin { ...@@ -35,12 +36,17 @@ struct smfs_plugin {
#define HOOK_SETATTR 10 #define HOOK_SETATTR 10
#define HOOK_WRITE 11 #define HOOK_WRITE 11
#define HOOK_READDIR 12 #define HOOK_READDIR 12
#define HOOK_MAX 13 #define HOOK_F_SETATTR 13
#define HOOK_MAX 14
struct hook_msg { struct hook_msg {
struct dentry * dentry; struct dentry * dentry;
}; };
struct hook_link_msg {
struct dentry * dentry;
struct dentry * new_dentry;
};
struct hook_unlink_msg { struct hook_unlink_msg {
struct dentry * dentry; struct dentry * dentry;
int mode; int mode;
...@@ -76,7 +82,11 @@ struct hook_setattr_msg { ...@@ -76,7 +82,11 @@ struct hook_setattr_msg {
struct iattr *attr; struct iattr *attr;
}; };
#define SMFS_PRE_HOOK(inode, op, msg) \ void smfs_pre_hook (struct inode*, int, void*);
void smfs_post_hook(struct inode*,int, void*, int);
#define SMFS_PRE_HOOK(inode, op, msg) smfs_pre_hook (inode, op, msg)
/*\
do { \ do { \
struct smfs_super_info *smb = S2SMI(inode->i_sb); \ struct smfs_super_info *smb = S2SMI(inode->i_sb); \
struct list_head *hlist = &smb->smsi_plg_list; \ struct list_head *hlist = &smb->smsi_plg_list; \
...@@ -88,8 +98,10 @@ do { \ ...@@ -88,8 +98,10 @@ do { \
plg->plg_private); \ plg->plg_private); \
} \ } \
} while(0) } while(0)
*/
#define SMFS_POST_HOOK(inode, op, msg, rc) \ #define SMFS_POST_HOOK(inode, op, msg, rc) smfs_post_hook(inode, op, msg, rc)
/*\
do { \ do { \
struct smfs_super_info *smb = S2SMI(inode->i_sb); \ struct smfs_super_info *smb = S2SMI(inode->i_sb); \
struct list_head *hlist = &smb->smsi_plg_list; \ struct list_head *hlist = &smb->smsi_plg_list; \
...@@ -101,24 +113,22 @@ do { \ ...@@ -101,24 +113,22 @@ do { \
plg->plg_private); \ plg->plg_private); \
} \ } \
} while(0) } while(0)
*/
#define PLG_EXIT 0 #define PLG_EXIT 0
#define PLG_TRANS_SIZE 1 #define PLG_TRANS_SIZE 1
#define PLG_TEST_INODE 2 #define PLG_TEST_INODE 2
#define PLG_SET_INODE 3 #define PLG_SET_INODE 3
#define PLG_HELPER_MAX 4 #define PLG_START 4
#define PLG_STOP 5
#define SMFS_PLG_HELP(sb, op, data) \ #define PLG_HELPER_MAX 6
do { \
struct list_head *hlist = &S2SMI(sb)->smsi_plg_list; \ struct plg_hmsg {
struct smfs_plugin *plugin, *tmp; \ __u32 data;
\ __u32 result;
list_for_each_entry_safe(plugin, tmp, hlist, plg_list) { \ };
if (plugin->plg_helper) \
plugin->plg_helper(op, sb, data, \ int smfs_helper (struct super_block *, int, void *);
plugin->plg_private); \ #define SMFS_PLG_HELP(sb, op, data) smfs_helper(sb, op, data)
} \
} while(0)
int smfs_register_plugin(struct super_block *, struct smfs_plugin *); int smfs_register_plugin(struct super_block *, struct smfs_plugin *);
void * smfs_deregister_plugin(struct super_block *, int); void * smfs_deregister_plugin(struct super_block *, int);
......
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
#define SMFS_PSDEV_MINOR 250 #define SMFS_PSDEV_MINOR 250
#define SMFS_PSDEV_MAJOR 10 #define SMFS_PSDEV_MAJOR 10
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10))
#define FC3_KERNEL
#endif
struct option { struct option {
char *opt; char *opt;
char *value; char *value;
...@@ -124,8 +128,8 @@ struct smfs_hook_ops *smfs_unregister_hook_ops(struct smfs_super_info *smb, ...@@ -124,8 +128,8 @@ struct smfs_hook_ops *smfs_unregister_hook_ops(struct smfs_super_info *smb,
/*smfs_lib.c*/ /*smfs_lib.c*/
void smfs_put_super(struct super_block *sb); void smfs_put_super(struct super_block *sb);
int smfs_fill_super(struct super_block *sb, void *data, int silent); int smfs_fill_super(struct super_block *sb, void *data, int silent);
int smfs_post_setup(struct super_block *, struct vfsmount *);
void smfs_cleanup_hooks(struct smfs_super_info *smb); void smfs_post_cleanup(struct super_block *);
/*sysctl.c*/ /*sysctl.c*/
extern int sm_debug_level; extern int sm_debug_level;
extern int sm_inodes; extern int sm_inodes;
...@@ -134,6 +138,9 @@ extern int sm_stack; ...@@ -134,6 +138,9 @@ extern int sm_stack;
/*dir.c*/ /*dir.c*/
extern struct inode_operations smfs_dir_iops; extern struct inode_operations smfs_dir_iops;
extern struct file_operations smfs_dir_fops; extern struct file_operations smfs_dir_fops;
extern struct inode_operations smfs_iopen_iops;
extern struct file_operations smfs_iopen_fops;
/*file.c*/ /*file.c*/
extern struct inode_operations smfs_file_iops; extern struct inode_operations smfs_file_iops;
extern struct file_operations smfs_file_fops; extern struct file_operations smfs_file_fops;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment