/* 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);
}
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")))
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;
}
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));
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;
}
* 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)
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;
}
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;
}
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) {
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;
}
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));
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;
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
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);
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);
}
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);
}
/* 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;
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;
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);
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)
if (r < 0)
return r;
- if ((UNIT(s)->meta.load_state != UNIT_STUB))
+ if ((s->meta.load_state != UNIT_STUB))
break;
}
/* 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;
}
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;
}
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;
goto fail;
}
- p = manager_get_unit(UNIT(s)->meta.manager, k);
+ p = manager_get_unit(s->meta.manager, k);
free(k);
if (!p)
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]);
}
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);
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;
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);
}
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);
}
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
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);
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
* 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 */
* 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)
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;
}
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);
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
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);
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;
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)