Send Linux-ha-cvs mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."


Today's Topics:

   1. Linux-HA CVS: linux-ha by zhenh from 
      ([email protected])
   2. Linux-HA CVS: cim by panjiam from 
      ([email protected])
   3. Linux-HA CVS: cim by panjiam from 
      ([email protected])


----------------------------------------------------------------------

Message: 1
Date: Wed, 21 Dec 2005 20:25:29 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: linux-ha by zhenh from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : zhenh
Host    : 
Module  : linux-ha

Dir     : linux-ha


Modified Files:
        configure.in 


Log Message:
fix the check of python-devel
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/configure.in,v
retrieving revision 1.481
retrieving revision 1.482
diff -u -3 -r1.481 -r1.482
--- configure.in        22 Dec 2005 00:28:53 -0000      1.481
+++ configure.in        22 Dec 2005 03:25:29 -0000      1.482
@@ -10,7 +10,7 @@
 AC_INIT(heartbeat.spec.in)
 
 AC_CONFIG_AUX_DIR(.)
-AC_REVISION($Revision: 1.481 $) dnl cvs revision
+AC_REVISION($Revision: 1.482 $) dnl cvs revision
 AC_CANONICAL_HOST
 
 
@@ -2257,7 +2257,7 @@
                      [], [enable_mgmt=try])
 
 MGMT_ENABLED=0
-if test "x${enable_mgmt}" = "xyes" | test "x${enable_mgmt}" = "xtry"; then
+if test "x${enable_mgmt}" = "xyes" || test "x${enable_mgmt}" = "xtry"; then
        MGMT_ENABLED=1
        python_headers_found="yes"
        PYTHON_HEADER_DIR="python${PYTHON_VERSION}"




------------------------------

Message: 2
Date: Wed, 21 Dec 2005 22:35:53 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: cim by panjiam from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : panjiam
Host    : 
Project : linux-ha
Module  : cim

Dir     : linux-ha/cim


Removed Files:
        cmpi_utils.c rule_provider.c 


Log Message:
forgot to delete them




------------------------------

Message: 3
Date: Wed, 21 Dec 2005 23:11:49 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: cim by panjiam from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : panjiam
Host    : 
Project : linux-ha
Module  : cim

Dir     : linux-ha/cim


Modified Files:
        assoc_utils.c cluster_indication_provider.c cluster_info.c 
        cluster_node_provider.c cluster_provider.c 
        colocation_constraint_provider.c constraint_common.c 
        inst_attribute_provider.c location_constraint_provider.c 
        masterslave_resource_provider.c operation_on_provider.c 
        operation_provider.c order_constraint_provider.c 
        resource_clone_provider.c resource_common.c simple_demo.c 
        sub_resource_provider.c 


Log Message:
fixed beam's complaints
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/assoc_utils.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- assoc_utils.c       21 Dec 2005 14:12:58 -0000      1.1
+++ assoc_utils.c       22 Dec 2005 06:11:48 -0000      1.2
@@ -119,9 +119,12 @@
         i = 0;
         while(CMHasNext(en, rc)) {
                 CMPIObjectPath * top = CMGetNext(en, rc).value.ref;
-                if ( CMIsNullObject(top) ) continue;
-                if ( i == max_len ) break;
-
+                if ( CMIsNullObject(top) ) {
+                        continue;
+                }
+                if ( i == max_len ) {
+                        break;
+                }
                 CMSetArrayElementAt(array, i, &top, CMPI_ref);
                 i ++;
         }
@@ -246,7 +249,8 @@
                 target_role = left;
                 left_is_source = 0;
         } else {
-                cl_log(LOG_ERR, "assoc: neither lclass nor rclass");
+                cl_log(LOG_ERR, "enum_associators: lclass: %s, rclass: %s, 
source class: %s", 
+                      lclass, rclass, source_class);
                 return HA_FAIL;
         }
 
@@ -338,14 +342,12 @@
                 target_role = left;
                 left_is_source = 0;
         } else {
-                cl_log(LOG_ERR, "assoc: neither lclass nor rclass");
+                cl_log(LOG_ERR, "enum_references: lcass: %s, rclass: %s, 
source class: %s", 
+                       lclass, rclass, source_classname);
                 return HA_FAIL;
         }
 
-        cl_log(LOG_INFO, "source_classname is %s", source_classname);
-
         /* enumerate taget object paths */
-
         if ( enum_func ) {
                 array = enum_func(broker, classname, ctx, nsp, 
                                   target_classname, target_role, cop, rc);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/cluster_indication_provider.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- cluster_indication_provider.c       21 Dec 2005 14:12:58 -0000      1.1
+++ cluster_indication_provider.c       22 Dec 2005 06:11:48 -0000      1.2
@@ -139,7 +139,7 @@
         struct cmpi_ind_data data ;
         char msg[256];
 
-        if ( event == NULL ) return HA_FAIL;
+        if ( event == NULL ) { return HA_FAIL; }
         cl_log(LOG_INFO, "ind_event_handler: got event: %s", event);
         sprintf(msg, "Got an indication: %s", event);
 
@@ -173,8 +173,6 @@
 static void *
 ind_thread_func(void * param)
 {
-        int ret = 0;
-
         /* attach thread */
         CBAttachThread(ind_env->broker, ind_env->context);
 
@@ -182,7 +180,7 @@
         signal(SIGINT, ind_stop_thread);
 
         /* main loop */
-        ret = ind_main_loop();
+        ind_main_loop();
 
 
         /* detach thread */
@@ -371,10 +369,8 @@
 static void 
 IndicationEnableIndications(CMPIIndicationMI * mi )
 {
-
         /* Enable indication generation */
         ind_enabled = 1;
-
 }
 
 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/cluster_info.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- cluster_info.c      21 Dec 2005 14:12:58 -0000      1.1
+++ cluster_info.c      22 Dec 2005 06:11:48 -0000      1.2
@@ -91,6 +91,7 @@
 
 #define ClientGetAt(x,i)  (x)->get_nth_value(x, i)
 #define ClientSize(x)     (x)->rlen
+#define ClientFree(x)     (x)->free(x)
 
 struct mgmt_client {
         char ** rdata;
@@ -149,7 +150,7 @@
         va_start(ap, type);
         while (1) {
                 char * arg = va_arg(ap, char *);
-                if ( arg == NULL ) break;
+                if ( arg == NULL ) { break; }
                 msg = mgmt_msg_append(msg, arg);
         }
         va_end(ap);
@@ -189,8 +190,8 @@
 
         rc = HA_OK;
 out:   
-        if (msg) mgmt_del_msg(msg);
-       if (result) mgmt_del_msg(result);
+        if (msg) { mgmt_del_msg(msg); }
+       if (result) { mgmt_del_msg(result); }
 
         ci_lib_finalize();
         return rc;
@@ -199,12 +200,10 @@
 static char *
 mgmt_client_get_nth_value(struct mgmt_client * client, uint32_t index) 
 {
-        if ( client == NULL ) return NULL;
-
+        if ( client == NULL ) { return NULL; }
        if ( index >= client->rlen ) {
                return NULL;
        }
-
         return client->rdata[index];
 }
 
@@ -212,10 +211,10 @@
 mgmt_client_free(struct mgmt_client * client)
 {
         char ** args;
-        if (client == NULL ) return ;
+        if (client == NULL ) { return ; }
         if ( client->rdata ) {
                 args = --client->rdata;
-                if ( args ) mgmt_del_args(args);
+                if ( args ) { mgmt_del_args(args); }
         }
 
         CIM_FREE(client);
@@ -235,6 +234,7 @@
 {
         struct mgmt_client * client;
         client = (struct mgmt_client *)CIM_MALLOC(sizeof(struct mgmt_client));
+        if ( client == NULL ) { return NULL; }
         memset(client, 0, sizeof(struct mgmt_client));
         
         client->free = mgmt_client_free;
@@ -282,7 +282,7 @@
 {
         struct ci_data * data;
         
-        if ( value == NULL ) return NULL;
+        if ( value == NULL ) { return NULL; }
         if ( ( data = (struct ci_data *)
                CIM_MALLOC(sizeof(struct ci_data))) == NULL ) {
                 return NULL;
@@ -325,7 +325,7 @@
                               const char * key, const void * value, int type)
 {
         struct ci_data * data;
-        if ( key == NULL || value == NULL ) return HA_FAIL;   
+        if ( key == NULL || value == NULL ) { return HA_FAIL; }
 
         if ( ! private->withkey ) {
                 cl_log(LOG_INFO, "add: without key, please use add instead");
@@ -354,7 +354,7 @@
                              const void * value, int type)
 {
         struct ci_data * data;
-        if (  value == NULL ) return HA_FAIL;   
+        if (  value == NULL ) { return HA_FAIL;  } 
         
         if ( private->withkey ) {
                 cl_log(LOG_INFO, "add: withkey, please use insert instead");
@@ -373,24 +373,26 @@
 ci_table_private_free(struct ci_table_private * private)
 {
         int i;
-        if ( private == NULL ) return;
+        if ( private == NULL ) { return; }
         if ( private->array == NULL ) {
                 CIM_FREE(private);
                 return;
         }
-
         cl_log(LOG_INFO, "freeing (private: 0x%0x)", (POINTER_t)private);
         for ( i = 0; i < private->array->len; i ++ ) {
                 struct ci_data * data;
                 data = (struct ci_data *) 
                         g_ptr_array_index(private->array, i);
-                if ( data == NULL ) continue;
-                if (data->key) CIM_FREE(data->key);
+                if ( data == NULL ) { continue; }
+                if (data->key) { CIM_FREE(data->key); }
+
                 switch(data->type){
                 case CI_uint32:
                         break;
                 case CI_string:
-                        if (data->value.string)CIM_FREE(data->value.string);
+                        if (data->value.string){ 
+                                CIM_FREE(data->value.string);
+                        }
                         break;
                 case CI_table:
                         if ( data->value.table){
@@ -404,8 +406,9 @@
         if ( private->withkey ) {
                 g_hash_table_destroy(private->map);
         }
-        CIM_FREE(private);
+
         cl_log(LOG_INFO, "(private: 0x%0x) freed", (POINTER_t)private);
+        CIM_FREE(private);
 }
 
 static struct ci_table_private *
@@ -454,7 +457,7 @@
 {
         struct ci_table_private * private;
         
-        if (table == NULL ) return 0;
+        if (table == NULL ) { return 0; }
         if (( private = CITablePrivate(table)) == NULL ) {
                 return 0;
         }
@@ -483,7 +486,10 @@
         }
 
         data =(struct ci_data *)g_hash_table_lookup(private->map, key);
-        if ( data == NULL ) return zero_data;
+        if ( data == NULL ) {
+                return zero_data;
+        }
+
         cl_log(LOG_INFO, "got %s from (private: 0x%0x, map: 0x%0x), type: %d", 
                key, (POINTER_t)private, (POINTER_t)private->map, data->type);
         return * data;
@@ -495,7 +501,7 @@
         struct ci_table_private * private;
         struct ci_data * data;
 
-        if (table == NULL ) return zero_data;
+        if (table == NULL ) { return zero_data; }
         if (( private = CITablePrivate(table)) == NULL ) {
                 return zero_data;
         }
@@ -508,7 +514,7 @@
         }
 
         data = (struct ci_data *)g_ptr_array_index(private->array, index);
-        if ( data == NULL ) return zero_data;
+        if ( data == NULL ) { return zero_data; }
 
         cl_log(LOG_INFO, "got data %d from (private: 0x%0x, array: 0x%0x), 
type: %d", 
                index, (POINTER_t)private, (POINTER_t)private->array, 
data->type);
@@ -530,7 +536,7 @@
 {
         struct ci_table_private * private;
 
-        if ( data == NULL ) return;
+        if ( data == NULL ) { return; }
         private = (struct ci_table_private *) data->private;
         if (private) {
                 private->free(private);
@@ -773,9 +779,9 @@
 
         for( i = 0; i < client->get_size(client); i++ ) {
                char * node = client->get_nth_value(client, i);
-                if ( node == NULL ) continue;
+                if ( node == NULL ) { continue; }
                 node = CIM_STRDUP(node);
-                if ( node == NULL ) continue;
+                if ( node == NULL ) { continue; }
                 g_ptr_array_add(node_table, node);
         };
         
@@ -907,13 +913,13 @@
         
         /* instattr->atrr->nvpairs */
        if ( ( instattr = ci_table_new (TRUE)) == NULL ) {
-                array->free(array);
-               return NULL;
+               CITableFree(array);
+                return NULL;
        }
 
        attr = ci_get_attributes (id);
        if ( attr == NULL ) {
-                attr->free(instattr);
+                CITableFree(instattr);
                return NULL;
        }
 
@@ -931,7 +937,7 @@
         char * type = NULL;
         uint32_t rc = 0;
 
-        if ( id == NULL) return 0;
+        if ( id == NULL) { return 0; }
         
         if ((client = mgmt_client_new()) == NULL ) {
                 return 0;
@@ -989,12 +995,19 @@
         provider = client->get_nth_value(client, 2);
         type = client->get_nth_value(client, 3);
 
+        if ( strcmp(lid, id) != 0 ) {
+                cl_log(LOG_ERR, "get_primitive: id not match: %s vs %s", lid, 
id);
+                ClientFree(client);
+                CITableFree(primitive);
+                return NULL;
+        }
+
         CITableInsert(primitive, "id", id, CI_string);
         CITableInsert(primitive, "class", class, CI_string);
-        CITableInsert(primitive, "provider", class, CI_string);
+        CITableInsert(primitive, "provider", provider, CI_string);
         CITableInsert(primitive, "type", type, CI_string);
 
-        client->free(client);
+        ClientFree(client);
         return primitive;
 }
 
@@ -1170,7 +1183,7 @@
         char * node;
         struct mgmt_client * client;
         
-        if ( id == NULL ) return NULL;
+        if ( id == NULL ) { return NULL; }
         if ( (client = mgmt_client_new()) == NULL ) {
                 return NULL;
         }
@@ -1197,7 +1210,7 @@
         char * status;
         struct mgmt_client * client;
         
-        if ( id == NULL ) return NULL;
+        if ( id == NULL ) { return NULL; }
         if ( (client = mgmt_client_new()) == NULL ) {
                 return NULL;
         }
@@ -1229,7 +1242,7 @@
        char * lid, * from, * type, * to;
         struct mgmt_client * client;
         
-        if ( id == NULL ) return NULL;
+        if ( id == NULL ) { return NULL; }
         if ( (client = mgmt_client_new()) == NULL ) {
                 return NULL;
         }
@@ -1250,6 +1263,13 @@
        type = client->get_nth_value(client, 2);
        to = client->get_nth_value(client, 3);
 
+        if ( strcmp(lid, id) != 0 ) {
+                cl_log(LOG_ERR, "get_order_constraint: id not match: %s vs 
%s", 
+                       lid, id);
+                ClientFree(client);
+                CITableFree(rsc_order);
+        }
+
         CITableInsert(rsc_order, "id", id, CI_string);
         CITableInsert(rsc_order, "from", from, CI_string);
         CITableInsert(rsc_order, "type", type, CI_string);
@@ -1278,7 +1298,7 @@
         struct mgmt_client * client;
         int i;
 
-        if ( id == NULL ) return NULL;
+        if ( id == NULL ) { return NULL; }
         if ( (client = mgmt_client_new()) == NULL ) {
                 return NULL;
         }
@@ -1358,6 +1378,13 @@
        to = client->get_nth_value(client, 2);
        score = client->get_nth_value(client, 3);
 
+        if ( strcmp(lid, id) != 0 ) {
+                cl_log(LOG_ERR, "get_colocation_constraint: id not match: %s 
vs %s",
+                       lid, id);
+                ClientFree(client);
+                CITableFree(rsc_colocation);
+        }
+
         CITableInsert(rsc_colocation, "id", id, CI_string);
         CITableInsert(rsc_colocation, "from", from, CI_string);
         CITableInsert(rsc_colocation, "to", to, CI_string);
@@ -1405,7 +1432,7 @@
 
         for ( i = 0; i < client->get_size(client); i++ ) {
                 char * consid = client->get_nth_value(client, i);
-                if ( consid == NULL ) continue;
+                if ( consid == NULL ) { continue; }
                 if ( (consid = CIM_STRDUP(consid)) == NULL ) {
                         continue;
                 }
@@ -1446,7 +1473,7 @@
 
        for ( i = 0; i < client->get_size(client); i ++ ) {
                char * class = client->get_nth_value(client, i);
-               if ( class == NULL ) continue;
+               if ( class == NULL ) { continue; }
                g_ptr_array_add(classes, CIM_STRDUP(class));
        } 
         client->free(client);
@@ -1460,7 +1487,7 @@
         int i;
         struct mgmt_client * client;
 
-        if ( class == NULL ) return NULL;
+        if ( class == NULL ) { return NULL; }
         if ( (client = mgmt_client_new()) == NULL ) {
                 return NULL;
         }
@@ -1476,7 +1503,7 @@
 
         for ( i = 0; i < client->get_size(client); i++ ) {
                 char * type = client->get_nth_value(client, i);
-                if ( type == NULL ) continue;
+                if ( type == NULL ) { continue; }
                 
                 g_ptr_array_add(types, CIM_STRDUP(type));
         }
@@ -1492,7 +1519,7 @@
         int i;
         struct mgmt_client * client;
 
-        if ( class == NULL || type == NULL ) return NULL;
+        if ( class == NULL || type == NULL ) { return NULL; }
         if ((client = mgmt_client_new()) == NULL ) {
                 return NULL;
         }
@@ -1508,7 +1535,7 @@
 
         for ( i = 0; i < client->get_size(client); i++ ) {
                 char * provider = client->get_nth_value(client, i);
-                if ( provider == NULL ) continue;
+                if ( provider == NULL ) { continue; }
                 g_ptr_array_add(providers, CIM_STRDUP(provider));
         }
 
@@ -1570,10 +1597,9 @@
 
        i = 0;
        while (!feof(fstream)) {
-
                if ( fgets(buffer, 4096, fstream) != NULL ){
                        /** add buffer to std_out **/
-                       *std_out = realloc(*std_out, (i+2) * sizeof(char*));    
+                       *std_out = CIM_REALLOC(*std_out, (i+2) * 
sizeof(char*));        
                         if ( *std_out == NULL ) {
                                 rc = HA_FAIL;
                                 goto exit;
@@ -1584,7 +1610,6 @@
                        continue;
                }
                i++;
-
        }
        
        rc = HA_OK;
@@ -1717,5 +1742,5 @@
 
 void
 ci_safe_free(void * ptr) {
-        if (ptr) CIM_FREE(ptr);
+        if (ptr) { CIM_FREE(ptr); }
 }
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/cluster_node_provider.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- cluster_node_provider.c     21 Dec 2005 14:12:58 -0000      1.1
+++ cluster_node_provider.c     22 Dec 2005 06:11:48 -0000      1.2
@@ -76,8 +76,9 @@
         }       
 
         active_status = CITableGet(nodeinfo, "active_status").value.string;
-        if(active_status) CMSetProperty(ci, "ActiveStatus", active_status, 
CMPI_chars);
-
+        if(active_status) {
+                CMSetProperty(ci, "ActiveStatus", active_status, CMPI_chars);
+        }
         if ( active_status && strcmp (active_status, "True") == 0) {
                 char * standby, * unclean, * shutdown, * expected_up, * 
node_ping;
                 standby = CITableGet(nodeinfo, "standby").value.string;
@@ -86,13 +87,22 @@
                 expected_up = CITableGet(nodeinfo, "expected_up").value.string;
                 node_ping = CITableGet(nodeinfo, "node_ping").value.string;
 
-                if (standby) CMSetProperty(ci, "Standby", standby, CMPI_chars);
-                if (unclean) CMSetProperty(ci, "Unclean", unclean, CMPI_chars);
-                if (shutdown) CMSetProperty(ci, "Shutdown", shutdown, 
CMPI_chars);
-                if (expected_up) CMSetProperty(ci, "ExpectedUp", expected_up, 
CMPI_chars);
-                if (node_ping) CMSetProperty(ci, "NodePing", node_ping, 
CMPI_chars);
+                if (standby) { 
+                        CMSetProperty(ci, "Standby", standby, CMPI_chars);
+                }
+                if (unclean) { 
+                        CMSetProperty(ci, "Unclean", unclean, CMPI_chars);
+                }
+                if (shutdown) { 
+                        CMSetProperty(ci, "Shutdown", shutdown, CMPI_chars);
+                }
+                if (expected_up) { 
+                        CMSetProperty(ci, "ExpectedUp", expected_up, 
CMPI_chars);
+                }
+                if (node_ping) { 
+                        CMSetProperty(ci, "NodePing", node_ping, CMPI_chars);
+                }       
         }
-
         dc = ci_get_cluster_dc();
         uuid = CIM_STRDUP("N/A");
         
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/cluster_provider.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- cluster_provider.c  21 Dec 2005 14:12:58 -0000      1.1
+++ cluster_provider.c  22 Dec 2005 06:11:48 -0000      1.2
@@ -392,15 +392,10 @@
 
         CMPIString* class_name = NULL;
         CMPIStatus rc = {CMPI_RC_OK, NULL};
-        CMPIData arg_data;
         CMPIValue valrc;
-        char param [] = "action";
-
-        init_logger(PROVIDER_ID);
+        
         class_name = CMGetClassName(ref, &rc);
 
-        arg_data = CMGetArg(in, param, &rc);
-
         if(strcasecmp(CMGetCharPtr(class_name), G_classname) == 0 &&
            strcasecmp("RequestStatusChange", method_name) == 0 ){
                 cl_log(LOG_INFO, "%s: NOT IMPLEMENTED", __FUNCTION__);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/colocation_constraint_provider.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- colocation_constraint_provider.c    21 Dec 2005 14:12:59 -0000      1.1
+++ colocation_constraint_provider.c    22 Dec 2005 06:11:48 -0000      1.2
@@ -68,7 +68,6 @@
         } else {
                 return rc;
         }
-        CMReturn(CMPI_RC_OK);
 }
 
 
@@ -86,7 +85,6 @@
         } else {
                 return rc;
         }
-        CMReturn(CMPI_RC_OK);  
 }
 
 static CMPIStatus 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/constraint_common.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- constraint_common.c 21 Dec 2005 14:12:59 -0000      1.1
+++ constraint_common.c 22 Dec 2005 06:11:48 -0000      1.2
@@ -27,7 +27,7 @@
         int i, size;
 
         rule = CITableGet(constraint, "rule").value.table;
-        if ( rule == NULL ) return;
+        if ( rule == NULL ) { return; }
         size = CITableSize(rule);
 
         if (( array = CMNewArray(broker, size, CMPI_chars, rc)) == NULL ){
@@ -39,7 +39,7 @@
                 int str_len;
                 char * tmp;
                 exp = CITableGetAt(rule, i).value.table;
-                if ( exp == NULL ) continue;
+                if ( exp == NULL ) { continue; }
 
                 id = CITableGet(exp, "id").value.string;
                 attribute = CITableGet(exp, "attribute").value.string;
@@ -50,7 +50,7 @@
                         strlen(operation) + strlen(value) +
                         strlen("id") + strlen("attribute") +
                         strlen("operation") + strlen("value") + 8;
-                if ( (tmp = (char *)CIM_MALLOC(str_len)) == NULL ) return;
+                if ( (tmp = (char *)CIM_MALLOC(str_len)) == NULL ) { return; }
 
                 sprintf(tmp, "id=%s,attribute=%s,operation=%s,value=%s",
                         id, attribute, operation, value);
@@ -71,7 +71,7 @@
         char type_colocation [] = "Colocation";
         char type_order [] = "Order";
         char caption[256];
-        if ( constraint == NULL ) return NULL;
+        if ( constraint == NULL ) { return NULL; }
 
         ci = CMNewInstance(broker, op, rc);
         if ( CMIsNullObject(ci) ) {
@@ -82,7 +82,7 @@
         }
         
         id = constraint->get_data(constraint, "id").value.string;
-        if ( id == NULL ) return NULL;
+        if ( id == NULL ) { return NULL; }
 
         /* setting properties */
         CMSetProperty(ci, "Id", id, CMPI_chars);
@@ -100,11 +100,12 @@
                  action = order->get_data(order, "action").value.string;
                  order_type = order->get_data(order, "type").value.string;
 
-                 if(to) CMSetProperty(ci, "To", to, CMPI_chars);
-                 if(from) CMSetProperty(ci, "From", from, CMPI_chars);
-                 if(action) CMSetProperty(ci, "Action", action, CMPI_chars);
-                 if(order_type) CMSetProperty(ci, "OrderType", order_type, 
CMPI_chars);
-
+                 if(to) { CMSetProperty(ci, "To", to, CMPI_chars);            }
+                 if(from) { CMSetProperty(ci, "From", from, CMPI_chars);      }
+                 if(action) { CMSetProperty(ci, "Action", action, CMPI_chars);}
+                 if(order_type) { 
+                        CMSetProperty(ci, "OrderType", order_type, CMPI_chars);
+                 }
                  CMSetProperty(ci, "Type", type_order, CMPI_chars);
         } else if ( type == TID_CONS_LOCATION ) {
                  struct ci_table * location = constraint;
@@ -113,8 +114,10 @@
                  resource = CITableGet(location, "resource").value.string;
                  score = CITableGet(location, "score").value.string;
 
-                 if(resource) CMSetProperty(ci, "Resource", resource, 
CMPI_chars);
-                 if(score) CMSetProperty(ci, "Score", score, CMPI_chars);
+                 if(resource) { 
+                        CMSetProperty(ci, "Resource", resource, CMPI_chars); 
+                 }
+                 if(score) { CMSetProperty(ci, "Score", score, CMPI_chars); }
                  CMSetProperty(ci, "Type", type_location, CMPI_chars);
 
                  /* currently Rules is an array, which should be modeled as a 
class */
@@ -127,9 +130,9 @@
                  from = colocation->get_data(colocation, "from").value.string;
                  score = colocation->get_data(colocation, 
"score").value.string;
 
-                 if(to) CMSetProperty(ci, "To", to, CMPI_chars);
-                 if(from) CMSetProperty(ci, "From", from, CMPI_chars);
-                 if(score) CMSetProperty(ci, "Score", score, CMPI_chars);
+                 if(to) { CMSetProperty(ci, "To", to, CMPI_chars); }
+                 if(from) { CMSetProperty(ci, "From", from, CMPI_chars); }
+                 if(score) { CMSetProperty(ci, "Score", score, CMPI_chars); }
 
                  CMSetProperty(ci, "Type", type_colocation, CMPI_chars);
         }
@@ -148,7 +151,7 @@
                      char * id, uint32_t type, CMPIStatus * rc) 
 {
         struct ci_table * constraint;
-        if ( id == NULL ) return NULL;
+        if ( id == NULL ) { return NULL; }
 
         switch(type) {
         case TID_CONS_LOCATION:
@@ -164,7 +167,7 @@
              return NULL;
         }
 
-        if ( constraint == NULL ) return NULL;
+        if ( constraint == NULL ) { return NULL; }
         return make_cons_inst(broker, classname, op, constraint, type, rc);
 }
 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/inst_attribute_provider.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- inst_attribute_provider.c   21 Dec 2005 14:12:59 -0000      1.1
+++ inst_attribute_provider.c   22 Dec 2005 06:11:48 -0000      1.2
@@ -94,11 +94,10 @@
         cl_log(LOG_INFO, "attrs: ready to iterate, size = %d", 
                attr->get_data_size(attr));
         for ( i = 0; i < attr->get_data_size(attr); i++ ) {
-                char * id, * name, * value;
-                char * tmp;
-
+                char * id, * name, * value, * tmp;
+                int len;
                 nvpair = attr->get_data_at(attr, i).value.table;
-                if ( nvpair == NULL ) continue;
+                if ( nvpair == NULL ) { continue; }
 
                 id = nvpair->get_data(nvpair, "id").value.string;
                 name = nvpair->get_data(nvpair, "name").value.string;
@@ -106,15 +105,13 @@
 
                 cl_log(LOG_INFO, "cmpi attrs: id, name, value = %s, %s, %s",
                        id, name, value);
-                tmp = (char *)CIM_MALLOC( strlen("id") + strlen("name") 
-                                          + strlen("value") + strlen(id) 
-                                          + strlen(name) + strlen(value) 
-                                          + 8);
+                len = strlen("id") + strlen("name") + strlen("value")
+                      + strlen(id) + strlen(name) + strlen(value) + 8;
+                if ((tmp = (char *) CIM_MALLOC(len)) == NULL ) {
+                        continue;
+                }
                 sprintf(tmp, "id=%s,name=%s,value=%s", id, name, value);
                 CMSetArrayElementAt(array, i, &tmp, CMPI_chars);
-                
-                /* FIXME: free tmp will cause OpenWBEM segment fault?! */
-                /* CIM_FREE(tmp); */
         }
         
         sprintf(caption, "Attributes.%s", id);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/location_constraint_provider.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- location_constraint_provider.c      21 Dec 2005 14:12:59 -0000      1.1
+++ location_constraint_provider.c      22 Dec 2005 06:11:48 -0000      1.2
@@ -62,15 +62,14 @@
                               CMPIResult * rslt, CMPIObjectPath * ref)
 {
         CMPIStatus rc;
-        init_logger( PROVIDER_ID );
 
+        init_logger( PROVIDER_ID );
         if ( enum_inst_cons(G_broker, G_classname, ctx, rslt, 
                             ref, 0, TID_CONS_LOCATION, &rc) == HA_OK ) {
                 CMReturn(CMPI_RC_OK);        
         } else {
                 return rc;
         }
-        CMReturn(CMPI_RC_OK);  
 }
 
 
@@ -88,7 +87,6 @@
         } else {
                 return rc;
         }
-        CMReturn(CMPI_RC_OK);  
 }
 
 static CMPIStatus 
@@ -96,15 +94,13 @@
                         CMPIResult * rslt, CMPIObjectPath * cop,
                         char ** properties)
 {
-        CMPIStatus rc;
-        init_logger( PROVIDER_ID );
-
-        if ( get_inst_cons(G_broker, G_classname, ctx, rslt, cop, 
-                           properties, TID_CONS_LOCATION, &rc) != HA_OK ) {
-                return rc;
-        }
+        CMPIStatus rc = {CMPI_RC_OK, NULL};
 
-        CMReturn(CMPI_RC_OK);
+        init_logger( PROVIDER_ID );
+        get_inst_cons(G_broker, G_classname, ctx, rslt, cop, 
+                      properties, TID_CONS_LOCATION, &rc);
+        
+        return rc; 
 }
 
 static CMPIStatus 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/masterslave_resource_provider.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- masterslave_resource_provider.c     21 Dec 2005 14:12:59 -0000      1.1
+++ masterslave_resource_provider.c     22 Dec 2005 06:11:48 -0000      1.2
@@ -62,14 +62,12 @@
 {
         CMPIStatus rc;
         init_logger( PROVIDER_ID );
-
         if ( enum_inst_resource(G_broker, G_classname, ctx, rslt, ref, 0, 
                                 TID_RES_MASTER, &rc) == HA_OK ) {
                 CMReturn(CMPI_RC_OK);        
         } else {
                 return rc;
         }
-        CMReturn(CMPI_RC_OK);  
 }
 
 
@@ -87,7 +85,6 @@
         } else {
                 return rc;
         }
-        CMReturn(CMPI_RC_OK);  
 }
 
 static CMPIStatus 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/operation_on_provider.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- operation_on_provider.c     21 Dec 2005 14:12:59 -0000      1.1
+++ operation_on_provider.c     22 Dec 2005 06:11:48 -0000      1.2
@@ -74,12 +74,12 @@
         if ((s = CMGetKey(source_op, "Id", rc).value.string) == NULL ) {
                 return NULL;
         }
-        if ((rsc_id = CMGetCharPtr(s)) == NULL ) return NULL;
+        if ((rsc_id = CMGetCharPtr(s)) == NULL ) { return NULL; }
         if (( s = CMGetKey(source_op, "CreationClassName", 
                            rc).value.string) == NULL ) {
                 return NULL;
         }
-        if ((rsc_cr_name = CMGetCharPtr(s)) == NULL ) return NULL;
+        if ((rsc_cr_name = CMGetCharPtr(s)) == NULL ) { return NULL; }
 
         if ((operations = ci_get_inst_operations(rsc_id)) == NULL ) {
                 return NULL;
@@ -98,12 +98,12 @@
                 char * operation_id;
                 
                 target_op = CMNewObjectPath(broker, namespace, G_right_class, 
rc);
-                if ( CMIsNullObject(target_op)) continue;
+                if ( CMIsNullObject(target_op)) { continue; }
 
                 operation = operations->get_data_at(operations, i).value.table;
-                if ( operation == NULL )  continue;
+                if ( operation == NULL )  { continue; }
                 operation_id = operation->get_data(operation, 
"id").value.string;
-                if (operation_id == NULL ) continue;
+                if (operation_id == NULL ) { continue; }
 
                 CMAddKey(target_op, "Id", operation_id, CMPI_chars);
                 CMAddKey(target_op, "SystemName", rsc_id, CMPI_chars);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/operation_provider.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- operation_provider.c        21 Dec 2005 14:12:59 -0000      1.1
+++ operation_provider.c        22 Dec 2005 06:11:48 -0000      1.2
@@ -78,9 +78,9 @@
         interval = CITableGet(operation, "interval").value.string;
         timeout = CITableGet(operation, "timeout").value.string;
 
-        if (interval) CMSetProperty(ci, "Interval", interval, CMPI_chars);
-        if (timeout)  CMSetProperty(ci, "Timeout", timeout, CMPI_chars);
-        if (name)     CMSetProperty(ci, "Name", name, CMPI_chars);
+        if (interval) { CMSetProperty(ci, "Interval", interval, CMPI_chars); }
+        if (timeout)  { CMSetProperty(ci, "Timeout", timeout, CMPI_chars);   }
+        if (name)     { CMSetProperty(ci, "Name", name, CMPI_chars);         }
         
         sprintf(caption, "Operation.%s", id);
         CMSetProperty(ci, "Id", id, CMPI_chars);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/order_constraint_provider.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- order_constraint_provider.c 21 Dec 2005 14:12:59 -0000      1.1
+++ order_constraint_provider.c 22 Dec 2005 06:11:48 -0000      1.2
@@ -66,10 +66,8 @@
         if ( enum_inst_cons(G_broker, G_classname, ctx, rslt, ref, 0, 
                             TID_CONS_ORDER, &rc) == HA_OK ) {
                 CMReturn(CMPI_RC_OK);        
-        } else {
-                return rc;
         }
-        CMReturn(CMPI_RC_OK);  
+        return rc;
 }
 
 
@@ -84,10 +82,9 @@
         if ( enum_inst_cons(G_broker, G_classname, ctx, rslt, ref, 1, 
                             TID_CONS_ORDER, &rc) == HA_OK ) {
                 CMReturn(CMPI_RC_OK);        
-        } else {
-                return rc;
-        }
-        CMReturn(CMPI_RC_OK);
+        } 
+
+        return rc;
 }
 
 static CMPIStatus 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/resource_clone_provider.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- resource_clone_provider.c   21 Dec 2005 14:12:59 -0000      1.1
+++ resource_clone_provider.c   22 Dec 2005 06:11:48 -0000      1.2
@@ -88,8 +88,6 @@
         } else {
                 CMReturn(CMPI_RC_ERR_FAILED);
         }
-        CMReturn(CMPI_RC_OK);  
-
 }
 
 static CMPIStatus 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/resource_common.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- resource_common.c   21 Dec 2005 14:12:59 -0000      1.1
+++ resource_common.c   22 Dec 2005 06:11:48 -0000      1.2
@@ -65,6 +65,10 @@
         notify = clone->get_data(clone, "notify").value.string;
         ordered = clone->get_data(clone, "ordered").value.string;
         interleave = clone->get_data(clone, "interleave").value.string;
+        if (notify) { CMSetProperty(ci, "Notify", notify, CMPI_chars); }
+        if (ordered) { CMSetProperty(ci, "Ordered", ordered, CMPI_chars); }
+        if (interleave) { CMSetProperty(ci, "Interleave", interleave, 
CMPI_chars); }
+
 }
 
 static void 
@@ -88,7 +92,7 @@
         char * id , * status;
         char caption [256];
 
-        if ( info == NULL ) return NULL;
+        if ( info == NULL ) { return NULL; }
         ci = CMNewInstance(broker, op, rc);
         if ( CMIsNullObject(ci) ) {
                 cl_log(LOG_ERR, "%s: can't create instance", __FUNCTION__);
@@ -140,7 +144,7 @@
         char * namespace, * classname;
         CMPIObjectPath * op;
 
-        if ( rsc_name == NULL ) return NULL;
+        if ( rsc_name == NULL ) { return NULL; }
         namespace = CMGetCharPtr(CMGetNameSpace(ref, rc));
 
         cl_log(LOG_INFO, "%s: make instance for %s", __FUNCTION__, rsc_name);
@@ -165,7 +169,7 @@
              return NULL;
         }
 
-        if ( info == NULL ) return NULL;
+        if ( info == NULL ) { return NULL; }
 
         op = CMNewObjectPath(broker, namespace, classname, rc);
         if ( CMIsNullObject(op) ) {
@@ -186,7 +190,7 @@
         char * namespace, * classname;
         CMPIObjectPath * op;
 
-        if ( rsc_name == NULL ) return NULL;
+        if ( rsc_name == NULL )  { return NULL; }
         namespace = CMGetCharPtr(CMGetNameSpace(ref, rc));
 
         switch(type) {
@@ -277,7 +281,7 @@
         for ( i = 0; i < CITableSize(table); i++) {
                 char * rsc_id;
                 rsc_id = CITableGetAt(table, i).value.string;
-                if ( rsc_id == NULL ) continue;
+                if ( rsc_id == NULL ) { continue; }
                 /* if type == 0, enum all resources */
                 this_type =  ci_get_resource_type(rsc_id);
                 if ( type != 0 && type != this_type) {
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/simple_demo.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- simple_demo.c       21 Dec 2005 14:12:59 -0000      1.6
+++ simple_demo.c       22 Dec 2005 06:11:48 -0000      1.7
@@ -39,7 +39,10 @@
         int i;
         char * result;
 
-        if ( argc < 2 ) return 0;
+        if ( argc < 2 ) {
+                return 0;
+        }
+
         ci_lib_initialize();
         if ( (msg = mgmt_new_msg(argv[1], NULL)) == NULL ) {
                 return 0;
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/sub_resource_provider.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- sub_resource_provider.c     21 Dec 2005 14:12:59 -0000      1.1
+++ sub_resource_provider.c     22 Dec 2005 06:11:48 -0000      1.2
@@ -133,9 +133,9 @@
                 char * sub_id;
                 
                 sub_id = (char *) g_ptr_array_index(sub_name_tbl, i);
-                if ( sub_id == NULL ) continue;
-                if ( CMIsNullObject(target_op) ) continue;
-
+                if ( sub_id == NULL ) {
+                        continue;
+                }
                 rsc_type = ci_get_resource_type(sub_id);
                 if (rsc_type == TID_RES_PRIMITIVE ) {
                         cr_name = cr_name_primitive;
@@ -145,10 +145,15 @@
                         cr_name = cr_name_clone;
                 } else if ( rsc_type == TID_RES_MASTER ) {
                         cr_name = cr_name_master;
-                } else cr_name = cr_name_unknown;
-
+                } else {
+                        cr_name = cr_name_unknown;
+                }
+               
                 /* create object path */
                 target_op = CMNewObjectPath(broker, namespace, cr_name, rc);
+                if ( CMIsNullObject(target_op) ) {
+                        continue;
+                }
                 /* set keys */
                 CMAddKey(target_op, "Id", sub_id, CMPI_chars);
                 CMAddKey(target_op, "SystemName", sys_name, CMPI_chars);
@@ -243,8 +248,9 @@
         for ( i = 0; i < sub_name_tbl->len; i++ ) {
                 char * sub_rsc_id;
                 sub_rsc_id = (char *)  g_ptr_array_index(sub_name_tbl, i);
-                if ( rsc_id == NULL ) continue;
-
+                if ( rsc_id == NULL ) {
+                        continue;
+                }
                 if ( strcmp(sub_rsc_id, rsc_id ) == 0 ) {
                         /* found */
                         return 1;




------------------------------

_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs


End of Linux-ha-cvs Digest, Vol 25, Issue 60
********************************************

Reply via email to