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: cim by panjiam from
([email protected])
2. Linux-HA CVS: cim by panjiam from
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Mon, 10 Apr 2006 04:25:55 -0600 (MDT)
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:
order_constraint_provider.c location_constraint_provider.c
colocation_constraint_provider.c
Log Message:
updated callee's names
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/order_constraint_provider.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- order_constraint_provider.c 20 Mar 2006 03:12:39 -0000 1.3
+++ order_constraint_provider.c 10 Apr 2006 10:25:55 -0000 1.4
@@ -46,7 +46,6 @@
static CMPIStatus
OrderConstraintCleanup(CMPIInstanceMI * mi, CMPIContext * ctx)
{
-
CMReturn(CMPI_RC_OK);
}
@@ -55,10 +54,9 @@
CMPIResult * rslt, CMPIObjectPath * ref)
{
CMPIStatus rc;
- int ret;
PROVIDER_INIT_LOGGER();
- ret = enumerate_constraint(Broker, ClassName, ctx, rslt, ref,
+ constraint_enum_insts(Broker, ClassName, ctx, rslt, ref,
FALSE, TID_CONS_ORDER, &rc);
return rc;
}
@@ -70,10 +68,9 @@
char ** properties)
{
CMPIStatus rc;
- int ret;
PROVIDER_INIT_LOGGER();
- ret = enumerate_constraint(Broker, ClassName, ctx, rslt, ref,
+ constraint_enum_insts(Broker, ClassName, ctx, rslt, ref,
TRUE, TID_CONS_ORDER, &rc);
return rc;
}
@@ -84,10 +81,9 @@
char ** properties)
{
CMPIStatus rc;
- int ret;
PROVIDER_INIT_LOGGER();
- ret = get_constraint(Broker, ClassName, ctx, rslt, cop,
+ constraing_get_inst(Broker, ClassName, ctx, rslt, cop,
properties, TID_CONS_ORDER, &rc);
return rc;
}
@@ -98,10 +94,9 @@
CMPIInstance * ci)
{
CMPIStatus rc = {CMPI_RC_OK, NULL};
- int ret;
PROVIDER_INIT_LOGGER();
- ret = create_constraint(Broker, ClassName, mi, ctx, rslt,
+ constraint_create_inst(Broker, ClassName, mi, ctx, rslt,
cop, ci, TID_CONS_ORDER, &rc);
return rc;
}
@@ -113,10 +108,9 @@
CMPIInstance * ci, char ** properties)
{
CMPIStatus rc = {CMPI_RC_OK, NULL};
- int ret;
PROVIDER_INIT_LOGGER();
- ret = update_constraint(Broker, ClassName, mi, ctx, rslt,
+ constraint_update_inst(Broker, ClassName, mi, ctx, rslt,
cop, ci, properties, TID_CONS_ORDER, &rc);
return rc;
}
@@ -127,8 +121,7 @@
CMPIResult * rslt, CMPIObjectPath * cop)
{
CMPIStatus rc = {CMPI_RC_OK, NULL};
- int ret;
- ret = delete_constraint(Broker, ClassName, mi, ctx,
+ constraint_delete_inst(Broker, ClassName, mi, ctx,
rslt, cop, TID_CONS_ORDER, &rc);
return rc;
}
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/location_constraint_provider.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- location_constraint_provider.c 20 Mar 2006 03:12:39 -0000 1.3
+++ location_constraint_provider.c 10 Apr 2006 10:25:55 -0000 1.4
@@ -59,7 +59,7 @@
{
CMPIStatus rc;
PROVIDER_INIT_LOGGER();
- enumerate_constraint(Broker, ClassName, ctx, rslt,
+ constraint_enum_insts(Broker, ClassName, ctx, rslt,
ref, FALSE, TID_CONS_LOCATION, &rc);
return rc;
}
@@ -72,7 +72,7 @@
{
CMPIStatus rc;
PROVIDER_INIT_LOGGER();
- enumerate_constraint(Broker, ClassName, ctx, rslt,
+ constraint_enum_insts(Broker, ClassName, ctx, rslt,
ref, TRUE, TID_CONS_LOCATION, &rc);
return rc;
}
@@ -84,7 +84,7 @@
{
CMPIStatus rc = {CMPI_RC_OK, NULL};
PROVIDER_INIT_LOGGER();
- get_constraint(Broker, ClassName, ctx, rslt, cop,
+ constraing_get_inst(Broker, ClassName, ctx, rslt, cop,
properties, TID_CONS_LOCATION, &rc);
return rc;
@@ -96,10 +96,9 @@
CMPIInstance * ci)
{
CMPIStatus rc = {CMPI_RC_OK, NULL};
- int ret;
PROVIDER_INIT_LOGGER();
- ret = create_constraint(Broker, ClassName, mi, ctx, rslt,
+ constraint_create_inst(Broker, ClassName, mi, ctx, rslt,
cop, ci, TID_CONS_LOCATION, &rc);
return rc;
}
@@ -114,7 +113,7 @@
int ret;
PROVIDER_INIT_LOGGER();
- ret = update_constraint(Broker, ClassName, mi, ctx, rslt,
+ ret = constraint_update_inst(Broker, ClassName, mi, ctx, rslt,
cop, ci, properties, TID_CONS_LOCATION, &rc);
return rc;
}
@@ -126,7 +125,7 @@
{
CMPIStatus rc = {CMPI_RC_OK, NULL};
int ret;
- ret = delete_constraint(Broker, ClassName, mi, ctx,
+ ret = constraint_delete_inst(Broker, ClassName, mi, ctx,
rslt, cop, TID_CONS_LOCATION, &rc);
return rc;
}
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/colocation_constraint_provider.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- colocation_constraint_provider.c 20 Mar 2006 03:12:39 -0000 1.3
+++ colocation_constraint_provider.c 10 Apr 2006 10:25:55 -0000 1.4
@@ -62,7 +62,7 @@
CMPIStatus rc;
int ret;
PROVIDER_INIT_LOGGER();
- ret = enumerate_constraint(Broker, ClassName, ctx, rslt, ref,
+ ret = constraint_enum_insts(Broker, ClassName, ctx, rslt, ref,
FALSE, TID_CONS_COLOCATION, &rc);
return rc;
}
@@ -76,7 +76,7 @@
CMPIStatus rc;
int ret;
PROVIDER_INIT_LOGGER();
- ret = enumerate_constraint(Broker, ClassName, ctx, rslt, ref,
+ ret = constraint_enum_insts(Broker, ClassName, ctx, rslt, ref,
TRUE, TID_CONS_COLOCATION, &rc);
return rc;
}
@@ -90,7 +90,7 @@
int ret;
PROVIDER_INIT_LOGGER();
- ret = get_constraint(Broker, ClassName, ctx, rslt, cop,
+ ret = constraing_get_inst(Broker, ClassName, ctx, rslt, cop,
properties, TID_CONS_COLOCATION, &rc);
return rc;
}
@@ -104,7 +104,7 @@
int ret;
PROVIDER_INIT_LOGGER();
- ret = create_constraint(Broker, ClassName, mi, ctx, rslt,
+ ret = constraint_create_inst(Broker, ClassName, mi, ctx, rslt,
cop, ci, TID_CONS_COLOCATION, &rc);
return rc;
}
@@ -119,7 +119,7 @@
int ret;
PROVIDER_INIT_LOGGER();
- ret = update_constraint(Broker, ClassName, mi, ctx, rslt,
+ ret = constraint_update_inst(Broker, ClassName, mi, ctx, rslt,
cop, ci, properties, TID_CONS_COLOCATION, &rc);
return rc;
}
@@ -131,7 +131,7 @@
{
CMPIStatus rc = {CMPI_RC_OK, NULL};
int ret;
- ret = delete_constraint(Broker, ClassName, mi, ctx,
+ ret = constraint_delete_inst(Broker, ClassName, mi, ctx,
rslt, cop, TID_CONS_COLOCATION, &rc);
return rc;
}
------------------------------
Message: 2
Date: Mon, 10 Apr 2006 04:27:16 -0600 (MDT)
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:
utils.h utils.c
Log Message:
added some utilities
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/utils.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- utils.h 22 Mar 2006 08:58:04 -0000 1.3
+++ utils.h 10 Apr 2006 10:27:16 -0000 1.4
@@ -1,3 +1,26 @@
+/*
+ * utils.h: utilities header
+ *
+ * Author: Jia Ming Pan <[EMAIL PROTECTED]>
+ * Copyright (c) 2005 International Business Machines
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
#ifndef _UTILS_H
#define _UTILS_H
#include <portability.h>
@@ -35,16 +58,20 @@
#endif
#endif
-extern int debug_class;
-#define cim_debug(c,priority,fmt...) \
+extern int debug_level;
+#define cim_debug2(prio, fmt...) \
do { \
- if(debug_class&c){ \
- cl_log(priority, ##fmt);\
+ if(debug_level > 2){ \
+ cl_log(prio, ##fmt); \
} \
- }while(0);
-#define cim_debug_set(c) debug_class = debug_class | c
-#define cim_debug_clean(c) debug_class = debug_class &(~c)
+ }while(0)
+
#define PROVIDER_INIT_LOGGER() cim_init_logger(PROVIDER_ID)
+#define cim_debug_msg(msg, fmt...) \
+ do { \
+ cl_log(LOG_INFO, ##fmt); \
+ cl_log(LOG_INFO, "%s", msg2string(msg));\
+ }while (0)
/* container */
enum ContainerType { T_ARRAY, T_TABLE };
@@ -120,13 +147,7 @@
t; \
})
-static void
-cim_table_free(void * table)
-{
- CIMTable * t = (CIMTable *)table;
- g_hash_table_destroy(t->table);
- cim_free(t);
-}
+
#define cim_table_lookup(t,k) ((cimdata_t*)g_hash_table_lookup(t->table,k))
#define cim_table_lookup_v(t,k) ({
\
@@ -159,72 +180,18 @@
#define cim_array_len(a) ((a && a->array)?a->array->len:0)
-static void cim_array_free(void*);
-static void cimdata_free(void * data);
-
-static void
-cim_array_free(void * array)
-{
- int i;
- CIMArray * a = (CIMArray*)array;
- for (i=0; i<a->array->len; i++){
- cimdata_t * d = cim_array_index(a,i);
- cimdata_free(d);
- }
- g_ptr_array_free(a->array, FALSE);
- cim_free(array);
-}
-
-
-static void
-cimdata_free(void * data)
-{
- cimdata_t * d = (cimdata_t *)data;
- if ( d == NULL ) {
- return ;
- }
-
- switch(d->type){
- case TYPEString: cim_free(d->v.str); break;
- case TYPETable: cim_table_free(d->v.table); break;
- case TYPEArray: cim_array_free(d->v.array); break;
- default:
- cl_log(LOG_WARNING, "cimdata_free: unknown data type");
- break;
- }
- cim_free(d);
-}
-
-#define cim_table_strdup_replace(t,k,v) ({ \
- char * key = NULL; \
- cimdata_t * data; \
- int ret; \
- if ((key = cim_strdup(k)) == NULL ) { \
- ret = HA_FAIL; \
- } else { \
- if ((data = makeStrData(v)) == NULL){ \
- cim_free(key); \
- ret = HA_FAIL; \
- } else { \
- cl_log(LOG_INFO, "[%s] <- %s", key, v); \
- cim_table_replace(t, key, data); \
- ret = HA_OK; \
- } \
- } \
- ret; \
-})
-
-
-void dump_cim_table(CIMTable *table, const char *id);
-int cim_init_logger(const char* entity);
-void cim_assert(const char* assertion, int line, const char* file);
-int run_shell_cmnd(const char* cmnd,int* ret,char*** out,char***);
-char ** regex_search(const char * reg, const char * str, int *
len);
-void free_2d_array(void *array, int len, cim_free_t free);
-void free_2d_zarray(void *zarray, cim_free_t free);
-char * uuid_to_str(const cl_uuid_t * uuid);
-char ** split_string(const char *string, int *len, const char
*delim);
-
-
+void cim_table_free(void * table);
+void cim_array_free(void*);
+void cimdata_free(void * data);
+int cim_table_strdup_replace(CIMTable*table, const char*key, const
char*val);
+void dump_cim_table(CIMTable *table, const char *id);
+int cim_init_logger(const char* entity);
+void cim_assert(const char* assertion, int line, const char* file);
+int run_shell_cmnd(const char* cmnd,int* ret,char*** out,char***);
+char** regex_search(const char * reg, const char * str, int * len);
+void free_2d_array(void *array, int len, cim_free_t free);
+void free_2d_zarray(void *zarray, cim_free_t free);
+char* uuid_to_str(const cl_uuid_t * uuid);
+char** split_string(const char *string, int *len, const char *delim);
#endif
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/utils.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- utils.c 22 Mar 2006 08:58:04 -0000 1.4
+++ utils.c 10 Apr 2006 10:27:16 -0000 1.5
@@ -1,3 +1,25 @@
+/*
+ * utils.c: utilities
+ *
+ * Author: Jia Ming Pan <[EMAIL PROTECTED]>
+ * Copyright (c) 2005 International Business Machines
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
#include <portability.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -16,7 +38,7 @@
#include "cluster_info.h"
#include "utils.h"
-int debug_class = 0;
+int debug_level = 10;
int
cim_init_logger(const char * entity)
@@ -129,9 +151,10 @@
*len = nmatch;
for(i = 0; i < maxmatch && i < nmatch; i++){
int str_len = pm[i].rm_eo - pm[i].rm_so;
- match[i] = cim_malloc(str_len + 1);
- strncpy( match[i], str + pm[i].rm_so, str_len);
- match[i][str_len] = EOS;
+ if ((match[i] = cim_malloc(str_len + 1))) {
+ strncpy( match[i], str + pm[i].rm_so, str_len);
+ match[i][str_len] = EOS;
+ }
}
regfree(®exp);
DEBUG_LEAVE();
@@ -259,3 +282,66 @@
return strings;
}
+int
+cim_table_strdup_replace(CIMTable *table, const char *key,const char* val)
+{
+ char * dupkey = NULL;
+ cimdata_t * data;
+ if ((dupkey = cim_strdup(key)) == NULL ) {
+ cl_log(LOG_ERR, "cim_table:can't duplicate key.");
+ return HA_FAIL;
+ }
+ if ((data = makeStrData(val)) == NULL){
+ cl_log(LOG_ERR, "cim_table:can't make data.");
+ cim_free(dupkey);
+ return HA_FAIL;
+ }
+
+ cl_log(LOG_INFO, "[%s] <- %s", dupkey, val);
+ cim_table_replace(table, dupkey, data);
+ return HA_OK;
+}
+
+
+void
+cimdata_free(void * data)
+{
+ cimdata_t * d = (cimdata_t *)data;
+ if ( d == NULL ) {
+ return ;
+ }
+
+ switch(d->type){
+ case TYPEString: cim_free(d->v.str); break;
+ case TYPETable: cim_table_free(d->v.table); break;
+ case TYPEArray: cim_array_free(d->v.array); break;
+ default:
+ cl_log(LOG_WARNING, "cimdata_free: unknown data type");
+ break;
+ }
+ cim_free(d);
+}
+
+void
+cim_array_free(void * array)
+{
+ int i;
+ CIMArray * a = (CIMArray*)array;
+ for (i=0; i<a->array->len; i++){
+ cimdata_t * d = cim_array_index(a,i);
+ cimdata_free(d);
+ }
+ g_ptr_array_free(a->array, FALSE);
+ cim_free(array);
+}
+
+void
+cim_table_free(void * table)
+{
+ CIMTable * t = (CIMTable *)table;
+ g_hash_table_destroy(t->table);
+ cim_free(t);
+}
+
+
+
------------------------------
_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
End of Linux-ha-cvs Digest, Vol 29, Issue 62
********************************************