I have an embedded device with a flash memory running linux. I want to do raw read writes on the flash part but I also want to avoid any file system cache. How can I do this? Any pointers?
Tell me more
×
Unix & Linux Stack Exchange is a question and answer site for
users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
|
If the flash has a filesystem on it and you just want to open a file but bypass the cache for IO to that file, then open it with the O_DIRECT flag. If it has no filesystem on it, then you just open the block device directly. |
|||
|
|
|
I think you want the O_DIRECT flag to open(). Be aware that it may not work as expected on the filesystem on your flash device. Also, I am assuming you are using a filesystem, and not reading a device file. |
|||
|
|