2 * $Id: blktrans.h,v 1.5 2003/06/23 12:00:08 dwmw2 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__
13 #include <asm/semaphore.h>
17 struct mtd_blktrans_ops
;
21 struct mtd_blktrans_dev
{
22 struct mtd_blktrans_ops
*tr
;
23 struct list_head list
;
30 void *blkcore_priv
; /* gendisk in 2.5, devfs_handle in 2.4 */
33 struct blkcore_priv
; /* Differs for 2.4 and 2.5 kernels; private */
35 struct mtd_blktrans_ops
{
40 /* Access functions */
41 int (*readsect
)(struct mtd_blktrans_dev
*dev
,
42 unsigned long block
, char *buffer
);
43 int (*writesect
)(struct mtd_blktrans_dev
*dev
,
44 unsigned long block
, char *buffer
);
46 /* Block layer ioctls */
47 int (*getgeo
)(struct mtd_blktrans_dev
*dev
, struct hd_geometry
*geo
);
48 int (*flush
)(struct mtd_blktrans_dev
*dev
);
50 /* Called with mtd_table_mutex held; no race with add/remove */
51 int (*open
)(struct mtd_blktrans_dev
*dev
);
52 int (*release
)(struct mtd_blktrans_dev
*dev
);
54 /* Called on {de,}registration and on subsequent addition/removal
55 of devices, with mtd_table_mutex held. */
56 void (*add_mtd
)(struct mtd_blktrans_ops
*tr
, struct mtd_info
*mtd
);
57 void (*remove_dev
)(struct mtd_blktrans_dev
*dev
);
59 struct list_head devs
;
60 struct list_head list
;
63 struct mtd_blkcore_priv
*blkcore_priv
;
66 extern int register_mtd_blktrans(struct mtd_blktrans_ops
*tr
);
67 extern int deregister_mtd_blktrans(struct mtd_blktrans_ops
*tr
);
68 extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev
*dev
);
69 extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev
*dev
);
72 #endif /* __MTD_TRANS_H__ */