service: Change service.name to service.dbus_path 56/129956/3
authorPaweł Szewczyk <p.szewczyk@samsung.com>
Thu, 18 May 2017 12:03:43 +0000 (14:03 +0200)
committerPaweł Szewczyk <p.szewczyk@samsung.com>
Fri, 19 May 2017 12:54:23 +0000 (14:54 +0200)
What we called 'name' was actually a dbus path, so 'dbus_path' is a better
name for it.

Change-Id: If85c82e6f9dde703e6c2946e01cdc68e0db5ca7b
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
src/core/service.c
src/core/service.h
src/decision_makers/rv_dm.c
src/event_types/resource_violation_event.c
src/event_types/service_failed_event.c

index 1a87d87f83494c8ea1182e768e67179cb628546b..a01116fcbca5c3b187e5c1e8748c543d03d00938 100644 (file)
@@ -42,12 +42,12 @@ int systemd_service_init_by_pid(pid_t pid, struct systemd_service *s)
        return systemd_service_init(n, s);
 }
 
-int systemd_service_init(const char *name, struct systemd_service *s)
+int systemd_service_init(const char *dbus_path, struct systemd_service *s)
 {
-       assert(name);
+       assert(dbus_path);
        assert(s);
 
-       s->name = strdup(name);
+       s->dbus_path = strdup(dbus_path);
 
        return 0;
 }
@@ -55,7 +55,7 @@ int systemd_service_init(const char *name, struct systemd_service *s)
 void systemd_service_cleanup(struct systemd_service *s)
 {
        if (s)
-               free(s->name);
+               free(s->dbus_path);
 }
 
 int systemd_get_unit_by_pid(pid_t pid, const char **name)
index 5f3694d157558547510752f6c8eb6819a6798973..52818e701b06b441fff0a88edfe509e197c7e45d 100644 (file)
 #include <unistd.h>
 
 struct systemd_service {
-       char *name;
+       char *dbus_path;
 };
 
 int systemd_service_init_by_pid(pid_t pid, struct systemd_service *s);
-int systemd_service_init(const char *name, struct systemd_service *s);
+int systemd_service_init(const char *dbus_path, struct systemd_service *s);
 void systemd_service_cleanup(struct systemd_service *s);
 int systemd_get_unit_by_pid(pid_t pid, const char **name);
 
index 8596fb0e17e2dadefeeff1632fb7558938751d5a..59e9303310b9a92754193b7c60c2c8accd55fa1b 100644 (file)
@@ -49,7 +49,7 @@ static int rv_make_decision(struct faultd_event_handler *handler)
        };
        int ret;
 
-       ev_data.action_data = strdup(rv_ev->service.name);
+       ev_data.action_data = strdup(rv_ev->service.dbus_path);
        if (!ev_data.action_data) {
                log_error("Unable to duplicate service name");
                faultd_event_unref(ev);
index cb02f7e416fa906ccf8b72582f3658a1b1d010ee..45c7f2be30f11f1fb183a614627b15a2159013cc 100644 (file)
@@ -72,12 +72,12 @@ static char *rv_event_to_string(struct faultd_event *ev)
        /* TODO print other fields */
        ret = asprintf(&str, "Resource Violation Event:"
                                   " Time: %lld.%.9ld"
-                                  " Service: pid: %d, name %s"
+                                  " Service: pid: %d, path %s"
                                   " Resource type: %d",
                                   (long long)rv_ev->event.timestamp.tv_sec,
                                   rv_ev->event.timestamp.tv_nsec,
                                   rv_ev->pid,
-                                  rv_ev->service.name,
+                                  rv_ev->service.dbus_path,
                                   rv_ev->resource_type);
 
        return ret > 0 ? str : NULL;
index 58ddc15d4d1654026c22b5f102ac6bbfa07bab95..fb605f510b370d387e9f7c5d89c2cd3610b73767 100644 (file)
@@ -73,10 +73,10 @@ static char *sf_event_to_string(struct faultd_event *ev)
        /* TODO print other fields */
        ret = asprintf(&str, "Service Failed Event:"
                                   " Time: %lld.%.9ld"
-                                  " Service: name %s",
+                                  " Service: path %s",
                                   (long long)sf_ev->event.timestamp.tv_sec,
                                   sf_ev->event.timestamp.tv_nsec,
-                                  sf_ev->service.name);
+                                  sf_ev->service.dbus_path);
 
        return ret > 0 ? str : NULL;
 }