ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I notice when I read a file in linux or more easy, if I make "cat file_from_CF", the first time read from compact flash ( light status is blinking ), but if I repeat operation again, light status does not blink (I think its read from a cache or similar) .
Is there any way to force read directly from compact flash??
I have a embedded system and I would like to make a program to read a file every 1 sec to find read problems.
What makes you think the read from cache will be incorrect? A good rule of thumb is to not try to outsmart the filesystem. If the file has been modified since your last read, the filesystem will know, and either read from the block device media, or will have updated the cache accordingly. There may be options available for your filesystem to disable caching. If you think there is a problem is with the block device, you can read and write it directly.
What makes you think the read from cache will be incorrect? A good rule of thumb is to not try to outsmart the filesystem. If the file has been modified since your last read, the filesystem will know, and either read from the block device media, or will have updated the cache accordingly. There may be options available for your filesystem to disable caching. If you think there is a problem is with the block device, you can read and write it directly.
--- rod.
Hello rod,
I dont think the read from cache is incorrect.
I would like to test IDE adapter because sometimes, I have some boards that ide adapter is not soldier correctly, and return me some read problems.
For example, I find some options:
open() with O_DIRECT flag to acces directly to CF, for example.
Is there other way to do it? for example, fopen().
The filesystem will just get in the way. You should not mount the filesystem, and just use the block device (/dev/hdxx) directly in order to diagnose problems. Or, better still, access the hardware directly, either from userspace or with a kernel-mode diagnostic (that you will most likely have to write).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.