MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / linux / mtd / blktrans.h
blob2f9fc755facbb69b84f40ef50c223a7a4f476c62
1 /*
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'.
8 */
10 #ifndef __MTD_TRANS_H__
11 #define __MTD_TRANS_H__
13 #include <asm/semaphore.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 semaphore sem;
26 int devnum;
27 int blksize;
28 unsigned long size;
29 int readonly;
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 {
36 char *name;
37 int major;
38 int part_bits;
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);
45 #ifdef CONFIG_MAGIC_ROM_PTR
46 int (*romptr)(struct mtd_blktrans_dev *dev, struct vm_area_struct * vma);
47 #endif /* CONFIG_MAGIC_ROM_PTR */
49 /* Block layer ioctls */
50 int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo);
51 int (*flush)(struct mtd_blktrans_dev *dev);
53 /* Called with mtd_table_mutex held; no race with add/remove */
54 int (*open)(struct mtd_blktrans_dev *dev);
55 int (*release)(struct mtd_blktrans_dev *dev);
57 /* Called on {de,}registration and on subsequent addition/removal
58 of devices, with mtd_table_mutex held. */
59 void (*add_mtd)(struct mtd_blktrans_ops *tr, struct mtd_info *mtd);
60 void (*remove_dev)(struct mtd_blktrans_dev *dev);
62 struct list_head devs;
63 struct list_head list;
64 struct module *owner;
66 struct mtd_blkcore_priv *blkcore_priv;
69 extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr);
70 extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr);
71 extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
72 extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
75 #endif /* __MTD_TRANS_H__ */