Minor renames

This commit is contained in:
topjohnwu 2020-10-25 21:41:14 -07:00
parent 02ea3ca525
commit 5b8a1fc2a7

View File

@ -643,7 +643,7 @@ static void prepare_modules() {
} }
template<typename Func> template<typename Func>
static void foreach_modules(Func fn) { static void foreach_module(Func fn) {
auto dir = open_dir(MODULEROOT); auto dir = open_dir(MODULEROOT);
if (!dir) if (!dir)
return; return;
@ -659,7 +659,7 @@ static void foreach_modules(Func fn) {
} }
static void collect_modules() { static void collect_modules() {
foreach_modules([](int dfd, dirent *entry, int modfd) { foreach_module([](int dfd, dirent *entry, int modfd) {
if (faccessat(modfd, "remove", F_OK, 0) == 0) { if (faccessat(modfd, "remove", F_OK, 0) == 0) {
LOGI("%s: remove\n", entry->d_name); LOGI("%s: remove\n", entry->d_name);
auto uninstaller = MODULEROOT + "/"s + entry->d_name + "/uninstall.sh"; auto uninstaller = MODULEROOT + "/"s + entry->d_name + "/uninstall.sh";
@ -686,13 +686,13 @@ void handle_modules() {
} }
void disable_modules() { void disable_modules() {
foreach_modules([](auto, auto, int modfd) { foreach_module([](int, auto, int modfd) {
close(xopenat(modfd, "disable", O_RDONLY | O_CREAT | O_CLOEXEC, 0)); close(xopenat(modfd, "disable", O_RDONLY | O_CREAT | O_CLOEXEC, 0));
}); });
} }
void remove_modules() { void remove_modules() {
foreach_modules([](int dfd, dirent *entry, int modfd) { foreach_module([](int, dirent *entry, int) {
auto uninstaller = MODULEROOT + "/"s + entry->d_name + "/uninstall.sh"; auto uninstaller = MODULEROOT + "/"s + entry->d_name + "/uninstall.sh";
if (access(uninstaller.data(), F_OK) == 0) if (access(uninstaller.data(), F_OK) == 0)
exec_script(uninstaller.data()); exec_script(uninstaller.data());