public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Christine Caulfield <chrissie@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: cluster: STABLE3 - config: remove translation table from confdb2ldif
Date: Tue, 08 Sep 2009 14:17:00 -0000	[thread overview]
Message-ID: <20090908141728.171B71201F5@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=e13262aa941b2686236853810d3f5463de31d733
Commit:        e13262aa941b2686236853810d3f5463de31d733
Parent:        7a38bb2937f0559918009ef7dcc5ec10fd03c7a0
Author:        Christine Caulfield <ccaulfie@redhat.com>
AuthorDate:    Tue Sep 8 15:16:01 2009 +0100
Committer:     Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Tue Sep 8 15:16:01 2009 +0100

config: remove translation table from confdb2ldif

The translation table is performing an obvious algorithm now, so I
can add features, realiability and future-proofing by removing lots of code

I love patches like that  :-)

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
 config/tools/ldap/confdb2ldif.c |   29 ++---------------------------
 1 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/config/tools/ldap/confdb2ldif.c b/config/tools/ldap/confdb2ldif.c
index 8115c12..f75a5b3 100644
--- a/config/tools/ldap/confdb2ldif.c
+++ b/config/tools/ldap/confdb2ldif.c
@@ -12,28 +12,7 @@
 confdb_callbacks_t callbacks = {
 };
 
-/* This structure maps object parent names to object classes */
-struct objectclasses
-{
-	const char *name;
-	const char *class;
-} objectclasses[] =
-{
-	{ "cluster", "rhcsCluster" },
-	{ "cman", "rhcsCman" },
-	{ "totem", "rhcsTotem" },
-	{ "clusternode", "rhcsClusternode" },
-	{ "device", "rhcsDevice" },
-	{ "fencedevice", "rhcsFencedevice" },
-	{ "method", "rhcsmethod" },
-	{ "logging", "rhcsLoggersubsys" },
-	{ "fence_daemon", "rhcsFencedaemon" },
-	{ "dlm", "rhcsDlm" },
-/* TODO: Add more here as the schema gets filled in */
-};
-
-
-static char *ldap_attr_name(char *attrname)
+static const char *ldap_attr_name(const char *attrname)
 {
 	static char newname[1024];
 	int i;
@@ -67,7 +46,6 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
 	size_t key_value_len;
 	char cumulative_dn[4096];
 	int res;
-	int i;
 	int keycount=0;
 
 	printf("\ndn: %s\n", fulldn);
@@ -97,10 +75,7 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
 		printf("objectclass: nsContainer\n");
 	}
 	else {
-		for (i = 0; i < sizeof(objectclasses)/sizeof(struct objectclasses); i++) {
-			if (strcmp(objectclasses[i].name, dn) == 0)
-				printf("objectclass: %s\n", objectclasses[i].class);
-		}
+		printf("objectclass: %s\n", ldap_attr_name(dn));
 	}
 
 	/* Show sub-objects */


                 reply	other threads:[~2009-09-08 14:17 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=20090908141728.171B71201F5@lists.fedorahosted.org \
    --to=chrissie@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).