init: Reorder GetBlockDeviceSymlinks() so FindDmDevice() is first
By moving FindDmDevice() it's easier to unify the code with the IsBootDevice() function. In this case the order doesn't matter since anything with the uevent path "/devices/virtual/block/dm-" (the only devices FindDmDevice() looks at) won't match any of the other sections of the if/then/else test. Bug: 316324155 Test: Build & boot Change-Id: I819eb60aa5077f0eb2c2f2783b152e43a52ba8b7
This commit is contained in:
parent
e53e50e3fa
commit
9f760f8d41
1 changed files with 7 additions and 7 deletions
|
|
@ -376,7 +376,13 @@ std::vector<std::string> DeviceHandler::GetBlockDeviceSymlinks(const Uevent& uev
|
|||
std::string partition;
|
||||
std::string uuid;
|
||||
|
||||
if (FindPlatformDevice(uevent.path, &device)) {
|
||||
if (FindDmDevice(uevent, &partition, &uuid)) {
|
||||
std::vector<std::string> symlinks = {"/dev/block/mapper/" + partition};
|
||||
if (!uuid.empty()) {
|
||||
symlinks.emplace_back("/dev/block/mapper/by-uuid/" + uuid);
|
||||
}
|
||||
return symlinks;
|
||||
} else 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/";
|
||||
|
|
@ -392,12 +398,6 @@ std::vector<std::string> DeviceHandler::GetBlockDeviceSymlinks(const Uevent& uev
|
|||
type = "pci";
|
||||
} else if (FindVbdDevicePrefix(uevent.path, &device)) {
|
||||
type = "vbd";
|
||||
} else if (FindDmDevice(uevent, &partition, &uuid)) {
|
||||
std::vector<std::string> symlinks = {"/dev/block/mapper/" + partition};
|
||||
if (!uuid.empty()) {
|
||||
symlinks.emplace_back("/dev/block/mapper/by-uuid/" + uuid);
|
||||
}
|
||||
return symlinks;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue