#include <linux/module.h>
#include <linux/slab.h>
#include <linux/ioport.h>
#include <linux/vmalloc.h>
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/mtdram.h>
static unsigned long total_size = …;
static unsigned long erase_size = …;
static unsigned long writebuf_size = …;
#define MTDRAM_TOTAL_SIZE …
#define MTDRAM_ERASE_SIZE …
module_param(total_size, ulong, 0);
MODULE_PARM_DESC(…) …;
module_param(erase_size, ulong, 0);
MODULE_PARM_DESC(…) …;
module_param(writebuf_size, ulong, 0);
MODULE_PARM_DESC(…) …;
static struct mtd_info *mtd_info;
static int check_offs_len(struct mtd_info *mtd, loff_t ofs, uint64_t len)
{ … }
static int ram_erase(struct mtd_info *mtd, struct erase_info *instr)
{ … }
static int ram_point(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, void **virt, resource_size_t *phys)
{ … }
static int ram_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
{ … }
static int ram_read(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf)
{ … }
static int ram_write(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf)
{ … }
static void __exit cleanup_mtdram(void)
{ … }
int mtdram_init_device(struct mtd_info *mtd, void *mapped_address,
unsigned long size, const char *name)
{ … }
static int __init init_mtdram(void)
{ … }
module_init(…) …;
module_exit(cleanup_mtdram);
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;