[LTP] [PATCH 2/4] lib: Add .modprobe
Cyril Hrubis
chrubis@suse.cz
Wed Nov 1 17:35:03 CET 2023
Hi!
> > if (tst_test->mount_device)
> > tst_test->format_device = 1;
> >
> > @@ -1362,6 +1402,19 @@ static void do_cleanup(void)
> >
> > tst_sys_conf_restore(0);
> >
> > + if (tst_test->modprobe) {
> > + const char *name;
> > + int i;
> > +
> > + for (i = 0; (name = tst_test->modprobe[i]); ++i) {
> > + if (!modules_loaded[i])
> > + continue;
> > +
> > + const char *const cmd_rmmod[] = {"rmmod", name, NULL};
>
> modprobe -r please, rmmod has been deprecated for ages.
And one more minor point, we should attempt to remove the module only if
it has shown up in the /proc/modules.
Assuming that we want to skip the tst_module_is_buildin() check on some
systems as Ritchie suggested we would attempt to remove build in modules
here if we blindly trusted the return value from modpprobe.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list