diff options
author | Oliver Schinagl <oliver@schinagl.nl> | 2011-02-26 12:16:43 (GMT) |
---|---|---|
committer | Oliver Schinagl <oliver@schinagl.nl> | 2011-02-26 12:16:43 (GMT) |
commit | edb45850f53478c7779484105c30f8df0a3a3782 (patch) | |
tree | 26e758b463e03475be4d214aeb17c6517b01a83e /linux-2.4.x/drivers/mtd/mtdblock_ro.c | |
parent | ba6dc76a789f33fc999bbd24fe8af5b856f90085 (diff) | |
download | openipcam-edb45850f53478c7779484105c30f8df0a3a3782.zip openipcam-edb45850f53478c7779484105c30f8df0a3a3782.tar.gz openipcam-edb45850f53478c7779484105c30f8df0a3a3782.tar.bz2 |
2.4.20-uc0 uClinux patch added
Diffstat (limited to 'linux-2.4.x/drivers/mtd/mtdblock_ro.c')
-rw-r--r-- | linux-2.4.x/drivers/mtd/mtdblock_ro.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/linux-2.4.x/drivers/mtd/mtdblock_ro.c b/linux-2.4.x/drivers/mtd/mtdblock_ro.c index d411e34..a66b852 100644 --- a/linux-2.4.x/drivers/mtd/mtdblock_ro.c +++ b/linux-2.4.x/drivers/mtd/mtdblock_ro.c @@ -240,6 +240,30 @@ static int mtdblock_ioctl(struct inode * inode, struct file * file, } } + +#ifdef MAGIC_ROM_PTR +static int +mtdblock_romptr(kdev_t dev, struct vm_area_struct * vma) +{ + struct mtd_info *mtd; + u_char *ptr; + size_t len; + + mtd = __get_mtd_device(NULL, MINOR(dev)); + + if (!mtd->point) + return -ENOSYS; /* Can't do it, No function to point to correct addr */ + + if ((*mtd->point)(mtd,vma->vm_offset,vma->vm_end-vma->vm_start,&len,&ptr) != 0) + return -ENOSYS; + + vma->vm_start = (unsigned long) ptr; + vma->vm_end = vma->vm_start + len; + return 0; +} +#endif + + #if LINUX_VERSION_CODE < 0x20326 static struct file_operations mtd_fops = { @@ -247,6 +271,9 @@ static struct file_operations mtd_fops = ioctl: mtdblock_ioctl, release: mtdblock_release, read: block_read, +#ifdef MAGIC_ROM_PTR + romptr: mtdblock_romptr, +#endif write: block_write }; #else @@ -257,6 +284,9 @@ static struct block_device_operations mtd_fops = #endif open: mtdblock_open, release: mtdblock_release, +#ifdef MAGIC_ROM_PTR + romptr: mtdblock_romptr, +#endif ioctl: mtdblock_ioctl }; #endif @@ -270,6 +300,9 @@ int __init init_mtdblock(void) MTD_BLOCK_MAJOR); return -EAGAIN; } + DEBUG(MTD_DEBUG_LEVEL3, + "init_mtdblock: allocated major number %d (read only).\n", + MTD_BLOCK_MAJOR); /* We fill it in at open() time. */ for (i=0; i< MAX_MTD_DEVICES; i++) { |