On 06/27/2013 06:22 PM, [email protected] wrote: > Hi! >> +/* >> + * Load a module using insmod program. >> + * >> + * @argv: an array of pointers to null-terminated strings that represent the >> + * additional parameters to the module. The array of pointers should be >> + * terminated by a NULL pointer. If argv points to NULL, it will be ignored. > Again should vs must. > OK >> + >> + if (err != 0) { >> + free(buf); >> + tst_brkm(TCONF, cleanup_fn, "Failed to find module '%s'", >> + mod_name); >> + } >> + >> + if (mod_path != NULL) >> + *mod_path = buf; >> + else >> + free(buf); >> +} > So you expect that the '.ko' suffix is part of the module name. It > should be written in the comment in the header. Because at least I > expect the module name to be the name that is returned by lsmod. > I will change module name to module's file name in the comments, is it OK? >> +void tst_module_load(void (cleanup_fn)(void), >> + const char *mod_name, char *const argv[]) >> +{ >> + char *mod_path = NULL; >> + tst_module_exists(cleanup_fn, mod_name,&mod_path); >> + >> + static int offset = 2; /* command name& module path */ >> + int size = 0; >> + while (argv&& argv[size]) >> + ++size; >> + size += offset; >> + char *mod_argv[size + 1]; /* + NULL in the end */ >> + mod_argv[size] = NULL; >> + mod_argv[0] = "insmod"; >> + mod_argv[1] = mod_path; >> + >> + int i; >> + for (i = offset; i< size; ++i) >> + mod_argv[i] = argv[i - offset]; >> + >> + tst_run_cmd(cleanup_fn, mod_argv); >> + free(mod_path); >> +} >> + >> +void tst_module_unload(void (cleanup_fn)(void), const char *mod_name) >> +{ >> + char *mod_path = NULL; >> + tst_module_exists(cleanup_fn, mod_name,&mod_path); >> + char *const argv[] = { "rmmod", mod_path, NULL }; > Hmm, man rmmod suggest that it takes module name (not module path) as > parameter i.e. the string without the path and the '.ko' suffix. Does it > work with module path too? > It works fine with path too, also without/with suffix .ko
------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
