Merge "ueventd: add the import option from the init parser"
This commit is contained in:
commit
0608e36fb9
5 changed files with 20 additions and 11 deletions
|
@ -13,6 +13,16 @@ For example
|
|||
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
|
||||
|
|
|
@ -283,12 +283,7 @@ int ueventd_main(int argc, char** argv) {
|
|||
|
||||
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),
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <android-base/parseint.h>
|
||||
|
||||
#include "import_parser.h"
|
||||
#include "keyword_map.h"
|
||||
#include "parser.h"
|
||||
|
||||
|
@ -220,10 +221,11 @@ Result<void> SubsystemParser::EndSection() {
|
|||
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));
|
||||
|
||||
|
@ -249,9 +251,7 @@ UeventdConfiguration ParseConfig(const std::vector<std::string>& configs) {
|
|||
std::bind(ParseEnabledDisabledLine, _1,
|
||||
&ueventd_configuration.enable_parallel_restorecon));
|
||||
|
||||
for (const auto& config : configs) {
|
||||
parser.ParseConfig(config);
|
||||
}
|
||||
parser.ParseConfig(config);
|
||||
|
||||
return ueventd_configuration;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ struct UeventdConfiguration {
|
|||
bool enable_parallel_restorecon = false;
|
||||
};
|
||||
|
||||
UeventdConfiguration ParseConfig(const std::vector<std::string>& configs);
|
||||
UeventdConfiguration ParseConfig(const std::string& config);
|
||||
|
||||
} // namespace init
|
||||
} // namespace android
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue