Whamcloud - gitweb
Added code for obdfs to do writes to files and reads of directories and
[fs/lustre-release.git] / lustre / include / linux / obd_class.h
index a124b36..f7d6f22 100644 (file)
@@ -4,12 +4,18 @@
 #include <linux/fs.h>
 #include <linux/ext2_fs.h>
 
 #include <linux/fs.h>
 #include <linux/ext2_fs.h>
 
+#include <linux/obd_sim.h>
+/* #include <linux/obd_fc.h> */
+
 #define OBD_PSDEV_MAJOR 120
 #define MAX_OBD_DEVICES 2
 
 #define OBD_PSDEV_MAJOR 120
 #define MAX_OBD_DEVICES 2
 
+extern struct obd_device obd_dev[MAX_OBD_DEVICES];
+
 struct obd_conn_info {
        unsigned int conn_id;     /* handle */
        unsigned long conn_ino;   /* root inode number */
 struct obd_conn_info {
        unsigned int conn_id;     /* handle */
        unsigned long conn_ino;   /* root inode number */
+       /* XXX do we really need this */
        unsigned long conn_blocksize; 
        unsigned char conn_blocksize_bits;
 };
        unsigned long conn_blocksize; 
        unsigned char conn_blocksize_bits;
 };
@@ -18,21 +24,24 @@ struct obd_type {
        struct list_head typ_chain;
        struct obd_ops *typ_ops;
        char *typ_name;
        struct list_head typ_chain;
        struct obd_ops *typ_ops;
        char *typ_name;
-       int  typ_refcount;
+       int  typ_refcnt;
 };
 
 };
 
+/* corresponds to one of the obdx */
 struct obd_device {
        struct obd_type *obd_type;
 struct obd_device {
        struct obd_type *obd_type;
-       int refcnt;
-       struct super_block * sb;
-       unsigned int last_id;
-       unsigned long prealloc_quota;
-       struct list_head clients;
+       int obd_refcnt; 
+       union {
+               struct sim_obd sim;
+               /* struct fc_obd fc; */
+       } u;
 };
 
 #define OBD_FL_SETUP 0x1
 
 struct obd_ops {
 };
 
 #define OBD_FL_SETUP 0x1
 
 struct obd_ops {
+       int (*o_format)(void);
+       int (*o_partition)(int partition, unsigned int size);
        int (*o_connect)(int minor, struct obd_conn_info *info);
        int (*o_disconnect)(unsigned int conn_id);
        int (*o_setup) (struct obd_device *dev, void *data);
        int (*o_connect)(int minor, struct obd_conn_info *info);
        int (*o_disconnect)(unsigned int conn_id);
        int (*o_setup) (struct obd_device *dev, void *data);
@@ -43,7 +52,9 @@ struct obd_ops {
        int (*o_create)(struct obd_device *, int prealloc_ino, int *er);
        int (*o_destroy)(unsigned int conn_id, unsigned long ino);
        unsigned long (*o_read)(unsigned int conn_id, unsigned long ino, char *buf, unsigned long count, loff_t offset, int *err);
        int (*o_create)(struct obd_device *, int prealloc_ino, int *er);
        int (*o_destroy)(unsigned int conn_id, unsigned long ino);
        unsigned long (*o_read)(unsigned int conn_id, unsigned long ino, char *buf, unsigned long count, loff_t offset, int *err);
+       unsigned long (*o_read2)(unsigned int conn_id, unsigned long ino, char *buf, unsigned long count, loff_t offset, int *err);
        unsigned long (*o_write)(unsigned int conn_id, unsigned long ino, char *buf, unsigned long count, loff_t offset, int *err);
        unsigned long (*o_write)(unsigned int conn_id, unsigned long ino, char *buf, unsigned long count, loff_t offset, int *err);
+       int (*o_brw)(int rw, int conn, int objectid, struct page *page);
        long (*o_preallocate)(unsigned int conn_id, int req, long inodes[32], int *err);
        void (*o_cleanup_device)(int dev);
 };
        long (*o_preallocate)(unsigned int conn_id, int req, long inodes[32], int *err);
        void (*o_cleanup_device)(int dev);
 };
@@ -87,10 +98,15 @@ struct oic_rw_s {
        unsigned long count;
        loff_t offset;
 };
        unsigned long count;
        loff_t offset;
 };
+struct oic_partition {
+       int partition;
+       unsigned int size;
+};
+
 
 #define OBD_IOC_CREATE                 _IOR ('f',  3, long)
 
 #define OBD_IOC_CREATE                 _IOR ('f',  3, long)
-#define OBD_IOC_SETUP_SUPER            _IOW ('f',  4, long)
-#define OBD_IOC_CLEANUP_SUPER          _IO  ('f',  5      )
+#define OBD_IOC_SETUP_OBDDEV           _IOW ('f',  4, long)
+#define OBD_IOC_CLEANUP_OBDDEV         _IO  ('f',  5      )
 #define OBD_IOC_DESTROY                _IOW ('f',  6, long)
 #define OBD_IOC_PREALLOCATE            _IOWR('f',  7, long)
 #define OBD_IOC_DEC_USE_COUNT          _IO  ('f',  8      )
 #define OBD_IOC_DESTROY                _IOW ('f',  6, long)
 #define OBD_IOC_PREALLOCATE            _IOWR('f',  7, long)
 #define OBD_IOC_DEC_USE_COUNT          _IO  ('f',  8      )
@@ -102,6 +118,9 @@ struct oic_rw_s {
 #define OBD_IOC_DISCONNECT             _IOW ('f', 14, long)
 #define OBD_IOC_STATFS                 _IOWR('f', 15, long)
 #define OBD_IOC_SYNC                   _IOR ('f',  16, long)
 #define OBD_IOC_DISCONNECT             _IOW ('f', 14, long)
 #define OBD_IOC_STATFS                 _IOWR('f', 15, long)
 #define OBD_IOC_SYNC                   _IOR ('f',  16, long)
+#define OBD_IOC_READ2                  _IOWR('f', 17, long)
+#define OBD_IOC_FORMAT                 _IO('f', 17, long)
+#define OBD_IOC_READ2                  _IOWR('f', 17, long)
 
 #define OBD_IOC_DEC_FS_USE_COUNT       _IO  ('f', 32      )
 
 
 #define OBD_IOC_DEC_FS_USE_COUNT       _IO  ('f', 32      )