]> err.no Git - systemd/commitdiff
unit: get rid of various unnecessary casts
authorLennart Poettering <lennart@poettering.net>
Sat, 19 Jun 2010 14:55:49 +0000 (16:55 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 19 Jun 2010 14:55:49 +0000 (16:55 +0200)
src/automount.c
src/device.c
src/mount.c
src/path.c
src/service.c
src/snapshot.c
src/socket.c
src/swap.c
src/target.c
src/timer.c

index 262a47da4efe5fdc79b5579b37f5a78968a0d9da..75c10538b7dd4bcc55f26902d6cbd8f9d45de0ef 100644 (file)
@@ -87,8 +87,8 @@ static void unmount_autofs(Automount *a) {
         /* If we reload/reexecute things we keep the mount point
          * around */
         if (a->where &&
-            (UNIT(a)->meta.manager->exit_code != MANAGER_RELOAD &&
-             UNIT(a)->meta.manager->exit_code != MANAGER_REEXECUTE))
+            (a->meta.manager->exit_code != MANAGER_RELOAD &&
+             a->meta.manager->exit_code != MANAGER_REEXECUTE))
                 repeat_unmout(a->where);
 }
 
@@ -150,7 +150,7 @@ static int automount_verify(Automount *a) {
         char *e;
         assert(a);
 
-        if (UNIT(a)->meta.load_state != UNIT_LOADED)
+        if (a->meta.load_state != UNIT_LOADED)
                 return 0;
 
         if (!(e = unit_name_from_path(a->where, ".automount")))
@@ -160,7 +160,7 @@ static int automount_verify(Automount *a) {
         free(e);
 
         if (!b) {
-                log_error("%s's Where setting doesn't match unit name. Refusing.", UNIT(a)->meta.id);
+                log_error("%s's Where setting doesn't match unit name. Refusing.", a->meta.id);
                 return -EINVAL;
         }
 
@@ -212,7 +212,7 @@ static void automount_set_state(Automount *a, AutomountState state) {
 
         if (state != old_state)
                 log_debug("%s changed %s -> %s",
-                          UNIT(a)->meta.id,
+                          a->meta.id,
                           automount_state_to_string(old_state),
                           automount_state_to_string(state));
 
@@ -403,7 +403,7 @@ int automount_send_ready(Automount *a, int status) {
         if (set_isempty(a->tokens))
                 return 0;
 
-        if ((ioctl_fd = open_ioctl_fd(UNIT(a)->meta.manager->dev_autofs_fd, a->where, a->dev_id)) < 0) {
+        if ((ioctl_fd = open_ioctl_fd(a->meta.manager->dev_autofs_fd, a->where, a->dev_id)) < 0) {
                 r = ioctl_fd;
                 goto fail;
         }
@@ -422,7 +422,7 @@ int automount_send_ready(Automount *a, int status) {
                  * if you pass a positive status code here, the kernel will
                  * freeze! Yay! */
 
-                if ((k = autofs_send_ready(UNIT(a)->meta.manager->dev_autofs_fd,
+                if ((k = autofs_send_ready(a->meta.manager->dev_autofs_fd,
                                            ioctl_fd,
                                            token,
                                            status)) < 0)
@@ -452,7 +452,7 @@ static void automount_enter_waiting(Automount *a) {
         if (a->tokens)
                 set_clear(a->tokens);
 
-        if ((dev_autofs_fd = open_dev_autofs(UNIT(a)->meta.manager)) < 0) {
+        if ((dev_autofs_fd = open_dev_autofs(a->meta.manager)) < 0) {
                 r = dev_autofs_fd;
                 goto fail;
         }
@@ -545,7 +545,7 @@ static void automount_enter_runnning(Automount *a) {
 
         if (!S_ISDIR(st.st_mode) || st.st_dev != a->dev_id)
                 log_info("%s's automount point already active?", a->meta.id);
-        else if ((r = manager_add_job(UNIT(a)->meta.manager, JOB_START, UNIT(a->mount), JOB_REPLACE, true, NULL)) < 0) {
+        else if ((r = manager_add_job(a->meta.manager, JOB_START, UNIT(a->mount), JOB_REPLACE, true, NULL)) < 0) {
                 log_warning("%s failed to queue mount startup job: %s", a->meta.id, strerror(-r));
                 goto fail;
         }
index adc6cc1e275cf1d7a78392c03855f0174b63d153..a0349c4300470dc9cc02a7e19019488ca22b75b0 100644 (file)
@@ -53,7 +53,7 @@ static void device_set_state(Device *d, DeviceState state) {
 
         if (state != old_state)
                 log_debug("%s changed %s -> %s",
-                          UNIT(d)->meta.id,
+                          d->meta.id,
                           device_state_to_string(old_state),
                           device_state_to_string(state));
 
index b49c64aeabc7b287c171cc8bf45fcc7b4d7f36fa..e3984203ac3d33b37b21351cacb30523578a9a03 100644 (file)
@@ -251,7 +251,7 @@ static int mount_add_target_links(Mount *m) {
         else
                 target = SPECIAL_LOCAL_FS_TARGET;
 
-        if ((r = manager_load_unit(UNIT(m)->meta.manager, target, NULL, &tu)) < 0)
+        if ((r = manager_load_unit(m->meta.manager, target, NULL, &tu)) < 0)
                 return r;
 
         if (automount && m->meta.manager->running_as == MANAGER_SYSTEM) {
@@ -294,12 +294,12 @@ static int mount_verify(Mount *m) {
         free(e);
 
         if (!b) {
-                log_error("%s's Where setting doesn't match unit name. Refusing.", UNIT(m)->meta.id);
+                log_error("%s's Where setting doesn't match unit name. Refusing.", m->meta.id);
                 return -EINVAL;
         }
 
         if (m->meta.fragment_path && !m->parameters_fragment.what) {
-                log_error("%s's What setting is missing. Refusing.", UNIT(m)->meta.id);
+                log_error("%s's What setting is missing. Refusing.", m->meta.id);
                 return -EBADMSG;
         }
 
@@ -420,7 +420,7 @@ static void mount_set_state(Mount *m, MountState state) {
 
         if (state != old_state)
                 log_debug("%s changed %s -> %s",
-                          UNIT(m)->meta.id,
+                          m->meta.id,
                           mount_state_to_string(old_state),
                           mount_state_to_string(state));
 
@@ -529,8 +529,8 @@ static int mount_spawn(Mount *m, ExecCommand *c, pid_t *_pid) {
                             m->meta.manager->environment,
                             true,
                             true,
-                            UNIT(m)->meta.manager->confirm_spawn,
-                            UNIT(m)->meta.cgroup_bondings,
+                            m->meta.manager->confirm_spawn,
+                            m->meta.cgroup_bondings,
                             &pid)) < 0)
                 goto fail;
 
@@ -582,7 +582,7 @@ static void mount_enter_signal(Mount *m, MountState state, bool success) {
 
                 if (m->kill_mode == KILL_CONTROL_GROUP) {
 
-                        if ((r = cgroup_bonding_kill_list(UNIT(m)->meta.cgroup_bondings, sig)) < 0) {
+                        if ((r = cgroup_bonding_kill_list(m->meta.cgroup_bondings, sig)) < 0) {
                                 if (r != -EAGAIN && r != -ESRCH)
                                         goto fail;
                         } else
@@ -609,7 +609,7 @@ static void mount_enter_signal(Mount *m, MountState state, bool success) {
         return;
 
 fail:
-        log_warning("%s failed to kill processes: %s", UNIT(m)->meta.id, strerror(-r));
+        log_warning("%s failed to kill processes: %s", m->meta.id, strerror(-r));
 
         if (state == MOUNT_REMOUNTING_SIGTERM || state == MOUNT_REMOUNTING_SIGKILL)
                 mount_enter_mounted(m, false);
@@ -645,7 +645,7 @@ static void mount_enter_unmounting(Mount *m, bool success) {
         return;
 
 fail:
-        log_warning("%s failed to run 'umount' task: %s", UNIT(m)->meta.id, strerror(-r));
+        log_warning("%s failed to run 'umount' task: %s", m->meta.id, strerror(-r));
         mount_enter_mounted(m, false);
 }
 
@@ -688,7 +688,7 @@ static void mount_enter_mounting(Mount *m) {
         return;
 
 fail:
-        log_warning("%s failed to run 'mount' task: %s", UNIT(m)->meta.id, strerror(-r));
+        log_warning("%s failed to run 'mount' task: %s", m->meta.id, strerror(-r));
         mount_enter_dead(m, false);
 }
 
index 8a940d0262d617657e2cfa213a133aa46f571512..24545bad35d395c8f6ff8ebdb9e3ef5675e9fc04 100644 (file)
@@ -91,7 +91,7 @@ static int path_add_mount_links(Path *p) {
 static int path_verify(Path *p) {
         assert(p);
 
-        if (UNIT(p)->meta.load_state != UNIT_LOADED)
+        if (p->meta.load_state != UNIT_LOADED)
                 return 0;
 
         if (!p->specs) {
@@ -297,7 +297,7 @@ static void path_enter_running(Path *p) {
         int r;
         assert(p);
 
-        if ((r = manager_add_job(UNIT(p)->meta.manager, JOB_START, p->unit, JOB_REPLACE, true, NULL)) < 0)
+        if ((r = manager_add_job(p->meta.manager, JOB_START, p->unit, JOB_REPLACE, true, NULL)) < 0)
                 goto fail;
 
         path_set_state(p, PATH_RUNNING);
index 987320178a785afcb20b5179e18e93d5dc7944fe..ba60b8f8796f16ba3543538d658794b418dda258 100644 (file)
@@ -279,7 +279,7 @@ static int sysv_fix_order(Service *s) {
         /* For each pair of services where at least one lacks a LSB
          * header, we use the start priority value to order things. */
 
-        LIST_FOREACH(units_per_type, other, UNIT(s)->meta.manager->units_per_type[UNIT_SERVICE]) {
+        LIST_FOREACH(units_per_type, other, s->meta.manager->units_per_type[UNIT_SERVICE]) {
                 Service *t;
                 UnitDependency d;
 
@@ -711,7 +711,7 @@ static int service_load_sysv_name(Service *s, const char *name) {
             endswith(name, ".sh.service"))
                 return -ENOENT;
 
-        STRV_FOREACH(p, UNIT(s)->meta.manager->lookup_paths.sysvinit_path) {
+        STRV_FOREACH(p, s->meta.manager->lookup_paths.sysvinit_path) {
                 char *path;
                 int r;
 
@@ -723,7 +723,7 @@ static int service_load_sysv_name(Service *s, const char *name) {
 
                 r = service_load_sysv_path(s, path);
 
-                if (r >= 0 && UNIT(s)->meta.load_state == UNIT_STUB) {
+                if (r >= 0 && s->meta.load_state == UNIT_STUB) {
                         /* Try Debian style xxx.sh source'able init scripts */
                         strcat(path, ".sh");
                         r = service_load_sysv_path(s, path);
@@ -731,7 +731,7 @@ static int service_load_sysv_name(Service *s, const char *name) {
 
                 free(path);
 
-                if (r >= 0 && UNIT(s)->meta.load_state == UNIT_STUB) {
+                if (r >= 0 && s->meta.load_state == UNIT_STUB) {
                         /* Try SUSE style boot.xxx init scripts */
 
                         if (asprintf(&path, "%s/boot.%s", *p, name) < 0)
@@ -745,7 +745,7 @@ static int service_load_sysv_name(Service *s, const char *name) {
                 if (r < 0)
                         return r;
 
-                if ((UNIT(s)->meta.load_state != UNIT_STUB))
+                if ((s->meta.load_state != UNIT_STUB))
                         break;
         }
 
@@ -762,22 +762,22 @@ static int service_load_sysv(Service *s) {
         /* Load service data from SysV init scripts, preferably with
          * LSB headers ... */
 
-        if (strv_isempty(UNIT(s)->meta.manager->lookup_paths.sysvinit_path))
+        if (strv_isempty(s->meta.manager->lookup_paths.sysvinit_path))
                 return 0;
 
-        if ((t = UNIT(s)->meta.id))
+        if ((t = s->meta.id))
                 if ((r = service_load_sysv_name(s, t)) < 0)
                         return r;
 
-        if (UNIT(s)->meta.load_state == UNIT_STUB)
-                SET_FOREACH(t, UNIT(s)->meta.names, i) {
-                        if (t == UNIT(s)->meta.id)
+        if (s->meta.load_state == UNIT_STUB)
+                SET_FOREACH(t, s->meta.names, i) {
+                        if (t == s->meta.id)
                                 continue;
 
                         if ((r == service_load_sysv_name(s, t)) < 0)
                                 return r;
 
-                        if (UNIT(s)->meta.load_state != UNIT_STUB)
+                        if (s->meta.load_state != UNIT_STUB)
                                 break;
                 }
 
@@ -803,16 +803,16 @@ static int service_add_bus_name(Service *s) {
 static int service_verify(Service *s) {
         assert(s);
 
-        if (UNIT(s)->meta.load_state != UNIT_LOADED)
+        if (s->meta.load_state != UNIT_LOADED)
                 return 0;
 
         if (!s->exec_command[SERVICE_EXEC_START]) {
-                log_error("%s lacks ExecStart setting. Refusing.", UNIT(s)->meta.id);
+                log_error("%s lacks ExecStart setting. Refusing.", s->meta.id);
                 return -EINVAL;
         }
 
         if (s->exec_command[SERVICE_EXEC_START]->command_next) {
-                log_error("%s has more than one ExecStart setting. Refusing.", UNIT(s)->meta.id);
+                log_error("%s has more than one ExecStart setting. Refusing.", s->meta.id);
                 return -EINVAL;
         }
 
@@ -1019,7 +1019,7 @@ static int service_get_sockets(Service *s, Set **_set) {
         if (!(set = set_new(NULL, NULL)))
                 return -ENOMEM;
 
-        SET_FOREACH(t, UNIT(s)->meta.names, i) {
+        SET_FOREACH(t, s->meta.names, i) {
                 char *k;
                 Unit *p;
 
@@ -1031,7 +1031,7 @@ static int service_get_sockets(Service *s, Set **_set) {
                         goto fail;
                 }
 
-                p = manager_get_unit(UNIT(s)->meta.manager, k);
+                p = manager_get_unit(s->meta.manager, k);
                 free(k);
 
                 if (!p)
@@ -1138,13 +1138,13 @@ static void service_set_state(Service *s, ServiceState state) {
             state != SERVICE_STOP_POST &&
             state != SERVICE_FINAL_SIGTERM &&
             state != SERVICE_FINAL_SIGKILL &&
-            !(state == SERVICE_DEAD && UNIT(s)->meta.job)) {
+            !(state == SERVICE_DEAD && s->meta.job)) {
                 service_close_socket_fd(s);
                 service_connection_unref(s);
         }
 
         if (old_state != state)
-                log_debug("%s changed %s -> %s", UNIT(s)->meta.id, service_state_to_string(old_state), service_state_to_string(state));
+                log_debug("%s changed %s -> %s", s->meta.id, service_state_to_string(old_state), service_state_to_string(state));
 
         unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state]);
 }
@@ -1351,8 +1351,8 @@ static int service_spawn(
                        env,
                        apply_permissions,
                        apply_chroot,
-                       UNIT(s)->meta.manager->confirm_spawn,
-                       UNIT(s)->meta.cgroup_bondings,
+                       s->meta.manager->confirm_spawn,
+                       s->meta.cgroup_bondings,
                        &pid);
 
         strv_free(argv);
@@ -1416,7 +1416,7 @@ static int cgroup_good(Service *s) {
 
         assert(s);
 
-        if ((r = cgroup_bonding_is_empty_list(UNIT(s)->meta.cgroup_bondings)) < 0)
+        if ((r = cgroup_bonding_is_empty_list(s->meta.cgroup_bondings)) < 0)
                 return r;
 
         return !r;
@@ -1444,7 +1444,7 @@ static void service_enter_dead(Service *s, bool success, bool allow_restart) {
         return;
 
 fail:
-        log_warning("%s failed to run install restart timer: %s", UNIT(s)->meta.id, strerror(-r));
+        log_warning("%s failed to run install restart timer: %s", s->meta.id, strerror(-r));
         service_enter_dead(s, false, false);
 }
 
@@ -1479,7 +1479,7 @@ static void service_enter_stop_post(Service *s, bool success) {
         return;
 
 fail:
-        log_warning("%s failed to run 'stop-post' task: %s", UNIT(s)->meta.id, strerror(-r));
+        log_warning("%s failed to run 'stop-post' task: %s", s->meta.id, strerror(-r));
         service_enter_signal(s, SERVICE_FINAL_SIGTERM, false);
 }
 
@@ -1497,7 +1497,7 @@ static void service_enter_signal(Service *s, ServiceState state, bool success) {
 
                 if (s->kill_mode == KILL_CONTROL_GROUP) {
 
-                        if ((r = cgroup_bonding_kill_list(UNIT(s)->meta.cgroup_bondings, sig)) < 0) {
+                        if ((r = cgroup_bonding_kill_list(s->meta.cgroup_bondings, sig)) < 0) {
                                 if (r != -EAGAIN && r != -ESRCH)
                                         goto fail;
                         } else
@@ -1540,7 +1540,7 @@ static void service_enter_signal(Service *s, ServiceState state, bool success) {
         return;
 
 fail:
-        log_warning("%s failed to kill processes: %s", UNIT(s)->meta.id, strerror(-r));
+        log_warning("%s failed to kill processes: %s", s->meta.id, strerror(-r));
 
         if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGKILL)
                 service_enter_stop_post(s, false);
@@ -1577,7 +1577,7 @@ static void service_enter_stop(Service *s, bool success) {
         return;
 
 fail:
-        log_warning("%s failed to run 'stop' task: %s", UNIT(s)->meta.id, strerror(-r));
+        log_warning("%s failed to run 'stop' task: %s", s->meta.id, strerror(-r));
         service_enter_signal(s, SERVICE_STOP_SIGTERM, false);
 }
 
@@ -1622,7 +1622,7 @@ static void service_enter_start_post(Service *s) {
         return;
 
 fail:
-        log_warning("%s failed to run 'start-post' task: %s", UNIT(s)->meta.id, strerror(-r));
+        log_warning("%s failed to run 'start-post' task: %s", s->meta.id, strerror(-r));
         service_enter_stop(s, false);
 }
 
@@ -1687,7 +1687,7 @@ static void service_enter_start(Service *s) {
         return;
 
 fail:
-        log_warning("%s failed to run 'start' task: %s", UNIT(s)->meta.id, strerror(-r));
+        log_warning("%s failed to run 'start' task: %s", s->meta.id, strerror(-r));
         service_enter_signal(s, SERVICE_FINAL_SIGTERM, false);
 }
 
@@ -1717,7 +1717,7 @@ static void service_enter_start_pre(Service *s) {
         return;
 
 fail:
-        log_warning("%s failed to run 'start-pre' task: %s", UNIT(s)->meta.id, strerror(-r));
+        log_warning("%s failed to run 'start-pre' task: %s", s->meta.id, strerror(-r));
         service_enter_dead(s, false, true);
 }
 
@@ -1727,15 +1727,15 @@ static void service_enter_restart(Service *s) {
 
         service_enter_dead(s, true, false);
 
-        if ((r = manager_add_job(UNIT(s)->meta.manager, JOB_START, UNIT(s), JOB_FAIL, false, NULL)) < 0)
+        if ((r = manager_add_job(s->meta.manager, JOB_START, UNIT(s), JOB_FAIL, false, NULL)) < 0)
                 goto fail;
 
-        log_debug("%s scheduled restart job.", UNIT(s)->meta.id);
+        log_debug("%s scheduled restart job.", s->meta.id);
         return;
 
 fail:
 
-        log_warning("%s failed to schedule restart job: %s", UNIT(s)->meta.id, strerror(-r));
+        log_warning("%s failed to schedule restart job: %s", s->meta.id, strerror(-r));
         service_enter_dead(s, false, false);
 }
 
@@ -1765,7 +1765,7 @@ static void service_enter_reload(Service *s) {
         return;
 
 fail:
-        log_warning("%s failed to run 'reload' task: %s", UNIT(s)->meta.id, strerror(-r));
+        log_warning("%s failed to run 'reload' task: %s", s->meta.id, strerror(-r));
         service_enter_stop(s, false);
 }
 
@@ -1796,7 +1796,7 @@ static void service_run_next(Service *s, bool success) {
         return;
 
 fail:
-        log_warning("%s failed to run next task: %s", UNIT(s)->meta.id, strerror(-r));
+        log_warning("%s failed to run next task: %s", s->meta.id, strerror(-r));
 
         if (s->state == SERVICE_START_PRE)
                 service_enter_signal(s, SERVICE_FINAL_SIGTERM, false);
@@ -2167,7 +2167,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
                                          * executed. */
 
                                         if ((r = service_load_pid_file(s)) < 0)
-                                                log_warning("%s: failed to load PID file %s: %s", UNIT(s)->meta.id, s->pid_file, strerror(-r));
+                                                log_warning("%s: failed to load PID file %s: %s", s->meta.id, s->pid_file, strerror(-r));
                                 }
 
                                 /* Fall through */
@@ -2572,7 +2572,7 @@ int service_set_socket_fd(Service *s, int fd, Socket *sock) {
          * service for a stream socket and the socket needs to be
          * configured. */
 
-        if (UNIT(s)->meta.load_state != UNIT_LOADED)
+        if (s->meta.load_state != UNIT_LOADED)
                 return -EINVAL;
 
         if (s->socket_fd >= 0)
index 513bf66475679106698f1983fba5a6d058bca519..ea3894bb91b33b1f52c3a280ab30be986648ad80 100644 (file)
@@ -40,7 +40,7 @@ static void snapshot_set_state(Snapshot *s, SnapshotState state) {
 
         if (state != old_state)
                 log_debug("%s changed %s -> %s",
-                          UNIT(s)->meta.id,
+                          s->meta.id,
                           snapshot_state_to_string(old_state),
                           snapshot_state_to_string(state));
 
index 751d8aa8fa5bf4479176d19fcf83c698a1026353..ccbe4326c160dc5b0903f26e4e6e3e976cf170f1 100644 (file)
@@ -144,11 +144,11 @@ static bool have_non_accept_socket(Socket *s) {
 static int socket_verify(Socket *s) {
         assert(s);
 
-        if (UNIT(s)->meta.load_state != UNIT_LOADED)
+        if (s->meta.load_state != UNIT_LOADED)
                 return 0;
 
         if (!s->ports) {
-                log_error("%s lacks Listen setting. Refusing.", UNIT(s)->meta.id);
+                log_error("%s lacks Listen setting. Refusing.", s->meta.id);
                 return -EINVAL;
         }
 
@@ -699,8 +699,8 @@ static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) {
                        s->meta.manager->environment,
                        true,
                        true,
-                       UNIT(s)->meta.manager->confirm_spawn,
-                       UNIT(s)->meta.cgroup_bondings,
+                       s->meta.manager->confirm_spawn,
+                       s->meta.cgroup_bondings,
                        &pid);
 
         strv_free(argv);
@@ -772,7 +772,7 @@ static void socket_enter_signal(Socket *s, SocketState state, bool success) {
 
                 if (s->kill_mode == KILL_CONTROL_GROUP) {
 
-                        if ((r = cgroup_bonding_kill_list(UNIT(s)->meta.cgroup_bondings, sig)) < 0) {
+                        if ((r = cgroup_bonding_kill_list(s->meta.cgroup_bondings, sig)) < 0) {
                                 if (r != -EAGAIN && r != -ESRCH)
                                         goto fail;
                         } else
@@ -907,7 +907,7 @@ static void socket_enter_running(Socket *s, int cfd) {
         assert(s);
 
         if (cfd < 0) {
-                if ((r = manager_add_job(UNIT(s)->meta.manager, JOB_START, UNIT(s->service), JOB_REPLACE, true, NULL)) < 0)
+                if ((r = manager_add_job(s->meta.manager, JOB_START, UNIT(s->service), JOB_REPLACE, true, NULL)) < 0)
                         goto fail;
 
                 socket_set_state(s, SOCKET_RUNNING);
@@ -924,7 +924,7 @@ static void socket_enter_running(Socket *s, int cfd) {
                 if ((r = instance_from_socket(cfd, s->n_accepted++, &instance)) < 0)
                         goto fail;
 
-                if (!(prefix = unit_name_to_prefix(UNIT(s)->meta.id))) {
+                if (!(prefix = unit_name_to_prefix(s->meta.id))) {
                         free(instance);
                         r = -ENOMEM;
                         goto fail;
@@ -939,7 +939,7 @@ static void socket_enter_running(Socket *s, int cfd) {
                         goto fail;
                 }
 
-                r = manager_load_unit(UNIT(s)->meta.manager, name, NULL, &u);
+                r = manager_load_unit(s->meta.manager, name, NULL, &u);
                 free(name);
 
                 if (r < 0)
index 501a1d96c8b70001f997209800b5feca54fb24a5..663c568961b38519bf87c6b8c119da5c6296a37c 100644 (file)
@@ -127,7 +127,7 @@ static int swap_verify(Swap *s) {
         bool b;
         char *e;
 
-        if (UNIT(s)->meta.load_state != UNIT_LOADED)
+        if (s->meta.load_state != UNIT_LOADED)
                   return 0;
 
         if (!(e = unit_name_from_path(s->what, ".swap")))
@@ -137,7 +137,7 @@ static int swap_verify(Swap *s) {
         free(e);
 
         if (!b) {
-                log_error("%s: Value of \"What\" and unit name do not match, not loading.\n", UNIT(s)->meta.id);
+                log_error("%s: Value of \"What\" and unit name do not match, not loading.\n", s->meta.id);
                 return -EINVAL;
         }
 
@@ -320,7 +320,7 @@ static void swap_set_state(Swap *s, SwapState state) {
 
         if (state != old_state)
                 log_debug("%s changed %s -> %s",
-                          UNIT(s)->meta.id,
+                          s->meta.id,
                           swap_state_to_string(old_state),
                           swap_state_to_string(state));
 
index d3f3748cd54f86057b73d6e07f2bbe13784cb63f..fba99568a3007e53df0665c540106481167f0b98 100644 (file)
@@ -43,7 +43,7 @@ static void target_set_state(Target *t, TargetState state) {
 
         if (state != old_state)
                 log_debug("%s changed %s -> %s",
-                          UNIT(t)->meta.id,
+                          t->meta.id,
                           target_state_to_string(old_state),
                           target_state_to_string(state));
 
index 7bf2d1023892338488261ea23399d6a8dd385ded..ead8ab92a4b0881de1120cfe78b93775f6e44e00 100644 (file)
@@ -60,7 +60,7 @@ static void timer_done(Unit *u) {
 static int timer_verify(Timer *t) {
         assert(t);
 
-        if (UNIT(t)->meta.load_state != UNIT_LOADED)
+        if (t->meta.load_state != UNIT_LOADED)
                 return 0;
 
         if (!t->values) {
@@ -258,7 +258,7 @@ static void timer_enter_running(Timer *t) {
         int r;
         assert(t);
 
-        if ((r = manager_add_job(UNIT(t)->meta.manager, JOB_START, t->unit, JOB_REPLACE, true, NULL)) < 0)
+        if ((r = manager_add_job(t->meta.manager, JOB_START, t->unit, JOB_REPLACE, true, NULL)) < 0)
                 goto fail;
 
         timer_set_state(t, TIMER_RUNNING);