mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
53 lines
1.7 KiB
Diff
53 lines
1.7 KiB
Diff
|
From 4e3dd21aff55b5bbaa08b037fc2a5625bfffc0a5 Mon Sep 17 00:00:00 2001
|
||
|
From: Dave Reisner <dreisner@archlinux.org>
|
||
|
Date: Mon, 30 Jan 2012 23:39:30 -0500
|
||
|
Subject: [PATCH 4/4] modprobe: remove 0 refcnt deps
|
||
|
|
||
|
---
|
||
|
tools/kmod-modprobe.c | 15 +++++++++++++--
|
||
|
1 files changed, 13 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/tools/kmod-modprobe.c b/tools/kmod-modprobe.c
|
||
|
index c882856..bd991a5 100644
|
||
|
--- a/tools/kmod-modprobe.c
|
||
|
+++ b/tools/kmod-modprobe.c
|
||
|
@@ -381,7 +381,7 @@ static int rmmod_do_deps_list(struct kmod_list *list, bool stop_on_errors)
|
||
|
static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies)
|
||
|
{
|
||
|
const char *modname = kmod_module_get_name(mod);
|
||
|
- struct kmod_list *pre = NULL, *post = NULL;
|
||
|
+ struct kmod_list *pre = NULL, *post = NULL, *deps, *itr;
|
||
|
const char *cmd = NULL;
|
||
|
int err;
|
||
|
|
||
|
@@ -422,7 +422,7 @@ static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies)
|
||
|
rmmod_do_deps_list(post, false);
|
||
|
|
||
|
if (do_dependencies && remove_dependencies) {
|
||
|
- struct kmod_list *deps = kmod_module_get_dependencies(mod);
|
||
|
+ deps = kmod_module_get_dependencies(mod);
|
||
|
|
||
|
err = rmmod_do_deps_list(deps, true);
|
||
|
if (err < 0)
|
||
|
@@ -451,6 +451,17 @@ static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies)
|
||
|
|
||
|
rmmod_do_deps_list(pre, false);
|
||
|
|
||
|
+ deps = kmod_module_get_dependencies(mod);
|
||
|
+ if (deps != NULL) {
|
||
|
+ kmod_list_foreach_reverse(itr, deps) {
|
||
|
+ struct kmod_module *dep = kmod_module_get_module(itr);
|
||
|
+ if (kmod_module_get_refcnt(dep) == 0)
|
||
|
+ rmmod_do_remove_module(dep);
|
||
|
+ kmod_module_unref(dep);
|
||
|
+ }
|
||
|
+ kmod_module_unref_list(deps);
|
||
|
+ }
|
||
|
+
|
||
|
error:
|
||
|
kmod_module_unref_list(pre);
|
||
|
kmod_module_unref_list(post);
|
||
|
--
|
||
|
1.7.9
|
||
|
|