summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-05-28 02:47:36 +0200
committerLennart Poettering <lennart@poettering.net>2009-05-28 02:47:36 +0200
commitc224aace42ca3b59d18a5bc7d5f33aed7d9fb99c (patch)
tree53dac2f344317c18f90f3669935b9371a8534b6c
parent1c4393acf0a641a4f462cfa6c368d23d9e55a1b8 (diff)
modules: introduce PA_MODULE_DEPRECATED() macro for marking modules deprecated
-rw-r--r--src/daemon/dumpmodules.c2
-rw-r--r--src/modules/module-defs.h.m42
-rw-r--r--src/modules/module-detect.c1
-rw-r--r--src/modules/module-volume-restore.c3
-rw-r--r--src/modules/oss/module-oss.c3
-rw-r--r--src/pulsecore/cli-command.c2
-rw-r--r--src/pulsecore/ltdl-helper.h1
-rw-r--r--src/pulsecore/modinfo.c5
-rw-r--r--src/pulsecore/modinfo.h1
-rw-r--r--src/pulsecore/module.c9
-rw-r--r--src/pulsecore/module.h4
11 files changed, 31 insertions, 2 deletions
diff --git a/src/daemon/dumpmodules.c b/src/daemon/dumpmodules.c
index 0ffc0fc0..92470b49 100644
--- a/src/daemon/dumpmodules.c
+++ b/src/daemon/dumpmodules.c
@@ -71,6 +71,8 @@ static void long_info(const char *name, const char *path, pa_modinfo *i) {
if (i->usage)
printf(_("Usage: %s\n"), i->usage);
printf(_("Load Once: %s\n"), pa_yes_no(i->load_once));
+ if (i->deprecated)
+ printf(_("DEPRECATION WARNING: %s\n"), i->deprecated);
}
if (path)
diff --git a/src/modules/module-defs.h.m4 b/src/modules/module-defs.h.m4
index f9924cfa..b6a60b6a 100644
--- a/src/modules/module-defs.h.m4
+++ b/src/modules/module-defs.h.m4
@@ -17,6 +17,7 @@ gen_symbol(pa__get_author)
gen_symbol(pa__get_description)
gen_symbol(pa__get_usage)
gen_symbol(pa__get_version)
+gen_symbol(pa__get_deprecated)
gen_symbol(pa__load_once)
gen_symbol(pa__get_n_used)
@@ -28,6 +29,7 @@ const char* pa__get_author(void);
const char* pa__get_description(void);
const char* pa__get_usage(void);
const char* pa__get_version(void);
+const char* pa__get_deprecated(void);
pa_bool_t pa__load_once(void);
#endif
diff --git a/src/modules/module-detect.c b/src/modules/module-detect.c
index 49127abc..18479df3 100644
--- a/src/modules/module-detect.c
+++ b/src/modules/module-detect.c
@@ -50,6 +50,7 @@ PA_MODULE_DESCRIPTION("Detect available audio hardware and load matching drivers
PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE);
PA_MODULE_USAGE("just-one=<boolean>");
+PA_MODULE_DEPRECATED("Please use module-hal-detect instead of module-detect!");
static const char* const valid_modargs[] = {
"just-one",
diff --git a/src/modules/module-volume-restore.c b/src/modules/module-volume-restore.c
index 61858afa..91da598e 100644
--- a/src/modules/module-volume-restore.c
+++ b/src/modules/module-volume-restore.c
@@ -36,6 +36,7 @@ PA_MODULE_AUTHOR("Lennart Poettering");
PA_MODULE_DESCRIPTION("Compatibility module");
PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(TRUE);
+PA_MODULE_DEPRECATED("Please use module-stream-restore instead of module-volume-restore!");
static const char* const valid_modargs[] = {
"table",
@@ -62,7 +63,7 @@ int pa__init(pa_module*m) {
goto fail;
}
- pa_log_warn("module-volume-restore is obsolete. It has been replaced by module-stream-restore. We will now load the latter but please make sure to remove module-volume-restore from your configuration.");
+ pa_log_warn("We will now load module-stream-restore. Please make sure to remove module-volume-restore from your configuration.");
t = pa_sprintf_malloc("restore_volume=%s restore_device=%s", pa_yes_no(restore_volume), pa_yes_no(restore_device));
pa_module_load(m->core, "module-stream-restore", t);
diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c
index 7d8d25e4..b1afcfd6 100644
--- a/src/modules/oss/module-oss.c
+++ b/src/modules/oss/module-oss.c
@@ -98,6 +98,9 @@ PA_MODULE_USAGE(
"fragments=<number of fragments> "
"fragment_size=<fragment size> "
"mmap=<enable memory mapping?>");
+#ifdef __linux__
+PA_MODULE_DEPRECATED("Please use module-alsa-card instead of module-oss!");
+#endif
#define DEFAULT_DEVICE "/dev/dsp"
diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index 15fe525c..dad647a8 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -483,6 +483,8 @@ static int pa_cli_command_describe(pa_core *c, pa_tokenizer *t, pa_strbuf *buf,
if (i->usage)
pa_strbuf_printf(buf, "Usage: %s\n", i->usage);
pa_strbuf_printf(buf, "Load Once: %s\n", pa_yes_no(i->load_once));
+ if (i->deprecated)
+ pa_strbuf_printf(buf, "Warning, deprecated: %s\n", i->deprecated);
}
pa_modinfo_free(i);
diff --git a/src/pulsecore/ltdl-helper.h b/src/pulsecore/ltdl-helper.h
index 4c4f018a..9f346969 100644
--- a/src/pulsecore/ltdl-helper.h
+++ b/src/pulsecore/ltdl-helper.h
@@ -29,4 +29,3 @@ typedef void (*pa_void_func_t)(void);
pa_void_func_t pa_load_sym(lt_dlhandle handle, const char*module, const char *symbol);
#endif
-
diff --git a/src/pulsecore/modinfo.c b/src/pulsecore/modinfo.c
index 00fb9c43..b5ee9f56 100644
--- a/src/pulsecore/modinfo.c
+++ b/src/pulsecore/modinfo.c
@@ -38,6 +38,7 @@
#define PA_SYMBOL_DESCRIPTION "pa__get_description"
#define PA_SYMBOL_USAGE "pa__get_usage"
#define PA_SYMBOL_VERSION "pa__get_version"
+#define PA_SYMBOL_DEPRECATED "pa__get_deprecated"
#define PA_SYMBOL_LOAD_ONCE "pa__load_once"
pa_modinfo *pa_modinfo_get_by_handle(lt_dlhandle dl, const char *module_name) {
@@ -61,6 +62,9 @@ pa_modinfo *pa_modinfo_get_by_handle(lt_dlhandle dl, const char *module_name) {
if ((func = (const char* (*)(void)) pa_load_sym(dl, module_name, PA_SYMBOL_VERSION)))
i->version = pa_xstrdup(func());
+ if ((func = (const char* (*)(void)) pa_load_sym(dl, module_name, PA_SYMBOL_DEPRECATED)))
+ i->deprecated = pa_xstrdup(func());
+
if ((func2 = (pa_bool_t (*)(void)) pa_load_sym(dl, module_name, PA_SYMBOL_LOAD_ONCE)))
i->load_once = func2();
@@ -91,5 +95,6 @@ void pa_modinfo_free(pa_modinfo *i) {
pa_xfree(i->description);
pa_xfree(i->usage);
pa_xfree(i->version);
+ pa_xfree(i->deprecated);
pa_xfree(i);
}
diff --git a/src/pulsecore/modinfo.h b/src/pulsecore/modinfo.h
index 407e602a..baad0de7 100644
--- a/src/pulsecore/modinfo.h
+++ b/src/pulsecore/modinfo.h
@@ -30,6 +30,7 @@ typedef struct pa_modinfo {
char *description;
char *usage;
char *version;
+ char *deprecated;
pa_bool_t load_once;
} pa_modinfo;
diff --git a/src/pulsecore/module.c b/src/pulsecore/module.c
index 42fd912c..5bcdd898 100644
--- a/src/pulsecore/module.c
+++ b/src/pulsecore/module.c
@@ -48,10 +48,12 @@
#define PA_SYMBOL_DONE "pa__done"
#define PA_SYMBOL_LOAD_ONCE "pa__load_once"
#define PA_SYMBOL_GET_N_USED "pa__get_n_used"
+#define PA_SYMBOL_GET_DEPRECATE "pa__get_deprecated"
pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
pa_module *m = NULL;
pa_bool_t (*load_once)(void);
+ const char* (*get_deprecated)(void);
pa_modinfo *mi;
pa_assert(c);
@@ -89,6 +91,13 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
}
}
+ if ((get_deprecated = (const char* (*) (void)) pa_load_sym(m->dl, name, PA_SYMBOL_GET_DEPRECATE))) {
+ const char *t;
+
+ if ((t = get_deprecated()))
+ pa_log_warn("%s is deprecated: %s", name, t);
+ }
+
if (!(m->init = (int (*)(pa_module*_m)) pa_load_sym(m->dl, name, PA_SYMBOL_INIT))) {
pa_log("Failed to load module \"%s\": symbol \""PA_SYMBOL_INIT"\" not found.", name);
goto fail;
diff --git a/src/pulsecore/module.h b/src/pulsecore/module.h
index 3f697348..af89d793 100644
--- a/src/pulsecore/module.h
+++ b/src/pulsecore/module.h
@@ -78,6 +78,10 @@ int pa_module_get_n_used(pa_module*m);
const char * pa__get_version(void) { return s; } \
struct __stupid_useless_struct_to_allow_trailing_semicolon
+#define PA_MODULE_DEPRECATED(s) \
+ const char * pa__get_deprecated(void) { return s; } \
+ struct __stupid_useless_struct_to_allow_trailing_semicolon
+
#define PA_MODULE_LOAD_ONCE(b) \
pa_bool_t pa__load_once(void) { return b; } \
struct __stupid_useless_struct_to_allow_trailing_semicolon