[Ocfs2-tools-devel] [PATCH 03/25] o2cb_config: Add o2cb_config_remove_cluster()

Sunil Mushran sunil.mushran at oracle.com
Wed Jun 23 11:44:13 PDT 2010


o2cb_config_remove_cluster() added to allow removal of cluster from the config.

Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
---
 o2cb_ctl/o2cb_config.c |   15 +++++++++++++++
 o2cb_ctl/o2cb_config.h |    3 +--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/o2cb_ctl/o2cb_config.c b/o2cb_ctl/o2cb_config.c
index 224c69d..dd46089 100644
--- a/o2cb_ctl/o2cb_config.c
+++ b/o2cb_ctl/o2cb_config.c
@@ -631,6 +631,21 @@ O2CBCluster *o2cb_config_add_cluster(O2CBConfig *config,
     return cluster;
 }  /* o2cb_cluster_add_cluster() */
 
+gint o2cb_config_remove_cluster(O2CBConfig *config, const gchar *name)
+{
+    O2CBCluster *cluster;
+
+    g_return_val_if_fail(config != NULL, -1);
+    cluster = o2cb_config_get_cluster_by_name(config, name);
+    if (!cluster)
+	    return -1;
+
+    config->co_clusters = g_list_remove(config->co_clusters, cluster);
+    o2cb_cluster_free(cluster);
+
+    return 0;
+}
+
 O2CBCluster *o2cb_config_get_cluster_by_name(O2CBConfig *config,
                                              const gchar *name)
 {
diff --git a/o2cb_ctl/o2cb_config.h b/o2cb_ctl/o2cb_config.h
index da37e35..7e481f1 100644
--- a/o2cb_ctl/o2cb_config.h
+++ b/o2cb_ctl/o2cb_config.h
@@ -37,8 +37,7 @@ void o2cb_config_free(O2CBConfig *config);
 
 O2CBCluster *o2cb_config_add_cluster(O2CBConfig *config,
                                      const gchar *name);
-void o2cb_config_delete_cluster(O2CBConfig *config,
-                                O2CBCluster *cluster);
+gint o2cb_config_remove_cluster(O2CBConfig *config, const gchar *name);
 JIterator *o2cb_config_get_clusters(O2CBConfig *config);
 O2CBCluster *o2cb_config_get_cluster_by_name(O2CBConfig *config,
                                              const gchar *name);
-- 
1.7.0.4




More information about the Ocfs2-tools-devel mailing list