Whamcloud - gitweb
Over of the changes:
[fs/lustre-release.git] / lustre / include / linux / obd_class.h
index 200e45b..3115054 100644 (file)
@@ -1,27 +1,28 @@
-#ifndef __LINUX_SIM_OBD_H
-#define __LINUX_SIM_OBD_H
+#ifndef __LINUX_CLASS_OBD_H
+#define __LINUX_CLASS_OBD_H
 
 #include <linux/fs.h>
 #include <linux/ext2_fs.h>
+#include <linux/time.h>
+#include <linux/obd.h>
 
 #include <linux/obd_sim.h>
+#include <linux/obd_snap.h>
 /* #include <linux/obd_fc.h> */
+#include <linux/obd_raid1.h>
+#include <linux/obd_rpc.h>
+
 
 #define OBD_PSDEV_MAJOR 120
 #define MAX_OBD_DEVICES 2
+#define MAX_MULTI 16
+
+typedef int objid;
+typedef struct inode obdattr;
 
 extern struct obd_device obd_dev[MAX_OBD_DEVICES];
 
-struct obd_conn_info {
-       unsigned int conn_id;     /* handle */
-};
 
-struct obd_type {
-       struct list_head typ_chain;
-       struct obd_ops *typ_ops;
-       char *typ_name;
-       int  typ_refcnt;
-};
 
 #define OBD_ATTACHED 0x1
 #define OBD_SET_UP   0x2
@@ -32,8 +33,17 @@ struct obd_device {
        int obd_minor;
        int obd_flags;
        int obd_refcnt; 
+       int obd_multi_count;
+       struct obd_device *obd_multi_dev[MAX_MULTI];
+       struct obd_conn_info obd_multi_conns[MAX_MULTI];
+       unsigned int obd_gen_last_id;
+       unsigned long obd_gen_prealloc_quota;
+       struct list_head obd_gen_clients;
        union {
                struct sim_obd sim;
+               struct raid1_obd raid1;
+               struct snap_obd snap;
+               struct rpc_obd rpc;
                /* struct fc_obd fc; */
        } u;
 };
@@ -49,18 +59,20 @@ struct obd_ops {
        int (*o_setattr)(unsigned int conn_id, unsigned long id, struct inode *iattr);
        int (*o_getattr)(unsigned int conn_id, unsigned long id, struct inode *iattr);
        int (*o_statfs)(unsigned int conn_id, struct statfs *statfs);
-       int (*o_create)(struct obd_device *, int prealloc_ino, int *er);
+       int (*o_create)(int conn_id, 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);
-       int (*o_brw)(int rw, int conn, int objectid, struct page *page, int create);
+       int (*o_brw)(int rw, int conn, obdattr *obj, struct page *page, int create);
        long (*o_preallocate)(unsigned int conn_id, int req, long inodes[32], int *err);
-       void (*o_cleanup_device)(int dev);
+       int (*o_cleanup_device)(struct obd_device *);
        int  (*o_get_info)(unsigned int conn_id, int keylen, void *key, int *vallen, void **val);
        int  (*o_set_info)(unsigned int conn_id, int keylen, void *key, int vallen, void *val);
 };
 
+#define OBP(dev,op) dev->obd_type->typ_ops->o_ ## op
+
 int obd_register_type(struct obd_ops *ops, char *nm);
 int obd_unregister_type(char *nm);
 
@@ -77,6 +89,19 @@ struct obd_prealloc_inode {
        unsigned long inode;
 };
 
+/* generic operations shared by various OBD types */
+int gen_connect (struct obd_device *obddev, 
+                    struct obd_conn_info * conninfo);
+int gen_disconnect(unsigned int conn_id);
+int gen_multi_setup(struct obd_device *obddev, int len, void *data);
+int gen_multi_cleanup(struct obd_device *obddev);
+int gen_multi_attach(struct obd_device *obddev, int len, void *data);
+struct obd_client *gen_client(int cli_id);
+int gen_multi_cleanup_device(struct obd_device *obddev);
+int gen_cleanup(struct obd_device *obddev);
+
+
+
 /*
  * ioctl commands
  */
@@ -94,10 +119,15 @@ struct oic_prealloc_s {
                     * of succesfully preallocated inodes */
        long inodes[32]; /* actual inode numbers */
 };
-struct oic_attr_s {
+
+struct oic_create_s {
        unsigned int conn_id;
-       unsigned long inode;
+       unsigned long prealloc;
+};
 
+struct oic_attr_s {
+       unsigned int conn_id;
+       unsigned long ino;
        struct iattr iattr;
 };
 struct oic_rw_s {
@@ -115,7 +145,7 @@ struct oic_partition {
 
 #define OBD_IOC_CREATE                 _IOR ('f',  3, long)
 #define OBD_IOC_SETUP_OBDDEV           _IOW ('f',  4, long)
-#define OBD_IOC_CLEANUP_OBDDEV         _IO  ('f',  5      )
+#define OBD_IOC_CLEANUP                _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      )
@@ -140,4 +170,4 @@ extern void obd_sysctl_init (void);
 extern void obd_sysctl_clean (void);
 
 
-#endif /* __LINUX_SIM_OBD_H */
+#endif /* __LINUX_CLASS_OBD_H */