[PATCH 00 of 27] Fix uses of get_typed_*()
by Dan Smith
This is a huge set that changes the semantics of get_typed_class() and
get_typed_instance() to take a reference class name for proper typing. I
have only smoke-tested it, but it fixes several issues with returning
incorrectly-typed instances that I know of.
A healthy amount of testing would be appreciated :)
17 years, 1 month
[PATCH 00 of 12] Finish out the conversion to classname connections
by Dan Smith
This fixes the remaining uses of lv_connect() (except for
ComputerSystemIndication, which I'll deal with later). A quick poke seems
to indicate that things still work, but testing would be good.
Next, I will work on get_typed_instance(), which also needs a per-classname
change so that we don't return Xen_foo instances for non-xen cases. There
are also a lot of fixes needed to prevent classes from returning instances
for the incorrect platform. These would be any that don't depend on a
valid libvirt connection for their work.
17 years, 1 month
[PATCH] [RFC] Change interface of cu_return_instance{, name}s
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1195505862 28800
# Node ID f2c751be5069df9eb23a8bdbaafd5d55b3fd24e9
# Parent 25497386647b6e757ed5c8893f2a4c648543829b
[RFC] Change interface of cu_return_instance{,name}s
to use instance lists instead of null-terminated arrays. These
functions existed before we had instance lists, and need to be
updated.
This will require another wide-sweeping (but trivial) change to libvirt-cim
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 25497386647b -r f2c751be5069 instance_util.c
--- a/instance_util.c Mon Nov 19 08:00:42 2007 -0800
+++ b/instance_util.c Mon Nov 19 12:57:42 2007 -0800
@@ -24,15 +24,15 @@
#include "libcmpiutil.h"
unsigned int cu_return_instances(const CMPIResult *results,
- CMPIInstance ** const list)
+ const struct inst_list *list)
{
unsigned int i;
if (list == NULL)
return 0;
- for (i = 0; list[i] != NULL; i++)
- CMReturnInstance(results, list[i]);
+ for (i = 0; i < list->cur; i++)
+ CMReturnInstance(results, list->list[i]);
return i;
}
@@ -54,19 +54,17 @@ bool cu_return_instance_name(const CMPIR
}
unsigned int cu_return_instance_names(const CMPIResult *results,
- CMPIInstance ** const list)
+ const struct inst_list *list)
{
unsigned int i;
- unsigned int c = 0;
if (list == NULL)
return 0;
- for (i = 0; list[i] != NULL; i++)
- if (cu_return_instance_name(results, list[i]))
- c++;
+ for (i = 0; i < list->cur; i++)
+ cu_return_instance_name(results, list->list[i]);
- return c;
+ return i;
}
static bool _compare_data(const CMPIData *a, const CMPIData *b)
diff -r 25497386647b -r f2c751be5069 libcmpiutil.h
--- a/libcmpiutil.h Mon Nov 19 08:00:42 2007 -0800
+++ b/libcmpiutil.h Mon Nov 19 12:57:42 2007 -0800
@@ -139,15 +139,18 @@ int cu_get_u16_path(const CMPIObjectPath
const char *key,
uint16_t *target);
+/* Forward declaration */
+struct inst_list;
+
/**
* Return a list of instances
*
- * @param list A NULL-terminated list of instances
* @param results The result list to populate
+ * @param list A list of instances to return
* @returns The number of instances returned
*/
unsigned int cu_return_instances(const CMPIResult *results,
- CMPIInstance ** const list);
+ const struct inst_list *list);
/**
* Return an instance object path
@@ -163,13 +166,12 @@ bool cu_return_instance_name(const CMPIR
/**
* Return the object paths of a list of instances
*
- * @param list A NULL-terminated list of instances
* @param results The result list to populate
- * @param op The object path
+ * @param list A list of instances to return (names of)
* @returns The number of instance names returned
*/
unsigned int cu_return_instance_names(const CMPIResult *results,
- CMPIInstance ** const list);
+ const struct inst_list *list);
/**
* Get a string property of an instance
diff -r 25497386647b -r f2c751be5069 std_association.c
--- a/std_association.c Mon Nov 19 08:00:42 2007 -0800
+++ b/std_association.c Mon Nov 19 12:57:42 2007 -0800
@@ -217,9 +217,9 @@ static CMPIStatus do_assoc(struct std_as
}
if (names_only)
- cu_return_instance_names(results, list.list);
+ cu_return_instance_names(results, &list);
else
- cu_return_instances(results, list.list);
+ cu_return_instances(results, &list);
out:
inst_list_free(&list);
17 years, 1 month
[PATCH] Removing pre-existing parse InstanceID function (parse_instance_id()). This function should have been used instead of writing a new one, however, it doesn't support NULL parameters for the prefix and the local_id
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1195499749 28800
# Node ID a38c8fc56e5787d3cadde11cccba37cbfc6926ac
# Parent f3e1a5e15e27a2014a9fc382a40d74d476eaa76d
Removing pre-existing parse InstanceID function (parse_instance_id()). This function should have been used instead of writing a new one, however, it doesn't support NULL parameters for the prefix and the local_id.
Also replacing any calls to parse_instance_id() and replaced with parse_instanceid().
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r f3e1a5e15e27 -r a38c8fc56e57 libxkutil/misc_util.c
--- a/libxkutil/misc_util.c Mon Nov 19 10:08:54 2007 -0800
+++ b/libxkutil/misc_util.c Mon Nov 19 11:15:49 2007 -0800
@@ -155,29 +155,6 @@ bool match_pn_to_cn(const char *pn, cons
return result;
}
-int parse_instance_id(char *_iid, char **orgid, char **locid)
-{
- char *iid = NULL;
- char *delim = NULL;
- int ret = 0;
-
- iid = strdup(_iid);
-
- delim = strchr(iid, ':');
- if (!delim) {
- free(iid);
- goto out;
- }
-
- *delim = '\0';
- *orgid = iid;
- *locid = strdup(delim+1);
-
- ret = 1;
- out:
- return ret;
-}
-
static const char *prefix_from_uri(const char *uri)
{
if (strstr(uri, "xen"))
diff -r f3e1a5e15e27 -r a38c8fc56e57 src/Virt_VSSD.c
--- a/src/Virt_VSSD.c Mon Nov 19 10:08:54 2007 -0800
+++ b/src/Virt_VSSD.c Mon Nov 19 11:15:49 2007 -0800
@@ -223,23 +223,12 @@ static CMPIStatus GetInstance(CMPIInstan
{
CMPIStatus s;
CMPIInstance *inst;
- char *iid;
- char *orgid;
char *locid;
- iid = cu_get_str_path(reference, "InstanceID");
- if (iid == NULL) {
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "InstanceID not specified");
- return s;
- }
-
- if (!parse_instance_id(iid, &orgid, &locid)) {
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
+ if (!parse_instanceid(reference, NULL, &locid)) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
"Invalid InstanceID specified");
- free(iid);
return s;
}
@@ -249,8 +238,6 @@ static CMPIStatus GetInstance(CMPIInstan
CMSetStatus(&s, CMPI_RC_OK);
- free(iid);
- free(orgid);
free(locid);
return s;
17 years, 1 month
[PATCH] Add STD_InstanceMIStub to avoid warnings during compile time
by Heidi Eckhart
# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1195471122 -3600
# Node ID 4a0c7a2052a8da4062177a29d5bd02c6b5a551d1
# Parent 18403e085eaab25596f65d3273ad56befeb46463
Add STD_InstanceMIStub to avoid warnings during compile time
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r 18403e085eaa -r 4a0c7a2052a8 libcmpiutil.h
--- a/libcmpiutil.h Fri Nov 16 08:49:15 2007 -0800
+++ b/libcmpiutil.h Mon Nov 19 12:18:42 2007 +0100
@@ -464,6 +464,52 @@ const char *cu_compare_ref(const CMPIObj
const CMPIContext *ctx) \
{ return; }
+/**
+ * Generates the function table and initialization stub for an
+ * instance provider.
+ * @param pfx The prefix for all mandatory association provider
+ * functions.
+ * @param pn The provider name under which this provider is
+ * registered.
+ * @param broker The CMPIBroker pointer.
+ * @param hook Perform additional initialization functions.
+ * @return The function table of this instance provider.
+ */
+#define STD_InstanceMIStub(pfx, pn, broker, hook) \
+ static CMPIInstanceMIFT instMIFT__={ \
+ CMPICurrentVersion, \
+ CMPICurrentVersion, \
+ "instance" #pn, \
+ pfx##Cleanup, \
+ pfx##EnumInstanceNames, \
+ pfx##EnumInstances, \
+ pfx##GetInstance, \
+ pfx##CreateInstance, \
+ pfx##ModifyInstance, \
+ pfx##DeleteInstance, \
+ pfx##ExecQuery, \
+ }; \
+ \
+ CMPIInstanceMI * \
+ pn##_Create_InstanceMI(const CMPIBroker *, \
+ const CMPIContext *, \
+ CMPIStatus *rc); \
+ \
+ \
+ CMPI_EXTERN_C \
+ CMPIInstanceMI* pn##_Create_InstanceMI(const CMPIBroker* brkr, \
+ const CMPIContext *ctx, \
+ CMPIStatus *rc) \
+ { \
+ static CMPIInstanceMI mi={ \
+ NULL, \
+ &instMIFT__, \
+ }; \
+ broker=brkr; \
+ hook; \
+ return &mi; \
+ }
+
#endif
/*
17 years, 1 month
[PATCH] Add std_instance.h with updated MIStub macro
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1195488042 28800
# Node ID 25497386647b6e757ed5c8893f2a4c648543829b
# Parent 18403e085eaab25596f65d3273ad56befeb46463
Add std_instance.h with updated MIStub macro
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 18403e085eaa -r 25497386647b Makefile.am
--- a/Makefile.am Fri Nov 16 08:49:15 2007 -0800
+++ b/Makefile.am Mon Nov 19 08:00:42 2007 -0800
@@ -13,7 +13,8 @@ libcmpiutilinc_HEADERS = libcmpiutil.h \
libcmpiutilinc_HEADERS = libcmpiutil.h \
std_invokemethod.h \
std_association.h \
- std_indication.h
+ std_indication.h \
+ std_instance.h
libcmpiutil_la_SOURCES = args_util.c instance_util.c std_invokemethod.c \
std_association.c inst_list.c std_indication.c \
diff -r 18403e085eaa -r 25497386647b std_instance.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/std_instance.h Mon Nov 19 08:00:42 2007 -0800
@@ -0,0 +1,72 @@
+/*
+ * Copyright IBM Corp. 2007
+ *
+ * Authors:
+ * Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
+ * Dan Smith <danms(a)us.ibm.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __STD_INSTANCE_H
+#define __STD_INSTANCE_H
+
+/**
+ * Generates the function table and initialization stub for an
+ * instance provider.
+ * @param pfx The prefix for all mandatory association provider
+ * functions.
+ * @param pn The provider name under which this provider is
+ * registered.
+ * @param broker The CMPIBroker pointer.
+ * @param hook Perform additional initialization functions.
+ * @return The function table of this instance provider.
+ */
+#define STD_InstanceMIStub(pfx, pn, broker, hook) \
+ static CMPIInstanceMIFT instMIFT__={ \
+ CMPICurrentVersion, \
+ CMPICurrentVersion, \
+ "instance" #pn, \
+ pfx##Cleanup, \
+ pfx##EnumInstanceNames, \
+ pfx##EnumInstances, \
+ pfx##GetInstance, \
+ pfx##CreateInstance, \
+ pfx##ModifyInstance, \
+ pfx##DeleteInstance, \
+ pfx##ExecQuery, \
+ }; \
+ \
+ CMPIInstanceMI * \
+ pn##_Create_InstanceMI(const CMPIBroker *, \
+ const CMPIContext *, \
+ CMPIStatus *rc); \
+ \
+ \
+ CMPI_EXTERN_C \
+ CMPIInstanceMI* pn##_Create_InstanceMI(const CMPIBroker* brkr, \
+ const CMPIContext *ctx, \
+ CMPIStatus *rc) \
+ { \
+ static CMPIInstanceMI mi={ \
+ NULL, \
+ &instMIFT__, \
+ }; \
+ broker=brkr; \
+ hook; \
+ return &mi; \
+ }
+
+ #endif
17 years, 1 month
[PATCH 0 of 3] Transition back to connect_by_classname()
by Dan Smith
A more formal version of the last set, this time as a proposed change
instead of an RFC. Some testing of the first patch would be good to make
sure that I didn't change a provider name to be incongruent with what is
in the registration files.
17 years, 1 month
[PATCH] Fix up the src/Makefile.am to support parallel builds
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1195252274 28800
# Node ID 4fa05e74894807d8fa5e76f8dda6aad9b31ddd2b
# Parent 5ccd8aa18359f59d02f664ec9ebd9f07b422a698
Fix up the src/Makefile.am to support parallel builds
Fedora packaging guidelines suggest using parallel make where possible,
and we were pretty broken in that regard.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 5ccd8aa18359 -r 4fa05e748948 src/Makefile.am
--- a/src/Makefile.am Fri Nov 16 12:24:59 2007 -0800
+++ b/src/Makefile.am Fri Nov 16 14:31:14 2007 -0800
@@ -55,68 +55,84 @@ libVirt_ComputerSystem_la_SOURCES = Virt
libVirt_ComputerSystem_la_SOURCES = Virt_ComputerSystem.c
libVirt_Device_la_SOURCES = Virt_Device.c
+libVirt_ComputerSystemIndication_la_DEPENDENCIES = libVirt_ComputerSystem.la
libVirt_ComputerSystemIndication_la_SOURCES = Virt_ComputerSystemIndication.c
libVirt_ComputerSystemIndication_la_LIBADD = -lVirt_ComputerSystem -lpthread -lrt
+libVirt_VirtualSystemManagementService_la_DEPENDENCIES = libVirt_ComputerSystem.la libVirt_ComputerSystemIndication.la libVirt_RASD.la libVirt_HostSystem.la
libVirt_VirtualSystemManagementService_la_SOURCES = Virt_VirtualSystemManagementService.c
libVirt_VirtualSystemManagementService_la_LIBADD = -lVirt_ComputerSystem -lVirt_ComputerSystemIndication -lVirt_RASD -lVirt_HostSystem
libVirt_VirtualSystemManagementCapabilities_la_SOURCES = Virt_VirtualSystemManagementCapabilities.c
+libVirt_SystemDevice_la_DEPENDENCIES = libVirt_ComputerSystem.la libVirt_Device.la
libVirt_SystemDevice_la_SOURCES = Virt_SystemDevice.c
libVirt_SystemDevice_la_LIBADD = -lVirt_ComputerSystem -lVirt_Device
libVirt_VSSD_la_SOURCES = Virt_VSSD.c
libVirt_HostSystem_la_SOURCES = Virt_HostSystem.c
+libVirt_HostedDependency_la_DEPENDENCIES = libVirt_ComputerSystem.la libVirt_HostSystem.la
libVirt_HostedDependency_la_SOURCES = Virt_HostedDependency.c
libVirt_HostedDependency_la_LIBADD = -lVirt_ComputerSystem -lVirt_HostSystem
libVirt_DevicePool_la_SOURCES = Virt_DevicePool.c
+libVirt_ElementConformsToProfile_la_DEPENDENCIES = libVirt_RegisteredProfile.la
libVirt_ElementConformsToProfile_la_SOURCES = Virt_ElementConformsToProfile.c
libVirt_ElementConformsToProfile_la_LIBADD = -lVirt_RegisteredProfile
libVirt_EnabledLogicalElementCapabilities_la_SOURCES = Virt_EnabledLogicalElementCapabilities.c
+libVirt_ElementCapabilities_la_DEPENDENCIES = libVirt_VirtualSystemManagementCapabilities.la libVirt_EnabledLogicalElementCapabilities.la libVirt_ComputerSystem.la libVirt_HostSystem.la
libVirt_ElementCapabilities_la_SOURCES = Virt_ElementCapabilities.c
libVirt_ElementCapabilities_la_LIBADD = -lVirt_VirtualSystemManagementCapabilities \
-lVirt_EnabledLogicalElementCapabilities \
-lVirt_ComputerSystem \
-lVirt_HostSystem
+libVirt_AllocationCapabilities_la_DEPENDENCIES = libVirt_RASD.la
libVirt_AllocationCapabilities_la_SOURCES = Virt_AllocationCapabilities.c
libVirt_AllocationCapabilities_la_LIBADD = -lVirt_RASD
+libVirt_SettingsDefineCapabilities_la_DEPENDENCIES = libVirt_RASD.la libVirt_DevicePool.la
libVirt_SettingsDefineCapabilities_la_SOURCES = Virt_SettingsDefineCapabilities.c
libVirt_SettingsDefineCapabilities_la_LIBADD = -lVirt_RASD -lVirt_DevicePool
libVirt_RegisteredProfile_la_SOURCES = Virt_RegisteredProfile.c
+libVirt_HostedResourcePool_la_DEPENDENCIES = libVirt_DevicePool.la libVirt_HostSystem.la
libVirt_HostedResourcePool_la_SOURCES = Virt_HostedResourcePool.c
libVirt_HostedResourcePool_la_LIBADD = -lVirt_DevicePool -lVirt_HostSystem
libVirt_RASD_la_SOURCES = Virt_RASD.c
+libVirt_ResourcePoolConfigurationService_la_DEPENDENCIES = libVirt_HostSystem.la
libVirt_ResourcePoolConfigurationService_la_SOURCES = Virt_ResourcePoolConfigurationService.c
libVirt_ResourcePoolConfigurationService_la_LIBADD = -lVirt_HostSystem
libVirt_ResourcePoolConfigurationCapabilities_la_SOURCES = Virt_ResourcePoolConfigurationCapabilities.c
+libVirt_VSSDComponent_la_DEPENDENCIES = libVirt_VSSD.la libVirt_RASD.la
libVirt_VSSDComponent_la_SOURCES = Virt_VSSDComponent.c
libVirt_VSSDComponent_la_LIBADD = -lVirt_VSSD -lVirt_RASD
+libVirt_SettingsDefineState_la_DEPENDENCIES = libVirt_Device.la libVirt_RASD.la libVirt_VSSD.la libVirt_ComputerSystem.la
libVirt_SettingsDefineState_la_SOURCES = Virt_SettingsDefineState.c
libVirt_SettingsDefineState_la_LIBADD = -lVirt_Device -lVirt_RASD -lVirt_VSSD -lVirt_ComputerSystem
+libVirt_ResourceAllocationFromPool_la_DEPENDENCIES = libVirt_DevicePool.la libVirt_RASD.la
libVirt_ResourceAllocationFromPool_la_SOURCES = Virt_ResourceAllocationFromPool.c
libVirt_ResourceAllocationFromPool_la_LIBADD = -lVirt_DevicePool -lVirt_RASD
+libVirt_ElementAllocatedFromPool_la_DEPENDENCIES = libVirt_DevicePool.la libVirt_Device.la
libVirt_ElementAllocatedFromPool_la_SOURCES = Virt_ElementAllocatedFromPool.c
libVirt_ElementAllocatedFromPool_la_LIBADD = -lVirt_DevicePool -lVirt_Device
+libVirt_HostedService_la_DEPENDENCIES = libVirt_VirtualSystemManagementService.la libVirt_ResourcePoolConfigurationService.la
libVirt_HostedService_la_SOURCES = Virt_HostedService.c
libVirt_HostedService_la_LIBADD = -lVirt_VirtualSystemManagementService -lVirt_ResourcePoolConfigurationService
+libVirt_ElementSettingData_la_DEPENDENCIES = libVirt_VSSD.la
libVirt_ElementSettingData_la_SOURCES = Virt_ElementSettingData.c
libVirt_ElementSettingData_la_LIBADD = -lVirt_VSSD
17 years, 1 month