summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/dbus-util.c6
-rw-r--r--src/modules/module-x11-publish.c2
-rw-r--r--src/pulsecore/authkey-prop.c14
-rw-r--r--src/pulsecore/cli-command.c8
-rw-r--r--src/pulsecore/core.c4
-rw-r--r--src/pulsecore/core.h2
-rw-r--r--src/pulsecore/props.c74
-rw-r--r--src/pulsecore/props.h41
-rw-r--r--src/pulsecore/protocol-native.c10
-rw-r--r--src/pulsecore/x11wrap.c6
10 files changed, 84 insertions, 83 deletions
diff --git a/src/modules/dbus-util.c b/src/modules/dbus-util.c
index 905be13f..e18b6ab9 100644
--- a/src/modules/dbus-util.c
+++ b/src/modules/dbus-util.c
@@ -254,7 +254,7 @@ static pa_dbus_connection* pa_dbus_connection_new(pa_core* c, DBusConnection *co
pconn->connection = conn;
pconn->dispatch_event = c->mainloop->defer_new(c->mainloop, dispatch_cb, conn);
- pa_property_set(c, name, pconn);
+ pa_shared_set(c, name, pconn);
return pconn;
}
@@ -282,7 +282,7 @@ void pa_dbus_connection_unref(pa_dbus_connection *c) {
}
/* already disconnected, just free */
- pa_property_remove(c->core, c->property_name);
+ pa_shared_remove(c->core, c->property_name);
c->core->mainloop->defer_free(c->dispatch_event);
dbus_connection_unref(c->connection);
pa_xfree(c);
@@ -309,7 +309,7 @@ pa_dbus_connection* pa_dbus_bus_get(pa_core *c, DBusBusType type, DBusError *err
pa_assert(type == DBUS_BUS_SYSTEM || type == DBUS_BUS_SESSION || type == DBUS_BUS_STARTER);
- if ((pconn = pa_property_get(c, prop_name[type])))
+ if ((pconn = pa_shared_get(c, prop_name[type])))
return pa_dbus_connection_ref(pconn);
if (!(conn = dbus_bus_get_private(type, error)))
diff --git a/src/modules/module-x11-publish.c b/src/modules/module-x11-publish.c
index 705d90f4..d0ce344f 100644
--- a/src/modules/module-x11-publish.c
+++ b/src/modules/module-x11-publish.c
@@ -152,7 +152,7 @@ int pa__init(pa_module*m) {
if (!(u->x11_wrapper = pa_x11_wrapper_get(m->core, pa_modargs_get_value(ma, "display", NULL))))
goto fail;
- if (!(l = pa_property_get(m->core, PA_NATIVE_SERVER_PROPERTY_NAME)))
+ if (!(l = pa_shared_get(m->core, PA_NATIVE_SERVER_PROPERTY_NAME)))
goto fail;
l = pa_strlist_reverse(l);
diff --git a/src/pulsecore/authkey-prop.c b/src/pulsecore/authkey-prop.c
index a953bf7d..9e147ec1 100644
--- a/src/pulsecore/authkey-prop.c
+++ b/src/pulsecore/authkey-prop.c
@@ -47,7 +47,7 @@ int pa_authkey_prop_get(pa_core *c, const char *name, void *data, size_t len) {
pa_assert(data);
pa_assert(len > 0);
- if (!(a = pa_property_get(c, name)))
+ if (!(a = pa_shared_get(c, name)))
return -1;
pa_assert(a->length == len);
@@ -62,7 +62,7 @@ int pa_authkey_prop_put(pa_core *c, const char *name, const void *data, size_t l
pa_assert(c);
pa_assert(name);
- if (pa_property_get(c, name))
+ if (pa_shared_get(c, name))
return -1;
a = pa_xmalloc(PA_ALIGN(sizeof(struct authkey_data)) + len);
@@ -70,7 +70,7 @@ int pa_authkey_prop_put(pa_core *c, const char *name, const void *data, size_t l
a->length = len;
memcpy((uint8_t*) a + PA_ALIGN(sizeof(struct authkey_data)), data, len);
- pa_property_set(c, name, a);
+ pa_shared_set(c, name, a);
return 0;
}
@@ -81,7 +81,7 @@ void pa_authkey_prop_ref(pa_core *c, const char *name) {
pa_assert(c);
pa_assert(name);
- a = pa_property_get(c, name);
+ a = pa_shared_get(c, name);
pa_assert(a);
pa_assert(PA_REFCNT_VALUE(a) >= 1);
PA_REFCNT_INC(a);
@@ -93,14 +93,12 @@ void pa_authkey_prop_unref(pa_core *c, const char *name) {
pa_assert(c);
pa_assert(name);
- a = pa_property_get(c, name);
+ a = pa_shared_get(c, name);
pa_assert(a);
pa_assert(PA_REFCNT_VALUE(a) >= 1);
if (PA_REFCNT_DEC(a) <= 0) {
- pa_property_remove(c, name);
+ pa_shared_remove(c, name);
pa_xfree(a);
}
}
-
-
diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index cbdb602a..43ec1042 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -110,7 +110,7 @@ static int pa_cli_command_autoload_list(pa_core *c, pa_tokenizer *t, pa_strbuf *
static int pa_cli_command_autoload_add(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
static int pa_cli_command_autoload_remove(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
-static int pa_cli_command_list_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
+static int pa_cli_command_list_shared_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
static int pa_cli_command_move_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
static int pa_cli_command_move_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
static int pa_cli_command_vacuum(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
@@ -160,7 +160,7 @@ static const struct command commands[] = {
{ "remove-autoload-sink", pa_cli_command_autoload_remove, NULL /*"Remove autoload entry for a sink (args: name)"*/, 2},
{ "remove-autoload-source", pa_cli_command_autoload_remove, NULL /*"Remove autoload entry for a source (args: name)"*/, 2},
{ "dump", pa_cli_command_dump, "Dump daemon configuration", 1},
- { "list-props", pa_cli_command_list_props, NULL, 1},
+ { "shared", pa_cli_command_list_shared_props, NULL, 1},
{ "move-sink-input", pa_cli_command_move_sink_input, "Move sink input to another sink (args: index, sink)", 3},
{ "move-source-output", pa_cli_command_move_source_output, "Move source output to another source (args: index, source)", 3},
{ "vacuum", pa_cli_command_vacuum, NULL, 1},
@@ -996,13 +996,13 @@ static int pa_cli_command_autoload_list(pa_core *c, pa_tokenizer *t, pa_strbuf *
return 0;
}
-static int pa_cli_command_list_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) {
+static int pa_cli_command_list_shared_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) {
pa_core_assert_ref(c);
pa_assert(t);
pa_assert(buf);
pa_assert(fail);
- pa_property_dump(c, buf);
+ pa_shared_dump(c, buf);
return 0;
}
diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
index b2638b10..9aabd37d 100644
--- a/src/pulsecore/core.c
+++ b/src/pulsecore/core.c
@@ -141,7 +141,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {
for (j = 0; j < PA_CORE_HOOK_MAX; j++)
pa_hook_init(&c->hooks[j], c);
- pa_property_init(c);
+ pa_shared_init(c);
pa_random(&c->cookie, sizeof(c->cookie));
@@ -189,7 +189,7 @@ static void core_free(pa_object *o) {
pa_silence_cache_done(&c->silence_cache);
pa_mempool_free(c->mempool);
- pa_property_cleanup(c);
+ pa_shared_cleanup(c);
for (j = 0; j < PA_CORE_HOOK_MAX; j++)
pa_hook_free(&c->hooks[j]);
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index 14a2c78d..e11655ef 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -94,7 +94,7 @@ struct pa_core {
pa_idxset *clients, *sinks, *sources, *sink_inputs, *source_outputs, *modules, *scache, *autoload_idxset;
/* Some hashmaps for all sorts of entities */
- pa_hashmap *namereg, *autoload_hashmap, *properties;
+ pa_hashmap *namereg, *autoload_hashmap, *shared;
/* The name of the default sink/source */
char *default_source_name, *default_sink_name;
diff --git a/src/pulsecore/props.c b/src/pulsecore/props.c
index 23d432ec..1bfb297a 100644
--- a/src/pulsecore/props.c
+++ b/src/pulsecore/props.c
@@ -29,110 +29,110 @@
#include "props.h"
-typedef struct pa_property {
- char *name; /* Points to memory allocated by the property subsystem */
+typedef struct pa_shared {
+ char *name; /* Points to memory allocated by the shared property system */
void *data; /* Points to memory maintained by the caller */
-} pa_property;
+} pa_shared;
-/* Allocate a new property object */
-static pa_property* property_new(const char *name, void *data) {
- pa_property* p;
+/* Allocate a new shared property object */
+static pa_shared* shared_new(const char *name, void *data) {
+ pa_shared* p;
pa_assert(name);
pa_assert(data);
- p = pa_xnew(pa_property, 1);
+ p = pa_xnew(pa_shared, 1);
p->name = pa_xstrdup(name);
p->data = data;
return p;
}
-/* Free a property object */
-static void property_free(pa_property *p) {
+/* Free a shared property object */
+static void shared_free(pa_shared *p) {
pa_assert(p);
pa_xfree(p->name);
pa_xfree(p);
}
-void* pa_property_get(pa_core *c, const char *name) {
- pa_property *p;
+void* pa_shared_get(pa_core *c, const char *name) {
+ pa_shared *p;
pa_assert(c);
pa_assert(name);
- pa_assert(c->properties);
+ pa_assert(c->shared);
- if (!(p = pa_hashmap_get(c->properties, name)))
+ if (!(p = pa_hashmap_get(c->shared, name)))
return NULL;
return p->data;
}
-int pa_property_set(pa_core *c, const char *name, void *data) {
- pa_property *p;
+int pa_shared_set(pa_core *c, const char *name, void *data) {
+ pa_shared *p;
pa_assert(c);
pa_assert(name);
pa_assert(data);
- pa_assert(c->properties);
+ pa_assert(c->shared);
- if (pa_hashmap_get(c->properties, name))
+ if (pa_hashmap_get(c->shared, name))
return -1;
- p = property_new(name, data);
- pa_hashmap_put(c->properties, p->name, p);
+ p = shared_new(name, data);
+ pa_hashmap_put(c->shared, p->name, p);
return 0;
}
-int pa_property_remove(pa_core *c, const char *name) {
- pa_property *p;
+int pa_shared_remove(pa_core *c, const char *name) {
+ pa_shared *p;
pa_assert(c);
pa_assert(name);
- pa_assert(c->properties);
+ pa_assert(c->shared);
- if (!(p = pa_hashmap_remove(c->properties, name)))
+ if (!(p = pa_hashmap_remove(c->shared, name)))
return -1;
- property_free(p);
+ shared_free(p);
return 0;
}
-void pa_property_init(pa_core *c) {
+void pa_shared_init(pa_core *c) {
pa_assert(c);
- c->properties = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
+ c->shared = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
}
-void pa_property_cleanup(pa_core *c) {
+void pa_shared_cleanup(pa_core *c) {
pa_assert(c);
- if (!c->properties)
+ if (!c->shared)
return;
- pa_assert(!pa_hashmap_size(c->properties));
+ pa_assert(pa_hashmap_isempty(c->shared));
- pa_hashmap_free(c->properties, NULL, NULL);
- c->properties = NULL;
+ pa_hashmap_free(c->shared, NULL, NULL);
+ c->shared = NULL;
}
-void pa_property_dump(pa_core *c, pa_strbuf *s) {
+void pa_shared_dump(pa_core *c, pa_strbuf *s) {
void *state = NULL;
- pa_property *p;
+ pa_shared *p;
pa_assert(c);
pa_assert(s);
- while ((p = pa_hashmap_iterate(c->properties, &state, NULL)))
+ while ((p = pa_hashmap_iterate(c->shared, &state, NULL)))
pa_strbuf_printf(s, "[%s] -> [%p]\n", p->name, p->data);
}
-int pa_property_replace(pa_core *c, const char *name, void *data) {
+int pa_shared_replace(pa_core *c, const char *name, void *data) {
pa_assert(c);
pa_assert(name);
- pa_property_remove(c, name);
- return pa_property_set(c, name, data);
+ pa_shared_remove(c, name);
+ return pa_shared_set(c, name, data);
}
diff --git a/src/pulsecore/props.h b/src/pulsecore/props.h
index 95db229b..dd3f94e2 100644
--- a/src/pulsecore/props.h
+++ b/src/pulsecore/props.h
@@ -1,5 +1,5 @@
-#ifndef foopropshfoo
-#define foopropshfoo
+#ifndef foosharedshfoo
+#define foosharedshfoo
/***
This file is part of PulseAudio.
@@ -25,34 +25,37 @@
#include <pulsecore/core.h>
#include <pulsecore/strbuf.h>
-/* The property subsystem is to be used to share data between
+/* The shared property subsystem is to be used to share data between
* modules. Consider them to be kind of "global" variables for a
* core. Why not use the hashmap functions directly? The hashmap
* functions copy neither the key nor value, while this property
* system copies the key. Users of this system have to think about
* reference counting themselves. */
-/* Return a pointer to the value of the specified property. */
-void* pa_property_get(pa_core *c, const char *name);
+/* Note: please don't confuse this with the proplist framework in
+ * pulse/proplist.[ch]! */
-/* Set the property 'name' to 'data'. This function fails in case a
- * property by this name already exists. The property data is not
- * copied or reference counted. This is the caller's job. */
-int pa_property_set(pa_core *c, const char *name, void *data);
+/* Return a pointer to the value of the specified shared property. */
+void* pa_shared_get(pa_core *c, const char *name);
-/* Remove the specified property. Return non-zero on failure */
-int pa_property_remove(pa_core *c, const char *name);
+/* Set the shared property 'name' to 'data'. This function fails in
+ * case a property by this name already exists. The property data is
+ * not copied or reference counted. This is the caller's job. */
+int pa_shared_set(pa_core *c, const char *name, void *data);
-/* A combination of pa_property_remove() and pa_property_set() */
-int pa_property_replace(pa_core *c, const char *name, void *data);
+/* Remove the specified shared property. Return non-zero on failure */
+int pa_shared_remove(pa_core *c, const char *name);
-/* Free all memory used by the property system */
-void pa_property_cleanup(pa_core *c);
+/* A combination of pa_shared_remove() and pa_shared_set() */
+int pa_shared_replace(pa_core *c, const char *name, void *data);
-/* Initialize the properties subsystem */
-void pa_property_init(pa_core *c);
+/* Free all memory used by the shared property system */
+void pa_shared_cleanup(pa_core *c);
-/* Dump the current set of properties */
-void pa_property_dump(pa_core *c, pa_strbuf *s);
+/* Initialize the shared property system */
+void pa_shared_init(pa_core *c);
+
+/* Dump the current set of shared properties */
+void pa_shared_dump(pa_core *c, pa_strbuf *s);
#endif
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index e1303597..f279b6af 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -4134,9 +4134,9 @@ pa_protocol_native* pa_protocol_native_new(pa_core *core, pa_socket_server *serv
if (pa_socket_server_get_address(p->server, t, sizeof(t))) {
pa_strlist *l;
- l = pa_property_get(core, PA_NATIVE_SERVER_PROPERTY_NAME);
+ l = pa_shared_get(core, PA_NATIVE_SERVER_PROPERTY_NAME);
l = pa_strlist_prepend(l, t);
- pa_property_replace(core, PA_NATIVE_SERVER_PROPERTY_NAME, l);
+ pa_shared_replace(core, PA_NATIVE_SERVER_PROPERTY_NAME, l);
}
return p;
@@ -4155,13 +4155,13 @@ void pa_protocol_native_free(pa_protocol_native *p) {
if (pa_socket_server_get_address(p->server, t, sizeof(t))) {
pa_strlist *l;
- l = pa_property_get(p->core, PA_NATIVE_SERVER_PROPERTY_NAME);
+ l = pa_shared_get(p->core, PA_NATIVE_SERVER_PROPERTY_NAME);
l = pa_strlist_remove(l, t);
if (l)
- pa_property_replace(p->core, PA_NATIVE_SERVER_PROPERTY_NAME, l);
+ pa_shared_replace(p->core, PA_NATIVE_SERVER_PROPERTY_NAME, l);
else
- pa_property_remove(p->core, PA_NATIVE_SERVER_PROPERTY_NAME);
+ pa_shared_remove(p->core, PA_NATIVE_SERVER_PROPERTY_NAME);
}
pa_socket_server_unref(p->server);
diff --git a/src/pulsecore/x11wrap.c b/src/pulsecore/x11wrap.c
index 00b6a157..9186cf74 100644
--- a/src/pulsecore/x11wrap.c
+++ b/src/pulsecore/x11wrap.c
@@ -192,7 +192,7 @@ static pa_x11_wrapper* x11_wrapper_new(pa_core *c, const char *name, const char
XAddConnectionWatch(d, x11_watch, (XPointer) w);
- pa_assert_se(pa_property_set(c, w->property_name, w) >= 0);
+ pa_assert_se(pa_shared_set(c, w->property_name, w) >= 0);
return w;
}
@@ -200,7 +200,7 @@ static pa_x11_wrapper* x11_wrapper_new(pa_core *c, const char *name, const char
static void x11_wrapper_free(pa_x11_wrapper*w) {
pa_assert(w);
- pa_assert_se(pa_property_remove(w->core, w->property_name) >= 0);
+ pa_assert_se(pa_shared_remove(w->core, w->property_name) >= 0);
pa_assert(!w->clients);
@@ -224,7 +224,7 @@ pa_x11_wrapper* pa_x11_wrapper_get(pa_core *c, const char *name) {
pa_core_assert_ref(c);
pa_snprintf(t, sizeof(t), "x11-wrapper%s%s", name ? "-" : "", name ? name : "");
- if ((w = pa_property_get(c, t)))
+ if ((w = pa_shared_get(c, t)))
return pa_x11_wrapper_ref(w);
return x11_wrapper_new(c, name, t);