rc_allow_plug -> rc_service_plugable
This commit is contained in:
parent
4e9e8d075c
commit
69ebf0c738
@ -568,7 +568,7 @@ char **rc_make_env (void)
|
||||
bool has_net_fs_list = false;
|
||||
FILE *fp;
|
||||
char buffer[PATH_MAX];
|
||||
char *runlevel = rc_get_runlevel ();
|
||||
char *runlevel = rc_runlevel_get ();
|
||||
|
||||
/* Don't trust environ for softlevel yet */
|
||||
snprintf (buffer, PATH_MAX, "%s.%s", RC_CONFIG, runlevel);
|
||||
|
12
src/librc.c
12
src/librc.c
@ -81,7 +81,7 @@ char **rc_get_runlevels (void)
|
||||
}
|
||||
librc_hidden_def(rc_get_runlevels)
|
||||
|
||||
char *rc_get_runlevel (void)
|
||||
char *rc_runlevel_get (void)
|
||||
{
|
||||
FILE *fp;
|
||||
char buffer[RC_LINEBUFFER];
|
||||
@ -102,9 +102,9 @@ char *rc_get_runlevel (void)
|
||||
|
||||
return (runlevel);
|
||||
}
|
||||
librc_hidden_def(rc_get_runlevel)
|
||||
librc_hidden_def(rc_runlevel_get)
|
||||
|
||||
bool rc_set_runlevel (const char *runlevel)
|
||||
bool rc_runlevel_set (const char *runlevel)
|
||||
{
|
||||
FILE *fp = fopen (SOFTLEVEL, "w");
|
||||
|
||||
@ -114,7 +114,7 @@ bool rc_set_runlevel (const char *runlevel)
|
||||
fclose (fp);
|
||||
return (true);
|
||||
}
|
||||
librc_hidden_def(rc_set_runlevel)
|
||||
librc_hidden_def(rc_runlevel_set)
|
||||
|
||||
bool rc_runlevel_exists (const char *runlevel)
|
||||
{
|
||||
@ -802,7 +802,7 @@ char **rc_services_scheduled (const char *service)
|
||||
}
|
||||
librc_hidden_def(rc_services_scheduled)
|
||||
|
||||
bool rc_allow_plug (char *service)
|
||||
bool rc_service_plugable (char *service)
|
||||
{
|
||||
char *list;
|
||||
char *p;
|
||||
@ -839,4 +839,4 @@ bool rc_allow_plug (char *service)
|
||||
free (list);
|
||||
return (allow);
|
||||
}
|
||||
librc_hidden_def(rc_allow_plug)
|
||||
librc_hidden_def(rc_service_plugable)
|
||||
|
@ -51,7 +51,6 @@
|
||||
#define librc_hidden_proto(x) hidden_proto(x)
|
||||
#define librc_hidden_def(x) hidden_def(x)
|
||||
|
||||
librc_hidden_proto(rc_allow_plug)
|
||||
librc_hidden_proto(rc_deptree_depends)
|
||||
librc_hidden_proto(rc_deptree_depinfo)
|
||||
librc_hidden_proto(rc_deptree_deptype)
|
||||
@ -67,7 +66,6 @@ librc_hidden_proto(rc_find_pids)
|
||||
librc_hidden_proto(rc_get_config)
|
||||
librc_hidden_proto(rc_get_config_entry)
|
||||
librc_hidden_proto(rc_get_list)
|
||||
librc_hidden_proto(rc_get_runlevel)
|
||||
librc_hidden_proto(rc_get_runlevels)
|
||||
librc_hidden_proto(rc_is_dir)
|
||||
librc_hidden_proto(rc_is_exec)
|
||||
@ -76,7 +74,9 @@ librc_hidden_proto(rc_is_link)
|
||||
librc_hidden_proto(rc_ls_dir)
|
||||
librc_hidden_proto(rc_make_env)
|
||||
librc_hidden_proto(rc_rm_dir)
|
||||
librc_hidden_proto(rc_runlevel_get)
|
||||
librc_hidden_proto(rc_runlevel_exists)
|
||||
librc_hidden_proto(rc_runlevel_set)
|
||||
librc_hidden_proto(rc_runlevel_starting)
|
||||
librc_hidden_proto(rc_runlevel_stopping)
|
||||
librc_hidden_proto(rc_schedule_clear)
|
||||
@ -88,10 +88,11 @@ librc_hidden_proto(rc_service_delete)
|
||||
librc_hidden_proto(rc_service_description)
|
||||
librc_hidden_proto(rc_service_exists)
|
||||
librc_hidden_proto(rc_service_in_runlevel)
|
||||
librc_hidden_proto(rc_service_mark)
|
||||
librc_hidden_proto(rc_service_option_get)
|
||||
librc_hidden_proto(rc_service_option_set)
|
||||
librc_hidden_proto(rc_service_options)
|
||||
librc_hidden_proto(rc_service_mark)
|
||||
librc_hidden_proto(rc_service_plugable)
|
||||
librc_hidden_proto(rc_service_resolve)
|
||||
librc_hidden_proto(rc_service_start)
|
||||
librc_hidden_proto(rc_service_stop)
|
||||
@ -102,7 +103,6 @@ librc_hidden_proto(rc_services_scheduled)
|
||||
librc_hidden_proto(rc_services_scheduled_by)
|
||||
librc_hidden_proto(rc_service_started_daemon)
|
||||
librc_hidden_proto(rc_service_state)
|
||||
librc_hidden_proto(rc_set_runlevel)
|
||||
librc_hidden_proto(rc_strcatpaths)
|
||||
librc_hidden_proto(rc_strlist_add)
|
||||
librc_hidden_proto(rc_strlist_addu)
|
||||
|
@ -46,7 +46,7 @@ int rc_depend (int argc, char **argv)
|
||||
char *runlevel = getenv ("RC_SOFTLEVEL");
|
||||
|
||||
if (! runlevel)
|
||||
runlevel = rc_get_runlevel ();
|
||||
runlevel = rc_runlevel_get ();
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp (argv[i], "--update") == 0) {
|
||||
|
@ -128,7 +128,7 @@ int rc_status (int argc, char **argv)
|
||||
rc_strlist_add (&levels, argv[optind++]);
|
||||
|
||||
if (! levels) {
|
||||
level = rc_get_runlevel ();
|
||||
level = rc_runlevel_get ();
|
||||
rc_strlist_add (&levels, level);
|
||||
free (level);
|
||||
}
|
||||
|
12
src/rc.c
12
src/rc.c
@ -887,7 +887,7 @@ int main (int argc, char **argv)
|
||||
|
||||
/* Load current softlevel */
|
||||
bootlevel = getenv ("RC_BOOTLEVEL");
|
||||
runlevel = rc_get_runlevel ();
|
||||
runlevel = rc_runlevel_get ();
|
||||
|
||||
/* Check we're in the runlevel requested, ie from
|
||||
rc single
|
||||
@ -1007,7 +1007,7 @@ int main (int argc, char **argv)
|
||||
strcmp (newlevel, RC_LEVEL_SINGLE) == 0))
|
||||
{
|
||||
going_down = true;
|
||||
rc_set_runlevel (newlevel);
|
||||
rc_runlevel_set (newlevel);
|
||||
setenv ("RC_SOFTLEVEL", newlevel, 1);
|
||||
rc_plugin_run (RC_HOOK_RUNLEVEL_STOP_IN, newlevel);
|
||||
} else {
|
||||
@ -1042,7 +1042,7 @@ int main (int argc, char **argv)
|
||||
rc_rm_dir (DEVBOOT, true);
|
||||
|
||||
STRLIST_FOREACH (start_services, service, i)
|
||||
if (rc_allow_plug (service))
|
||||
if (rc_service_plugable (service))
|
||||
rc_service_mark (service, RC_SERVICE_COLDPLUGGED);
|
||||
/* We need to dump this list now.
|
||||
This may seem redunant, but only Linux needs this and saves on
|
||||
@ -1067,7 +1067,7 @@ int main (int argc, char **argv)
|
||||
j = (strlen ("net.") + strlen (service) + 1);
|
||||
tmp = rc_xmalloc (sizeof (char *) * j);
|
||||
snprintf (tmp, j, "net.%s", service);
|
||||
if (rc_service_exists (tmp) && rc_allow_plug (tmp))
|
||||
if (rc_service_exists (tmp) && rc_service_plugable (tmp))
|
||||
rc_service_mark (tmp, RC_SERVICE_COLDPLUGGED);
|
||||
CHAR_FREE (tmp);
|
||||
}
|
||||
@ -1169,7 +1169,7 @@ int main (int argc, char **argv)
|
||||
|
||||
/* Save out softlevel now */
|
||||
if (going_down)
|
||||
rc_set_runlevel (newlevel);
|
||||
rc_runlevel_set (newlevel);
|
||||
|
||||
types = NULL;
|
||||
rc_strlist_add (&types, "needsme");
|
||||
@ -1270,7 +1270,7 @@ int main (int argc, char **argv)
|
||||
|
||||
/* Store the new runlevel */
|
||||
if (newlevel) {
|
||||
rc_set_runlevel (newlevel);
|
||||
rc_runlevel_set (newlevel);
|
||||
free (runlevel);
|
||||
runlevel = rc_xstrdup (newlevel);
|
||||
setenv ("RC_SOFTLEVEL", runlevel, 1);
|
||||
|
6
src/rc.h
6
src/rc.h
@ -163,15 +163,15 @@ bool rc_service_started_daemon (const char *service, const char *exec,
|
||||
/*! Check if the service is allowed to be hot/cold plugged
|
||||
* @param service to check
|
||||
* @return true if allowed, otherwise false */
|
||||
bool rc_allow_plug (char *service);
|
||||
bool rc_service_plugable (char *service);
|
||||
|
||||
/*! Return the current runlevel.
|
||||
* @return the current runlevel */
|
||||
char *rc_get_runlevel (void);
|
||||
char *rc_runlevel_get (void);
|
||||
/*! Set the runlevel.
|
||||
* This just changes the stored runlevel and does not start or stop any services.
|
||||
* @param runlevel to store */
|
||||
bool rc_set_runlevel (const char *runlevel);
|
||||
bool rc_runlevel_set (const char *runlevel);
|
||||
|
||||
/*! Checks if the runlevel exists or not
|
||||
* @param runlevel to check
|
||||
|
@ -1065,7 +1065,7 @@ int runscript (int argc, char **argv)
|
||||
/* We don't free our list as that would be null in environ */
|
||||
}
|
||||
|
||||
softlevel = rc_get_runlevel ();
|
||||
softlevel = rc_runlevel_get ();
|
||||
}
|
||||
|
||||
setenv ("RC_ELOG", service, 1);
|
||||
@ -1134,7 +1134,7 @@ int runscript (int argc, char **argv)
|
||||
}
|
||||
|
||||
if (rc_env_bool ("IN_HOTPLUG")) {
|
||||
if (! rc_env_bool ("RC_HOTPLUG") || ! rc_allow_plug (applet))
|
||||
if (! rc_env_bool ("RC_HOTPLUG") || ! rc_service_plugable (applet))
|
||||
eerrorx ("%s: not allowed to be hotplugged", applet);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user