aboutsummaryrefslogtreecommitdiff
path: root/modutils/modinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'modutils/modinfo.c')
-rw-r--r--modutils/modinfo.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/modutils/modinfo.c b/modutils/modinfo.c
index 731fc0553..db134bd00 100644
--- a/modutils/modinfo.c
+++ b/modutils/modinfo.c
@@ -23,9 +23,9 @@
23 23
24 24
25enum { 25enum {
26 OPT_TAGS = (1 << 6) - 1, 26 OPT_TAGS = (1 << 8) - 1,
27 OPT_F = (1 << 6), /* field name */ 27 OPT_F = (1 << 8), /* field name */
28 OPT_0 = (1 << 7), /* \0 as separator */ 28 OPT_0 = (1 << 9), /* \0 as separator */
29}; 29};
30 30
31struct modinfo_env { 31struct modinfo_env {
@@ -44,7 +44,7 @@ static int display(const char *data, const char *pattern, int flag)
44} 44}
45 45
46static void modinfo(const char *path, const char *version, 46static void modinfo(const char *path, const char *version,
47 struct modinfo_env *env) 47 const struct modinfo_env *env)
48{ 48{
49 static const char *const shortcuts[] = { 49 static const char *const shortcuts[] = {
50 "filename", 50 "filename",
@@ -53,6 +53,8 @@ static void modinfo(const char *path, const char *version,
53 "license", 53 "license",
54 "vermagic", 54 "vermagic",
55 "parm", 55 "parm",
56 "firmware",
57 "depends",
56 }; 58 };
57 size_t len; 59 size_t len;
58 int j, length; 60 int j, length;
@@ -80,11 +82,13 @@ static void modinfo(const char *path, const char *version,
80 if (field) 82 if (field)
81 tags |= OPT_F; 83 tags |= OPT_F;
82 for (j = 1; (1<<j) & (OPT_TAGS + OPT_F); j++) { 84 for (j = 1; (1<<j) & (OPT_TAGS + OPT_F); j++) {
83 const char *pattern = field; 85 const char *pattern;
84 if ((1<<j) & OPT_TAGS) 86
85 pattern = shortcuts[j];
86 if (!((1<<j) & tags)) 87 if (!((1<<j) & tags))
87 continue; 88 continue;
89 pattern = field;
90 if ((1<<j) & OPT_TAGS)
91 pattern = shortcuts[j];
88 length = strlen(pattern); 92 length = strlen(pattern);
89 ptr = the_module; 93 ptr = the_module;
90 while (1) { 94 while (1) {