[PATCH] Fix missing braces in HD
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1204315089 28800
# Node ID 9ca3b9b245f8af8f960a4d1e3557adf536daabee
# Parent b2f223ca9105b8f416ab768a1363df910d6815d4
Fix missing braces in HD.
Some missing braces cause host_to_vs() to exit before enumerating the instances.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r b2f223ca9105 -r 9ca3b9b245f8 src/Virt_HostedDependency.c
--- a/src/Virt_HostedDependency.c Fri Feb 29 13:04:15 2008 +0100
+++ b/src/Virt_HostedDependency.c Fri Feb 29 11:58:09 2008 -0800
@@ -75,11 +75,12 @@ static CMPIStatus host_to_vs(const CMPIO
goto out;
conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
- if (conn == NULL)
+ if (conn == NULL) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_NOT_FOUND,
"No such instance");
goto out;
+ }
ret = enum_domains(_BROKER, conn, NAMESPACE(ref), list);
if (!ret)
16 years, 9 months
[PATCH] Fix const usage for F9 compile
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1204317078 28800
# Node ID 55cdc06dc576fe5418292622daf15acd9b7c3dc8
# Parent 282e58e792ba318b63329420d3918b02e9af7dd5
Fix const usage for F9 compile
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 282e58e792ba -r 55cdc06dc576 instance_util.c
--- a/instance_util.c Fri Feb 29 11:28:16 2008 -0800
+++ b/instance_util.c Fri Feb 29 12:31:18 2008 -0800
@@ -255,7 +255,7 @@ CMPIInstance *cu_dup_instance(const CMPI
const char *cu_classname_from_inst(CMPIInstance *inst)
{
- char *ret = NULL;
+ const char *ret = NULL;
CMPIObjectPath *ref;
ref = CMGetObjectPath(inst, NULL);
diff -r 282e58e792ba -r 55cdc06dc576 std_indication.c
--- a/std_indication.c Fri Feb 29 11:28:16 2008 -0800
+++ b/std_indication.c Fri Feb 29 12:31:18 2008 -0800
@@ -183,7 +183,7 @@ CMPIStatus stdi_deliver(const CMPIBroker
}
CMPIStatus stdi_set_ind_filter_state(struct std_indication_ctx *ctx,
- char *ind_name,
+ const char *ind_name,
bool state)
{
CMPIStatus s = {CMPI_RC_OK, NULL};
@@ -212,7 +212,7 @@ CMPIStatus stdi_activate_filter(CMPIIndi
{
CMPIStatus s = {CMPI_RC_OK, NULL};
struct std_indication_ctx *_ctx;
- char *cn = NULL;
+ const char *cn = NULL;
_ctx = (struct std_indication_ctx *)mi->hdl;
cn = CLASSNAME(op);
@@ -237,7 +237,7 @@ CMPIStatus stdi_deactivate_filter(CMPIIn
{
CMPIStatus s = {CMPI_RC_OK, NULL};
struct std_indication_ctx *_ctx;
- char *cn = NULL;
+ const char *cn = NULL;
_ctx = (struct std_indication_ctx *)mi->hdl;
cn = CLASSNAME(op);
diff -r 282e58e792ba -r 55cdc06dc576 std_indication.h
--- a/std_indication.h Fri Feb 29 11:28:16 2008 -0800
+++ b/std_indication.h Fri Feb 29 12:31:18 2008 -0800
@@ -144,7 +144,7 @@ CMPIStatus stdi_cleanup(CMPIMethodMI *se
CMPIBoolean terminating);
CMPIStatus stdi_set_ind_filter_state(struct std_indication_ctx *ctx,
- char *ind_name,
+ const char *ind_name,
bool state);
/* This doesn't work, but should be made to. */
16 years, 9 months
[PATCH] [CU] Add set_int_property() function to EO parse
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1204130653 28800
# Node ID 64e51763141e107bc89710897ea9dc9c2fc08dbc
# Parent e5931f33c94eb4895a359538b53cd1a1d075bb53
[CU] Add set_int_property() function to EO parse.
This function attempts to find the appropriate property value type and then sets that property value.
This change is needed to properly parse non 64 bit integer. If the property is a uint16 value, and CMPI_uint64 is passed CMSetProperty(), the call will fail.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r e5931f33c94e -r 64e51763141e eo_parser.c
--- a/eo_parser.c Thu Feb 21 07:44:01 2008 -0800
+++ b/eo_parser.c Wed Feb 27 08:44:13 2008 -0800
@@ -107,6 +107,62 @@ int cu_parse_embedded_instance(const cha
}
}
+static int _set_int_prop(CMPISint64 value,
+ char *prop,
+ CMPIType type,
+ CMPIInstance *inst)
+{
+ CMPIStatus s;
+ uint64_t unsigned_val = 0;
+ int64_t signed_val = 0;
+
+ switch(type) {
+ case CMPI_uint64:
+ case CMPI_uint32:
+ case CMPI_uint16:
+ case CMPI_uint8:
+ unsigned_val = value;
+ s = CMSetProperty(inst, prop, &(unsigned_val), type);
+ break;
+ case CMPI_sint64:
+ case CMPI_sint32:
+ case CMPI_sint16:
+ case CMPI_sint8:
+ default:
+ signed_val = value;
+ s = CMSetProperty(inst, prop, &(signed_val), type);
+ }
+
+ if (s.rc == CMPI_RC_OK)
+ return 1;
+
+ return 0;
+}
+
+CMPIType set_int_prop(CMPISint64 value,
+ char *prop,
+ CMPIInstance *inst)
+{
+ if (_set_int_prop(value, prop, CMPI_uint64, inst) == 1)
+ return CMPI_uint64;
+ else if (_set_int_prop(value, prop, CMPI_uint32, inst) == 1)
+ return CMPI_uint32;
+ else if (_set_int_prop(value, prop, CMPI_uint16, inst) == 1)
+ return CMPI_uint16;
+ else if (_set_int_prop(value, prop, CMPI_uint8, inst) == 1)
+ return CMPI_uint8;
+ else if (_set_int_prop(value, prop, CMPI_sint64, inst) == 1)
+ return CMPI_sint64;
+ else if (_set_int_prop(value, prop, CMPI_sint32, inst) == 1)
+ return CMPI_sint32;
+ else if (_set_int_prop(value, prop, CMPI_sint16, inst) == 1)
+ return CMPI_sint16;
+ else
+ _set_int_prop(value, prop, CMPI_sint8, inst);
+
+ return CMPI_sint8;
+}
+
/*
* Local Variables:
* mode: C
diff -r e5931f33c94e -r 64e51763141e eo_parser_xml.h
--- a/eo_parser_xml.h Thu Feb 21 07:44:01 2008 -0800
+++ b/eo_parser_xml.h Wed Feb 27 08:44:13 2008 -0800
@@ -27,6 +27,10 @@ int cu_parse_ei_xml(const CMPIBroker *br
const char *xml,
CMPIInstance **instance);
+CMPIType set_int_prop(CMPISint64 value,
+ char *prop,
+ CMPIInstance *inst);
+
#endif
/*
diff -r e5931f33c94e -r 64e51763141e eo_util_parser.y
--- a/eo_util_parser.y Thu Feb 21 07:44:01 2008 -0800
+++ b/eo_util_parser.y Wed Feb 27 08:44:13 2008 -0800
@@ -10,9 +10,12 @@
%{
#include <stdlib.h>
#include <stdio.h>
+#include <stdint.h>
#include "cmpidt.h"
#include "cmpift.h"
+
+#include "eo_parser_xml.h"
/* specify prototypes to get rid of warnings */
int eo_parse_lex (void);
@@ -103,12 +106,12 @@ property: PROPERTYNAME '=' STRING ';'
| PROPERTYNAME '=' INTEGER ';'
{
- EOTRACE("propertyname = %s"
- "\ttype = CMPI_sint64\n"
- "\tvalue = %lld\n",
- $1, $3);
- unsigned long long value = $3;
- CMSetProperty(*_INSTANCE, $1, &(value), CMPI_uint64);
+ EOTRACE("propertyname = %s\n", $1);
+ int rc;
+ //uint64_t value = $3;
+ CMPIType t = set_int_prop($3, $1, *_INSTANCE);
+ EOTRACE("\ttype = %d\n"
+ "\tvalue = %lld\n", t, $3);
free($1);
}
16 years, 10 months
[PATCH] [CU] Fix const pointer warning
by lizg@cn.ibm.com
# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1204076903 -28800
# Node ID 8ef92e008bcbcf2336cbccfa083c2d22f690ca1d
# Parent b2606bc023a8a26ecd25464e976fb16606ed3a47
[CU] Fix const pointer warning
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r b2606bc023a8 -r 8ef92e008bcb instance_util.c
--- a/instance_util.c Tue Feb 26 15:16:00 2008 -0500
+++ b/instance_util.c Wed Feb 27 09:48:23 2008 +0800
@@ -255,7 +255,7 @@ CMPIInstance *cu_dup_instance(const CMPI
const char *cu_classname_from_inst(CMPIInstance *inst)
{
- char *ret = NULL;
+ const char *ret = NULL;
CMPIObjectPath *ref;
ref = CMGetObjectPath(inst, NULL);
diff -r b2606bc023a8 -r 8ef92e008bcb std_indication.c
--- a/std_indication.c Tue Feb 26 15:16:00 2008 -0500
+++ b/std_indication.c Wed Feb 27 09:48:23 2008 +0800
@@ -214,7 +214,7 @@ CMPIStatus stdi_activate_filter(CMPIIndi
char *cn = NULL;
_ctx = (struct std_indication_ctx *)mi->hdl;
- cn = CLASSNAME(op);
+ cn = (char *)CLASSNAME(op);
s = stdi_set_ind_filter_state(_ctx, cn, true);
if (_ctx->handler != NULL && _ctx->handler->activate_fn != NULL) {
@@ -239,7 +239,7 @@ CMPIStatus stdi_deactivate_filter(CMPIIn
char *cn = NULL;
_ctx = (struct std_indication_ctx *)mi->hdl;
- cn = CLASSNAME(op);
+ cn = (char *)CLASSNAME(op);
s = stdi_set_ind_filter_state(_ctx, cn, false);
if (_ctx->handler != NULL && _ctx->handler->deactivate_fn != NULL) {
16 years, 10 months
[PATCH] [CU] Add set_int_property() function to EO parse
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1204235749 28800
# Node ID e5e14ae1282c26c3ba16976bd239c36714162700
# Parent b07d295f167fe3d66377047b3f8e5c00ea6955be
[CU] Add set_int_property() function to EO parse.
Updates from set 1 to set 2:
-Cast value in _set_int_prop()
-Add (CMPIValue *) before unsigned_val/signed_val in CMSetProperty() call
-Remove comment and fix whitespace issues in eo_util_parser.y
This function attempts to find the appropriate property value type and then sets that property value.
This change is needed to properly parse non 64 bit integer. If the property is a uint16 value, and CMPI_uint64 is passed CMSetProperty(), the call will fail.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r b07d295f167f -r e5e14ae1282c eo_parser.c
--- a/eo_parser.c Wed Feb 27 10:39:55 2008 -0500
+++ b/eo_parser.c Thu Feb 28 13:55:49 2008 -0800
@@ -107,6 +107,68 @@ int cu_parse_embedded_instance(const cha
}
}
+static int _set_int_prop(CMPISint64 value,
+ char *prop,
+ CMPIType type,
+ CMPIInstance *inst)
+{
+ CMPIStatus s;
+ uint64_t unsigned_val = 0;
+ int64_t signed_val = 0;
+
+ switch(type) {
+ case CMPI_uint64:
+ case CMPI_uint32:
+ case CMPI_uint16:
+ case CMPI_uint8:
+ unsigned_val = (uint64_t) value;
+ s = CMSetProperty(inst,
+ prop,
+ (CMPIValue *) &(unsigned_val),
+ type);
+ break;
+ case CMPI_sint64:
+ case CMPI_sint32:
+ case CMPI_sint16:
+ case CMPI_sint8:
+ default:
+ signed_val = (int64_t) value;
+ s = CMSetProperty(inst,
+ prop,
+ (CMPIValue *) &(signed_val),
+ type);
+ }
+
+ if (s.rc == CMPI_RC_OK)
+ return 1;
+
+ return 0;
+}
+
+CMPIType set_int_prop(CMPISint64 value,
+ char *prop,
+ CMPIInstance *inst)
+{
+ if (_set_int_prop(value, prop, CMPI_uint64, inst) == 1)
+ return CMPI_uint64;
+ else if (_set_int_prop(value, prop, CMPI_uint32, inst) == 1)
+ return CMPI_uint32;
+ else if (_set_int_prop(value, prop, CMPI_uint16, inst) == 1)
+ return CMPI_uint16;
+ else if (_set_int_prop(value, prop, CMPI_uint8, inst) == 1)
+ return CMPI_uint8;
+ else if (_set_int_prop(value, prop, CMPI_sint64, inst) == 1)
+ return CMPI_sint64;
+ else if (_set_int_prop(value, prop, CMPI_sint32, inst) == 1)
+ return CMPI_sint32;
+ else if (_set_int_prop(value, prop, CMPI_sint16, inst) == 1)
+ return CMPI_sint16;
+ else
+ _set_int_prop(value, prop, CMPI_sint8, inst);
+
+ return CMPI_sint8;
+}
+
/*
* Local Variables:
* mode: C
diff -r b07d295f167f -r e5e14ae1282c eo_parser_xml.h
--- a/eo_parser_xml.h Wed Feb 27 10:39:55 2008 -0500
+++ b/eo_parser_xml.h Thu Feb 28 13:55:49 2008 -0800
@@ -27,6 +27,10 @@ int cu_parse_ei_xml(const CMPIBroker *br
const char *xml,
CMPIInstance **instance);
+CMPIType set_int_prop(CMPISint64 value,
+ char *prop,
+ CMPIInstance *inst);
+
#endif
/*
diff -r b07d295f167f -r e5e14ae1282c eo_util_parser.y
--- a/eo_util_parser.y Wed Feb 27 10:39:55 2008 -0500
+++ b/eo_util_parser.y Thu Feb 28 13:55:49 2008 -0800
@@ -10,9 +10,12 @@
%{
#include <stdlib.h>
#include <stdio.h>
+#include <stdint.h>
#include "cmpidt.h"
#include "cmpift.h"
+
+#include "eo_parser_xml.h"
/* specify prototypes to get rid of warnings */
int eo_parse_lex (void);
@@ -103,13 +106,12 @@ property: PROPERTYNAME '=' STRING ';'
| PROPERTYNAME '=' INTEGER ';'
{
- EOTRACE("propertyname = %s"
- "\ttype = CMPI_sint64\n"
- "\tvalue = %lld\n",
- $1, $3);
- unsigned long long value = $3;
- CMSetProperty(*_INSTANCE, $1, &(value), CMPI_uint64);
- free($1);
+ EOTRACE("propertyname = %s\n", $1);
+ int rc;
+ CMPIType t = set_int_prop($3, $1, *_INSTANCE);
+ EOTRACE("\ttype = %d\n"
+ "\tvalue = %lld\n", t, $3);
+ free($1);
}
| PROPERTYNAME '=' BOOLEAN ';'
16 years, 10 months