This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

master - libccs: add support for /child::*[%d]/ for xpathlite


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=72299320730ffb6fa7a0af4694ff152dc501d656
Commit:        72299320730ffb6fa7a0af4694ff152dc501d656
Parent:        60132fc9c185be95a6cc480bd535412995a167a2
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Mon Aug 11 13:23:28 2008 +0200
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Fri Aug 15 08:00:44 2008 +0200

libccs: add support for /child::*[%d]/ for xpathlite

xpathlite did not understand the concept of child::*[%d]
within a path (ex: /cluster/rm/child::*[1]/@name).

This operation is required by rgmanager to load the service tree.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 config/libs/libccsconfdb/libccs.c |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/config/libs/libccsconfdb/libccs.c b/config/libs/libccsconfdb/libccs.c
index 7e7b2e2..d945db4 100644
--- a/config/libs/libccsconfdb/libccs.c
+++ b/config/libs/libccsconfdb/libccs.c
@@ -337,6 +337,8 @@ static int path_dive(int tokens)
 			 */
 
 			char *start = NULL, *middle = NULL, *end = NULL;
+			char data[PATH_MAX];
+			int datalen;
 
 			/*
 			 * those ones should be always good because
@@ -355,7 +357,25 @@ static int path_dive(int tokens)
 			memset(start, 0, 1);
 			memset(end, 0, 1);
 
-			if (!strstr(middle, "@")) {
+			if (!strcmp(pos, "child::*")) {
+				int val, i;
+
+				val = atoi(middle);
+
+				if(val < 1)
+					goto fail;
+
+				if(confdb_object_iter_start(handle, query_handle) != SA_AIS_OK)
+					goto fail;
+
+				for (i = 1; i <= val; i++) {
+					if(confdb_object_iter(handle, query_handle, &new_obj_handle, data, &datalen) != SA_AIS_OK)
+						goto fail;
+				}
+
+				query_handle = new_obj_handle;
+
+			} else if (!strstr(middle, "@")) {
 				/* lookup something with index num = int */
 				int val, i;
 
@@ -373,8 +393,7 @@ static int path_dive(int tokens)
 			} else {
 				/* lookup something with obj foo = bar */
 				char *equal = NULL, *value = NULL, *tmp = NULL;
-				char data[PATH_MAX];
-				int goout = 0, datalen;
+				int goout = 0;
 
 				equal=strstr(middle, "=");
 				if(!equal)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]