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

Commit fa528ccc authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

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

parents 244a6306 46afe22f
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,