All of lore.kernel.org
 help / color / mirror / Atom feed
From: lhh@sourceware.org <lhh@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/rgmanager/src/daemons resrules.c
Date: 20 Oct 2006 20:57:19 -0000	[thread overview]
Message-ID: <20061020205719.7994.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	lhh at sourceware.org	2006-10-20 20:57:19

Modified files:
	rgmanager/src/daemons: resrules.c 

Log message:
	Correct incorrectly applied patch to fix compatibility issue

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/resrules.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.9.2.3&r2=1.9.2.4

--- cluster/rgmanager/src/daemons/resrules.c	2006/10/20 20:29:39	1.9.2.3
+++ cluster/rgmanager/src/daemons/resrules.c	2006/10/20 20:57:19	1.9.2.4
@@ -19,10 +19,10 @@
 #include <libxml/parser.h>
 #include <libxml/xmlmemory.h>
 #include <libxml/xpath.h>
+#include <magma.h>
 #include <ccs.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <string.h>
 #include <resgroup.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -53,6 +53,12 @@
 				newrule->rr_type);
 			return -1;
 		}
+		if (newrule->rr_root && curr->rr_root) {
+			fprintf(stderr, "Error storing %s: root "
+				"resource type %s exists already\n",
+				newrule->rr_type, curr->rr_type);
+			return -1;
+		}
 
 	} while (!list_done(rulelist, curr));
 			
@@ -180,6 +186,30 @@
 }
 
 
+/**
+   Get and store the root attribute.
+
+   @param doc		Pre-parsed XML document pointer.
+   @param ctx		Pre-allocated XML XPath context pointer.
+   @param base		XPath prefix to search
+   @param rr		Resource rule to store new information in.
+ */
+void
+_get_root(xmlDocPtr doc, xmlXPathContextPtr ctx, char *base,
+	  resource_rule_t *rr)
+{
+	char xpath[256];
+	char *ret = NULL;
+
+	snprintf(xpath, sizeof(xpath), "%s/attributes/@root", base);
+	ret = xpath_get_one(doc, ctx, xpath);
+	if (ret) {
+		rr->rr_root = 1;
+		free(ret);
+	}
+}
+
+
 int
 expand_time(char *val)
 {
@@ -326,6 +356,8 @@
 			free(act);
 		
 	} while (1);
+
+
 }
 
 
@@ -497,7 +529,10 @@
 {
 	int x;
 
-	printf("Resource Rules for \"%s\"\n", rr->rr_type);
+	printf("Resource Rules for \"%s\"", rr->rr_type);
+	if (rr->rr_root)
+		printf(" [ROOT]");
+	printf("\n");
 
 	if (rr->rr_version)
 		printf("OCF API Version: %s\n", rr->rr_version);
@@ -928,11 +963,12 @@
 		snprintf(base, sizeof(base),
 			 "/resource-agent[%d]/special[@tag=\"rgmanager\"]",
 			 ruleid);
+		_get_root(doc, ctx, base, rr);
 		_get_maxparents(doc, ctx, base, rr);
 		rr->rr_agent = strdup(filename);
 
 		/*
-		   Second, add the children fields
+		   Second, add the allowable-children fields
 		 */
 		_get_childtypes(doc, ctx, base, rr);
 



             reply	other threads:[~2006-10-20 20:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-20 20:57 lhh [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-01-30 20:00 [Cluster-devel] cluster/rgmanager/src/daemons resrules.c lhh
2008-01-30 20:00 lhh
2007-05-31 18:37 lhh
2006-10-20 20:59 lhh
2006-10-20 20:29 lhh
2006-10-20 20:29 lhh
2006-08-31 12:00 mgrac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061020205719.7994.qmail@sourceware.org \
    --to=lhh@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.