projects
/
project
/
ubox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3637b9f
)
kmodloader: support loading modules from a different prefix
author
Jo-Philipp Wich
<jow@openwrt.org>
Fri, 26 Jul 2013 08:57:01 +0000
(10:57 +0200)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Fri, 26 Jul 2013 08:57:01 +0000
(10:57 +0200)
kmodloader.c
patch
|
blob
|
history
diff --git
a/kmodloader.c
b/kmodloader.c
index
049a868
..
49899b3
100644
(file)
--- a/
kmodloader.c
+++ b/
kmodloader.c
@@
-56,6
+56,7
@@
struct module {
};
static struct avl_tree modules;
};
static struct avl_tree modules;
+static char *prefix = "";
static struct module *find_module(const char *name)
{
static struct module *find_module(const char *name)
{
@@
-82,7
+83,7
@@
static char* get_module_path(char *name)
return name;
uname(&ver);
return name;
uname(&ver);
- snprintf(path, 256,
DEF_MOD_PATH "%s.ko"
, ver.release, name);
+ snprintf(path, 256,
"%s" DEF_MOD_PATH "%s.ko", prefix
, ver.release, name);
if (!stat(path, &s))
return path;
if (!stat(path, &s))
return path;
@@
-94,7
+95,7
@@
static char* get_module_path(char *name)
t++;
}
t++;
}
- snprintf(path, 256,
DEF_MOD_PATH "%s.ko"
, ver.release, name);
+ snprintf(path, 256,
"%s" DEF_MOD_PATH "%s.ko", prefix
, ver.release, name);
if (!stat(path, &s))
return path;
if (!stat(path, &s))
return path;
@@
-610,6
+611,9
@@
static int main_loader(int argc, char **argv)
if (argc > 1)
dir = argv[1];
if (argc > 1)
dir = argv[1];
+ if (argc > 2)
+ prefix = argv[2];
+
path = malloc(strlen(dir) + 2);
strcpy(path, dir);
strcat(path, "*");
path = malloc(strlen(dir) + 2);
strcpy(path, dir);
strcat(path, "*");