public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* master - libccs: add support for /child::*[%d]/ for xpathlite
@ 2008-08-11 13:56 Fabio M. Di Nitto
  0 siblings, 0 replies; 2+ messages in thread
From: Fabio M. Di Nitto @ 2008-08-11 13:56 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=e46fc61639a46aacf68277182d8d7ef6a9f6790d
Commit:        e46fc61639a46aacf68277182d8d7ef6a9f6790d
Parent:        a7e3cf012418c46cd3f55896512dbfd5e2d0a08c
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: Mon Aug 11 13:23:28 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 1dcca62..3abebd6 100644
--- a/config/libs/libccsconfdb/libccs.c
+++ b/config/libs/libccsconfdb/libccs.c
@@ -338,6 +338,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
@@ -356,7 +358,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;
 
@@ -374,8 +394,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)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* master - libccs: add support for /child::*[%d]/ for xpathlite
@ 2008-08-15 15:32 Fabio M. Di Nitto
  0 siblings, 0 replies; 2+ messages in thread
From: Fabio M. Di Nitto @ 2008-08-15 15:32 UTC (permalink / raw)
  To: cluster-cvs-relay

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)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-15  6:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-11 13:56 master - libccs: add support for /child::*[%d]/ for xpathlite Fabio M. Di Nitto
2008-08-15 15:32 Fabio M. Di Nitto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).