init: add host side parser for init
Create a host side parser for init such that init rc files can be
verified for syntax correctness before being used on the device.
Bug: 36970783
Test: run the parser on init files on host
Change-Id: I7e8772e278ebaff727057308596ebacf28b6fdda
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 1040b47..51c2c9b 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -968,8 +968,8 @@
const char* value = args[2].c_str();
size_t value_len = strlen(value);
- if (!is_legal_property_name(name)) {
- return Error() << "is_legal_property_name(" << name << ") failed";
+ if (!IsLegalPropertyName(name)) {
+ return Error() << "IsLegalPropertyName(" << name << ") failed";
}
if (value_len >= PROP_VALUE_MAX) {
return Error() << "value too long";
@@ -1018,6 +1018,7 @@
{"exec", "/system/bin/vdc", "--wait", "cryptfs", "init_user0"});
}
+// Builtin-function-map start
const BuiltinFunctionMap::Map& BuiltinFunctionMap::map() const {
constexpr std::size_t kMax = std::numeric_limits<std::size_t>::max();
// clang-format off
@@ -1075,6 +1076,7 @@
// clang-format on
return builtin_functions;
}
+// Builtin-function-map end
} // namespace init
} // namespace android