2 * (C) 2003 David Woodhouse <dwmw2@infradead.org>
4 * Interface to Linux block layer for MTD 'translation layers'.
8 #ifndef __MTD_TRANS_H__
9 #define __MTD_TRANS_H__
11 #include <linux/mutex.h>
15 struct mtd_blktrans_ops;
19 struct mtd_blktrans_dev {
20 struct mtd_blktrans_ops *tr;
21 struct list_head list;
27 void *blkcore_priv; /* gendisk in 2.5, devfs_handle in 2.4 */
30 struct blkcore_priv; /* Differs for 2.4 and 2.5 kernels; private */
32 struct mtd_blktrans_ops {
39 /* Access functions */
40 int (*readsect)(struct mtd_blktrans_dev *dev,
41 unsigned long block, char *buffer);
42 int (*writesect)(struct mtd_blktrans_dev *dev,
43 unsigned long block, char *buffer);
45 /* Block layer ioctls */
46 int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo);
47 int (*flush)(struct mtd_blktrans_dev *dev);
49 /* Called with mtd_table_mutex held; no race with add/remove */
50 int (*open)(struct mtd_blktrans_dev *dev);
51 int (*release)(struct mtd_blktrans_dev *dev);
53 /* Called on {de,}registration and on subsequent addition/removal
54 of devices, with mtd_table_mutex held. */
55 void (*add_mtd)(struct mtd_blktrans_ops *tr, struct mtd_info *mtd);
56 void (*remove_dev)(struct mtd_blktrans_dev *dev);
58 struct list_head devs;
59 struct list_head list;
62 struct mtd_blkcore_priv *blkcore_priv;
65 extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr);
66 extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr);
67 extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
68 extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
71 #endif /* __MTD_TRANS_H__ */