openrc-run: rename some dependency variables and a function for clarity
All of the dependency type lists had the types_ prefix in their names; this has been changed to deptypes_ to make them more self documenting. Along the same lines, the setup_types function was renamed setup_deptypes.
This commit is contained in:
parent
b047ea47e9
commit
3b6a6df4b5
@ -85,8 +85,12 @@ static bool sighup, in_background, deps, dry_run;
|
|||||||
static pid_t service_pid;
|
static pid_t service_pid;
|
||||||
static int signal_pipe[2] = { -1, -1 };
|
static int signal_pipe[2] = { -1, -1 };
|
||||||
|
|
||||||
static RC_STRINGLIST *types_b, *types_n, *types_nu, *types_nua, *types_m;
|
static RC_STRINGLIST *deptypes_b;
|
||||||
static RC_STRINGLIST *types_mua = NULL;
|
static RC_STRINGLIST *deptypes_n;
|
||||||
|
static RC_STRINGLIST *deptypes_nu;
|
||||||
|
static RC_STRINGLIST *deptypes_nua;
|
||||||
|
static RC_STRINGLIST *deptypes_m;
|
||||||
|
static RC_STRINGLIST *deptypes_mua;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_signal(int sig)
|
handle_signal(int sig)
|
||||||
@ -231,12 +235,12 @@ cleanup(void)
|
|||||||
rc_plugin_unload();
|
rc_plugin_unload();
|
||||||
|
|
||||||
#ifdef DEBUG_MEMORY
|
#ifdef DEBUG_MEMORY
|
||||||
rc_stringlist_free(types_b);
|
rc_stringlist_free(deptypes_b);
|
||||||
rc_stringlist_free(types_n);
|
rc_stringlist_free(deptypes_n);
|
||||||
rc_stringlist_free(types_nu);
|
rc_stringlist_free(deptypes_nu);
|
||||||
rc_stringlist_free(types_nua);
|
rc_stringlist_free(deptypes_nua);
|
||||||
rc_stringlist_free(types_m);
|
rc_stringlist_free(deptypes_m);
|
||||||
rc_stringlist_free(types_mua);
|
rc_stringlist_free(deptypes_mua);
|
||||||
rc_deptree_free(deptree);
|
rc_deptree_free(deptree);
|
||||||
rc_stringlist_free(restart_services);
|
rc_stringlist_free(restart_services);
|
||||||
rc_stringlist_free(need_services);
|
rc_stringlist_free(need_services);
|
||||||
@ -518,30 +522,30 @@ get_started_services(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_types(void)
|
setup_deptypes(void)
|
||||||
{
|
{
|
||||||
types_b = rc_stringlist_new();
|
deptypes_b = rc_stringlist_new();
|
||||||
rc_stringlist_add(types_b, "broken");
|
rc_stringlist_add(deptypes_b, "broken");
|
||||||
|
|
||||||
types_n = rc_stringlist_new();
|
deptypes_n = rc_stringlist_new();
|
||||||
rc_stringlist_add(types_n, "ineed");
|
rc_stringlist_add(deptypes_n, "ineed");
|
||||||
|
|
||||||
types_nu = rc_stringlist_new();
|
deptypes_nu = rc_stringlist_new();
|
||||||
rc_stringlist_add(types_nu, "ineed");
|
rc_stringlist_add(deptypes_nu, "ineed");
|
||||||
rc_stringlist_add(types_nu, "iuse");
|
rc_stringlist_add(deptypes_nu, "iuse");
|
||||||
|
|
||||||
types_nua = rc_stringlist_new();
|
deptypes_nua = rc_stringlist_new();
|
||||||
rc_stringlist_add(types_nua, "ineed");
|
rc_stringlist_add(deptypes_nua, "ineed");
|
||||||
rc_stringlist_add(types_nua, "iuse");
|
rc_stringlist_add(deptypes_nua, "iuse");
|
||||||
rc_stringlist_add(types_nua, "iafter");
|
rc_stringlist_add(deptypes_nua, "iafter");
|
||||||
|
|
||||||
types_m = rc_stringlist_new();
|
deptypes_m = rc_stringlist_new();
|
||||||
rc_stringlist_add(types_m, "needsme");
|
rc_stringlist_add(deptypes_m, "needsme");
|
||||||
|
|
||||||
types_mua = rc_stringlist_new();
|
deptypes_mua = rc_stringlist_new();
|
||||||
rc_stringlist_add(types_mua, "needsme");
|
rc_stringlist_add(deptypes_mua, "needsme");
|
||||||
rc_stringlist_add(types_mua, "usesme");
|
rc_stringlist_add(deptypes_mua, "usesme");
|
||||||
rc_stringlist_add(types_mua, "beforeme");
|
rc_stringlist_add(deptypes_mua, "beforeme");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -604,10 +608,10 @@ svc_start_deps(void)
|
|||||||
|
|
||||||
if (!deptree && ((deptree = _rc_deptree_load(0, NULL)) == NULL))
|
if (!deptree && ((deptree = _rc_deptree_load(0, NULL)) == NULL))
|
||||||
eerrorx("failed to load deptree");
|
eerrorx("failed to load deptree");
|
||||||
if (!types_b)
|
if (!deptypes_b)
|
||||||
setup_types();
|
setup_deptypes();
|
||||||
|
|
||||||
services = rc_deptree_depends(deptree, types_b, applet_list,
|
services = rc_deptree_depends(deptree, deptypes_b, applet_list,
|
||||||
runlevel, 0);
|
runlevel, 0);
|
||||||
if (TAILQ_FIRST(services)) {
|
if (TAILQ_FIRST(services)) {
|
||||||
eerrorn("ERROR: %s needs service(s) ", applet);
|
eerrorn("ERROR: %s needs service(s) ", applet);
|
||||||
@ -625,9 +629,9 @@ svc_start_deps(void)
|
|||||||
rc_stringlist_free(services);
|
rc_stringlist_free(services);
|
||||||
services = NULL;
|
services = NULL;
|
||||||
|
|
||||||
need_services = rc_deptree_depends(deptree, types_n,
|
need_services = rc_deptree_depends(deptree, deptypes_n,
|
||||||
applet_list, runlevel, depoptions);
|
applet_list, runlevel, depoptions);
|
||||||
use_services = rc_deptree_depends(deptree, types_nu,
|
use_services = rc_deptree_depends(deptree, deptypes_nu,
|
||||||
applet_list, runlevel, depoptions);
|
applet_list, runlevel, depoptions);
|
||||||
|
|
||||||
if (!rc_runlevel_starting()) {
|
if (!rc_runlevel_starting()) {
|
||||||
@ -655,7 +659,7 @@ svc_start_deps(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Now wait for them to start */
|
/* Now wait for them to start */
|
||||||
services = rc_deptree_depends(deptree, types_nua, applet_list,
|
services = rc_deptree_depends(deptree, deptypes_nua, applet_list,
|
||||||
runlevel, depoptions);
|
runlevel, depoptions);
|
||||||
/* We use tmplist to hold our scheduled by list */
|
/* We use tmplist to hold our scheduled by list */
|
||||||
tmplist = rc_stringlist_new();
|
tmplist = rc_stringlist_new();
|
||||||
@ -860,10 +864,10 @@ svc_stop_deps(RC_SERVICE state)
|
|||||||
if (!deptree && ((deptree = _rc_deptree_load(0, NULL)) == NULL))
|
if (!deptree && ((deptree = _rc_deptree_load(0, NULL)) == NULL))
|
||||||
eerrorx("failed to load deptree");
|
eerrorx("failed to load deptree");
|
||||||
|
|
||||||
if (!types_m)
|
if (!deptypes_m)
|
||||||
setup_types();
|
setup_deptypes();
|
||||||
|
|
||||||
services = rc_deptree_depends(deptree, types_m, applet_list,
|
services = rc_deptree_depends(deptree, deptypes_m, applet_list,
|
||||||
runlevel, depoptions);
|
runlevel, depoptions);
|
||||||
tmplist = rc_stringlist_new();
|
tmplist = rc_stringlist_new();
|
||||||
TAILQ_FOREACH_REVERSE(svc, services, rc_stringlist, entries) {
|
TAILQ_FOREACH_REVERSE(svc, services, rc_stringlist, entries) {
|
||||||
@ -923,7 +927,7 @@ svc_stop_deps(RC_SERVICE state)
|
|||||||
|
|
||||||
/* We now wait for other services that may use us and are
|
/* We now wait for other services that may use us and are
|
||||||
* stopping. This is important when a runlevel stops */
|
* stopping. This is important when a runlevel stops */
|
||||||
services = rc_deptree_depends(deptree, types_mua, applet_list,
|
services = rc_deptree_depends(deptree, deptypes_mua, applet_list,
|
||||||
runlevel, depoptions);
|
runlevel, depoptions);
|
||||||
TAILQ_FOREACH(svc, services, entries) {
|
TAILQ_FOREACH(svc, services, entries) {
|
||||||
if (rc_service_state(svc->value) & RC_SERVICE_STOPPED)
|
if (rc_service_state(svc->value) & RC_SERVICE_STOPPED)
|
||||||
|
Loading…
Reference in New Issue
Block a user