* provide 1:1 compatibility with module-init-tools's modprobe
- dump configuration
- - 'modprobe -r' should remove modules which usecount became 0 because of
- module's removal
* Add kmod_validate(). It checks if all config files and indexes are still
valid. We need to save the mtime of each config dir when starting up and when
static int rmmod_do(struct kmod_module *mod)
{
const char *modname = kmod_module_get_name(mod);
- struct kmod_list *pre = NULL, *post = NULL;
+ struct kmod_list *pre = NULL, *post = NULL, *deps, *itr;
int err;
if (!ignore_commands) {
}
}
+ deps = kmod_module_get_dependencies(mod);
+ if (deps) {
+ kmod_list_foreach(itr, deps) {
+ struct kmod_module *dep = kmod_module_get_module(itr);
+ if (kmod_module_get_refcnt(dep) == 0) {
+ rmmod_do(dep);
+ }
+ }
+ kmod_module_unref_list(deps);
+ }
+
error:
kmod_module_unref_list(pre);
kmod_module_unref_list(post);