Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "ueventd_parser.h" |
| 18 | |
| 19 | #include <grp.h> |
| 20 | #include <pwd.h> |
| 21 | |
Tom Cherry | e291010 | 2018-12-06 13:29:30 -0800 | [diff] [blame] | 22 | #include <android-base/parseint.h> |
| 23 | |
Tom Cherry | 5b27179 | 2020-12-08 13:18:14 -0800 | [diff] [blame] | 24 | #include "import_parser.h" |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 25 | #include "keyword_map.h" |
Tom Cherry | 7421fa1 | 2018-07-13 15:32:02 -0700 | [diff] [blame] | 26 | #include "parser.h" |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 27 | |
Tom Cherry | e291010 | 2018-12-06 13:29:30 -0800 | [diff] [blame] | 28 | using android::base::ParseByteCount; |
| 29 | |
Tom Cherry | 81f5d3e | 2017-06-22 12:53:17 -0700 | [diff] [blame] | 30 | namespace android { |
| 31 | namespace init { |
| 32 | |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 33 | Result<void> ParsePermissionsLine(std::vector<std::string>&& args, |
| 34 | std::vector<SysfsPermissions>* out_sysfs_permissions, |
| 35 | std::vector<Permissions>* out_dev_permissions) { |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 36 | bool is_sysfs = out_sysfs_permissions != nullptr; |
Tom Cherry | 47031c8 | 2020-12-07 13:33:46 -0800 | [diff] [blame] | 37 | if (is_sysfs && !(args.size() == 5 || args.size() == 6)) { |
| 38 | return Error() << "/sys/ lines must have 5 or 6 entries"; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 39 | } |
| 40 | |
Tom Cherry | 47031c8 | 2020-12-07 13:33:46 -0800 | [diff] [blame] | 41 | if (!is_sysfs && !(args.size() == 4 || args.size() == 5)) { |
| 42 | return Error() << "/dev/ lines must have 4 or 5 entries"; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | auto it = args.begin(); |
| 46 | const std::string& name = *it++; |
| 47 | |
| 48 | std::string sysfs_attribute; |
| 49 | if (is_sysfs) sysfs_attribute = *it++; |
| 50 | |
| 51 | // args is now common to both sys and dev entries and contains: <perm> <uid> <gid> |
| 52 | std::string& perm_string = *it++; |
| 53 | char* end_pointer = 0; |
| 54 | mode_t perm = strtol(perm_string.c_str(), &end_pointer, 8); |
| 55 | if (end_pointer == nullptr || *end_pointer != '\0') { |
Tom Cherry | 89bcc85 | 2017-08-02 17:01:36 -0700 | [diff] [blame] | 56 | return Error() << "invalid mode '" << perm_string << "'"; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | std::string& uid_string = *it++; |
| 60 | passwd* pwd = getpwnam(uid_string.c_str()); |
| 61 | if (!pwd) { |
Tom Cherry | 89bcc85 | 2017-08-02 17:01:36 -0700 | [diff] [blame] | 62 | return Error() << "invalid uid '" << uid_string << "'"; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 63 | } |
| 64 | uid_t uid = pwd->pw_uid; |
| 65 | |
| 66 | std::string& gid_string = *it++; |
| 67 | struct group* grp = getgrnam(gid_string.c_str()); |
| 68 | if (!grp) { |
Tom Cherry | 89bcc85 | 2017-08-02 17:01:36 -0700 | [diff] [blame] | 69 | return Error() << "invalid gid '" << gid_string << "'"; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 70 | } |
| 71 | gid_t gid = grp->gr_gid; |
| 72 | |
Tom Cherry | 47031c8 | 2020-12-07 13:33:46 -0800 | [diff] [blame] | 73 | bool no_fnm_pathname = false; |
| 74 | if (it != args.end()) { |
| 75 | std::string& flags = *it++; |
| 76 | if (flags != "no_fnm_pathname") { |
| 77 | return Error() << "invalid option '" << flags << "', only no_fnm_pathname is supported"; |
| 78 | } |
| 79 | no_fnm_pathname = true; |
| 80 | } |
| 81 | |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 82 | if (is_sysfs) { |
Tom Cherry | 47031c8 | 2020-12-07 13:33:46 -0800 | [diff] [blame] | 83 | out_sysfs_permissions->emplace_back(name, sysfs_attribute, perm, uid, gid, no_fnm_pathname); |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 84 | } else { |
Tom Cherry | 47031c8 | 2020-12-07 13:33:46 -0800 | [diff] [blame] | 85 | out_dev_permissions->emplace_back(name, perm, uid, gid, no_fnm_pathname); |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 86 | } |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 87 | return {}; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 88 | } |
| 89 | |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 90 | Result<void> ParseFirmwareDirectoriesLine(std::vector<std::string>&& args, |
| 91 | std::vector<std::string>* firmware_directories) { |
Tom Cherry | 7421fa1 | 2018-07-13 15:32:02 -0700 | [diff] [blame] | 92 | if (args.size() < 2) { |
| 93 | return Error() << "firmware_directories must have at least 1 entry"; |
| 94 | } |
| 95 | |
| 96 | std::move(std::next(args.begin()), args.end(), std::back_inserter(*firmware_directories)); |
| 97 | |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 98 | return {}; |
Tom Cherry | 7421fa1 | 2018-07-13 15:32:02 -0700 | [diff] [blame] | 99 | } |
| 100 | |
Tom Cherry | dcb3d15 | 2019-08-07 16:02:28 -0700 | [diff] [blame] | 101 | Result<void> ParseExternalFirmwareHandlerLine( |
| 102 | std::vector<std::string>&& args, |
| 103 | std::vector<ExternalFirmwareHandler>* external_firmware_handlers) { |
Suchang Woo | 10c6374 | 2021-05-13 18:56:31 +0900 | [diff] [blame] | 104 | if (args.size() != 4 && args.size() != 5) { |
| 105 | return Error() << "external_firmware_handler lines must have 3 or 4 parameters"; |
Tom Cherry | dcb3d15 | 2019-08-07 16:02:28 -0700 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | if (std::find_if(external_firmware_handlers->begin(), external_firmware_handlers->end(), |
Suchang Woo | 8681f7e | 2021-04-06 10:55:34 +0900 | [diff] [blame] | 109 | [&args](const auto& other) { return other.devpath == args[1]; }) != |
Tom Cherry | dcb3d15 | 2019-08-07 16:02:28 -0700 | [diff] [blame] | 110 | external_firmware_handlers->end()) { |
| 111 | return Error() << "found a previous external_firmware_handler with the same devpath, '" |
Suchang Woo | 8681f7e | 2021-04-06 10:55:34 +0900 | [diff] [blame] | 112 | << args[1] << "'"; |
Tom Cherry | dcb3d15 | 2019-08-07 16:02:28 -0700 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | passwd* pwd = getpwnam(args[2].c_str()); |
| 116 | if (!pwd) { |
| 117 | return ErrnoError() << "invalid handler uid'" << args[2] << "'"; |
| 118 | } |
| 119 | |
Suchang Woo | 10c6374 | 2021-05-13 18:56:31 +0900 | [diff] [blame] | 120 | gid_t gid = 0; |
| 121 | int handler_index = 3; |
| 122 | if (args.size() == 5) { |
| 123 | struct group* grp = getgrnam(args[3].c_str()); |
| 124 | if (!grp) { |
| 125 | return ErrnoError() << "invalid handler gid '" << args[3] << "'"; |
| 126 | } |
| 127 | gid = grp->gr_gid; |
| 128 | handler_index = 4; |
| 129 | } |
| 130 | |
| 131 | ExternalFirmwareHandler handler(std::move(args[1]), pwd->pw_uid, gid, |
| 132 | std::move(args[handler_index])); |
Tom Cherry | dcb3d15 | 2019-08-07 16:02:28 -0700 | [diff] [blame] | 133 | external_firmware_handlers->emplace_back(std::move(handler)); |
| 134 | |
| 135 | return {}; |
| 136 | } |
| 137 | |
Tom Cherry | 4233ec7 | 2019-09-06 10:52:31 -0700 | [diff] [blame] | 138 | Result<void> ParseEnabledDisabledLine(std::vector<std::string>&& args, bool* feature) { |
Tom Cherry | 457e28f | 2018-08-01 13:12:20 -0700 | [diff] [blame] | 139 | if (args.size() != 2) { |
Tom Cherry | 4233ec7 | 2019-09-06 10:52:31 -0700 | [diff] [blame] | 140 | return Error() << args[0] << " lines take exactly one parameter"; |
Tom Cherry | 457e28f | 2018-08-01 13:12:20 -0700 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | if (args[1] == "enabled") { |
Tom Cherry | 4233ec7 | 2019-09-06 10:52:31 -0700 | [diff] [blame] | 144 | *feature = true; |
Tom Cherry | 457e28f | 2018-08-01 13:12:20 -0700 | [diff] [blame] | 145 | } else if (args[1] == "disabled") { |
Tom Cherry | 4233ec7 | 2019-09-06 10:52:31 -0700 | [diff] [blame] | 146 | *feature = false; |
Tom Cherry | 457e28f | 2018-08-01 13:12:20 -0700 | [diff] [blame] | 147 | } else { |
Tom Cherry | 4233ec7 | 2019-09-06 10:52:31 -0700 | [diff] [blame] | 148 | return Error() << args[0] << " takes either 'enabled' or 'disabled' as a parameter"; |
Tom Cherry | 457e28f | 2018-08-01 13:12:20 -0700 | [diff] [blame] | 149 | } |
| 150 | |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 151 | return {}; |
Tom Cherry | 457e28f | 2018-08-01 13:12:20 -0700 | [diff] [blame] | 152 | } |
| 153 | |
yuehu mi | ddffa0e | 2021-05-01 14:36:58 +0800 | [diff] [blame] | 154 | Result<void> ParseParallelRestoreconDirsLine(std::vector<std::string>&& args, |
| 155 | std::vector<std::string>* parallel_restorecon_dirs) { |
| 156 | if (args.size() != 2) { |
| 157 | return Error() << "parallel_restorecon_dir lines must have exactly 2 parameters"; |
| 158 | } |
| 159 | |
| 160 | std::move(std::next(args.begin()), args.end(), std::back_inserter(*parallel_restorecon_dirs)); |
| 161 | |
| 162 | return {}; |
| 163 | } |
| 164 | |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 165 | Result<void> ParseUeventSocketRcvbufSizeLine(std::vector<std::string>&& args, |
| 166 | size_t* uevent_socket_rcvbuf_size) { |
Tom Cherry | e291010 | 2018-12-06 13:29:30 -0800 | [diff] [blame] | 167 | if (args.size() != 2) { |
| 168 | return Error() << "uevent_socket_rcvbuf_size lines take exactly one parameter"; |
| 169 | } |
| 170 | |
| 171 | size_t parsed_size; |
| 172 | if (!ParseByteCount(args[1], &parsed_size)) { |
| 173 | return Error() << "could not parse size '" << args[1] << "' for uevent_socket_rcvbuf_line"; |
| 174 | } |
| 175 | |
| 176 | *uevent_socket_rcvbuf_size = parsed_size; |
| 177 | |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 178 | return {}; |
Tom Cherry | e291010 | 2018-12-06 13:29:30 -0800 | [diff] [blame] | 179 | } |
| 180 | |
Tom Cherry | 7421fa1 | 2018-07-13 15:32:02 -0700 | [diff] [blame] | 181 | class SubsystemParser : public SectionParser { |
| 182 | public: |
| 183 | SubsystemParser(std::vector<Subsystem>* subsystems) : subsystems_(subsystems) {} |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 184 | Result<void> ParseSection(std::vector<std::string>&& args, const std::string& filename, |
| 185 | int line) override; |
| 186 | Result<void> ParseLineSection(std::vector<std::string>&& args, int line) override; |
| 187 | Result<void> EndSection() override; |
Tom Cherry | 7421fa1 | 2018-07-13 15:32:02 -0700 | [diff] [blame] | 188 | |
| 189 | private: |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 190 | Result<void> ParseDevName(std::vector<std::string>&& args); |
| 191 | Result<void> ParseDirName(std::vector<std::string>&& args); |
Tom Cherry | 7421fa1 | 2018-07-13 15:32:02 -0700 | [diff] [blame] | 192 | |
| 193 | Subsystem subsystem_; |
| 194 | std::vector<Subsystem>* subsystems_; |
| 195 | }; |
| 196 | |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 197 | Result<void> SubsystemParser::ParseSection(std::vector<std::string>&& args, |
| 198 | const std::string& filename, int line) { |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 199 | if (args.size() != 2) { |
Tom Cherry | 89bcc85 | 2017-08-02 17:01:36 -0700 | [diff] [blame] | 200 | return Error() << "subsystems must have exactly one name"; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 201 | } |
| 202 | |
| 203 | if (std::find(subsystems_->begin(), subsystems_->end(), args[1]) != subsystems_->end()) { |
Tom Cherry | 89bcc85 | 2017-08-02 17:01:36 -0700 | [diff] [blame] | 204 | return Error() << "ignoring duplicate subsystem entry"; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 205 | } |
| 206 | |
Tom Cherry | 9c8d6dd | 2017-08-17 09:38:01 -0700 | [diff] [blame] | 207 | subsystem_ = Subsystem(std::move(args[1])); |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 208 | |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 209 | return {}; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 210 | } |
| 211 | |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 212 | Result<void> SubsystemParser::ParseDevName(std::vector<std::string>&& args) { |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 213 | if (args[1] == "uevent_devname") { |
Tom Cherry | 5f0198b | 2018-07-17 15:28:16 -0700 | [diff] [blame] | 214 | subsystem_.devname_source_ = Subsystem::DEVNAME_UEVENT_DEVNAME; |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 215 | return {}; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 216 | } |
| 217 | if (args[1] == "uevent_devpath") { |
Tom Cherry | 5f0198b | 2018-07-17 15:28:16 -0700 | [diff] [blame] | 218 | subsystem_.devname_source_ = Subsystem::DEVNAME_UEVENT_DEVPATH; |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 219 | return {}; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 220 | } |
| 221 | |
Tom Cherry | 89bcc85 | 2017-08-02 17:01:36 -0700 | [diff] [blame] | 222 | return Error() << "invalid devname '" << args[1] << "'"; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 223 | } |
| 224 | |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 225 | Result<void> SubsystemParser::ParseDirName(std::vector<std::string>&& args) { |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 226 | if (args[1].front() != '/') { |
Tom Cherry | 89bcc85 | 2017-08-02 17:01:36 -0700 | [diff] [blame] | 227 | return Error() << "dirname '" << args[1] << " ' does not start with '/'"; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | subsystem_.dir_name_ = args[1]; |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 231 | return {}; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 232 | } |
| 233 | |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 234 | Result<void> SubsystemParser::ParseLineSection(std::vector<std::string>&& args, int line) { |
| 235 | using OptionParser = Result<void> (SubsystemParser::*)(std::vector<std::string> && args); |
Tom Cherry | d52a5b3 | 2019-07-22 16:05:36 -0700 | [diff] [blame] | 236 | // clang-format off |
| 237 | static const KeywordMap<OptionParser> parser_map = { |
| 238 | {"devname", {1, 1, &SubsystemParser::ParseDevName}}, |
| 239 | {"dirname", {1, 1, &SubsystemParser::ParseDirName}}, |
| 240 | }; |
| 241 | // clang-format on |
Tom Cherry | 89bcc85 | 2017-08-02 17:01:36 -0700 | [diff] [blame] | 242 | |
Tom Cherry | d52a5b3 | 2019-07-22 16:05:36 -0700 | [diff] [blame] | 243 | auto parser = parser_map.Find(args); |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 244 | |
Bernie Innocenti | cecebbb | 2020-02-06 03:49:33 +0900 | [diff] [blame] | 245 | if (!parser.ok()) return Error() << parser.error(); |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 246 | |
Tom Cherry | 89bcc85 | 2017-08-02 17:01:36 -0700 | [diff] [blame] | 247 | return std::invoke(*parser, this, std::move(args)); |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 248 | } |
| 249 | |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 250 | Result<void> SubsystemParser::EndSection() { |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 251 | subsystems_->emplace_back(std::move(subsystem_)); |
Steven Moreland | 7d0a5c3 | 2017-11-10 14:20:47 -0800 | [diff] [blame] | 252 | |
Tom Cherry | bbcbc2f | 2019-06-10 11:08:01 -0700 | [diff] [blame] | 253 | return {}; |
Tom Cherry | ed506f7 | 2017-05-25 15:58:59 -0700 | [diff] [blame] | 254 | } |
Tom Cherry | 81f5d3e | 2017-06-22 12:53:17 -0700 | [diff] [blame] | 255 | |
Tom Cherry | 71dd706 | 2020-12-11 09:26:55 -0800 | [diff] [blame] | 256 | UeventdConfiguration ParseConfig(const std::vector<std::string>& configs) { |
Tom Cherry | 7421fa1 | 2018-07-13 15:32:02 -0700 | [diff] [blame] | 257 | Parser parser; |
| 258 | UeventdConfiguration ueventd_configuration; |
| 259 | |
Tom Cherry | 5b27179 | 2020-12-08 13:18:14 -0800 | [diff] [blame] | 260 | parser.AddSectionParser("import", std::make_unique<ImportParser>(&parser)); |
Tom Cherry | 7421fa1 | 2018-07-13 15:32:02 -0700 | [diff] [blame] | 261 | parser.AddSectionParser("subsystem", |
| 262 | std::make_unique<SubsystemParser>(&ueventd_configuration.subsystems)); |
| 263 | |
| 264 | using namespace std::placeholders; |
| 265 | parser.AddSingleLineParser( |
| 266 | "/sys/", |
| 267 | std::bind(ParsePermissionsLine, _1, &ueventd_configuration.sysfs_permissions, nullptr)); |
| 268 | parser.AddSingleLineParser("/dev/", std::bind(ParsePermissionsLine, _1, nullptr, |
| 269 | &ueventd_configuration.dev_permissions)); |
| 270 | parser.AddSingleLineParser("firmware_directories", |
| 271 | std::bind(ParseFirmwareDirectoriesLine, _1, |
| 272 | &ueventd_configuration.firmware_directories)); |
Tom Cherry | dcb3d15 | 2019-08-07 16:02:28 -0700 | [diff] [blame] | 273 | parser.AddSingleLineParser("external_firmware_handler", |
| 274 | std::bind(ParseExternalFirmwareHandlerLine, _1, |
| 275 | &ueventd_configuration.external_firmware_handlers)); |
Tom Cherry | 457e28f | 2018-08-01 13:12:20 -0700 | [diff] [blame] | 276 | parser.AddSingleLineParser("modalias_handling", |
Tom Cherry | 4233ec7 | 2019-09-06 10:52:31 -0700 | [diff] [blame] | 277 | std::bind(ParseEnabledDisabledLine, _1, |
Tom Cherry | 457e28f | 2018-08-01 13:12:20 -0700 | [diff] [blame] | 278 | &ueventd_configuration.enable_modalias_handling)); |
Tom Cherry | e291010 | 2018-12-06 13:29:30 -0800 | [diff] [blame] | 279 | parser.AddSingleLineParser("uevent_socket_rcvbuf_size", |
| 280 | std::bind(ParseUeventSocketRcvbufSizeLine, _1, |
| 281 | &ueventd_configuration.uevent_socket_rcvbuf_size)); |
yuehu mi | ddffa0e | 2021-05-01 14:36:58 +0800 | [diff] [blame] | 282 | parser.AddSingleLineParser("parallel_restorecon_dir", |
| 283 | std::bind(ParseParallelRestoreconDirsLine, _1, |
| 284 | &ueventd_configuration.parallel_restorecon_dirs)); |
Tom Cherry | 4233ec7 | 2019-09-06 10:52:31 -0700 | [diff] [blame] | 285 | parser.AddSingleLineParser("parallel_restorecon", |
| 286 | std::bind(ParseEnabledDisabledLine, _1, |
| 287 | &ueventd_configuration.enable_parallel_restorecon)); |
Tom Cherry | 7421fa1 | 2018-07-13 15:32:02 -0700 | [diff] [blame] | 288 | |
Tom Cherry | 71dd706 | 2020-12-11 09:26:55 -0800 | [diff] [blame] | 289 | for (const auto& config : configs) { |
| 290 | parser.ParseConfig(config); |
| 291 | } |
Tom Cherry | 7421fa1 | 2018-07-13 15:32:02 -0700 | [diff] [blame] | 292 | |
| 293 | return ueventd_configuration; |
| 294 | } |
| 295 | |
Tom Cherry | 81f5d3e | 2017-06-22 12:53:17 -0700 | [diff] [blame] | 296 | } // namespace init |
| 297 | } // namespace android |