From 5b2510562c26fbb41dd0f93326e4eb3f4f349b50 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 16 Jun 2013 02:23:59 -0500 Subject: Upgrade modinfo to support multiple modules, and add tests, from Isaac Dunham. --- toys/other/modinfo.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'toys/other/modinfo.c') diff --git a/toys/other/modinfo.c b/toys/other/modinfo.c index da510a1d..501ba27b 100644 --- a/toys/other/modinfo.c +++ b/toys/other/modinfo.c @@ -16,6 +16,8 @@ config MODINFO GLOBALS( char *field; + + long mod; ) static char *modinfo_tags[] = { @@ -69,10 +71,9 @@ static void modinfo_file(struct dirtree *dir) static int check_module(struct dirtree *new) { if (S_ISREG(new->st.st_mode)) { - char **ss; + char *s; - for (ss = toys.optargs; *ss; ss++) { - char *s = *ss; + for (s = toys.optargs[TT.mod]; *s; s++) { int len = 0; // The kernel treats - and _ the same, so we should too. @@ -97,5 +98,7 @@ void modinfo_main(void) if (uname(&uts) < 0) perror_exit("bad uname"); sprintf(toybuf, "/lib/modules/%s", uts.release); - dirtree_read(toybuf, check_module); + for(TT.mod = 0; TT.mod