Android 源码分析 - 存储 - Native层

libcutils

        源代码位置:system/core/libcutils。

        其中uevent.c提供对netlink的简单封装。

libsysutils

        源代码位置:system/core/libsysutils。

        提供SocketListener简单封装网络收发;FrameworkListener实现命令行处理框架;NetlinkListener实现NetlinkEvent分发。

libfs_mgr

        源代码位于:system/core/fs_mgr。

asec

Stage the mounting of media to hide the ASEC imagefile directory

  In order to protect the '/android_secure' directory on VFAT removable media from being mucked with by 3rd party applications on the device, we hide the directory with a read-only, zero-sized tmpfs mounted on-top. A reference to the hidden directory is kept by a bind-mount which is mounted at a location which only root can access.

Staging consists of:

  1. Mount checked media at a secure location (/mnt/secure/staging)

  2. Ensure /android_secure exists on the media, (creating if it doesnt)

  3. Bind-mount /mnt/secure/staging/android_secure -> /mnt/secure/asec

     (where only root can access it)

  4. Mount an RDONLY zero-sized tmpfs over /mnt/secure/staging/android_sec ure

  5. Atomically move /mnt/secure/staging to the publicly accessable storage

     directory (/mnt/sdcard)

        asec文件目录:

  1. /data/app-asec/<id>.asec
  2. /mnt/secure/asec/<id>.asec

        asec挂载父目录:

  1. /mnt/asec/

sdcard

        源代码位于:system/core/sdcard。

vold

        源代码位于:system/vold。

Fat处理vfat格式,/system/bin/fsck_msdos、/system/bin/newfs_msdos。

Ext4处理ext4格式,/system/bin/make_ext4fs。

        类型说明:

类名

说明

Devmapper

处理逻辑设备映射

Loop

处理循环设备

Process

检查进程打开文件是否在某个分卷上

NetlinkManager

创建netlink socket和NetlinkHandler

NetlinkHandler

接收UEvent,过滤出block子系统事件,转发给VolumeManager处理

Volume

代表分卷,基类。处理Fat挂载、格式化

DirectVolume

代表从fstab读取的分卷,处理UEvent事件。根据DEVPATH判断是否由读取实例处理

VolumeManager

管理Volume集合,分发命令和UEvent事件到合适的Volume,根据挂载点或者label查找

处理obb、asec虚拟设备的创建、挂载

CommandListener

继承FrameworkListener,打开”vold” UNIX套接字监听,处理客户端命令,以及广播事件到客户端

        CommandListener的命令:

命令

模块

说明

dump

当前状态

volume

分卷管理

storage

存储管理

asec

asec虚拟设备

obb

obb虚拟设备

xwarp

cryptfs

分卷加密

fstrim

分卷清理

vdc

        源代码位于:system/vold。  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Fighting Horse

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值