diff options
author | Tom Cherry <tomcherry@google.com> | 2019-06-10 11:08:01 -0700 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2019-06-10 12:39:18 -0700 |
commit | bbcbc2ffb339b2388e0cc282bb698fe436100b42 (patch) | |
tree | 3b1ab414d943a4a9b50dd29c581807fa2092ed06 /init/modalias_handler.cpp | |
parent | caa95d551d7f3b86d609b09bb4ab98e2435f6bc8 (diff) |
init: replace Result<Success> with Result<void>
Now that Result<T> is actually expected<T, ...>, and the expected
proposal states expected<void, ...> as the way to indicate an expected
object that returns either successfully with no object or an error,
let's move init's Result<Success> to the preferred Result<void>.
Bug: 132145659
Test: boot, init unit tests
Change-Id: Ib2f98396d8e6e274f95a496fcdfd8341f77585ee
Diffstat (limited to 'init/modalias_handler.cpp')
-rw-r--r-- | init/modalias_handler.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/init/modalias_handler.cpp b/init/modalias_handler.cpp index c61c21039..a51115628 100644 --- a/init/modalias_handler.cpp +++ b/init/modalias_handler.cpp @@ -33,7 +33,7 @@ namespace android { namespace init { -Result<Success> ModaliasHandler::ParseDepCallback(std::vector<std::string>&& args) { +Result<void> ModaliasHandler::ParseDepCallback(std::vector<std::string>&& args) { std::vector<std::string> deps; // Set first item as our modules path @@ -58,10 +58,10 @@ Result<Success> ModaliasHandler::ParseDepCallback(std::vector<std::string>&& arg std::replace(mod_name.begin(), mod_name.end(), '-', '_'); this->module_deps_[mod_name] = deps; - return Success(); + return {}; } -Result<Success> ModaliasHandler::ParseAliasCallback(std::vector<std::string>&& args) { +Result<void> ModaliasHandler::ParseAliasCallback(std::vector<std::string>&& args) { auto it = args.begin(); const std::string& type = *it++; @@ -77,7 +77,7 @@ Result<Success> ModaliasHandler::ParseAliasCallback(std::vector<std::string>&& a std::string& module_name = *it++; this->module_aliases_.emplace_back(alias, module_name); - return Success(); + return {}; } ModaliasHandler::ModaliasHandler() { @@ -100,7 +100,7 @@ ModaliasHandler::ModaliasHandler() { for (const auto& base_path : base_paths) dep_parser.ParseConfig(base_path + "modules.dep"); } -Result<Success> ModaliasHandler::Insmod(const std::string& path_name, const std::string& args) { +Result<void> ModaliasHandler::Insmod(const std::string& path_name, const std::string& args) { base::unique_fd fd( TEMP_FAILURE_RETRY(open(path_name.c_str(), O_RDONLY | O_NOFOLLOW | O_CLOEXEC))); if (fd == -1) return ErrnoError() << "Could not open module '" << path_name << "'"; @@ -109,17 +109,17 @@ Result<Success> ModaliasHandler::Insmod(const std::string& path_name, const std: if (ret != 0) { if (errno == EEXIST) { // Module already loaded - return Success(); + return {}; } return ErrnoError() << "Failed to insmod '" << path_name << "' with args '" << args << "'"; } LOG(INFO) << "Loaded kernel module " << path_name; - return Success(); + return {}; } -Result<Success> ModaliasHandler::InsmodWithDeps(const std::string& module_name, - const std::string& args) { +Result<void> ModaliasHandler::InsmodWithDeps(const std::string& module_name, + const std::string& args) { if (module_name.empty()) { return Error() << "Need valid module name"; } |