From: Lucas De Marchi Date: Wed, 8 Oct 2014 17:33:42 +0000 (-0300) Subject: Do not export array of kmod extensions X-Git-Tag: v19~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b95506ff6141aa65a46eef80fa0f0b06f9896712;p=platform%2Fupstream%2Fkmod.git Do not export array of kmod extensions The only user outside of libkmod-util is depmod, which really only needs to get the string for the extension of uncompressed modules. It doesn't need to access the array itself. --- diff --git a/libkmod/libkmod-util.c b/libkmod/libkmod-util.c index fd43838..0a904b1 100644 --- a/libkmod/libkmod-util.c +++ b/libkmod/libkmod-util.c @@ -33,8 +33,11 @@ #include "libkmod.h" #include "libkmod-internal.h" -const struct kmod_ext kmod_exts[] = { - {".ko", sizeof(".ko") - 1}, +static const struct kmod_ext { + const char *ext; + size_t len; +} kmod_exts[] = { + {KMOD_EXTENSION_UNCOMPRESSED, sizeof(KMOD_EXTENSION_UNCOMPRESSED) - 1}, #ifdef ENABLE_ZLIB {".ko.gz", sizeof(".ko.gz") - 1}, #endif diff --git a/libkmod/libkmod-util.h b/libkmod/libkmod-util.h index 3eb5e0c..3668437 100644 --- a/libkmod/libkmod-util.h +++ b/libkmod/libkmod-util.h @@ -6,12 +6,7 @@ #include -#define KMOD_EXT_UNC 0 - -extern const struct kmod_ext { - const char *ext; - size_t len; -} kmod_exts[]; +#define KMOD_EXTENSION_UNCOMPRESSED ".ko" int alias_normalize(const char *alias, char buf[PATH_MAX], size_t *len) _must_check_ __attribute__((nonnull(1,2))); char *modname_normalize(const char *modname, char buf[PATH_MAX], size_t *len) __attribute__((nonnull(1, 2))); diff --git a/tools/depmod.c b/tools/depmod.c index 74bc41f..ed1880f 100644 --- a/tools/depmod.c +++ b/tools/depmod.c @@ -1083,7 +1083,7 @@ static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod) if (mod->relpath != NULL) { size_t uncrelpathlen = lastslash - mod->relpath + modnamesz - + kmod_exts[KMOD_EXT_UNC].len; + + strlen(KMOD_EXTENSION_UNCOMPRESSED); mod->uncrelpath = memdup(mod->relpath, uncrelpathlen + 1); mod->uncrelpath[uncrelpathlen] = '\0'; err = hash_add_unique(depmod->modules_by_uncrelpath,