Dan Smith wrote:
This defines a function in the utility librart that does the libvirt
initialization, and could be extended to do anything else we need in the
future. This replaces CMNoHook in all of the providers with a call to
this function.
Great :).
Also in this patch is a change to all non-association providers to
use
a #define for the provider name to avoid duplication and improve
readability. I figured I'd make this cleanup while I was touching every
MIStub in the tree.
With sfcb and the #define approach the following error is thrown:
*** Inconsistent provider registration for Virt_ComputerSystemProvider (2)
This is caused by a non-resolved PN variable. PN is taken as "PN" and not
resolved to the string as in the #define.
+CMInstanceMIStub(, PN, _BROKER, libvirt_cim_init());
I do not have that many experiences with macros, but the PN approach
did not work for me, no matter in how many different ways I tried it.
PN was not resolved to the string defined at the beginning of the
provider. So I had to switch back to
-CMInstanceMIStub(, PN, _BROKER, libvirt_cim_init());
+CMInstanceMIStub(, Virt_ComputerSystemProvider, _BROKER,
libvirt_cim_init());
Maybe someone else has some more experiences here and knows a solution ?
On the other hand, I sent out a patch to libcmpiutil some minutes ago,
which adds a STD_InstanceMIStub macro to libcmpiutil.h . This macro
avoids now the warning in the original stub macro, which removes the
responsibility from each provider to define it by itself. The patches
below show the difference (first one is yours with PN approach, second
one is removing the PN approach and using STD_InstanceMIStub macro). Now
that you touched each MI stub, this might also be a good point in time
to resolve this (now very old ;) ... sorry for my delay) problem.
diff -r bb9245e8f41c -r f6c11dd07703 src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Fri Nov 16 10:22:13 2007 -0800
+++ b/src/Virt_ComputerSystem.c Fri Nov 16 12:24:53 2007 -0800
@@ -37,6 +37,8 @@
#include "Virt_ComputerSystem.h"
+#define PN Virt_ComputerSystemProvider
+
const static CMPIBroker *_BROKER;
enum CIM_state {
@@ -684,11 +686,11 @@ static CMPIStatus state_change(CMPIMetho
/* Avoid a warning in the stub macro below */
CMPIInstanceMI *
-Virt_ComputerSystemProvider_Create_InstanceMI(const CMPIBroker *,
+PN_Create_InstanceMI(const CMPIBroker *,
const CMPIContext *,
CMPIStatus *rc);
-CMInstanceMIStub(, Virt_ComputerSystemProvider, _BROKER, CMNoHook);
+CMInstanceMIStub(, PN, _BROKER, libvirt_cim_init());
static struct method_handler RequestStateChange = {
.name = "RequestStateChange",
@@ -704,11 +706,7 @@ static struct method_handler *my_handler
NULL
};
-STDIM_MethodMIStub(,
- Virt_ComputerSystemProvider,
- _BROKER,
- CMNoHook,
- my_handlers);
+STDIM_MethodMIStub(, PN, _BROKER, libvirt_cim_init(), my_handlers);
/*
* Local Variables:
diff -r 599292e408aa src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Fri Nov 16 12:24:59 2007 -0800
+++ b/src/Virt_ComputerSystem.c Mon Nov 19 12:41:48 2007 +0100
@@ -37,8 +37,6 @@
#include "Virt_ComputerSystem.h"
-#define PN Virt_ComputerSystemProvider
-
const static CMPIBroker *_BROKER;
enum CIM_state {
@@ -681,13 +679,7 @@ static CMPIStatus state_change(CMPIMetho
return s;
}
-/* Avoid a warning in the stub macro below */
-CMPIInstanceMI *
-PN_Create_InstanceMI(const CMPIBroker *,
- const CMPIContext *,
- CMPIStatus *rc);
-
-CMInstanceMIStub(, PN, _BROKER, libvirt_cim_init());
+STD_InstanceMIStub(, Virt_ComputerSystemProvider, _BROKER,
libvirt_cim_init());
static struct method_handler RequestStateChange = {
.name = "RequestStateChange",
@@ -703,7 +695,7 @@ static struct method_handler *my_handler
NULL
};
-STDIM_MethodMIStub(, PN, _BROKER, libvirt_cim_init(), my_handlers);
+STDIM_MethodMIStub(, Virt_ComputerSystemProvider, _BROKER,
libvirt_cim_init(), my_handlers);
/*
* Local Variables:
--
Regards
Heidi Eckhart
Software Engineer
Linux Technology Center - Open Hypervisor
heidieck(a)linux.vnet.ibm.com
**************************************************
IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Herbert Kircher
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294