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/devices_test.cpp b/init/devices_test.cpp
index 5be0d88..b6b4b82 100644
--- a/init/devices_test.cpp
+++ b/init/devices_test.cpp
@@ -127,7 +127,7 @@
const char* platform_device = "/devices/soc.0/f9824900.sdhci";
uevent uevent = {
.path = "/devices/soc.0/f9824900.sdhci/mmc_host/mmc0/mmc0:0001/block/mmcblk0",
- .partition_name = nullptr,
+ .partition_name = "",
.partition_num = -1,
};
std::vector<std::string> expected_result{"/dev/block/platform/soc.0/f9824900.sdhci/mmcblk0"};
@@ -156,7 +156,7 @@
const char* platform_device = "/devices/soc.0/f9824900.sdhci";
uevent uevent = {
.path = "/devices/soc.0/f9824900.sdhci/mmc_host/mmc0/mmc0:0001/block/mmcblk0p1",
- .partition_name = nullptr,
+ .partition_name = "",
.partition_num = 1,
};
std::vector<std::string> expected_result{
@@ -185,9 +185,7 @@
TEST(devices, get_block_device_symlinks_success_pci) {
const char* platform_device = "/devices/do/not/match";
uevent uevent = {
- .path = "/devices/pci0000:00/0000:00:1f.2/mmcblk0",
- .partition_name = nullptr,
- .partition_num = -1,
+ .path = "/devices/pci0000:00/0000:00:1f.2/mmcblk0", .partition_name = "", .partition_num = -1,
};
std::vector<std::string> expected_result{"/dev/block/pci/pci0000:00/0000:00:1f.2/mmcblk0"};
@@ -197,7 +195,7 @@
TEST(devices, get_block_device_symlinks_pci_bad_format) {
const char* platform_device = "/devices/do/not/match";
uevent uevent = {
- .path = "/devices/pci//mmcblk0", .partition_name = nullptr, .partition_num = -1,
+ .path = "/devices/pci//mmcblk0", .partition_name = "", .partition_num = -1,
};
std::vector<std::string> expected_result{};
@@ -207,7 +205,7 @@
TEST(devices, get_block_device_symlinks_success_vbd) {
const char* platform_device = "/devices/do/not/match";
uevent uevent = {
- .path = "/devices/vbd-1234/mmcblk0", .partition_name = nullptr, .partition_num = -1,
+ .path = "/devices/vbd-1234/mmcblk0", .partition_name = "", .partition_num = -1,
};
std::vector<std::string> expected_result{"/dev/block/vbd/1234/mmcblk0"};
@@ -217,7 +215,7 @@
TEST(devices, get_block_device_symlinks_vbd_bad_format) {
const char* platform_device = "/devices/do/not/match";
uevent uevent = {
- .path = "/devices/vbd-/mmcblk0", .partition_name = nullptr, .partition_num = -1,
+ .path = "/devices/vbd-/mmcblk0", .partition_name = "", .partition_num = -1,
};
std::vector<std::string> expected_result{};
@@ -228,7 +226,7 @@
const char* platform_device = "/devices/soc.0/f9824900.sdhci";
uevent uevent = {
.path = "/devices/soc.0/not_the_device/mmc_host/mmc0/mmc0:0001/block/mmcblk0p1",
- .partition_name = nullptr,
+ .partition_name = "",
.partition_num = -1,
};
std::vector<std::string> expected_result;