Merge "ueventd: add no_fnm_pathname option"
diff --git a/init/README.ueventd.md b/init/README.ueventd.md
index 97fb515..2a76620 100644
--- a/init/README.ueventd.md
+++ b/init/README.ueventd.md
@@ -13,6 +13,16 @@
uevent_socket_rcvbuf_size 16M
Sets the uevent socket rcvbuf_size to 16 megabytes.
+## Importing configuration files
+--------------------------------
+Ueventd reads /system/etc/ueventd.rc, all other files are imported via the `import` command, which
+takes the format of
+
+ import <path>
+This command parses an ueventd config file, extending the current configuration. If _path_ is a
+directory, each file in the directory is parsed as a config file. It is not recursive, nested
+directories will not be parsed. Imported files are parsed after the current file has been parsed.
+
## /dev
----
Ueventd listens to the kernel uevent sockets and creates/deletes nodes in `/dev` based on the
diff --git a/init/devices.cpp b/init/devices.cpp
index a7c80c1..ce6298a 100644
--- a/init/devices.cpp
+++ b/init/devices.cpp
@@ -468,9 +468,10 @@
}
void DeviceHandler::HandleUevent(const Uevent& uevent) {
- if (uevent.action == "add" || uevent.action == "change" || uevent.action == "online") {
- FixupSysPermissions(uevent.path, uevent.subsystem);
- }
+ if (uevent.action == "add" || uevent.action == "change" ||
+ uevent.action == "bind" || uevent.action == "online") {
+ FixupSysPermissions(uevent.path, uevent.subsystem);
+ }
// if it's not a /dev device, nothing to do
if (uevent.major < 0 || uevent.minor < 0) return;
diff --git a/init/ueventd.cpp b/init/ueventd.cpp
index 54659c5..923d769 100644
--- a/init/ueventd.cpp
+++ b/init/ueventd.cpp
@@ -283,12 +283,7 @@
std::vector<std::unique_ptr<UeventHandler>> uevent_handlers;
- // Keep the current product name base configuration so we remain backwards compatible and
- // allow it to override everything.
- auto hardware = android::base::GetProperty("ro.hardware", "");
-
- auto ueventd_configuration = ParseConfig({"/system/etc/ueventd.rc", "/vendor/ueventd.rc",
- "/odm/ueventd.rc", "/ueventd." + hardware + ".rc"});
+ auto ueventd_configuration = ParseConfig("/system/etc/ueventd.rc");
uevent_handlers.emplace_back(std::make_unique<DeviceHandler>(
std::move(ueventd_configuration.dev_permissions),
diff --git a/init/ueventd_parser.cpp b/init/ueventd_parser.cpp
index 3578957..2605158 100644
--- a/init/ueventd_parser.cpp
+++ b/init/ueventd_parser.cpp
@@ -21,6 +21,7 @@
#include <android-base/parseint.h>
+#include "import_parser.h"
#include "keyword_map.h"
#include "parser.h"
@@ -229,10 +230,11 @@
return {};
}
-UeventdConfiguration ParseConfig(const std::vector<std::string>& configs) {
+UeventdConfiguration ParseConfig(const std::string& config) {
Parser parser;
UeventdConfiguration ueventd_configuration;
+ parser.AddSectionParser("import", std::make_unique<ImportParser>(&parser));
parser.AddSectionParser("subsystem",
std::make_unique<SubsystemParser>(&ueventd_configuration.subsystems));
@@ -258,9 +260,7 @@
std::bind(ParseEnabledDisabledLine, _1,
&ueventd_configuration.enable_parallel_restorecon));
- for (const auto& config : configs) {
- parser.ParseConfig(config);
- }
+ parser.ParseConfig(config);
return ueventd_configuration;
}
diff --git a/init/ueventd_parser.h b/init/ueventd_parser.h
index eaafa5a..2672626 100644
--- a/init/ueventd_parser.h
+++ b/init/ueventd_parser.h
@@ -36,7 +36,7 @@
bool enable_parallel_restorecon = false;
};
-UeventdConfiguration ParseConfig(const std::vector<std::string>& configs);
+UeventdConfiguration ParseConfig(const std::string& config);
} // namespace init
} // namespace android
diff --git a/rootdir/ueventd.rc b/rootdir/ueventd.rc
index 1994bdb..42229bd 100644
--- a/rootdir/ueventd.rc
+++ b/rootdir/ueventd.rc
@@ -1,3 +1,7 @@
+import /vendor/ueventd.rc
+import /odm/ueventd.rc
+import /ueventd.{ro.hardware}.rc
+
firmware_directories /etc/firmware/ /odm/firmware/ /vendor/firmware/ /firmware/image/
uevent_socket_rcvbuf_size 16M