Android by-name机制

init: create symlinks to block device nodes

 

eMMC block device names may change based on the detection order of

the eMMC device and any other SD bus devices, such as a removable SD

card.

 

This patch adds support to init for:

* Symlinks to block devices. When a block device uevent is

processed, if it starts with "/devices/platform", the platform

driver name is parsed out, and symlinks to the block device are

created in /dev/block/platform/<platform driver>/

* Symlinks based on partition name and number. If the uevent for

a block device contains information on the partition name or

number, symlinks are created under

/dev/block/platform/<platform driver>/by-num/p<partition>

and

/dev/block/platform/<platform driver>/by-name/<partition name>

 

init.rc can then use a device path like the following to mount an

eMMC device:

/dev/block/platform/<platform>/by-name/system /system ro

 

Change-Id: Id11bb7cdf1e2ada7752a5bd671cbf87237b34ae2

 

详细的patch文件请见:

https://android.googlesource.com/platform/system/core/+/b0ab94b7d5a888f0b6920b156e5c6a075fa0741a%5E%21/#F2

 

因为uevent文件是init的一个符号链接,主要原理就是uevent事件来了之后进行判断,是否是/devices/platform,是的话则分析创建符号链接

+ if (!strncmp(uevent->path, "/devices/platform/", 18))

+ links = parse_platform_block_device(uevent);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值