1 #ifndef __LINUX_SIM_OBD_H
2 #define __LINUX_SIM_OBD_H
5 #include <linux/ext2_fs.h>
7 #include <linux/obd_sim.h>
8 /* #include <linux/obd_fc.h> */
10 #define OBD_PSDEV_MAJOR 120
11 #define MAX_OBD_DEVICES 2
13 extern struct obd_device obd_dev[MAX_OBD_DEVICES];
15 struct obd_conn_info {
16 unsigned int conn_id; /* handle */
17 unsigned long conn_ino; /* root inode number */
18 /* XXX do we really need this */
19 unsigned long conn_blocksize;
20 unsigned char conn_blocksize_bits;
24 struct list_head typ_chain;
25 struct obd_ops *typ_ops;
30 /* corresponds to one of the obdx */
32 struct obd_type *obd_type;
36 /* struct fc_obd fc; */
40 #define OBD_FL_SETUP 0x1
43 int (*o_format)(void);
44 int (*o_partition)(int partition, unsigned int size);
45 int (*o_connect)(int minor, struct obd_conn_info *info);
46 int (*o_disconnect)(unsigned int conn_id);
47 int (*o_setup) (struct obd_device *dev, void *data);
48 int (*o_cleanup)(struct obd_device *dev);
49 int (*o_setattr)(unsigned int conn_id, unsigned long id, struct iattr *iattr);
50 int (*o_getattr)(unsigned int conn_id, unsigned long id, struct iattr *iattr);
51 int (*o_statfs)(unsigned int conn_id, struct statfs *statfs);
52 int (*o_create)(struct obd_device *, int prealloc_ino, int *er);
53 int (*o_destroy)(unsigned int conn_id, unsigned long ino);
54 unsigned long (*o_read)(unsigned int conn_id, unsigned long ino, char *buf, unsigned long count, loff_t offset, int *err);
55 unsigned long (*o_read2)(unsigned int conn_id, unsigned long ino, char *buf, unsigned long count, loff_t offset, int *err);
56 unsigned long (*o_write)(unsigned int conn_id, unsigned long ino, char *buf, unsigned long count, loff_t offset, int *err);
57 int (*o_brw)(int rw, int conn, int objectid, struct page *page);
58 long (*o_preallocate)(unsigned int conn_id, int req, long inodes[32], int *err);
59 void (*o_cleanup_device)(int dev);
62 int obd_register_type(struct obd_ops *ops, char *nm);
66 struct list_head cli_chain;
69 unsigned long cli_prealloc_quota;
70 struct list_head cli_prealloc_inodes;
73 struct obd_prealloc_inode {
74 struct list_head obd_prealloc_chain;
81 struct oic_prealloc_s {
83 unsigned long alloc; /* user sets it to the number of inodes requesting
84 * to be preallocated. kernel sets it to the actual number
85 * of succesfully preallocated inodes */
86 long inodes[32]; /* actual inode numbers */
101 struct oic_partition {
107 #define OBD_IOC_CREATE _IOR ('f', 3, long)
108 #define OBD_IOC_SETUP_OBDDEV _IOW ('f', 4, long)
109 #define OBD_IOC_CLEANUP_OBDDEV _IO ('f', 5 )
110 #define OBD_IOC_DESTROY _IOW ('f', 6, long)
111 #define OBD_IOC_PREALLOCATE _IOWR('f', 7, long)
112 #define OBD_IOC_DEC_USE_COUNT _IO ('f', 8 )
113 #define OBD_IOC_SETATTR _IOW ('f', 9, long)
114 #define OBD_IOC_GETATTR _IOR ('f', 10, long)
115 #define OBD_IOC_READ _IOWR('f', 11, long)
116 #define OBD_IOC_WRITE _IOWR('f', 12, long)
117 #define OBD_IOC_CONNECT _IOR ('f', 13, long)
118 #define OBD_IOC_DISCONNECT _IOW ('f', 14, long)
119 #define OBD_IOC_STATFS _IOWR('f', 15, long)
120 #define OBD_IOC_SYNC _IOR ('f', 16, long)
121 #define OBD_IOC_READ2 _IOWR('f', 17, long)
122 #define OBD_IOC_FORMAT _IO('f', 17, long)
123 #define OBD_IOC_READ2 _IOWR('f', 17, long)
125 #define OBD_IOC_DEC_FS_USE_COUNT _IO ('f', 32 )
129 extern void obd_sysctl_init (void);
130 extern void obd_sysctl_clean (void);
133 #endif /* __LINUX_SIM_OBD_H */