Loading init/block_dev_initializer.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -98,7 +98,11 @@ ListenerAction BlockDevInitializer::HandleUevent(const Uevent& uevent, LOG(VERBOSE) << __PRETTY_FUNCTION__ << ": found partition: " << name; // Remove partition from the list only if it was found on boot device if (device_handler_->IsBootDevice(uevent)) { devices->erase(iter); } device_handler_->HandleUevent(uevent); return devices->empty() ? ListenerAction::kStop : ListenerAction::kContinue; } Loading init/devices.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,28 @@ void SysfsPermissions::SetPermissions(const std::string& path) const { } } bool DeviceHandler::IsBootDevice(const Uevent& uevent) const { std::string device; if (FindPlatformDevice(uevent.path, &device)) { // Skip /devices/platform or /devices/ if present static constexpr std::string_view devices_platform_prefix = "/devices/platform/"; static constexpr std::string_view devices_prefix = "/devices/"; if (StartsWith(device, devices_platform_prefix)) { device = device.substr(devices_platform_prefix.length()); } else if (StartsWith(device, devices_prefix)) { device = device.substr(devices_prefix.length()); } } else if (FindPciDevicePrefix(uevent.path, &device)) { } else if (FindVbdDevicePrefix(uevent.path, &device)) { } else { return false; } return boot_devices_.find(device) != boot_devices_.end(); } std::string DeviceHandler::GetPartitionNameForDevice(const std::string& query_device) { static const auto partition_map = [] { std::vector<std::pair<std::string, std::string>> partition_map; Loading init/devices.h +1 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ class DeviceHandler : public UeventHandler { // `androidboot.partition_map=vdb,metadata;vdc,userdata` maps `vdb` to `metadata` and `vdc` to // `userdata`. static std::string GetPartitionNameForDevice(const std::string& device); bool IsBootDevice(const Uevent& uevent) const; private: void ColdbootDone() override; Loading Loading
init/block_dev_initializer.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -98,7 +98,11 @@ ListenerAction BlockDevInitializer::HandleUevent(const Uevent& uevent, LOG(VERBOSE) << __PRETTY_FUNCTION__ << ": found partition: " << name; // Remove partition from the list only if it was found on boot device if (device_handler_->IsBootDevice(uevent)) { devices->erase(iter); } device_handler_->HandleUevent(uevent); return devices->empty() ? ListenerAction::kStop : ListenerAction::kContinue; } Loading
init/devices.cpp +22 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,28 @@ void SysfsPermissions::SetPermissions(const std::string& path) const { } } bool DeviceHandler::IsBootDevice(const Uevent& uevent) const { std::string device; if (FindPlatformDevice(uevent.path, &device)) { // Skip /devices/platform or /devices/ if present static constexpr std::string_view devices_platform_prefix = "/devices/platform/"; static constexpr std::string_view devices_prefix = "/devices/"; if (StartsWith(device, devices_platform_prefix)) { device = device.substr(devices_platform_prefix.length()); } else if (StartsWith(device, devices_prefix)) { device = device.substr(devices_prefix.length()); } } else if (FindPciDevicePrefix(uevent.path, &device)) { } else if (FindVbdDevicePrefix(uevent.path, &device)) { } else { return false; } return boot_devices_.find(device) != boot_devices_.end(); } std::string DeviceHandler::GetPartitionNameForDevice(const std::string& query_device) { static const auto partition_map = [] { std::vector<std::pair<std::string, std::string>> partition_map; Loading
init/devices.h +1 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ class DeviceHandler : public UeventHandler { // `androidboot.partition_map=vdb,metadata;vdc,userdata` maps `vdb` to `metadata` and `vdc` to // `userdata`. static std::string GetPartitionNameForDevice(const std::string& device); bool IsBootDevice(const Uevent& uevent) const; private: void ColdbootDone() override; Loading