Android6.0 storage目錄sd卡存儲的路徑創建
前言:
之前一直很疑惑,android6.0上sd卡掛載storage下的sd卡路徑是什么時候創建的。
因為掛載sd卡的PublicVolume,負責創建mount路徑,然后掛載。
接著會創建幾個fuse路徑,如下:
1./mnt/runtime/default/
2./mnt/runtime/read/
3./mnt/runtime/write/
然后會把這個mount的路徑fuse到上面這幾個路徑。
但是一直沒有storage/下sd卡路徑的創建,而在PublicVolume下doMount函數也只有設置mPath為storage/....確沒有創建這個路徑。
后來終于在init.rc中發現下面這句
on post-fs start logd #add for amt chmod 0755 /amt # once everything is setup, no need to modify / mount rootfs rootfs / ro remount # Mount shared so changes propagate into child namespaces mount rootfs rootfs / shared rec # Mount default storage into root namespace mount none /mnt/runtime/default /storage slave bind rec
它把/mnt/runtime/default mount到storage下了,這樣問題就迎刃而解了。
只是為什么要這么做比較奇怪,一般總是會創建目錄,或者創建軟鏈接。像這種方式比較少,所以也沒往這地方想。導致找了很長時間才發現。
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
新聞熱點
疑難解答