I am trying to read a file with O_DIRECT
flag, from native code. I use the _SC_PAGESIZE
to align the buffer and I read in chunks of 4KB. When I read the file from internal storage, it works fine. However, when I read from external, emulated storage (on my Sone Xperia M), read returns EINVAL
. What could be the problem? Does alignment change by file system? Should I do a different alignment for the second partition?
Asked
Active
Viewed 320 times
2

Maheera Jazi - new account -
- 287
- 3
- 12

drgr
- 43
- 8
-
For what purpose are you using the `O_DIRECT` flag ? (I mean, what is the use-case requiring such a solution). Also, what version of Android are you running ? (It seems that this flag has been disabled in Kitkat https://code.google.com/p/android/issues/detail?id=67406). – Halim Qarroum Jan 19 '15 at 08:04
-
I want to bypass the caching. Also, I am running on 4.3. It makes it more strange when the code works for one partition but not the other. – drgr Jan 19 '15 at 08:29
-
Bypassing the cache is the solution, not the use-case. What is the *end* use-cache of bypassing the cache ? – Halim Qarroum Jan 19 '15 at 08:31