[PATCH 1/5] activation: change SystemdService to ActivationRequest
Scott James Remnant
scott at netsplit.com
Sun Jan 2 14:46:53 PST 2011
Instead of hardcoding the request string to be the systemd service
name, make it any string you wish to pass to the activation manager.
---
bus/activation.c | 44 ++++++++++++++++++++++----------------------
bus/desktop-file.h | 2 +-
2 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/bus/activation.c b/bus/activation.c
index ee5efa8..70ecff8 100644
--- a/bus/activation.c
+++ b/bus/activation.c
@@ -70,7 +70,7 @@ typedef struct
char *name;
char *exec;
char *user;
- char *systemd_service;
+ char *activation_request;
unsigned long mtime;
BusServiceDirectory *s_dir;
char *filename;
@@ -92,7 +92,7 @@ typedef struct
BusActivation *activation;
char *service_name;
char *exec;
- char *systemd_service;
+ char *activation_request;
DBusList *entries;
int n_entries;
DBusBabysitter *babysitter;
@@ -200,7 +200,7 @@ bus_pending_activation_unref (BusPendingActivation *pending_activation)
dbus_free (pending_activation->service_name);
dbus_free (pending_activation->exec);
- dbus_free (pending_activation->systemd_service);
+ dbus_free (pending_activation->activation_request);
link = _dbus_list_get_first_link (&pending_activation->entries);
@@ -247,7 +247,7 @@ bus_activation_entry_unref (BusActivationEntry *entry)
dbus_free (entry->exec);
dbus_free (entry->user);
dbus_free (entry->filename);
- dbus_free (entry->systemd_service);
+ dbus_free (entry->activation_request);
dbus_free (entry);
}
@@ -259,7 +259,7 @@ update_desktop_file_entry (BusActivation *activation,
BusDesktopFile *desktop_file,
DBusError *error)
{
- char *name, *exec, *user, *exec_tmp, *systemd_service;
+ char *name, *exec, *user, *exec_tmp, *activation_request;
BusActivationEntry *entry;
DBusStat stat_buf;
DBusString file_path;
@@ -272,7 +272,7 @@ update_desktop_file_entry (BusActivation *activation,
user = NULL;
exec_tmp = NULL;
entry = NULL;
- systemd_service = NULL;
+ activation_request = NULL;
dbus_error_init (&tmp_error);
@@ -333,11 +333,11 @@ update_desktop_file_entry (BusActivation *activation,
}
_DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error);
- /* systemd service is never required */
+ /* activation request is never required */
if (!bus_desktop_file_get_string (desktop_file,
DBUS_SERVICE_SECTION,
- DBUS_SERVICE_SYSTEMD_SERVICE,
- &systemd_service, &tmp_error))
+ DBUS_SERVICE_ACTIVATION_REQUEST,
+ &activation_request, &tmp_error))
{
_DBUS_ASSERT_ERROR_IS_SET (&tmp_error);
/* if we got OOM, then exit */
@@ -350,8 +350,8 @@ update_desktop_file_entry (BusActivation *activation,
{
/* if we have error because we didn't find anything then continue */
dbus_error_free (&tmp_error);
- dbus_free (systemd_service);
- systemd_service = NULL;
+ dbus_free (activation_request);
+ activation_request = NULL;
}
}
@@ -384,7 +384,7 @@ update_desktop_file_entry (BusActivation *activation,
entry->name = name;
entry->exec = exec;
entry->user = user;
- entry->systemd_service = systemd_service;
+ entry->activation_request = activation_request;
entry->refcount = 1;
entry->s_dir = s_dir;
@@ -426,8 +426,8 @@ update_desktop_file_entry (BusActivation *activation,
dbus_free (entry->name);
dbus_free (entry->exec);
dbus_free (entry->user);
- dbus_free (entry->systemd_service);
- entry->systemd_service = systemd_service;
+ dbus_free (entry->activation_request);
+ entry->activation_request = activation_request;
entry->name = name;
entry->exec = exec;
entry->user = user;
@@ -455,7 +455,7 @@ failed:
dbus_free (name);
dbus_free (exec_tmp);
dbus_free (user);
- dbus_free (systemd_service);
+ dbus_free (activation_request);
_dbus_string_free (&file_path);
if (entry)
@@ -1803,12 +1803,12 @@ bus_activation_activate_service (BusActivation *activation,
return FALSE;
}
- if (entry->systemd_service)
+ if (entry->activation_request)
{
- pending_activation->systemd_service = _dbus_strdup (entry->systemd_service);
- if (!pending_activation->systemd_service)
+ pending_activation->activation_request = _dbus_strdup (entry->activation_request);
+ if (!pending_activation->activation_request)
{
- _dbus_verbose ("Failed to copy systemd service for pending activation\n");
+ _dbus_verbose ("Failed to copy activation request for pending activation\n");
BUS_SET_OOM (error);
bus_pending_activation_unref (pending_activation);
bus_pending_activation_entry_free (pending_activation_entry);
@@ -1906,7 +1906,7 @@ bus_activation_activate_service (BusActivation *activation,
connects to us and do nothing. */
return TRUE;
- if (entry->systemd_service)
+ if (entry->activation_request)
{
BusTransaction *activation_transaction;
DBusString service_string;
@@ -1936,7 +1936,7 @@ bus_activation_activate_service (BusActivation *activation,
if (!dbus_message_set_sender (message, DBUS_SERVICE_DBUS) ||
!dbus_message_set_destination (message, "org.freedesktop.systemd1") ||
!dbus_message_append_args (message,
- DBUS_TYPE_STRING, &entry->systemd_service,
+ DBUS_TYPE_STRING, &entry->activation_request,
DBUS_TYPE_INVALID))
{
_dbus_verbose ("No memory to set args of activation message\n");
@@ -2176,7 +2176,7 @@ dbus_activation_systemd_failure (BusActivation *activation,
{
BusPendingActivation *p = _dbus_hash_iter_get_value (&iter);
- if (p->systemd_service && strcmp (p->systemd_service, unit) == 0)
+ if (p->activation_request && strcmp (p->activation_request, unit) == 0)
pending_activation_failed(p, &error);
}
}
diff --git a/bus/desktop-file.h b/bus/desktop-file.h
index 58e78e8..cdbfb80 100644
--- a/bus/desktop-file.h
+++ b/bus/desktop-file.h
@@ -35,7 +35,7 @@
#define DBUS_SERVICE_EXEC "Exec"
#define DBUS_SERVICE_USER "User"
#define DBUS_SERVICE_GROUP "Group"
-#define DBUS_SERVICE_SYSTEMD_SERVICE "SystemdService"
+#define DBUS_SERVICE_ACTIVATION_REQUEST "ActivationRequest"
typedef struct BusDesktopFile BusDesktopFile;
--
1.7.1
More information about the dbus
mailing list