writeback: split writeback_inodes_wb
[linux-2.6/next.git] / include / linux / mtd / blktrans.h
blobb481ccd7ff3c30330046f6b24311f5fcc6e0ef0f
1 /*
2 * (C) 2003 David Woodhouse <dwmw2@infradead.org>
4 * Interface to Linux block layer for MTD 'translation layers'.
6 */
8 #ifndef __MTD_TRANS_H__
9 #define __MTD_TRANS_H__
11 #include <linux/mutex.h>
12 #include <linux/kref.h>
13 #include <linux/sysfs.h>
15 struct hd_geometry;
16 struct mtd_info;
17 struct mtd_blktrans_ops;
18 struct file;
19 struct inode;
21 struct mtd_blktrans_dev {
22 struct mtd_blktrans_ops *tr;
23 struct list_head list;
24 struct mtd_info *mtd;
25 struct mutex lock;
26 int devnum;
27 unsigned long size;
28 int readonly;
29 int open;
30 struct kref ref;
31 struct gendisk *disk;
32 struct attribute_group *disk_attributes;
33 struct task_struct *thread;
34 struct request_queue *rq;
35 spinlock_t queue_lock;
36 void *priv;
39 struct mtd_blktrans_ops {
40 char *name;
41 int major;
42 int part_bits;
43 int blksize;
44 int blkshift;
46 /* Access functions */
47 int (*readsect)(struct mtd_blktrans_dev *dev,
48 unsigned long block, char *buffer);
49 int (*writesect)(struct mtd_blktrans_dev *dev,
50 unsigned long block, char *buffer);
51 int (*discard)(struct mtd_blktrans_dev *dev,
52 unsigned long block, unsigned nr_blocks);
54 /* Block layer ioctls */
55 int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo);
56 int (*flush)(struct mtd_blktrans_dev *dev);
58 /* Called with mtd_table_mutex held; no race with add/remove */
59 int (*open)(struct mtd_blktrans_dev *dev);
60 int (*release)(struct mtd_blktrans_dev *dev);
62 /* Called on {de,}registration and on subsequent addition/removal
63 of devices, with mtd_table_mutex held. */
64 void (*add_mtd)(struct mtd_blktrans_ops *tr, struct mtd_info *mtd);
65 void (*remove_dev)(struct mtd_blktrans_dev *dev);
67 struct list_head devs;
68 struct list_head list;
69 struct module *owner;
72 extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr);
73 extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr);
74 extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
75 extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
78 #endif /* __MTD_TRANS_H__ */