Ask a question about mtdblock.

David Woodhouse dwmw2 at infradead.org
Thu Jun 26 01:48:06 EDT 2003


On Thu, 2003-06-26 at 03:38, Yy Yy wrote:
> I want to implement mass storage protocol.
> I write a kernel thread to handle the requests from
> mass storage protocol.
> I don't know how to read/write data from flash memory
> by mtdblock in my kernel thread.

Assuming you're talking about implementing USB mass storage
'personality' for the USB slave code, surely you shouldn't be making it
at all specific to the mtdblock device? You should make it work on _any_
block device.

> Should I call sys_open/sys_read/sys_write to mtdblock
> device file (/dev/mtdblock0) to get the data.
> Or should I call do_cache_write or do_cache_read to
> get the data directly.

No. You should do neither of those. And if you want any reasonable
chance of data integrity you shouldn't be using the mtdblock device for
writing at all. You should send read and write requests via the block
device queues -- see blkmtd.c for inspiration.

-- 
dwmw2





More information about the linux-mtd mailing list