Skip to contentSkip to conversation

cluster/rgmanager include/list.h include/resli ...

Cluster-devel [email protected] 1 participant 1 message Mar 23, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: lhh at sourceware.org 2007-03-23 00:06:35

Modified files:
rgmanager/include: list.h reslist.h rgmanager/src/daemons: reslist.c resrules.c restree.c test.c
Removed files:
rgmanager/src/resources: perlscript.pl

Log message:
Merge resource-order patch from RHEL4 + main branches

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/list.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4&r2=1.4.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/reslist.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.15.2.1&r2=1.15.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/reslist.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.14.2.1&r2=1.14.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/resrules.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.16.2.1&r2=1.16.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/restree.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.23.2.1&r2=1.23.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/test.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.6.2.1&r2=1.6.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/perlscript.pl.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1&r2=NONE

rgmanager/include/list.h +36 -3
@@ -29,6 +29,14 @@
 	} \
 } while (0)
 
+	
+#define list_prepend(list, newnode) \
+do { \
+	list_insert(list, newnode); \
+	*list = newnode; \
+} while (0)
+
+
 #define list_remove(list, oldnode) \
 do { \
 	if (le(oldnode) == le(*list)) { \
@@ -46,6 +54,11 @@
 	} \
 } while (0)
 
+/*
+   list_do(list, node) {
+   	stuff;
+   } while (!list_done(list, node));
+ */
 #define list_do(list, curr) \
 	if (*list && (curr = *list)) do
 
@@ -53,9 +66,29 @@
 	(curr && (((curr = (void *)le(curr)->le_next)) && (curr == *list)))
 
 /*
-   list_do(list, node) {
-   	stuff;
-   } while (!list_done(list, node));
+ * list_for(list, tmp, counter) {
+ *     stuff;
+ * }
+ * 
+ * counter = # of items in list when done.
+ * * sets cnt to 0 before even checking list;
+ * * checks for valid list
+ * * traverses list, incrementing counter.  If we get to the for loop,
+ *   there must be at least one item in the list
  */
+#define list_for(list, curr, cnt) \
+	if (!(cnt=0) && list && *list) \
+		for (curr = *list; \
+		     (cnt == 0) || (curr != *list); \
+		     curr = (void*)le(curr)->le_next, \
+		     cnt++)
+			
+#define list_for_rev(list, curr, cnt) \
+	if (!(cnt=0) && list && *list) \
+		for (curr = (void *)(le(*list)->le_prev); \
+		     (cnt == 0) || ((void *)curr != le(*list)->le_prev); \
+		     curr = (void*)(le(curr)->le_prev), \
+		     cnt++)
+				   
 
 #endif
rgmanager/include/reslist.h +3 -2
@@ -64,10 +64,11 @@
 
 
 typedef struct _resource_child {
-	char    rc_forbid;
+	char	*rc_name;
 	int	rc_startlevel;
 	int	rc_stoplevel;
-	char	*rc_name;
+	int	rc_forbid;
+	int	rc_flags;
 } resource_child_t;
 
 
rgmanager/src/daemons/reslist.c +39 -4

56 lines not on this page · raw message

rgmanager/src/daemons/resrules.c +5 -2
@@ -449,11 +449,12 @@
    @param start		Start level
    @param stop		Stop level
    @param forbid	Do NOT allow this child type to exist
+   @param flags		set to 1 to note that it was defined inline
    @return		0 on success, nonzero on failure
  */
 int
 store_childtype(resource_child_t **childp, char *name, int start, int stop,
-		int forbid)
+		int forbid, int flags)
 {
 	int x = 0;
 	resource_child_t *child = *childp;
@@ -469,6 +470,7 @@
 		child[0].rc_startlevel = start;
 		child[0].rc_stoplevel = stop;
 		child[0].rc_forbid = forbid;
+		child[0].rc_flags = flags;
 		child[1].rc_name = NULL;
 
 		*childp = child;
@@ -485,6 +487,7 @@
 	child[x].rc_startlevel = start;
 	child[x].rc_stoplevel = stop;
 	child[x].rc_forbid = forbid;
+	child[x].rc_flags = flags;
 	child[x+1].rc_name = NULL;
 
 	*childp = child;
@@ -777,7 +780,7 @@
 		 */
 		if (childname)
 			store_childtype(&rr->rr_childtypes, childname,
-					startlevel, stoplevel, forbid);
+					startlevel, stoplevel, forbid, 0);
 	}
 
 	return 0;
rgmanager/src/daemons/restree.c +462 -100

662 lines not on this page · raw message

rgmanager/src/daemons/test.c +7 -1
@@ -48,8 +48,8 @@
 	"\trules\n\n"
 
 
+void _no_op_mode(int);
 void malloc_dump_table(void);
-
 char *agentpath = RESOURCE_ROOTDIR;
 
 
@@ -77,6 +77,7 @@
 }
 
 
+
 int
 test_func(int argc, char **argv)
 {
@@ -319,6 +320,11 @@
 			shift();
 			ret = test_func(argc, argv);
 			goto out;
+		} else if (!strcmp(argv[1], "noop")) {
+			shift();
+			_no_op_mode(1);
+			ret = test_func(argc, argv);
+			goto out;
 		} else if (!strcmp(argv[1], "rules")) {
 			shift();
 			ret = rules_func(argc, argv);