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

Sunil Mushran sunil.mushran at oracle.com
Tue Sep 14 15:54:33 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 4f86a36..3dae2f3 100644
--- a/o2cb_ctl/o2cb_config.c
+++ b/o2cb_ctl/o2cb_config.c
@@ -635,6 +635,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 -ENOENT;
+
+    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 6f41dba..4b040e1 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