Merge changes Ice594cce,I9a87f988

* changes:
  init: Fix ordering of second-stage snapuserd transition.
  init: Pass a uevent regen callback to libsnapshot.
This commit is contained in:
David Anderson 2020-11-23 18:24:38 +00:00 committed by Gerrit Code Review
commit d7f31801c0
4 changed files with 13 additions and 4 deletions

View file

@ -40,8 +40,8 @@ bool BlockDevInitializer::InitDeviceMapper() {
return InitMiscDevice("device-mapper");
}
bool BlockDevInitializer::InitDmUser() {
return InitMiscDevice("dm-user");
bool BlockDevInitializer::InitDmUser(const std::string& name) {
return InitMiscDevice("dm-user!" + name);
}
bool BlockDevInitializer::InitMiscDevice(const std::string& name) {

View file

@ -27,7 +27,7 @@ class BlockDevInitializer final {
BlockDevInitializer();
bool InitDeviceMapper();
bool InitDmUser();
bool InitDmUser(const std::string& name);
bool InitDevices(std::set<std::string> devices);
bool InitDmDevice(const std::string& device);

View file

@ -343,6 +343,15 @@ bool FirstStageMount::CreateLogicalPartitions() {
if (!InitRequiredDevices({"userdata"})) {
return false;
}
sm->SetUeventRegenCallback([this](const std::string& device) -> bool {
if (android::base::StartsWith(device, "/dev/block/dm-")) {
return block_dev_init_.InitDmDevice(device);
}
if (android::base::StartsWith(device, "/dev/dm-user/")) {
return block_dev_init_.InitDmUser(android::base::Basename(device));
}
return block_dev_init_.InitDevices({device});
});
return sm->CreateLogicalAndSnapshotPartitions(super_path_);
}
}

View file

@ -875,13 +875,13 @@ int SecondStageMain(int argc, char** argv) {
SetProperty(gsi::kGsiInstalledProp, is_installed);
am.QueueBuiltinAction(SetupCgroupsAction, "SetupCgroups");
am.QueueBuiltinAction(TransitionSnapuserdAction, "TransitionSnapuserd");
am.QueueBuiltinAction(SetKptrRestrictAction, "SetKptrRestrict");
am.QueueBuiltinAction(TestPerfEventSelinuxAction, "TestPerfEventSelinux");
am.QueueEventTrigger("early-init");
// Queue an action that waits for coldboot done so we know ueventd has set up all of /dev...
am.QueueBuiltinAction(wait_for_coldboot_done_action, "wait_for_coldboot_done");
am.QueueBuiltinAction(TransitionSnapuserdAction, "TransitionSnapuserd");
// ... so that we can start queuing up actions that require stuff from /dev.
am.QueueBuiltinAction(MixHwrngIntoLinuxRngAction, "MixHwrngIntoLinuxRng");
am.QueueBuiltinAction(SetMmapRndBitsAction, "SetMmapRndBits");