Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32f281d7 authored by David Anderson's avatar David Anderson
Browse files

init: Pass a uevent regen callback to libsnapshot.

In first-stage init, libsnapshot needs to know how to wait for device
paths, since ueventd isn't running yet. We do this by passing a callback
wrapping BlockDevInitializer.

Bug: 173476209
Test: device boots into first-stage init after full VABC ota
Change-Id: I9a87f98824e65a9379cb0b99c001e28cccd9d205
parent 231cfc4f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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);

+9 −0
Original line number Diff line number Diff line
@@ -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_);
        }
    }