summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-08-07 02:28:47 +0200
committerLennart Poettering <lennart@poettering.net>2008-08-07 02:28:47 +0200
commitecb2bc4f04e5a6a71e19d4be651596cebbb83500 (patch)
tree8dc36f952bf744c649826a2bf348a1eddcb3242c /src/modules
parentbd05b36a1eb54f51c9e901738a422a621fe0918d (diff)
Modify pa_state_path() to take an additional argument for prepending the machine id to the file name.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/module-default-device-restore.c16
-rw-r--r--src/modules/module-device-restore.c10
-rw-r--r--src/modules/module-stream-restore.c10
-rw-r--r--src/modules/module-volume-restore.c2
4 files changed, 13 insertions, 25 deletions
diff --git a/src/modules/module-default-device-restore.c b/src/modules/module-default-device-restore.c
index 4037881f..d2cc24f3 100644
--- a/src/modules/module-default-device-restore.c
+++ b/src/modules/module-default-device-restore.c
@@ -154,28 +154,16 @@ static void subscribe_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t id
int pa__init(pa_module *m) {
struct userdata *u;
- char hn[256], *fn;
pa_assert(m);
m->userdata = u = pa_xnew0(struct userdata, 1);
u->core = m->core;
- if (!pa_get_host_name(hn, sizeof(hn)))
+ if (!(u->sink_filename = pa_state_path("default-sink", TRUE)))
goto fail;
- fn = pa_sprintf_malloc("default-sink.%s", hn);
- u->sink_filename = pa_state_path(fn);
- pa_xfree(fn);
-
- if (!u->sink_filename)
- goto fail;
-
- fn = pa_sprintf_malloc("default-source.%s", hn);
- u->source_filename = pa_state_path(fn);
- pa_xfree(fn);
-
- if (!u->source_filename)
+ if (!(u->source_filename = pa_state_path("default-source", TRUE)))
goto fail;
load(u);
diff --git a/src/modules/module-device-restore.c b/src/modules/module-device-restore.c
index fcd40219..3d731f12 100644
--- a/src/modules/module-device-restore.c
+++ b/src/modules/module-device-restore.c
@@ -284,7 +284,6 @@ int pa__init(pa_module*m) {
pa_modargs *ma = NULL;
struct userdata *u;
char *fname, *fn;
- char hn[256];
pa_sink *sink;
pa_source *source;
uint32_t idx;
@@ -321,11 +320,12 @@ int pa__init(pa_module*m) {
u->source_fixate_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_FIXATE], PA_HOOK_EARLY, (pa_hook_cb_t) source_fixate_hook_callback, u);
}
- if (!pa_get_host_name(hn, sizeof(hn)))
- goto fail;
+ /* We include the host identifier in the file name because gdbm
+ * files are CPU dependant, and we don't want things to go wrong
+ * if we are on a multiarch system. */
- fn = pa_sprintf_malloc("device-volumes.%s."CANONICAL_HOST".gdbm", hn);
- fname = pa_state_path(fn);
+ fn = pa_sprintf_malloc("device-volumes."CANONICAL_HOST".gdbm");
+ fname = pa_state_path(fn, TRUE);
pa_xfree(fn);
if (!fname)
diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index b6d7b0f3..ec4e7c79 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -666,7 +666,6 @@ int pa__init(pa_module*m) {
pa_modargs *ma = NULL;
struct userdata *u;
char *fname, *fn;
- char hn[256];
pa_sink_input *si;
pa_source_output *so;
uint32_t idx;
@@ -714,11 +713,12 @@ int pa__init(pa_module*m) {
if (restore_volume || restore_muted)
u->sink_input_fixate_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_FIXATE], PA_HOOK_EARLY, (pa_hook_cb_t) sink_input_fixate_hook_callback, u);
- if (!pa_get_host_name(hn, sizeof(hn)))
- goto fail;
+ /* We include the host identifier in the file name because gdbm
+ * files are CPU dependant, and we don't want things to go wrong
+ * if we are on a multiarch system. */
- fn = pa_sprintf_malloc("stream-volumes.%s."CANONICAL_HOST".gdbm", hn);
- fname = pa_state_path(fn);
+ fn = pa_sprintf_malloc("stream-volumes."CANONICAL_HOST".gdbm");
+ fname = pa_state_path(fn, TRUE);
pa_xfree(fn);
if (!fname)
diff --git a/src/modules/module-volume-restore.c b/src/modules/module-volume-restore.c
index d862c203..0fb17a0d 100644
--- a/src/modules/module-volume-restore.c
+++ b/src/modules/module-volume-restore.c
@@ -493,7 +493,7 @@ int pa__init(pa_module*m) {
m->userdata = u;
- if (!(u->table_file = pa_state_path(pa_modargs_get_value(ma, "table", DEFAULT_VOLUME_TABLE_FILE))))
+ if (!(u->table_file = pa_state_path(pa_modargs_get_value(ma, "table", DEFAULT_VOLUME_TABLE_FILE), TRUE)))
goto fail;
if (pa_modargs_get_value_boolean(ma, "restore_device", &restore_device) < 0 ||