libmodprobe: support parameters in LoadWithAliases
Add support to specify module parameters in LoadWithAliases. These
parameters will be appended to any which are specified for the module in
modules.options.
Change-Id: I9aff1656ea397826f815b658b3b52c1892748601
diff --git a/libmodprobe/libmodprobe_ext.cpp b/libmodprobe/libmodprobe_ext.cpp
index 8cbd08c..52e308f 100644
--- a/libmodprobe/libmodprobe_ext.cpp
+++ b/libmodprobe/libmodprobe_ext.cpp
@@ -22,7 +22,7 @@
#include <modprobe/modprobe.h>
-bool Modprobe::Insmod(const std::string& path_name) {
+bool Modprobe::Insmod(const std::string& path_name, const std::string& parameters) {
android::base::unique_fd fd(
TEMP_FAILURE_RETRY(open(path_name.c_str(), O_RDONLY | O_NOFOLLOW | O_CLOEXEC)));
if (fd == -1) {
@@ -35,6 +35,9 @@
if (options_iter != module_options_.end()) {
options = options_iter->second;
}
+ if (!parameters.empty()) {
+ options = options + " " + parameters;
+ }
LOG(INFO) << "Loading module " << path_name << " with args \"" << options << "\"";
int ret = syscall(__NR_finit_module, fd.get(), options.c_str(), 0);