From: fabbione@sourceware.org <fabbione@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] Cluster Project branch, master, updated. gfs-kernel_0_1_22-62-g53d0c18
Date: 10 Mar 2008 19:04:17 -0000 [thread overview]
Message-ID: <20080310190417.4739.qmail@sourceware.org> (raw)
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
reply other threads:[~2008-03-10 19:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20080310190417.4739.qmail@sourceware.org \
--to=fabbione@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 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).