[PATCH 1/3] module: Add support for unloading by name.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The request for unloading modules by name was added to module.c.
If there are more modules with the same name all of them are unloaded.
---
 src/pulsecore/module.c |   11 +++++++++++
 src/pulsecore/module.h |    1 +
 2 files changed, 12 insertions(+)

diff --git a/src/pulsecore/module.c b/src/pulsecore/module.c
index 8b3ff8f..332bc2b 100644
--- a/src/pulsecore/module.c
+++ b/src/pulsecore/module.c
@@ -252,6 +252,17 @@ void pa_module_unload_request_by_index(pa_core *c, uint32_t idx, pa_bool_t force
     pa_module_unload_request(m, force);
 }
 
+void pa_module_unload_request_by_name(pa_core *c, const char *name, pa_bool_t force) {
+    pa_module *m;
+    uint32_t idx;
+
+    pa_assert(c);
+
+    PA_IDXSET_FOREACH(m, c->modules, idx)
+        if (pa_streq(name, m->name))
+            pa_module_unload_request(m, force);
+}
+
 int pa_module_get_n_used(pa_module*m) {
     pa_assert(m);
 
diff --git a/src/pulsecore/module.h b/src/pulsecore/module.h
index 0b6cb7c..2ba452c 100644
--- a/src/pulsecore/module.h
+++ b/src/pulsecore/module.h
@@ -57,6 +57,7 @@ void pa_module_unload_by_index(pa_core *c, uint32_t idx, pa_bool_t force);
 
 void pa_module_unload_request(pa_module *m, pa_bool_t force);
 void pa_module_unload_request_by_index(pa_core *c, uint32_t idx, pa_bool_t force);
+void pa_module_unload_request_by_name(pa_core *c, const char *name, pa_bool_t force);
 
 void pa_module_unload_all(pa_core *c);
 
-- 
1.7.10.2



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux