Results 1 to 1 of 1
Hi.
I'm writing an application which performs read operations from a device that is connected to the linux machine via USB.
Here is a code sample:
-----------------------
#define BLOCK_TO_READ 2048
...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-10-2006 #1Just Joined!
- Join Date
- Aug 2006
- Posts
- 1
Cached read problem
Hi.
I'm writing an application which performs read operations from a device that is connected to the linux machine via USB.
Here is a code sample:
-----------------------
#define BLOCK_TO_READ 2048
fd = open("/dev/sdb", O_RDWR | O_SYNC);
lseek(fd, BLOCK_TO_READ * 512, SEEK_SET);
read(fd, buffer, 512);
-----------------------
BLOCK_TO_READ is constant, but can be set to any value (2048 is just an arbitrary value).
Also, I'm reading 512 byte blocks.
The problem is the device can change the block value that is sent to the linux machine internally and here lies the problem.
The read is cached and so I'm reading the same value over and over again although it has changed.
Is there any way to force non caching?


Reply With Quote
