* [Cluster-devel] Cluster Project branch, master, updated. gfs-kernel_0_1_22-62-g53d0c18
@ 2008-03-10 19:04 fabbione
0 siblings, 0 replies; only message in thread
From: fabbione @ 2008-03-10 19:04 UTC (permalink / raw)
To: cluster-devel.redhat.com
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=53d0c185cb0374ec037fdc2dd24752d07150edec
The branch, master has been updated
via 53d0c185cb0374ec037fdc2dd24752d07150edec (commit)
from d596d8495b708a990a1abd599fb9ff2b282df3d1 (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 53d0c185cb0374ec037fdc2dd24752d07150edec
Author: Fabio M. Di Nitto <fabbione@fabbione.net>
Date: Mon Mar 10 20:03:13 2008 +0100
[CCS] Fix xml -> objdb config import
Signed-off-by: Fabio M. Di Nitto <fabbione@fabbione.net>
-----------------------------------------------------------------------
Summary of changes:
ccs/ccsais/config.c | 34 ++++++++++++++++++++++++----------
1 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/ccs/ccsais/config.c b/ccs/ccsais/config.c
index 485a95b..1365206 100644
--- a/ccs/ccsais/config.c
+++ b/ccs/ccsais/config.c
@@ -75,6 +75,28 @@ static struct lcr_comp ccs_comp_ver0 = {
__attribute__ ((constructor)) static void ccs_comp_register(void) {
lcr_interfaces_set(&ifaces_ver0[0], &ccsconfig_iface_ver0);
lcr_component_register(&ccs_comp_ver0);
+};
+
+static int should_alloc(int ccs_fd, char *key)
+{
+ int keyerror, childerr;
+ char keypath[256], childpath[256];
+ char *str = NULL;
+
+ sprintf(keypath, "/cluster/%s/@*", key);
+ keyerror = ccs_get_list(ccs_fd, keypath, &str);
+ if(str)
+ free(str);
+
+ sprintf(childpath, "/cluster/%s/child::*", key);
+ childerr = ccs_get_list(ccs_fd, childpath, &str);
+ if(str)
+ free(str);
+
+ if (childerr && keyerror)
+ return 0;
+
+ return 1;
}
static int read_config_for(int ccs_fd, struct objdb_iface_ver0 *objdb, unsigned int parent,
@@ -89,9 +111,9 @@ static int read_config_for(int ccs_fd, struct objdb_iface_ver0 *objdb, unsigned
int subkeycount = 0;
int i;
- if (always_create) {
+ if (should_alloc(ccs_fd, key) || always_create)
objdb->object_create(parent, &object_handle, object, strlen(object));
- }
+
sprintf(path, "/cluster/%s/@*", key);
/* Get the keys */
@@ -103,10 +125,6 @@ static int read_config_for(int ccs_fd, struct objdb_iface_ver0 *objdb, unsigned
if (error || !str)
break;
- if (!object_handle) {
- objdb->object_create(parent, &object_handle, object, strlen(object));
- }
-
equal = strchr(str, '=');
if (equal)
{
@@ -167,10 +185,6 @@ static int read_config_for(int ccs_fd, struct objdb_iface_ver0 *objdb, unsigned
{
char subpath[1024];
- /* Allow for empty parents */
- if (!object_handle)
- object_handle = parent;
-
/* Found a subkey, iterate through it's sub sections */
sprintf(subpath, "%s/%s[%d]", key, str, ++count);
if (!read_config_for(ccs_fd, objdb, object_handle, str, subpath, 0))
hooks/post-receive
--
Cluster Project
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-03-10 19:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-10 19:04 [Cluster-devel] Cluster Project branch, master, updated. gfs-kernel_0_1_22-62-g53d0c18 fabbione
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 NNTP newsgroup(s).