1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
From 658e2cafc2b88d1ab88f20b6183daabc113d3714 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Sat, 4 Feb 2012 16:08:34 -0500
Subject: [PATCH 6/8] modprobe: remove support for path based loading
m-i-t doesn't support this, and it causes serious problems with local
files clashing with alias names.
---
tools/kmod-modprobe.c | 35 ++---------------------------------
1 files changed, 2 insertions(+), 33 deletions(-)
diff --git a/tools/kmod-modprobe.c b/tools/kmod-modprobe.c
index e70bf3d..b9943da 100644
--- a/tools/kmod-modprobe.c
+++ b/tools/kmod-modprobe.c
@@ -737,27 +737,6 @@ error:
return err;
}
-static int insmod_path(struct kmod_ctx *ctx, const char *path,
- const char *extra_options)
-{
- struct kmod_module *mod;
- struct array recursion;
- int err;
-
- err = kmod_module_new_from_path(ctx, path, &mod);
- if (err < 0) {
- LOG("Module %s not found.\n", path);
- return err;
- }
-
- array_init(&recursion, INSMOD_RECURSION_STEP);
- err = insmod_do_module(mod, extra_options, true, &recursion);
- kmod_module_unref(mod);
- array_free_array(&recursion);
-
- return err;
-}
-
static int handle_failed_lookup(struct kmod_ctx *ctx, const char *alias)
{
struct kmod_module *mod;
@@ -831,22 +810,12 @@ static int insmod_alias(struct kmod_ctx *ctx, const char *alias,
return err;
}
-static int insmod(struct kmod_ctx *ctx, const char *name,
- const char *extra_options)
-{
- struct stat st;
- if (stat(name, &st) == 0)
- return insmod_path(ctx, name, extra_options);
- else
- return insmod_alias(ctx, name, extra_options);
-}
-
static int insmod_all(struct kmod_ctx *ctx, char **args, int nargs)
{
int i, err = 0;
for (i = 0; i < nargs; i++) {
- int r = insmod(ctx, args[i], NULL);
+ int r = insmod_alias(ctx, args[i], NULL);
if (r < 0)
err = r;
}
@@ -1232,7 +1201,7 @@ static int do_modprobe(int argc, char **orig_argv)
char *opts;
err = options_from_array(args, nargs, &opts);
if (err == 0) {
- err = insmod(ctx, args[0], opts);
+ err = insmod_alias(ctx, args[0], opts);
free(opts);
}
}
--
1.7.9
|