#define DEFAULT_VERBOSE LOG_WARNING
static int verbose = DEFAULT_VERBOSE;
-#define KMOD_EXT_UNC 0
-
-static const struct kmod_ext {
- const char *ext;
- size_t len;
-} kmod_exts[] = {
- {".ko", sizeof(".ko") - 1},
-#ifdef ENABLE_ZLIB
- {".ko.gz", sizeof(".ko.gz") - 1},
-#endif
-#ifdef ENABLE_XZ
- {".ko.xz", sizeof(".ko.xz") - 1},
-#endif
- {NULL, 0},
-};
-
static const char CFG_BUILTIN_KEY[] = "built-in";
static const char *default_cfg_paths[] = {
"/run/depmod.d",
struct mod *mod;
const char *relpath;
char modname[PATH_MAX];
- const struct kmod_ext *eitr;
size_t modnamelen;
- uint8_t matches = 0;
int err;
- for (eitr = kmod_exts; eitr->ext != NULL; eitr++) {
- if (namelen <= eitr->len)
- continue;
- if (streq(path + baselen + namelen - eitr->len, eitr->ext)) {
- matches = 1;
- break;
- }
- }
- if (!matches)
+ if (!path_ends_with_kmod_ext(path, baselen + namelen))
return 0;
if (path_to_modname(path, modname, &modnamelen) == NULL) {
path);
closedir(subdir);
} else if (S_ISREG(st.st_mode)) {
- const struct kmod_ext *eitr;
- uint8_t matches = 0;
- for (eitr = kmod_exts; eitr->ext != NULL; eitr++) {
- if (namelen <= eitr->len)
- continue;
- if (streq(name + namelen - eitr->len, eitr->ext)) {
- matches = 1;
- break;
- }
- }
- if (!matches)
+ if (!path_ends_with_kmod_ext(path, namelen))
continue;
memcpy(path + baselen, name, namelen + 1);
err = st.st_mtime <= mtime;