[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[microblaze-uclinux] problems with the file access to /dev/mtdblock0
Hi,
I access the flash partition directly by file IO interface without file system.
But I noticed the driver doesn't care about my desired synchronous I/O mode I've setup with parameter O_SYNC. I mean whenever I write data the writing is still cached (with cache size == flash sector size) and not really fully written to flash memory; also fsync() doesn't help. This looks like a driver bug to me. I found it out by activating the kernel logging of the MTD driver.
What can I do?
I use it this way:
...
int fd = open("/dev/mtdblock0", O_RDWR | O_SYNC);
...
// read from flash
lseek(fd, relAddr, SEEK_SET);
read(fd, pReadInBuffer, size);
...
// write to flash
lseek(fd, relAddr, SEEK_SET);
write(fd, pBufferToWrite, size);
fsync(fd); // actually not necessary because of O_SYNC
...
The file will be opened at program start and will never be closed because of efficiency and further problems I experienced with closing and reopening of that driver.
Cheers,
Falk
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/