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文件目录:
- /data/app-asec/<id>.asec
- /mnt/secure/asec/<id>.asec
asec挂载父目录:
- /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。
本文解析了Linux内核中libcutils的netlink封装,libsysutils的SocketListener与NetlinkListener,以及Vold的VFS管理,涉及asec安全机制和volody处理多种文件系统格式。
1128

被折叠的 条评论
为什么被折叠?



