[Initng-svn] r2992 - in initng: . plugins plugins/last plugins/rlparser plugins/runlevel plugins/unneeded src

svn at initng.thinktux.net svn at initng.thinktux.net
Tue Feb 14 10:53:37 CET 2006


Author: jimmy
Date: Tue Feb 14 10:53:36 2006
New Revision: 2992

Added:
   initng/plugins/runlevel/
   initng/plugins/runlevel/Makefile.am
   initng/plugins/runlevel/initng_runlevel.c
   initng/plugins/runlevel/initng_runlevel.h
Modified:
   initng/configure.in
   initng/plugins/Makefile.am
   initng/plugins/last/initng_last.c
   initng/plugins/rlparser/initng_rl_parser.c
   initng/plugins/unneeded/initng_unneeded.c
   initng/src/initng_static_service_types.c
   initng/src/initng_static_service_types.h
   initng/src/initng_static_states.c
Log:
Move TYPE_RUNLEVEL out of core.


Modified: initng/configure.in
==============================================================================
--- initng/configure.in	(original)
+++ initng/configure.in	Tue Feb 14 10:53:36 2006
@@ -402,6 +402,7 @@
 	  plugins/fstat/Makefile \
 	  plugins/find/Makefile \
 	  plugins/interactive/Makefile \
+	  plugins/runlevel/Makefile \
 	  plugins/syncron/Makefile \
 	  plugins/dllaunch/Makefile \
 	  plugins/reload/Makefile \

Modified: initng/plugins/Makefile.am
==============================================================================
--- initng/plugins/Makefile.am	(original)
+++ initng/plugins/Makefile.am	Tue Feb 14 10:53:36 2006
@@ -1,5 +1,5 @@
 
-SUBDIRS=service daemon
+SUBDIRS=service daemon runlevel
 
 if BUILD_ALSO
     SUBDIRS+=also

Modified: initng/plugins/last/initng_last.c
==============================================================================
--- initng/plugins/last/initng_last.c	(original)
+++ initng/plugins/last/initng_last.c	Tue Feb 14 10:53:36 2006
@@ -64,8 +64,8 @@
 
         /* ignore runlevels */
         /* TODO 20051105 SaTaN0rX: i do not know why i need to check for this */
-        if (current->type == &TYPE_RUNLEVEL)
-            continue;
+        /*if (current->type == &TYPE_RUNLEVEL)
+            continue;*/
 
         /* if this service also should be started last, continue */
         if (initng_active_db_is(&LAST, current))
@@ -76,13 +76,13 @@
         if (initng_depend_deep(current, service) == TRUE)
         {
             /* don't wait, because this wait is circular */
-            D_("Service %s depends on %s\n", service->name, current->name);
+            W_("Service %s depends on %s\n", service->name, current->name);
             continue;
         }
 
         if (IS_STARTING(current))
         {
-            D_("Service %s is also starting, and %s should be started last\n",
+            W_("Service %s is also starting, and %s should be started last\n",
                current->name, service->name);
             return (FALSE);
         }

Modified: initng/plugins/rlparser/initng_rl_parser.c
==============================================================================
--- initng/plugins/rlparser/initng_rl_parser.c	(original)
+++ initng/plugins/rlparser/initng_rl_parser.c	Tue Feb 14 10:53:36 2006
@@ -36,10 +36,13 @@
 #include "../../src/initng_plugin_hook.h"
 #include "../../src/initng_handler.h"
 #include "../../src/initng_static_service_types.h"
+#include "../../src/initng_service_types.h"
 #include "../../initng-paths.h"
 
 #include "initng_rl_parser.h"
 
+stype_h *TYPE_RUNLEVEL;
+
 /* a simple parser for a runlevel file */
 service_cache_h *initng_rl_parser(const char *runlevel_name)
 {
@@ -50,7 +53,17 @@
     char *a = NULL;
 
     assert(runlevel_name);
-
+    
+    /* make sure service type RUNLEVEL is set */
+    if(!TYPE_RUNLEVEL)
+    {
+	TYPE_RUNLEVEL=initng_service_types_get("runlevel");
+	if(!TYPE_RUNLEVEL)
+	{
+	    F_("ERROR, runlevel servicetype is not found, make sure runlevel plugin is loaded.\n");
+	    return(NULL);
+	}
+    }
     filetoparse = (char *) i_calloc(strlen(INITNG_ROOT) + 1 +
                                     strlen(runlevel_name) + 10, sizeof(char));
 
@@ -63,7 +76,7 @@
 
     /* allocate a new service */
     if (!
-        (n_service = initng_service_cache_new(runlevel_name, &TYPE_RUNLEVEL)))
+        (n_service = initng_service_cache_new(runlevel_name, TYPE_RUNLEVEL)))
     {
         free(filetoparse);
         return (NULL);
@@ -124,6 +137,9 @@
 
 int module_init(const char *version)
 {
+    /* initziate globals */
+    TYPE_RUNLEVEL = NULL;
+    
     D_("initng_rl_parser: module_init();\n");
     if (strcmp(version, INITNG_VERSION) != 0)
     {

Modified: initng/plugins/unneeded/initng_unneeded.c
==============================================================================
--- initng/plugins/unneeded/initng_unneeded.c	(original)
+++ initng/plugins/unneeded/initng_unneeded.c	Tue Feb 14 10:53:36 2006
@@ -66,16 +66,13 @@
     int needed = FALSE;
     active_db_h *A, *As = NULL;
     active_db_h *B = NULL;
-
+    stype_h *TYPE_RUNLEVEL = initng_service_types_get("runlevel");
     S_;
 
     /* walk through all and check */
     while_active_db_safe(A, As)
     {
-        /* don't stop virtuals */
-        if (A->type == &TYPE_VIRTUAL)
-            continue;
-        if (A->type == &TYPE_RUNLEVEL)
+        if (A->type == TYPE_RUNLEVEL)
             continue;
 
         /* reset variables */

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 10:53:36 2006
@@ -53,13 +53,11 @@
 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_RUNLEVEL = { "runlevel", &start_DAEMON_or_SERVICE, &stop_SERVICE_or_DAEMON, NULL };
 stype_h TYPE_CLASS = { "class", NULL, NULL, NULL };
 
 void initng_service_add_static_stypes(void)
 {
     initng_service_types_add(&TYPE_VIRTUAL);
-    initng_service_types_add(&TYPE_RUNLEVEL);
     initng_service_types_add(&TYPE_CLASS);
 }
 

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 10:53:36 2006
@@ -26,7 +26,6 @@
 #include "initng_active_db.h"
 
 extern stype_h TYPE_VIRTUAL;
-extern stype_h TYPE_RUNLEVEL;
 
 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 10:53:36 2006
@@ -194,8 +194,7 @@
         return;
     }
 
-    if (service_to_start->type == &TYPE_RUNLEVEL
-        || service_to_start->type == &TYPE_VIRTUAL)
+    if (service_to_start->type == &TYPE_VIRTUAL)
     {
         initng_common_mark_service(service_to_start, &DONE);
         return;
@@ -259,8 +258,7 @@
 
 
     /* this wont execute anything ... */
-    if (service_to_stop->type == &TYPE_RUNLEVEL ||
-        service_to_stop->type == &TYPE_VIRTUAL)
+    if (service_to_stop->type == &TYPE_VIRTUAL)
     {
         initng_common_mark_service(service_to_stop, &STOPPED);
         return;


More information about the Initng-svn mailing list