libmodprobe: make name canonical in LoadWithAliases

Make the module name canonical in LoadWithAliases so it may be used
more easily from outside the class.

Change-Id: I7ee496b77a2beea43a6b68daed7af42660747559
This commit is contained in:
Steve Muckle 2019-07-30 16:03:44 -07:00
parent 4104b8803a
commit 73b2928b94

View file

@ -256,11 +256,7 @@ bool Modprobe::InsmodWithDeps(const std::string& module_name) {
// load module dependencies in reverse order // load module dependencies in reverse order
for (auto dep = dependencies.rbegin(); dep != dependencies.rend() - 1; ++dep) { for (auto dep = dependencies.rbegin(); dep != dependencies.rend() - 1; ++dep) {
const std::string& canonical_name = MakeCanonical(*dep); if (!LoadWithAliases(*dep, true)) {
if (canonical_name.empty()) {
return false;
}
if (!LoadWithAliases(canonical_name, true)) {
return false; return false;
} }
} }
@ -288,7 +284,7 @@ bool Modprobe::InsmodWithDeps(const std::string& module_name) {
} }
bool Modprobe::LoadWithAliases(const std::string& module_name, bool strict) { bool Modprobe::LoadWithAliases(const std::string& module_name, bool strict) {
std::set<std::string> modules_to_load = {module_name}; std::set<std::string> modules_to_load = {MakeCanonical(module_name)};
bool module_loaded = false; bool module_loaded = false;
// use aliases to expand list of modules to load (multiple modules // use aliases to expand list of modules to load (multiple modules