ueventd: replace char* with std::string in struct uevent
Bug: 36250207
Test: Boot bullhead
Test: Boot sailfish, observe no boot time regression
Test: init unit tests
Change-Id: Ib82833bea56bdafbe1d7a045126aaa91a8725d98
diff --git a/init/init.cpp b/init/init.cpp
index 6c09c99..6c1c541 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -958,7 +958,7 @@
const std::string syspath = "/sys/block/" + device_name;
device_init(syspath.c_str(), [&](uevent* uevent) -> coldboot_action_t {
- if (uevent->device_name && device_name == uevent->device_name) {
+ if (uevent->device_name == device_name) {
LOG(VERBOSE) << "early_mount: creating dm-verity device : " << dm_device;
return COLDBOOT_STOP;
}
@@ -1055,21 +1055,17 @@
return;
}
device_init(nullptr, [=](uevent* uevent) -> coldboot_action_t {
- if (!strncmp(uevent->subsystem, "firmware", 8)) {
- return COLDBOOT_CONTINUE;
- }
-
// we need platform devices to create symlinks
- if (!strncmp(uevent->subsystem, "platform", 8)) {
+ if (uevent->subsystem == "platform") {
return COLDBOOT_CREATE;
}
// Ignore everything that is not a block device
- if (strncmp(uevent->subsystem, "block", 5)) {
+ if (uevent->subsystem != "block") {
return COLDBOOT_CONTINUE;
}
- if (uevent->partition_name) {
+ if (!uevent->partition_name.empty()) {
// match partition names to create device nodes for partitions
// both partition_names and uevent->partition_name have A/B suffix when A/B is used
auto iter = partition_names->find(uevent->partition_name);