Commit 4cd1fbcc authored by Lennart Poettering's avatar Lennart Poettering

unit: get rid of various unnecessary casts

parent bb00e604
......@@ -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;
}
......
......@@ -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));
......
......@@ -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);
}
......
......@@ -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);
......
This diff is collapsed.
......@@ -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));
......
......@@ -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)
......
......@@ -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));
......
......@@ -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));
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment