block: remove debug prints
[project/ubox.git] / kmodloader.c
index 0f7deec..49899b3 100644 (file)
@@ -56,6 +56,7 @@ struct module {
 };
 
 static struct avl_tree modules;
+static char *prefix = "";
 
 static struct module *find_module(const char *name)
 {
@@ -82,7 +83,7 @@ static char* get_module_path(char *name)
                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;
@@ -94,7 +95,7 @@ static char* get_module_path(char *name)
                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;
@@ -578,7 +579,7 @@ static int main_depmod(int argc, char **argv)
 
        uname(&ver);
        path = alloca(sizeof(DEF_MOD_PATH "*.ko") + strlen(ver.release) + 1);
-       snprintf(path, sizeof(path), DEF_MOD_PATH "*.ko", ver.release);
+       sprintf(path, DEF_MOD_PATH "*.ko", ver.release);
 
        scan_module_folder(path);
 
@@ -610,6 +611,9 @@ static int main_loader(int argc, char **argv)
        if (argc > 1)
                dir = argv[1];
 
+       if (argc > 2)
+               prefix = argv[2];
+
        path = malloc(strlen(dir) + 2);
        strcpy(path, dir);
        strcat(path, "*");