#ifndef __LINUX_SMFS_H
#define __LINUX_SMFS_H
-//#include <linux/lustre_fsfilt.h>
+#include "smfs_api.h"
#define SMFSDEV_NAME "/dev/smfsconf"
#define SMFS_PSDEV_MINOR 250
#define SMFS_PSDEV_MAJOR 10
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10))
+#define FC3_KERNEL
+#endif
+
struct option {
char *opt;
char *value;
#define INODE_OPS_CHECK 0x2
#define FILE_OPS_CHECK 0x4
#define DENTRY_OPS_CHECK 0x8
-#define DEV_OPS_CHECK 0x10
+#define SPECIAL_OPS_CHECK 0x10
#define SYMLINK_OPS_CHECK 0x20
#define DIR_OPS_CHECK 0x40
-#define KML_LOG_NAME "kml_rec"
-
#define MYPATHLEN(buffer, path) ((buffer) + PAGE_SIZE - (path))
-
#define PACK_KML_REC_INIT(buffer, op_code) \
do{ \
int opcode = op_code; \
buffer += sizeof(opcode); \
} while (0)
+#define SMFS_IOPEN_INO 1
+#define KEY_IS(str, key) (strcmp(str,key) == 0)
extern int init_smfs_proc_sys(void);
-/*options.c*/
-extern int get_opt(struct option **option, char **pos);
-extern void cleanup_option(void);
-extern int init_option(char *data);
/*cache.c*/
-extern void sm_set_inode_ops(struct inode *cache_inode, struct inode *inode);
+extern void sm_set_inode_ops(struct inode *);
extern void sm_set_sb_ops(struct super_block *cache_sb, struct super_block *sb);
-extern void init_smfs_cache(void);
-extern void cleanup_smfs_cache(void);
-extern void sm_set_journal_ops(struct super_block *sb, char *cache_type);
+//extern void init_smfs_cache(void);
+//extern void cleanup_smfs_cache(void);
+//extern void sm_set_journal_ops(struct super_block *sb, char *cache_type);
extern int smfs_init_sm_ops(struct smfs_super_info *smb);
extern void smfs_cleanup_sm_ops(struct smfs_super_info *smb);
-static inline struct super_operations *cache_sops(struct smfs_super_info *smb)
-{
- return &smb->sm_ops->sm_sb_ops;
-}
-static inline struct inode_operations *cache_diops(struct smfs_super_info *smb)
-{
- return &smb->sm_ops->sm_dir_iops;
-}
-static inline struct inode_operations *cache_fiops(struct smfs_super_info *smb)
-{
- return &smb->sm_ops->sm_file_iops;
-}
-static inline struct inode_operations *cache_siops(struct smfs_super_info *smb)
-{
- return &smb->sm_ops->sm_sym_iops;
-}
-static inline struct file_operations *cache_dfops(struct smfs_super_info *smb)
-{
- return &smb->sm_ops->sm_dir_fops;
-}
-static inline struct file_operations *cache_ffops(struct smfs_super_info *smb)
-{
- return &smb->sm_ops->sm_file_fops;
-}
-static inline struct file_operations *cache_sfops(struct smfs_super_info *smb)
-{
- return &smb->sm_ops->sm_sym_fops;
-}
-static inline struct dentry_operations *cache_dops(struct smfs_super_info *smb)
-{
- return &smb->sm_ops->sm_dentry_ops;
-}
-static inline struct journal_operations *journal_ops(struct smfs_super_info *smb)
-{
- return &smb->sm_ops->sm_journal_ops;
-}
-
-struct smfs_hook_ops *smfs_alloc_hook_ops(char *name,
- smfs_hook_func pre_hook,
- smfs_hook_func post_hook);
-
-void smfs_free_hook_ops(struct smfs_hook_ops *hops);
-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 smfs_super_info *smb,
- char *name);
/*smfs_lib.c*/
void smfs_put_super(struct super_block *sb);
int smfs_fill_super(struct super_block *sb, void *data, int silent);
+int smfs_post_setup(struct obd_device *, struct vfsmount *, struct dentry *);
+void smfs_post_cleanup(struct super_block *);
+void * smfs_get_plg_priv(struct smfs_super_info *, int);
/*sysctl.c*/
extern int sm_debug_level;
extern int sm_inodes;
/*dir.c*/
extern struct inode_operations smfs_dir_iops;
extern struct file_operations smfs_dir_fops;
+extern struct inode_operations smfs_iopen_iops;
+extern struct file_operations smfs_iopen_fops;
+
/*file.c*/
extern struct inode_operations smfs_file_iops;
extern struct file_operations smfs_file_fops;
+extern struct inode_operations smfs_special_iops;
extern int smfs_ioctl(struct inode * inode, struct file * filp,
unsigned int cmd, unsigned long arg);
extern int smfs_fsync(struct file * file, struct dentry *dentry, int datasync);
size_t size);
extern ssize_t smfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
extern int smfs_removexattr(struct dentry *dentry, const char *name);
+extern int smfs_permission(struct inode *inode, int mask, struct nameidata *nd);
extern int smfs_open(struct inode * inode, struct file * filp);
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);
+struct inode *smfs_get_inode(struct super_block *, struct inode*,
+ struct smfs_inode_info *, int);
extern struct super_operations smfs_super_ops;
struct smfs_iget_args {
- struct inode *s_inode;
- int s_index;
- int s_ino;
+ struct inode *s_inode;
+ struct smfs_inode_info *s_info;
+ int s_index;
};
+
/*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);
void *data1, void *data2);
/*kml.c*/
int smfs_do_rec(struct inode *inode);
-int smfs_rec_cleanup(struct super_block *sb);
+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);
-
-/*mds_kml.c*/
-int mds_rec_pack_init(struct super_block *sb);
-/*ost_kml.c*/
-int ost_rec_pack_init(struct super_block *sb);
+extern int mds_rec_pack(int, char *, struct dentry *, struct inode *,
+ void *, void *);
+extern int ost_rec_pack(int, char *, struct dentry *, struct inode *,
+ void *, void *);
/*smfs_llog.c*/
-extern int smfs_llog_setup(struct super_block *sb, struct vfsmount *mnt);
-extern int smfs_llog_cleanup(struct super_block *sb);
-extern int smfs_llog_add_rec(struct smfs_super_info * sinfo, void *data,
- int data_size);
+extern int smfs_llog_setup(struct dentry **, struct dentry **);
+extern int smfs_llog_cleanup(struct smfs_super_info *);
+extern int smfs_llog_add_rec(struct smfs_super_info *, void *, int);
/*ioctl.c*/
extern int init_smfs_psdev(void);
extern void smfs_cleanup_psdev(void);
/*smfs_cow.c */
+/* audit_transfer.c */
+int audit_notify(struct llog_handle *llh, void*, int);
+int audit_start_transferd(void);
+int audit_stop_transferd(void);
+
/* cache_space.c */
extern int do_cache_manage;
struct cache_purge_queue {
rc = 0;
RETURN(rc);
}
-#define HOOK_CREATE 1
-#define HOOK_LOOKUP 2
-#define HOOK_LINK 3
-#define HOOK_UNLINK 4
-#define HOOK_SYMLINK 5
-#define HOOK_MKDIR 6
-#define HOOK_RMDIR 7
-#define HOOK_MKNOD 8
-#define HOOK_RENAME 9
-#define HOOK_SETATTR 10
-#define HOOK_WRITE 11
-#define HOOK_MAX 11
-
-#define PRE_HOOK 0
-#define POST_HOOK 1
-#define SMFS_HOOK(inode, dentry, data1, data2, op, handle, flag, rc, label) \
-do { \
- LASSERT(inode->i_sb); \
- if (!rc) { \
- struct smfs_super_info *smb = S2SMI(inode->i_sb); \
- struct list_head *hlist = &smb->smsi_hook_list; \
- struct list_head *p; \
- \
- list_for_each(p, hlist) { \
- struct smfs_hook_ops *hops; \
- \
- hops = list_entry(p, typeof(*hops), smh_list); \
- if (flag == PRE_HOOK && hops->smh_pre_op) \
- rc = hops->smh_pre_op(inode, dentry, data1, \
- data2, op, handle); \
- else if (flag == POST_HOOK && hops->smh_post_op) \
- rc = hops->smh_post_op(inode, dentry, data1, \
- data2, op, handle); \
- if (rc) \
- break; \
- } \
- } \
- if (rc) \
- GOTO(label, rc); \
-} while(0) \
-
-#define SMFS_GET_INODE(sb, cache_inode, dir, index, inode, rc, label) \
-do { \
- LASSERT(cache_inode); \
- inode = smfs_get_inode(sb, cache_inode->i_ino, dir, index); \
- iput(cache_inode); \
- if (!inode) \
- GOTO(label, rc = -ENOENT); \
-} while(0)
+struct kml_buffer {
+ char *buf;
+ int buf_size;
+};
+
+#ifdef __KERNEL__
+static inline void
+smfs_inode2id(struct lustre_id *id, struct inode *inode)
+{
+ mdc_pack_id(id, inode->i_ino, inode->i_generation,
+ (inode->i_mode & S_IFMT), 0, 0);
+}
+
+static inline void
+smfs_prepare_mdc_data(struct mdc_op_data *data, struct inode *i1,
+ struct inode *i2, const char *name, int namelen,
+ int mode)
+{
+ LASSERT(i1);
+
+ smfs_inode2id(&data->id1, i1);
+ if (i2)
+ smfs_inode2id(&data->id2, i2);
+ else
+ memset(&data->id2, 0, sizeof(data->id2));
+
+ data->valid = 0;
+ data->name = name;
+ data->namelen = namelen;
+ data->create_mode = mode;
+ data->mod_time = LTIME_S(CURRENT_TIME);
+}
+#endif
#if CONFIG_SNAPFS
int smfs_cow_init(struct super_block *sb);
int smfs_cow_cleanup(struct smfs_super_info *smb);
-int smfs_init_snap_inode_info(struct inode *inode, struct smfs_iget_args *args);
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)