2 * $Id: blktrans.h,v 1.6 2005/11/07 11:14:54 gleixner Exp $
4 * (C) 2003 David Woodhouse <dwmw2@infradead.org>
6 * Interface to Linux block layer for MTD 'translation layers'.
10 #ifndef __MTD_TRANS_H__
11 #define __MTD_TRANS_H__
15 #include <linux/mutex.h>
17 #include <linux/list.h>
22 struct mtd_blktrans_ops;
26 struct mtd_blktrans_dev {
27 struct mtd_blktrans_ops *tr;
28 struct list_head list;
37 void *blkcore_priv; /* gendisk in 2.5, devfs_handle in 2.4 */
40 struct blkcore_priv; /* Differs for 2.4 and 2.5 kernels; private */
42 struct mtd_blktrans_ops {
49 /* Access functions */
50 int (*readsect)(struct mtd_blktrans_dev *dev,
51 unsigned long block, char *buffer);
52 int (*writesect)(struct mtd_blktrans_dev *dev,
53 unsigned long block, char *buffer);
55 /* Block layer ioctls */
56 int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo);
57 int (*flush)(struct mtd_blktrans_dev *dev);
59 /* Called with mtd_table_mutex held; no race with add/remove */
60 int (*open)(struct mtd_blktrans_dev *dev);
61 int (*release)(struct mtd_blktrans_dev *dev);
63 /* Called on {de,}registration and on subsequent addition/removal
64 of devices, with mtd_table_mutex held. */
65 void (*add_mtd)(struct mtd_blktrans_ops *tr, struct mtd_info *mtd);
66 void (*remove_dev)(struct mtd_blktrans_dev *dev);
68 struct list_head devs;
69 struct list_head list;
72 struct mtd_blkcore_priv *blkcore_priv;
75 extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr);
76 extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr);
77 extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
78 extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
81 #endif /* __MTD_TRANS_H__ */