08.15.2011 01:30 PM
We've run into a problem with build 4.5.91 on the Motorola Atrix. Our product uses native code to open a file on the SD Card.
We need to open the file with the O_DIRECT flag so that the OS does not cache our reads and it writes directly through to the filesystem. The SD card that's mounted is a really smart sdcard and is able to respond back to the commands we're writing.
This has been working perfectly with older build but after upgrading to the 4.5.91 build we're getting EINVAL (errno ==22) when we atempt to open a file. I've tracked this down to the use of the O_DIRECT flag. Once the flag is removed we're able to open the file but we need the ability to write through directly and not have the data cached so our reads get fresh data from the sd card.
hFile = open("/sdcard/external_sd/foo.txt", O_RDWR | O_CREAT |O_SYNC|O_NDELAY|O_DIRECT); // this returns -1 and errno is set to 22
hFile = open("/sdcard/external_sd/foo.txt", O_RDWR | O_CREAT |O_SYNC| O_NDELAY); // this returns a valid file handle
Can someone shed some light on what's happend and how we could work around this change.
- of 1