Merge "[libutils] Modernize codebase by replacing NULL with nullptr"
diff --git a/debuggerd/libdebuggerd/tombstone.cpp b/debuggerd/libdebuggerd/tombstone.cpp
index 433bb46..0b8a936 100644
--- a/debuggerd/libdebuggerd/tombstone.cpp
+++ b/debuggerd/libdebuggerd/tombstone.cpp
@@ -474,7 +474,7 @@
static void dump_log_file(log_t* log, pid_t pid, const char* filename, unsigned int tail) {
bool first = true;
- struct logger_list* logger_list;
+ logger_list* logger_list;
if (!log->should_retrieve_logcat) {
return;
@@ -488,11 +488,9 @@
return;
}
- struct log_msg log_entry;
-
while (true) {
+ log_msg log_entry;
ssize_t actual = android_logger_list_read(logger_list, &log_entry);
- struct logger_entry* entry;
if (actual < 0) {
if (actual == -EINTR) {
@@ -515,8 +513,6 @@
// high-frequency debug diagnostics should just be written to
// the tombstone file.
- entry = &log_entry.entry_v1;
-
if (first) {
_LOG(log, logtype::LOGS, "--------- %slog %s\n",
tail ? "tail end of " : "", filename);
@@ -527,19 +523,8 @@
//
// We want to display it in the same format as "logcat -v threadtime"
// (although in this case the pid is redundant).
- static const char* kPrioChars = "!.VDIWEFS";
- unsigned hdr_size = log_entry.entry.hdr_size;
- if (!hdr_size) {
- hdr_size = sizeof(log_entry.entry_v1);
- }
- if ((hdr_size < sizeof(log_entry.entry_v1)) ||
- (hdr_size > sizeof(log_entry.entry))) {
- continue;
- }
- char* msg = reinterpret_cast<char*>(log_entry.buf) + hdr_size;
-
char timeBuf[32];
- time_t sec = static_cast<time_t>(entry->sec);
+ time_t sec = static_cast<time_t>(log_entry.entry.sec);
struct tm tmBuf;
struct tm* ptm;
ptm = localtime_r(&sec, &tmBuf);
@@ -547,17 +532,23 @@
if (log_entry.id() == LOG_ID_EVENTS) {
if (!g_eventTagMap) {
- g_eventTagMap = android_openEventTagMap(NULL);
+ g_eventTagMap = android_openEventTagMap(nullptr);
}
AndroidLogEntry e;
char buf[512];
- android_log_processBinaryLogBuffer(entry, &e, g_eventTagMap, buf, sizeof(buf));
- _LOG(log, logtype::LOGS, "%s.%03d %5d %5d %c %-8.*s: %s\n",
- timeBuf, entry->nsec / 1000000, entry->pid, entry->tid,
- 'I', (int)e.tagLen, e.tag, e.message);
+ if (android_log_processBinaryLogBuffer(&log_entry.entry_v1, &e, g_eventTagMap, buf,
+ sizeof(buf)) == 0) {
+ _LOG(log, logtype::LOGS, "%s.%03d %5d %5d %c %-8.*s: %s\n", timeBuf,
+ log_entry.entry.nsec / 1000000, log_entry.entry.pid, log_entry.entry.tid, 'I',
+ (int)e.tagLen, e.tag, e.message);
+ }
continue;
}
+ char* msg = log_entry.msg();
+ if (msg == nullptr) {
+ continue;
+ }
unsigned char prio = msg[0];
char* tag = msg + 1;
msg = tag + strlen(tag) + 1;
@@ -568,20 +559,21 @@
*nl-- = '\0';
}
+ static const char* kPrioChars = "!.VDIWEFS";
char prioChar = (prio < strlen(kPrioChars) ? kPrioChars[prio] : '?');
// Look for line breaks ('\n') and display each text line
// on a separate line, prefixed with the header, like logcat does.
do {
nl = strchr(msg, '\n');
- if (nl) {
+ if (nl != nullptr) {
*nl = '\0';
++nl;
}
- _LOG(log, logtype::LOGS, "%s.%03d %5d %5d %c %-8s: %s\n",
- timeBuf, entry->nsec / 1000000, entry->pid, entry->tid,
- prioChar, tag, msg);
+ _LOG(log, logtype::LOGS, "%s.%03d %5d %5d %c %-8s: %s\n", timeBuf,
+ log_entry.entry.nsec / 1000000, log_entry.entry.pid, log_entry.entry.tid, prioChar, tag,
+ msg);
} while ((msg = nl));
}
diff --git a/fastboot/constants.h b/fastboot/constants.h
new file mode 100644
index 0000000..5e7e955
--- /dev/null
+++ b/fastboot/constants.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#define FB_CMD_GETVAR "getvar"
+#define FB_CMD_DOWNLOAD "download"
+#define FB_CMD_UPLOAD "upload"
+#define FB_CMD_VERIFY "verify"
+#define FB_CMD_FLASH "flash"
+#define FB_CMD_ERASE "erase"
+#define FB_CMD_BOOT "boot"
+#define FB_CMD_SET_ACTIVE "set_active"
+#define FB_CMD_CONTINUE "continue"
+#define FB_CMD_REBOOT "reboot"
+#define FB_CMD_SHUTDOWN "shutdown"
+#define FB_CMD_REBOOT_BOOTLOADER "reboot-bootloader"
+#define FB_CMD_POWERDOWN "powerdown"
+
+#define RESPONSE_OKAY "OKAY"
+#define RESPONSE_FAIL "FAIL"
+#define RESPONSE_DATA "DATA"
+#define RESPONSE_INFO "INFO"
+
+#define FB_COMMAND_SZ 64
+#define FB_RESPONSE_SZ 64
+
+#define FB_VAR_VERSION "version"
+#define FB_VAR_VERSION_BOOTLOADER "version-bootloader"
+#define FB_VAR_VERSION_BASEBAND "version-baseband"
+#define FB_VAR_PRODUCT "product"
+#define FB_VAR_SERIALNO "serialno"
+#define FB_VAR_SECURE "secure"
+#define FB_VAR_UNLOCKED "unlocked"
+#define FB_VAR_CURRENT_SLOT "current-slot"
+#define FB_VAR_MAX_DOWNLOAD_SIZE "max-download-size"
+#define FB_VAR_HAS_SLOT "has-slot"
+#define FB_VAR_SLOT_COUNT "slot-count"
+#define FB_VAR_PARTITION_SIZE "partition-size"
diff --git a/fastboot/engine.cpp b/fastboot/engine.cpp
index f271d09..1087573 100644
--- a/fastboot/engine.cpp
+++ b/fastboot/engine.cpp
@@ -42,6 +42,7 @@
#include <android-base/stringprintf.h>
+#include "constants.h"
#include "transport.h"
enum Op {
@@ -79,7 +80,7 @@
static std::vector<std::unique_ptr<Action>> action_list;
bool fb_getvar(Transport* transport, const std::string& key, std::string* value) {
- std::string cmd = "getvar:" + key;
+ std::string cmd = FB_CMD_GETVAR ":" + key;
char buf[FB_RESPONSE_SZ + 1];
memset(buf, 0, sizeof(buf));
@@ -110,12 +111,12 @@
}
void fb_set_active(const std::string& slot) {
- Action& a = queue_action(OP_COMMAND, "set_active:" + slot);
+ Action& a = queue_action(OP_COMMAND, FB_CMD_SET_ACTIVE ":" + slot);
a.msg = "Setting current slot to '" + slot + "'";
}
void fb_queue_erase(const std::string& partition) {
- Action& a = queue_action(OP_COMMAND, "erase:" + partition);
+ Action& a = queue_action(OP_COMMAND, FB_CMD_ERASE ":" + partition);
a.msg = "Erasing '" + partition + "'";
}
@@ -125,7 +126,7 @@
a.size = sz;
a.msg = android::base::StringPrintf("Sending '%s' (%u KB)", partition.c_str(), sz / 1024);
- Action& b = queue_action(OP_COMMAND, "flash:" + partition);
+ Action& b = queue_action(OP_COMMAND, FB_CMD_FLASH ":" + partition);
b.msg = "Writing '" + partition + "'";
}
@@ -135,7 +136,7 @@
a.size = sz;
a.msg = android::base::StringPrintf("Sending '%s' (%u KB)", partition.c_str(), sz / 1024);
- Action& b = queue_action(OP_COMMAND, "flash:" + partition);
+ Action& b = queue_action(OP_COMMAND, FB_CMD_FLASH ":" + partition);
b.msg = "Writing '" + partition + "'";
}
@@ -147,7 +148,7 @@
a.msg = android::base::StringPrintf("Sending sparse '%s' %zu/%zu (%u KB)", partition.c_str(),
current, total, sz / 1024);
- Action& b = queue_action(OP_COMMAND, "flash:" + partition);
+ Action& b = queue_action(OP_COMMAND, FB_CMD_FLASH ":" + partition);
b.msg = android::base::StringPrintf("Writing sparse '%s' %zu/%zu", partition.c_str(), current,
total);
}
@@ -223,7 +224,7 @@
void fb_queue_require(const std::string& product, const std::string& var, bool invert,
size_t nvalues, const char** values) {
- Action& a = queue_action(OP_QUERY, "getvar:" + var);
+ Action& a = queue_action(OP_QUERY, FB_CMD_GETVAR ":" + var);
a.product = product;
a.data = values;
a.size = nvalues;
@@ -243,7 +244,7 @@
}
void fb_queue_display(const std::string& label, const std::string& var) {
- Action& a = queue_action(OP_QUERY, "getvar:" + var);
+ Action& a = queue_action(OP_QUERY, FB_CMD_GETVAR ":" + var);
a.data = xstrdup(label.c_str());
a.func = cb_display;
}
@@ -258,7 +259,7 @@
}
void fb_queue_query_save(const std::string& var, char* dest, uint32_t dest_size) {
- Action& a = queue_action(OP_QUERY, "getvar:" + var);
+ Action& a = queue_action(OP_QUERY, FB_CMD_GETVAR ":" + var);
a.data = dest;
a.size = dest_size;
a.func = cb_save;
@@ -270,7 +271,7 @@
}
void fb_queue_reboot() {
- Action& a = queue_action(OP_COMMAND, "reboot");
+ Action& a = queue_action(OP_COMMAND, FB_CMD_REBOOT);
a.func = cb_do_nothing;
a.msg = "Rebooting";
}
diff --git a/fastboot/fastboot.h b/fastboot/fastboot.h
index 50c70f3..a93c0ac 100644
--- a/fastboot/fastboot.h
+++ b/fastboot/fastboot.h
@@ -35,6 +35,8 @@
#include <bootimg.h>
+#include "constants.h"
+
class Transport;
struct sparse_file;
@@ -47,9 +49,6 @@
int64_t fb_upload_data(Transport* transport, const char* outfile);
const std::string fb_get_error();
-#define FB_COMMAND_SZ 64
-#define FB_RESPONSE_SZ 64
-
/* engine.c - high level command queue engine */
bool fb_getvar(Transport* transport, const std::string& key, std::string* value);
void fb_queue_flash(const std::string& partition, void* data, uint32_t sz);
diff --git a/fastboot/protocol.cpp b/fastboot/protocol.cpp
index fda6f5d..e625095 100644
--- a/fastboot/protocol.cpp
+++ b/fastboot/protocol.cpp
@@ -44,6 +44,7 @@
#include <sparse/sparse.h>
#include <utils/FileMap.h>
+#include "constants.h"
#include "fastboot.h"
#include "transport.h"
@@ -68,39 +69,39 @@
}
status[r] = 0;
- if (r < 4) {
+ if (static_cast<size_t>(r) < strlen(RESPONSE_OKAY)) {
g_error = android::base::StringPrintf("status malformed (%d bytes)", r);
transport->Close();
return -1;
}
- if (!memcmp(status, "INFO", 4)) {
- verbose("received INFO \"%s\"", status + 4);
- fprintf(stderr, "(bootloader) %s\n", status + 4);
+ if (!memcmp(status, RESPONSE_INFO, strlen(RESPONSE_INFO))) {
+ verbose("received INFO \"%s\"", status + strlen(RESPONSE_INFO));
+ fprintf(stderr, "(bootloader) %s\n", status + strlen(RESPONSE_INFO));
continue;
}
- if (!memcmp(status, "OKAY", 4)) {
- verbose("received OKAY \"%s\"", status + 4);
+ if (!memcmp(status, RESPONSE_OKAY, strlen(RESPONSE_OKAY))) {
+ verbose("received OKAY \"%s\"", status + strlen(RESPONSE_OKAY));
if (response) {
- strcpy(response, status + 4);
+ strcpy(response, status + strlen(RESPONSE_OKAY));
}
return 0;
}
- if (!memcmp(status, "FAIL", 4)) {
- verbose("received FAIL \"%s\"", status + 4);
- if (r > 4) {
- g_error = android::base::StringPrintf("remote: %s", status + 4);
+ if (!memcmp(status, RESPONSE_FAIL, strlen(RESPONSE_FAIL))) {
+ verbose("received FAIL \"%s\"", status + strlen(RESPONSE_FAIL));
+ if (static_cast<size_t>(r) > strlen(RESPONSE_FAIL)) {
+ g_error = android::base::StringPrintf("remote: %s", status + strlen(RESPONSE_FAIL));
} else {
g_error = "remote failure";
}
return -1;
}
- if (!memcmp(status, "DATA", 4) && size > 0){
- verbose("received DATA %s", status + 4);
- uint32_t dsize = strtol(status + 4, 0, 16);
+ if (!memcmp(status, RESPONSE_DATA, strlen(RESPONSE_DATA)) && size > 0){
+ verbose("received DATA %s", status + strlen(RESPONSE_DATA));
+ uint32_t dsize = strtol(status + strlen(RESPONSE_DATA), 0, 16);
if (dsize > size) {
g_error = android::base::StringPrintf("data size too large (%d)", dsize);
transport->Close();
@@ -247,18 +248,21 @@
}
int64_t fb_download_data(Transport* transport, const void* data, uint32_t size) {
- std::string cmd(android::base::StringPrintf("download:%08x", size));
+ std::string cmd(android::base::StringPrintf(
+ FB_CMD_DOWNLOAD ":" "%08x", size));
return _command_send(transport, cmd.c_str(), data, size, 0) < 0 ? -1 : 0;
}
int64_t fb_download_data_fd(Transport* transport, int fd, uint32_t size) {
- std::string cmd(android::base::StringPrintf("download:%08x", size));
+ std::string cmd(android::base::StringPrintf(
+ FB_CMD_DOWNLOAD ":" "%08x", size));
return _command_send_fd(transport, cmd.c_str(), fd, size, 0) < 0 ? -1 : 0;
}
int64_t fb_upload_data(Transport* transport, const char* outfile) {
// positive return value is the upload size sent by the device
- int64_t r = _command_start(transport, "upload", std::numeric_limits<int32_t>::max(), nullptr);
+ int64_t r = _command_start(transport, FB_CMD_UPLOAD,
+ std::numeric_limits<int32_t>::max(), nullptr);
if (r <= 0) {
g_error = android::base::StringPrintf("command start failed (%s)", strerror(errno));
return r;
@@ -345,7 +349,8 @@
return -1;
}
- std::string cmd(android::base::StringPrintf("download:%08" PRIx64, size));
+ std::string cmd(android::base::StringPrintf(
+ FB_CMD_DOWNLOAD ":" "%08" PRIx64, size));
int r = _command_start(transport, cmd, size, 0);
if (r < 0) {
return -1;
diff --git a/init/devices.h b/init/devices.h
index f9035da..9224fcd 100644
--- a/init/devices.h
+++ b/init/devices.h
@@ -106,7 +106,6 @@
DeviceHandler(std::vector<Permissions> dev_permissions,
std::vector<SysfsPermissions> sysfs_permissions, std::vector<Subsystem> subsystems,
std::set<std::string> boot_devices, bool skip_restorecon);
- ~DeviceHandler(){};
void HandleDeviceEvent(const Uevent& uevent);
diff --git a/init/firmware_handler.cpp b/init/firmware_handler.cpp
index 8c8d9f2..28bda34 100644
--- a/init/firmware_handler.cpp
+++ b/init/firmware_handler.cpp
@@ -21,7 +21,6 @@
#include <sys/wait.h>
#include <unistd.h>
-#include <string>
#include <thread>
#include <android-base/chrono_utils.h>
@@ -36,6 +35,8 @@
namespace android {
namespace init {
+std::vector<std::string> firmware_directories;
+
static void LoadFirmware(const Uevent& uevent, const std::string& root, int fw_fd, size_t fw_size,
int loading_fd, int data_fd) {
// Start transfer.
@@ -78,12 +79,9 @@
return;
}
- static const char* firmware_dirs[] = {"/etc/firmware/", "/odm/firmware/",
- "/vendor/firmware/", "/firmware/image/"};
-
try_loading_again:
- for (size_t i = 0; i < arraysize(firmware_dirs); i++) {
- std::string file = firmware_dirs[i] + uevent.firmware;
+ for (const auto& firmware_directory : firmware_directories) {
+ std::string file = firmware_directory + uevent.firmware;
unique_fd fw_fd(open(file.c_str(), O_RDONLY | O_CLOEXEC));
struct stat sb;
if (fw_fd != -1 && fstat(fw_fd, &sb) != -1) {
diff --git a/init/firmware_handler.h b/init/firmware_handler.h
index e456ac4..6081511 100644
--- a/init/firmware_handler.h
+++ b/init/firmware_handler.h
@@ -17,11 +17,16 @@
#ifndef _INIT_FIRMWARE_HANDLER_H
#define _INIT_FIRMWARE_HANDLER_H
+#include <string>
+#include <vector>
+
#include "uevent.h"
namespace android {
namespace init {
+extern std::vector<std::string> firmware_directories;
+
void HandleFirmwareEvent(const Uevent& uevent);
} // namespace init
diff --git a/init/ueventd.cpp b/init/ueventd.cpp
index a284203..6809445 100644
--- a/init/ueventd.cpp
+++ b/init/ueventd.cpp
@@ -215,39 +215,6 @@
LOG(INFO) << "Coldboot took " << cold_boot_timer.duration().count() / 1000.0f << " seconds";
}
-DeviceHandler CreateDeviceHandler() {
- Parser parser;
-
- std::vector<Subsystem> subsystems;
- parser.AddSectionParser("subsystem", std::make_unique<SubsystemParser>(&subsystems));
-
- using namespace std::placeholders;
- std::vector<SysfsPermissions> sysfs_permissions;
- std::vector<Permissions> dev_permissions;
- parser.AddSingleLineParser("/sys/",
- std::bind(ParsePermissionsLine, _1, &sysfs_permissions, nullptr));
- parser.AddSingleLineParser("/dev/",
- std::bind(ParsePermissionsLine, _1, nullptr, &dev_permissions));
-
- parser.ParseConfig("/ueventd.rc");
- parser.ParseConfig("/vendor/ueventd.rc");
- parser.ParseConfig("/odm/ueventd.rc");
-
- /*
- * keep the current product name base configuration so
- * we remain backwards compatible and allow it to override
- * everything
- * TODO: cleanup platform ueventd.rc to remove vendor specific
- * device node entries (b/34968103)
- */
- std::string hardware = android::base::GetProperty("ro.hardware", "");
- parser.ParseConfig("/ueventd." + hardware + ".rc");
-
- auto boot_devices = fs_mgr_get_boot_devices();
- return DeviceHandler(std::move(dev_permissions), std::move(sysfs_permissions),
- std::move(subsystems), std::move(boot_devices), true);
-}
-
int ueventd_main(int argc, char** argv) {
/*
* init sets the umask to 077 for forked processes. We need to
@@ -263,9 +230,26 @@
SelinuxSetupKernelLogging();
SelabelInitialize();
- DeviceHandler device_handler = CreateDeviceHandler();
+ DeviceHandler device_handler;
UeventListener uevent_listener;
+ {
+ // Keep the current product name base configuration so we remain backwards compatible and
+ // allow it to override everything.
+ // TODO: cleanup platform ueventd.rc to remove vendor specific device node entries (b/34968103)
+ auto hardware = android::base::GetProperty("ro.hardware", "");
+
+ auto ueventd_configuration =
+ ParseConfig({"/ueventd.rc", "/vendor/ueventd.rc", "/odm/ueventd.rc", hardware});
+
+ device_handler = DeviceHandler{std::move(ueventd_configuration.dev_permissions),
+ std::move(ueventd_configuration.sysfs_permissions),
+ std::move(ueventd_configuration.subsystems),
+ fs_mgr_get_boot_devices(), true};
+
+ firmware_directories = ueventd_configuration.firmware_directories;
+ }
+
if (access(COLDBOOT_DONE, F_OK) != 0) {
ColdBoot cold_boot(uevent_listener, device_handler);
cold_boot.Run();
diff --git a/init/ueventd_parser.cpp b/init/ueventd_parser.cpp
index f74c878..c114ec7 100644
--- a/init/ueventd_parser.cpp
+++ b/init/ueventd_parser.cpp
@@ -20,6 +20,7 @@
#include <pwd.h>
#include "keyword_map.h"
+#include "parser.h"
namespace android {
namespace init {
@@ -72,6 +73,33 @@
return Success();
}
+Result<Success> ParseFirmwareDirectoriesLine(std::vector<std::string>&& args,
+ std::vector<std::string>* firmware_directories) {
+ if (args.size() < 2) {
+ return Error() << "firmware_directories must have at least 1 entry";
+ }
+
+ std::move(std::next(args.begin()), args.end(), std::back_inserter(*firmware_directories));
+
+ return Success();
+}
+
+class SubsystemParser : public SectionParser {
+ public:
+ SubsystemParser(std::vector<Subsystem>* subsystems) : subsystems_(subsystems) {}
+ Result<Success> ParseSection(std::vector<std::string>&& args, const std::string& filename,
+ int line) override;
+ Result<Success> ParseLineSection(std::vector<std::string>&& args, int line) override;
+ Result<Success> EndSection() override;
+
+ private:
+ Result<Success> ParseDevName(std::vector<std::string>&& args);
+ Result<Success> ParseDirName(std::vector<std::string>&& args);
+
+ Subsystem subsystem_;
+ std::vector<Subsystem>* subsystems_;
+};
+
Result<Success> SubsystemParser::ParseSection(std::vector<std::string>&& args,
const std::string& filename, int line) {
if (args.size() != 2) {
@@ -138,5 +166,29 @@
return Success();
}
+UeventdConfiguration ParseConfig(const std::vector<std::string>& configs) {
+ Parser parser;
+ UeventdConfiguration ueventd_configuration;
+
+ parser.AddSectionParser("subsystem",
+ std::make_unique<SubsystemParser>(&ueventd_configuration.subsystems));
+
+ using namespace std::placeholders;
+ parser.AddSingleLineParser(
+ "/sys/",
+ std::bind(ParsePermissionsLine, _1, &ueventd_configuration.sysfs_permissions, nullptr));
+ parser.AddSingleLineParser("/dev/", std::bind(ParsePermissionsLine, _1, nullptr,
+ &ueventd_configuration.dev_permissions));
+ parser.AddSingleLineParser("firmware_directories",
+ std::bind(ParseFirmwareDirectoriesLine, _1,
+ &ueventd_configuration.firmware_directories));
+
+ for (const auto& config : configs) {
+ parser.ParseConfig(config);
+ }
+
+ return ueventd_configuration;
+}
+
} // namespace init
} // namespace android
diff --git a/init/ueventd_parser.h b/init/ueventd_parser.h
index 83684f3..343d58b 100644
--- a/init/ueventd_parser.h
+++ b/init/ueventd_parser.h
@@ -21,30 +21,18 @@
#include <vector>
#include "devices.h"
-#include "parser.h"
namespace android {
namespace init {
-class SubsystemParser : public SectionParser {
- public:
- SubsystemParser(std::vector<Subsystem>* subsystems) : subsystems_(subsystems) {}
- Result<Success> ParseSection(std::vector<std::string>&& args, const std::string& filename,
- int line) override;
- Result<Success> ParseLineSection(std::vector<std::string>&& args, int line) override;
- Result<Success> EndSection() override;
-
- private:
- Result<Success> ParseDevName(std::vector<std::string>&& args);
- Result<Success> ParseDirName(std::vector<std::string>&& args);
-
- Subsystem subsystem_;
- std::vector<Subsystem>* subsystems_;
+struct UeventdConfiguration {
+ std::vector<Subsystem> subsystems;
+ std::vector<SysfsPermissions> sysfs_permissions;
+ std::vector<Permissions> dev_permissions;
+ std::vector<std::string> firmware_directories;
};
-Result<Success> ParsePermissionsLine(std::vector<std::string>&& args,
- std::vector<SysfsPermissions>* out_sysfs_permissions,
- std::vector<Permissions>* out_dev_permissions);
+UeventdConfiguration ParseConfig(const std::vector<std::string>& configs);
} // namespace init
} // namespace android
diff --git a/rootdir/ueventd.rc b/rootdir/ueventd.rc
index b03d83b..2f85dec 100644
--- a/rootdir/ueventd.rc
+++ b/rootdir/ueventd.rc
@@ -1,3 +1,5 @@
+firmware_directories /etc/firmware/ /odm/firmware/ /vendor/firmware/ /firmware/image/
+
subsystem adf
devname uevent_devname