modinfo: match more standard module fields and fix version field
No binary (build failed)
—
(log yok)
| @@ -24,9 +24,9 @@ | |
| enum { | |
| - | OPT_TAGS = (1 << 8) - 1, |
| - | OPT_F = (1 << 8), /* field name */ |
| - | OPT_0 = (1 << 9), /* \0 as separator */ |
| + | OPT_TAGS = (1 << 12) - 1, /* shortcut count */ |
| + | OPT_F = (1 << 12), /* field name */ |
| + | OPT_0 = (1 << 13), /* \0 as separator */ |
| }; | |
| struct modinfo_env { | |
| @@ -49,13 +49,17 @@ static void modinfo(const char *path, const char *version, | |
| { | |
| static const char *const shortcuts[] = { | |
| "filename", | |
| - | "description", |
| - | "author", |
| "license", | |
| + | "author", |
| + | "description", |
| + | "version", |
| + | "alias", |
| + | "srcversion", |
| + | "depends", |
| + | "uts_release", |
| "vermagic", | |
| "parm", | |
| "firmware", | |
| - | "depends", |
| }; | |
| size_t len; | |
| int j, length; | |
| @@ -97,8 +101,11 @@ static void modinfo(const char *path, const char *version, | |
| if (ptr == NULL) /* no occurance left, done */ | |
| break; | |
| if (strncmp(ptr, pattern, length) == 0 && ptr[length] == '=') { | |
| - | ptr += length + 1; |
| - | ptr += display(ptr, pattern, (1<<j) != tags); |
| + | /* field prefixes are 0x80 or 0x00 */ |
| + | if ((ptr[-1] & 0x7F) == '\0') { |
| + | ptr += length + 1; |
| + | ptr += display(ptr, pattern, (1<<j) != tags); |
| + | } |
| } | |
| ++ptr; | |
| } | |
| @@ -131,7 +138,7 @@ int modinfo_main(int argc UNUSED_PARAM, char **argv) | |
| env.field = NULL; | |
| opt_complementary = "-1"; /* minimum one param */ | |
| - | opts = getopt32(argv, "fdalvpF:0", &env.field); |
| + | opts = getopt32(argv, "nladvAsDumpF:0", &env.field); |
| env.tags = opts & OPT_TAGS ? opts & OPT_TAGS : OPT_TAGS; | |
| argv += optind; | |