Commit graph

3 commits

Author SHA1 Message Date
Tom Cherry
9949ec5f56 init: replace Result<> with expected<>
Android-base has an implementation of the future std::expected<>.
This provides the same baseline functionality as Result<>, so use it
instead of our own version.

Bug: 132145659
Test: boot, init unit tests
Change-Id: I11e61bcb5719b262a6420483ed51a762826a9e23
2019-05-22 15:23:01 -07:00
Mark Salyzyn
793f4b503e init: mount_handler: system-as-root (legacy)
On marlin, dev.mnt.blk.root is empty.  Issue is shared for all
devices that are system-as-root.

/dev/root /proc/mounts entry exists before the associated block device
is instantiated by ueventd.  As a result when the device shows up the
root mount is updated late when the next mount inotify trigger occurs,
delay which we will accept.  But the property entries are added before
removed in the loop which causes the ultimate property entry for root
to report empty. Add /dev/block/dm-0, remove /dev/root, for property
dev.mnt.blk.root.

Fix is to change to Remove before Adding.  Remove /dev/root, then add
/dev/block/dm-0.

On system-as-root as well, can not just use fstab.  Determine if a
dm-verity reference is wrapped around system and use that instead.

Add some additional filtration of loop and APEX mounts to reduce
property noise.

Fix issue with creating the std:string line holder from getline(3).

Test: manual on marlin
Bug: 124072565
Change-Id: Ief2e1a6f559cbcbc87273fc2db35c675bb972f43
2019-03-27 20:50:39 +00:00
Mark Salyzyn
a73ed22cb7 init: add MountHandler property handler
Set properties dev.mnt.blk.<mount_point>=<device_block_class> for mount
and umount operations by setting up an Epoll handler to catch
EPOLLERR or EPOLLPRI signals when /proc/mounts is changed.  Only
update properties associated with block devices.  For the mount
point of /, use the designation of /root instead.

Can use the properties in init rc expansion like:

on property dev.mnt.blk.root=*
    write /sys/block/${dev.mnt.blk.root}/queue/read_ahead_kb ${boot_read_ahead_kb:-2048}

on property dev.mnt.blk.data=*
    write /sys/block/${dev.mnt.blk.data}/queue/read_ahead_kb ${boot_read_ahead_kb:-2048}

on late-fs
    setprop boot_read_ahead_kb 128
    write /sys/block/${dev.mnt.blk.root}/queue/read_ahead_kb ${boot_read_ahead_kb}
    write /sys/block/${dev.mnt.blk.data}/queue/read_ahead_kb ${boot_read_ahead_kb}

Test: boot and inspect getprop results.
Bug: 124072565
Change-Id: I1b8aff44f922ba372cd926de2919c215c40ee874
2019-03-15 11:54:38 -07:00