[Initng-svn] r2994 - in initng: initfiles/system plugins/runlevel src

svn at initng.thinktux.net svn at initng.thinktux.net
Tue Feb 14 11:02:33 CET 2006


Author: jimmy
Date: Tue Feb 14 11:02:32 2006
New Revision: 2994

Modified:
   initng/initfiles/system/coldplug.ii
   initng/plugins/runlevel/initng_runlevel.c
   initng/src/initng_static_service_types.c
   initng/src/initng_static_service_types.h
   initng/src/initng_static_states.c
Log:
Move TYPE_VIRTUAL into initng_runlevel.c for now.


Modified: initng/initfiles/system/coldplug.ii
==============================================================================
--- initng/initfiles/system/coldplug.ii	(original)
+++ initng/initfiles/system/coldplug.ii	Tue Feb 14 11:02:32 2006
@@ -1,4 +1,4 @@
-class system/coldplug/class {
+container system/coldplug/class {
 	need = system/initial;
 	use = system/static-modules;
 	exec start = /etc/hotplug/${NAME}.rc start;

Modified: initng/plugins/runlevel/initng_runlevel.c
==============================================================================
--- initng/plugins/runlevel/initng_runlevel.c	(original)
+++ initng/plugins/runlevel/initng_runlevel.c	Tue Feb 14 11:02:32 2006
@@ -65,6 +65,7 @@
  * ############################################################################
  */
 stype_h TYPE_RUNLEVEL = { "runlevel", &start_RUNLEVEL, &stop_RUNLEVEL, NULL };
+stype_h TYPE_VIRTUAL = { "virtual", &start_RUNLEVEL, &stop_RUNLEVEL, NULL };
 
 
 /*
@@ -176,6 +177,7 @@
     }
 
     initng_service_types_add(&TYPE_RUNLEVEL);
+    initng_service_types_add(&TYPE_VIRTUAL);
 
 
     initng_active_state_add(&RUNLEVEL_START_MARKED);
@@ -198,6 +200,7 @@
     D_("module_unload();\n");
 
     initng_service_types_del(&TYPE_RUNLEVEL);
+    initng_service_types_del(&TYPE_VIRTUAL);
 
 
     initng_active_state_del(&RUNLEVEL_START_MARKED);

Modified: initng/src/initng_static_service_types.c
==============================================================================
--- initng/src/initng_static_service_types.c	(original)
+++ initng/src/initng_static_service_types.c	Tue Feb 14 11:02:32 2006
@@ -49,63 +49,11 @@
 #include "initng_static_states.h"
 
 
-static int start_DAEMON_or_SERVICE(active_db_h * service_to_start);
-static int stop_SERVICE_or_DAEMON(active_db_h * service_to_stop);
-
-stype_h TYPE_VIRTUAL = { "virtual", &start_DAEMON_or_SERVICE, &stop_SERVICE_or_DAEMON, NULL };
-stype_h TYPE_CLASS = { "class", NULL, NULL, NULL };
+stype_h TYPE_CONTAINER = { "container", NULL, NULL, NULL };
 
 void initng_service_add_static_stypes(void)
 {
-    initng_service_types_add(&TYPE_VIRTUAL);
-    initng_service_types_add(&TYPE_CLASS);
-}
-
-
-static int start_DAEMON_or_SERVICE(active_db_h * service_to_start)
-{
-    /* mark it WAITING_FOR_START_DEP and wait */
-    if (!initng_common_mark_service(service_to_start, &WAITING_FOR_START_DEP))
-    {
-        W_("mark_service WAITING_FOR_START_DEP failed for service %s\n",
-           service_to_start->name);
-        return (FALSE);
-    }
-    return (TRUE);
+    initng_service_types_add(&TYPE_CONTAINER);
 }
 
 
-
-static int stop_SERVICE_or_DAEMON(active_db_h * service_to_stop)
-{
-    active_db_h *current, *safe = NULL;
-
-    /*
-     * Okay, service is in state for stopping!
-     */
-
-    /* set stopping */
-    if (!initng_common_mark_service(service_to_stop, &STOP_MARKED))
-        return (FALSE);
-
-    /* also stop all service depending on service_to_stop */
-    while_active_db_safe(current, safe)
-    {
-        if (current == service_to_stop)
-            continue;
-
-        /* don't auto stop runlevels or virtuals */
-        if (current->type == &TYPE_VIRTUAL)
-            continue;
-
-        /* don't stop a stopping service */
-        if (current->current_state == &STOPPING)
-            continue;
-
-        /* if current depends on the one we are stopping */
-        if (initng_depend(current, service_to_stop) == TRUE)
-            initng_handler_stop_service(current);
-    }
-
-    return (TRUE);
-}

Modified: initng/src/initng_static_service_types.h
==============================================================================
--- initng/src/initng_static_service_types.h	(original)
+++ initng/src/initng_static_service_types.h	Tue Feb 14 11:02:32 2006
@@ -25,7 +25,7 @@
 #include <time.h>
 #include "initng_active_db.h"
 
-extern stype_h TYPE_VIRTUAL;
+extern stype_h TYPE_CONTAINER;
 
 void initng_service_add_static_stypes(void);
 

Modified: initng/src/initng_static_states.c
==============================================================================
--- initng/src/initng_static_states.c	(original)
+++ initng/src/initng_static_states.c	Tue Feb 14 11:02:32 2006
@@ -194,12 +194,6 @@
         return;
     }
 
-    if (service_to_start->type == &TYPE_VIRTUAL)
-    {
-        initng_common_mark_service(service_to_start, &DONE);
-        return;
-    }
-
     F_("DEP MET BUT CANT HANDLE!\n");
     initng_common_mark_service(service_to_start, &FAIL_STARTING);
 }
@@ -257,12 +251,6 @@
     }
 
 
-    /* this wont execute anything ... */
-    if (service_to_stop->type == &TYPE_VIRTUAL)
-    {
-        initng_common_mark_service(service_to_stop, &STOPPED);
-        return;
-    }
 
     /* ok, stopping deps are met */
     D_("Try set STOP_DEP_MET!\n");
@@ -278,11 +266,6 @@
 static void handle_STOP_DEP_MET(active_db_h * service_to_stop)
 {
 
-    if (service_to_stop->type == &TYPE_VIRTUAL)
-    {
-        initng_common_mark_service(service_to_stop, &STOPPED);
-        return;
-    }
 
     initng_common_mark_service(service_to_stop, &FAIL_STOPPING);
     F_("DON'T KNOW HOW TO STOP %s!\n", service_to_stop->name);
@@ -302,10 +285,6 @@
         if (current == service_stopped)
             continue;
 
-        /* DON'T stop runlevels OR virtuals */
-        if (current->type == &TYPE_VIRTUAL)
-            continue;
-
         /* check that current needs service_stopped */
         if (initng_depend(current, service_stopped) == FALSE)
             continue;


More information about the Initng-svn mailing list