ueventd: Put dm-user devices in a folder
When a device-mapper table contains a "user" entry, a corresponding dm-user misc control device is created. The devices are put into a separate folder by default, which currently confuses ueventd, and we wind up with paths like: /dev/dm-user!blah Special case these devices so they wind up as: /dev/dm-user/blah Test: dmctl create blah user 0 100 test-device /dev/dm-user/test-device exists Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com> Change-Id: I313db07c3400f14f3ed0ffa20fdac2ac3e34b6d3
This commit is contained in:
parent
fe1eba0056
commit
515a5bdde0
|
@ -22,6 +22,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
@ -439,6 +440,13 @@ void DeviceHandler::HandleDevice(const std::string& action, const std::string& d
|
|||
}
|
||||
}
|
||||
unlink(devpath.c_str());
|
||||
|
||||
if (android::base::StartsWith(devpath, "/dev/dm-user/")) {
|
||||
std::error_code ec;
|
||||
if (std::filesystem::is_empty("/dev/dm-user/", ec)) {
|
||||
rmdir("/dev/dm-user");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -496,6 +504,8 @@ void DeviceHandler::HandleUevent(const Uevent& uevent) {
|
|||
} else if (StartsWith(uevent.subsystem, "usb")) {
|
||||
// ignore other USB events
|
||||
return;
|
||||
} else if (uevent.subsystem == "misc" && StartsWith(uevent.device_name, "dm-user/")) {
|
||||
devpath = "/dev/dm-user/" + uevent.device_name.substr(8);
|
||||
} else {
|
||||
devpath = "/dev/" + Basename(uevent.path);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue