Revert "ueventd: remove PlatformDeviceList"
Bug: 62864413
This reverts commit c94ce7b130979317d9523ba0d175f0ad369fb1c4.
Change-Id: I014360251e5cda89c87adfec46d8b1e5000f3a9c
diff --git a/init/devices.h b/init/devices.h
index 362c38c..09a0ce3 100644
--- a/init/devices.h
+++ b/init/devices.h
@@ -93,6 +93,20 @@
DevnameSource devname_source_;
};
+class PlatformDeviceList {
+ public:
+ void Add(const std::string& path) { platform_devices_.emplace_back(path); }
+ void Remove(const std::string& path) {
+ auto it = std::find(platform_devices_.begin(), platform_devices_.end(), path);
+ if (it != platform_devices_.end()) platform_devices_.erase(it);
+ }
+ bool Find(const std::string& path, std::string* out_path) const;
+ auto size() const { return platform_devices_.size(); }
+
+ private:
+ std::vector<std::string> platform_devices_;
+};
+
class DeviceHandler {
public:
friend class DeviceHandlerTester;
@@ -105,11 +119,16 @@
void HandleDeviceEvent(const Uevent& uevent);
+ void FixupSysPermissions(const std::string& upath, const std::string& subsystem) const;
+
+ void HandlePlatformDeviceEvent(const Uevent& uevent);
+ void HandleBlockDeviceEvent(const Uevent& uevent) const;
+ void HandleGenericDeviceEvent(const Uevent& uevent) const;
+
std::vector<std::string> GetBlockDeviceSymlinks(const Uevent& uevent) const;
void set_skip_restorecon(bool value) { skip_restorecon_ = value; }
private:
- bool FindPlatformDevice(std::string path, std::string* platform_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, int block, int major, int minor,
@@ -117,17 +136,13 @@
std::vector<std::string> GetCharacterDeviceSymlinks(const Uevent& uevent) const;
void HandleDevice(const std::string& action, const std::string& devpath, int block, int major,
int minor, const std::vector<std::string>& links) const;
- void FixupSysPermissions(const std::string& upath, const std::string& subsystem) const;
-
- void HandleBlockDeviceEvent(const Uevent& uevent) const;
- void HandleGenericDeviceEvent(const Uevent& uevent) const;
std::vector<Permissions> dev_permissions_;
std::vector<SysfsPermissions> sysfs_permissions_;
std::vector<Subsystem> subsystems_;
+ PlatformDeviceList platform_devices_;
selabel_handle* sehandle_;
bool skip_restorecon_;
- std::string sysfs_mount_point_;
};
// Exposed for testing