This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project Cluster Project.
http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=34925e9ae54cddda311a682c9131d2d6b84dca7c
The branch, master has been updated
via 34925e9ae54cddda311a682c9131d2d6b84dca7c (commit)
from e879971090c6821bb966f17875874d11aa740a5c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -
commit 34925e9ae54cddda311a682c9131d2d6b84dca7c
Author: Fabio M. Di Nitto [EMAIL PROTECTED]
Date: Tue Jun 3 10:45:45 2008 +0200
[CONFIG] Add full xpath support to libccs
Signed-off-by: Fabio M. Di Nitto [EMAIL PROTECTED]
---
Summary of changes:
config/libs/libccsconfdb/Makefile |3 +-
config/libs/libccsconfdb/ccs.h|2 +
config/libs/libccsconfdb/libccs.c | 287 ++---
3 files changed, 271 insertions(+), 21 deletions(-)
diff --git a/config/libs/libccsconfdb/Makefile
b/config/libs/libccsconfdb/Makefile
index c9b6d94..92c3b78 100644
--- a/config/libs/libccsconfdb/Makefile
+++ b/config/libs/libccsconfdb/Makefile
@@ -37,10 +37,11 @@ OBJS= $(TARGET).o
CFLAGS += -fPIC
CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-CFLAGS += -I${openaisincdir}
+CFLAGS += -I${openaisincdir} `xml2-config --cflags`
CFLAGS += -I${incdir}
LDFLAGS += -L${openaislibdir} -lconfdb
+LDFLAGS += `xml2-config --libs`
$(TARGET).a: $(OBJS)
${AR} r $@ $^
diff --git a/config/libs/libccsconfdb/ccs.h b/config/libs/libccsconfdb/ccs.h
index 91e63cd..eca9c4d 100644
--- a/config/libs/libccsconfdb/ccs.h
+++ b/config/libs/libccsconfdb/ccs.h
@@ -24,4 +24,6 @@ int ccs_get_list(int desc, const char *query, char **rtn);
int ccs_set(int desc, const char *path, char *val);
int ccs_lookup_nodename(int desc, const char *nodename, char **rtn);
+extern int fullxpath;
+
#endif /* __CCS_DOT_H__ */
diff --git a/config/libs/libccsconfdb/libccs.c
b/config/libs/libccsconfdb/libccs.c
index ab82b9d..3d75710 100644
--- a/config/libs/libccsconfdb/libccs.c
+++ b/config/libs/libccsconfdb/libccs.c
@@ -24,10 +24,12 @@
#include limits.h
#include openais/saAis.h
#include openais/confdb.h
+#include libxml/parser.h
+#include libxml/xpath.h
#include ccs.h
-/* Callbacks are not supported */
+/* Callbacks are not supported - we will use them to update fullxml doc/ctx */
static confdb_callbacks_t callbacks = {
.confdb_change_notify_fn = NULL,
};
@@ -39,40 +41,171 @@ static char previous_query[PATH_MAX];
static unsigned int query_handle;
static unsigned int list_handle;
+int fullxpath = 0;
+static int fullxpathint;
+
+static char *buffer = NULL;
+static xmlDocPtr doc = NULL;
+static xmlXPathContextPtr ctx = NULL;
+static int xmllistindex = 0;
+
+static void xpathlite_init() {
+ memset(current_query, 0, PATH_MAX);
+ memset(previous_query, 0, PATH_MAX);
+ query_handle = OBJECT_PARENT_HANDLE;
+ list_handle = OBJECT_PARENT_HANDLE;
+}
+
+static void add_to_buffer(char *data, char **buffer, int *size)
+{
+ int len;
+
+ if((len = strlen(data))) {
+ *size = *size + len;
+ if (*buffer)
+ strncpy(*buffer + strlen(*buffer), data, len);
+ }
+ return;
+}
+
+static int dump_objdb_buff(confdb_handle_t dump_handle, unsigned int
parent_object_handle, char **buffer, int *size)
+{
+ unsigned int object_handle;
+ char temp[PATH_MAX];
+ char object_name[PATH_MAX];
+ int object_name_len;
+ char key_name[PATH_MAX];
+ int key_name_len;
+ char key_value[PATH_MAX];
+ int key_value_len;
+ int res;
+
+ res = confdb_key_iter_start(dump_handle, parent_object_handle);
+ if (res != SA_AIS_OK)
+ return -1;
+
+ if (!*buffer || ((*buffer) !strlen(*buffer))) {
+ snprintf(temp, PATH_MAX - 1, ?xml
version=\1.0\?\nobjdbmaindoc\n);
+ add_to_buffer(temp, buffer, size);
+ }
+
+ while ( (res = confdb_key_iter(dump_handle, parent_object_handle,
key_name, key_name_len,
+ key_value, key_value_len)) ==
SA_AIS_OK) {
+ key_name[key_name_len] = '\0';
+ key_value[key_value_len] = '\0';
+ snprintf(temp, PATH_MAX - 1, %s=\%s\, key_name, key_value);
+ add_to_buffer(temp, buffer, size);
+ }
+
+ if (parent_object_handle 0) {
+ snprintf(temp, PATH_MAX - 1, \n);
+ add_to_buffer(temp, buffer, size);
+ }
+
+ res = confdb_object_iter_start(dump_handle, parent_object_handle);
+ if (res != SA_AIS_OK)
+ return -1;