Whamcloud - gitweb
Let's even be specific about the fact that it's the script library that we
[fs/lustre-release.git] / lustre / snapfs / snapfs_internal.h
index ce43dbf..f82a954 100644 (file)
@@ -1,7 +1,8 @@
 #ifndef __LINUX_SNAPFS_H
 #define __LINUX_SNAPFS_H
 /* maximum number of snapshot tables we maintain in the kernel */
-#define SNAP_MAX_TABLES        32
+#define SNAP_MAX               32      
+#define SNAP_MAX_TABLES        32      
 #define SNAP_MAX_NAMELEN       64
 
 /* ioctls for manipulating snapshots 40 - 60 */
@@ -23,7 +24,6 @@
 
 #define IOC_SNAP_MAX_NR                 51 
 
-
 struct snap {
        time_t          time;
        unsigned int    index;
@@ -32,14 +32,26 @@ struct snap {
        char    name[SNAP_MAX_NAMELEN];
 };
 
+
+/*FIXME, use ioc_data temporary, will use obd_ioc_data later*/
+struct ioc_data {
+       unsigned int ioc_inlen;
+       char         *ioc_inbuf;
+       char         ioc_bulk[0];
+};
+
 /* snap ioctl data for table fiddling */
-struct snap_table_data {
-       int             tblcmd_no;              /* which table */
+struct ioc_snap_tbl_data {
+       int             no;             /* which table */
        unsigned long   dev;
-       unsigned int    tblcmd_count;           /* how many snaps */
-       struct snap     tblcmd_snaps[0];        /* sorted times! */
+       unsigned int    count;          /* how many snaps */
+       struct snap     snaps[0];       /* sorted times! */
+};
+struct option {
+       char *opt;
+       char *value;
+       struct list_head list;
 };
-
 /* we have just a single snapshot control device
    it contains a list of all the snap_current info's
 */
@@ -47,6 +59,8 @@ struct snap_table_data {
 #define SNAP_PSDEV_MINOR 240
 #define SNAP_PSDEV_MAJOR 10
 
+#define SNAP_TABLE_OUTBUF_LEN  1020
+
 #ifdef __KERNEL__
 
 #if 0
@@ -67,7 +81,6 @@ typedef ino_t snap_id;
 //#define OBD_OBDMDSZ  54
 //#define SNAP_MAX ((OBD_OBDMDSZ - sizeof(uint32_t))/sizeof(snap_id))
 
-#define SNAP_MAX       50
 
 
 /* if time is 0 this designates the "current" snapshot, i.e.
@@ -196,7 +209,16 @@ struct snap_obd_data {
        unsigned int snap_index;/* which snapshot is ours */
        unsigned int snap_table;/* which table do we use */
 };
+#define DISK_SNAPTABLE_ATTR     "Snaptable12"
+#define DISK_SNAP_TABLE_MAGIC  0x1976
+struct snap_disk_table {
+       unsigned int            magic;
+       unsigned int            count;
+       unsigned int            generation;
+       struct  snap_disk       snap_items[SNAP_MAX];
+};
 
+/*Snap Table*/
 struct snap_table {
        struct semaphore    tbl_sema;
        spinlock_t          tbl_lock;
@@ -204,14 +226,6 @@ struct snap_table {
        unsigned int        generation;
        struct snap         snap_items[SNAP_MAX]; 
 };
-#define DISK_SNAPTABLE_ATTR     "Snaptable"
-#define DISK_SNAP_TABLE_MAGIC  0x1976
-struct snap_disk_table {
-       unsigned int            magic;
-       unsigned int            count;
-       unsigned int            generation;
-       struct  snap_disk       snap_items[SNAP_MAX];
-};
 
 struct snap_iterdata {
        kdev_t dev;     /* snap current device number */ 
@@ -239,6 +253,8 @@ extern int currentfs_is_under_dotsnap(struct dentry *de);
 /* cache.c */
 inline void snap_free_cache(struct snap_cache *cache);
 struct snap_cache *snap_find_cache(kdev_t dev);
+typedef int (*snap_cache_cb_t)(struct snap_cache*, void *in, unsigned long *out);
+int snap_cache_process(snap_cache_cb_t cb, void* in, unsigned long* out);
 
 /* snaptable.c */
 extern struct snap_table snap_tables[SNAP_MAX_TABLES];
@@ -262,13 +278,19 @@ int snap_migrate_data(struct inode *dst, struct inode *src);
 int snap_set_indirect(struct inode *pri, ino_t ind_ino, 
                        int index, ino_t parent_ino);
 
+/*super.c */
+void put_snap_current_mnt(struct super_block *sb);
+void get_snap_current_mnt(struct super_block *sb);
 /* inode.c */
 extern struct super_operations currentfs_super_ops;
 void cleanup_filter_info_cache(void);
 int init_filter_info_cache(void);
-void init_filter_data(struct inode *inode, struct snapshot_operations *snapops,
-                    int flag);
-
+extern void init_filter_data(struct inode *inode, int flag);
+extern void set_filter_ops(struct snap_cache *cache, struct inode *inode);
+extern int currentfs_setxattr(struct dentry *dentry, const char *name, 
+                      const void *value, size_t size, int flags);
+extern int currentfs_removexattr(struct dentry *dentry, const char *name);
+extern int currentfs_setattr(struct dentry *dentry, struct iattr *attr);
 /* dir.c */
 extern struct inode_operations currentfs_dir_iops;
 extern struct file_operations currentfs_dir_fops;
@@ -284,7 +306,12 @@ extern struct file_operations currentfs_sym_fops;
 
 extern struct dentry_operations currentfs_dentry_ops;
 
-
+/* options.c */
+extern int init_option(char *data);
+extern void cleanup_option(void);
+extern int get_opt(struct option **opt, char **pos);
+/* clonefs.c */
+int clonefs_mounted(struct snap_cache *cache, int index);
 
 #define FILTER_DID_SUPER_OPS   0x1
 #define FILTER_DID_INODE_OPS   0x2
@@ -297,7 +324,7 @@ extern struct dentry_operations currentfs_dentry_ops;
 #define FILTER_DID_JOURNAL_OPS 0x100
 
 struct filter_fs {
-       int o_flags;
+       unsigned long o_flags;
        struct filter_ops o_fops;
        struct cache_ops  o_caops;
        struct journal_ops *o_trops;
@@ -309,7 +336,6 @@ struct filter_fs {
 #define FILTER_FS_EXT3 1
 #define FILTER_FS_REISER 2
 extern struct filter_fs filter_oppar[FILTER_FS_TYPES];
-
 struct filter_fs *filter_get_filter_fs(const char *cache_type);
 inline struct super_operations *filter_c2usops(struct filter_fs *cache);
 inline struct inode_operations *filter_c2ufiops(struct filter_fs *cache);
@@ -319,12 +345,16 @@ inline struct super_operations *filter_c2csops(struct filter_fs *cache);
 inline struct inode_operations *filter_c2cfiops(struct filter_fs *cache);
 inline struct inode_operations *filter_c2cdiops(struct filter_fs *cache);
 inline struct inode_operations *filter_c2csiops(struct filter_fs *cache);
+inline struct file_operations *filter_c2udfops(struct filter_fs *cache);
 inline struct file_operations *filter_c2cffops(struct filter_fs *cache);
 inline struct file_operations *filter_c2cdfops(struct filter_fs *cache);
 inline struct file_operations *filter_c2csfops(struct filter_fs *cache);
+inline struct file_operations *filter_c2uffops(struct filter_fs *cache);
+inline struct file_operations *filter_c2usfops(struct filter_fs *cache);
 inline struct dentry_operations *filter_c2cdops(struct filter_fs *cache);
 inline struct dentry_operations *filter_c2udops(struct filter_fs *cache);
 inline struct address_space_operations *filter_c2cfaops(struct filter_fs *cache);
+inline struct address_space_operations *filter_c2ufaops(struct filter_fs *cache);
 /* for snapfs */
 inline struct snapshot_operations *filter_c2csnapops(struct filter_fs *cache);
 
@@ -382,7 +412,7 @@ static inline void snapfs_cpy_attrs(struct inode *dst, struct inode *src)
        dst->i_gid = src->i_gid;
        dst->i_mode = src->i_mode;
 }
-#ifdef SNAP_DEBUG
+#if 0
 extern unsigned int snap_debug_failcode;
 #ifdef CONFIG_LOOP_DISCARD
 #define BLKDEV_FAIL(dev,fail) loop_discard_io(dev,fail)