我怎么可以用O_DIRECT或O_SYNC外接SD卡采用Android奇巧 [英] How can I use O_DIRECT or O_SYNC on an external SD card with Android KitKat
问题描述
我的一个公司,使包括一个硬件加密引擎的SD存储卡。我们与写入/读取到一个特殊的文件加密模块进行交互。
I work for a company that makes an SD memory card that includes a hardware encryption engine. We interact with the encryption module by writing/reading to a special file.
与奇巧,在 O_DIRECT
标志开始似乎并没有在外部SD卡的支持。如果没有 O_DIRECT或O_SYNC
的支持,操作系统将返回缓存的数据,当我们读取SD卡(通过我们的特殊文件)加密引擎的响应。
Starting with KitKat, the O_DIRECT
flag does not seem to be supported on the external SD card. Without O_DIRECT or O_SYNC
support, the OS will returned cached data when we read the encryption engine's response from the SD card (via our special file).
是否有程序打开永恒的SD卡上的文件,读/写,有两种 O_DIRECT或O_SYNC
?
Is there a procedure to open a file on the eternal SD card, read/write, with either O_DIRECT or O_SYNC
?
推荐答案
如果你有root访问到您的手机,你可以写一个1到的/ proc / sys目录/ VM / drop_caches清除页面缓存(见的 http://linux-mm.org/Drop_Caches )。该命令之后的下一个读出的SD卡将返回非缓存的内容
If you have root-access to your phone you can write a 1 to /proc/sys/vm/drop_caches to clear the page cache (see http://linux-mm.org/Drop_Caches). After that command the next read on the sdcard will return the non-cached data.
有关股权设备(如您没有权限的/ proc / sys目录/ VM / drop_caches)有一个在AOSP一个问题(你可以加注星标): 的https://$c$c.google.com/p /安卓/问题/详细信息?ID = 67406
For stock-devices (where you have no permission to /proc/sys/vm/drop_caches) there is a issue in the AOSP (you may star it): https://code.google.com/p/android/issues/detail?id=67406
这篇关于我怎么可以用O_DIRECT或O_SYNC外接SD卡采用Android奇巧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!