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

Commit 2bf55942 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "init: Avoid extra string copies when finding devices by using const...

Merge "init: Avoid extra string copies when finding devices by using const refs" into main am: fa528ccc

Original change: https://android-review.googlesource.com/c/platform/system/core/+/3342430



Change-Id: I48357c43e2aeed627af60a6ef7be4ec40470416e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 886b9483 fa528ccc
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -307,7 +307,8 @@ bool DeviceHandler::FindSubsystemDevice(std::string path, std::string* device_pa
    return false;
}

bool DeviceHandler::FindPlatformDevice(std::string path, std::string* platform_device_path) const {
bool DeviceHandler::FindPlatformDevice(const std::string& path,
                                       std::string* platform_device_path) const {
    const std::set<std::string> subsystem_paths = {
            sysfs_mount_point_ + "/bus/platform",
            sysfs_mount_point_ + "/bus/amba",
@@ -316,7 +317,7 @@ bool DeviceHandler::FindPlatformDevice(std::string path, std::string* platform_d
    return FindSubsystemDevice(path, platform_device_path, subsystem_paths);
}

bool DeviceHandler::FindMmcDevice(std::string path, std::string* mmc_device_path) const {
bool DeviceHandler::FindMmcDevice(const std::string& path, std::string* mmc_device_path) const {
    const std::set<std::string> subsystem_paths = {
            sysfs_mount_point_ + "/bus/mmc",
    };
@@ -324,7 +325,7 @@ bool DeviceHandler::FindMmcDevice(std::string path, std::string* mmc_device_path
    return FindSubsystemDevice(path, mmc_device_path, subsystem_paths);
}

bool DeviceHandler::FindScsiDevice(std::string path, std::string* scsi_device_path) const {
bool DeviceHandler::FindScsiDevice(const std::string& path, std::string* scsi_device_path) const {
    const std::set<std::string> subsystem_paths = {
            sysfs_mount_point_ + "/bus/scsi",
    };
+3 −3
Original line number Diff line number Diff line
@@ -149,9 +149,9 @@ class DeviceHandler : public UeventHandler {
    BlockDeviceInfo GetBlockDeviceInfo(const std::string& uevent_path) const;
    bool FindSubsystemDevice(std::string path, std::string* device_path,
                             const std::set<std::string>& subsystem_paths) const;
    bool FindPlatformDevice(std::string path, std::string* platform_device_path) const;
    bool FindMmcDevice(std::string path, std::string* mmc_device_path) const;
    bool FindScsiDevice(std::string path, std::string* scsi_device_path) const;
    bool FindPlatformDevice(const std::string& path, std::string* platform_device_path) const;
    bool FindMmcDevice(const std::string& path, std::string* mmc_device_path) const;
    bool FindScsiDevice(const std::string& path, std::string* scsi_device_path) const;
    std::tuple<mode_t, uid_t, gid_t> GetDevicePermissions(
        const std::string& path, const std::vector<std::string>& links) const;
    void MakeDevice(const std::string& path, bool block, int major, int minor,