Find a zoned partition automatically
Since we cannot create a gpt table on zoned LU, we cannot make a generic symlink
from it. Instead, let's make it by uevent, "/dev/block/by-name/zoned_device".
Note that, we support only one zoned device in the system.
Bug: 265180564
Change-Id: Ie62b0fd68b77e3e43cf0f5c5cad9503150174271
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
diff --git a/init/devices.cpp b/init/devices.cpp
index 8bc6e52..39442a0 100644
--- a/init/devices.cpp
+++ b/init/devices.cpp
@@ -431,6 +431,12 @@
}
}
+ std::string model;
+ if (ReadFileToString("/sys/class/block/" + uevent.device_name + "/queue/zoned", &model) &&
+ !StartsWith(model, "none")) {
+ links.emplace_back("/dev/block/by-name/zoned_device");
+ }
+
auto last_slash = uevent.path.rfind('/');
links.emplace_back(link_path + "/" + uevent.path.substr(last_slash + 1));