summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorYauheni Kaliuta <yauheni.kaliuta@redhat.com>2016-11-23 17:23:38 +0200
committerLucas De Marchi <lucas.demarchi@intel.com>2017-05-09 00:01:50 -0700
commit0d6b3f9beaea031c445dc6bd125d0229f142718b (patch)
tree4a9044a90629cc0680a6b7d507c8a147c566c54c /tools
parentcd019a39eadf7d30de87179fddb283ff14566eae (diff)
downloadkmod-0d6b3f9beaea031c445dc6bd125d0229f142718b.tar.gz
kmod-0d6b3f9beaea031c445dc6bd125d0229f142718b.tar.bz2
kmod-0d6b3f9beaea031c445dc6bd125d0229f142718b.zip
depmod: search key: move builtin detection under the add function
Prepare to implement external directories support. It's better to isolate behaviour difference under the cfg_search_add() call, then make the client code aware of it. In case of external modules/directories support, there will be one more keyword added, so making the clients aware of it makes even less sense. Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/depmod.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/depmod.c b/tools/depmod.c
index 7f9e980..ded6450 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -455,10 +455,11 @@ struct cfg {
struct cfg_search *searches;
};
-static int cfg_search_add(struct cfg *cfg, const char *path, uint8_t builtin)
+static int cfg_search_add(struct cfg *cfg, const char *path)
{
struct cfg_search *s;
size_t len;
+ uint8_t builtin = streq(path, CFG_BUILTIN_KEY);
if (builtin)
len = 0;
@@ -571,8 +572,7 @@ static int cfg_file_parse(struct cfg *cfg, const char *filename)
if (streq(cmd, "search")) {
const char *sp;
while ((sp = strtok_r(NULL, "\t ", &saveptr)) != NULL) {
- uint8_t builtin = streq(sp, CFG_BUILTIN_KEY);
- cfg_search_add(cfg, sp, builtin);
+ cfg_search_add(cfg, sp);
}
} else if (streq(cmd, "override")) {
const char *modname = strtok_r(NULL, "\t ", &saveptr);
@@ -766,7 +766,7 @@ static int cfg_load(struct cfg *cfg, const char * const *cfg_paths)
* list here. But only if there was no "search" option specified.
*/
if (cfg->searches == NULL)
- cfg_search_add(cfg, "updates", 0);
+ cfg_search_add(cfg, "updates");
return 0;
}