WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-cim

Re: [Xen-cim] Provider Initialize functions

To: Jim Fehlig <jfehlig@xxxxxxxxxx>
Subject: Re: [Xen-cim] Provider Initialize functions
From: Gareth S Bestor <bestor@xxxxxxxxxx>
Date: Mon, 24 Apr 2006 15:43:58 -0700
Cc: xen-cim@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 24 Apr 2006 17:38:55 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <444D66C0.20407@xxxxxxxxxx>
List-help: <mailto:xen-cim-request@lists.xensource.com?subject=help>
List-id: xen-cim mailing list <xen-cim.lists.xensource.com>
List-post: <mailto:xen-cim@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-cim>, <mailto:xen-cim-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-cim>, <mailto:xen-cim-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-cim-bounces@xxxxxxxxxxxxxxxxxxx

The inclusion of the Initialize function is not needed by most of the classes - I had included it in the LTC Xen CIM provider more for future flexibility should the need ever arise, hence most of the initialize routines do little more than print the input params to tracing. The ctx param is passed in via the addition of the (optional) provider initialize routine in the CM*MIStub macro, which in turn is defined (with ctx) in your cmpimacs.h:


#ifdef DOC_ONLY
/** This macro generates the function table and initialization stub
for an instance provider. The initialization routine &lt;pn&gt;Create_InstanceMI
is called when this provider module is loaded by the broker.
This macro is for CMPI providers written in plain C.
@param pfx The prefix for all mandatory association provider functions.
This is a character string without quotes.
Mandatory functions are: &lt;pfx&gt;Cleanup, &lt;pfx&gt;EnumInstanceNames,
&lt;pfx&gt;EnumInstances, &lt;pfx&gt;GetInstance, &lt;pfx&gt;CreateInstance,
&lt;pfx&gt;SetInstance, &lt;pfx&gt;DeleteInstance and &lt;pfx&gt;ExecQuery.
@param pn The provider name under which this provider is registered.
This is a character string without quotes.
@param broker The name of the broker variable used by this macro to store
the CMPIBroker pointer
@param hook A statement that is executed within &lt;pn&gt;Create_InstanceMI routine.
This enables you to perform additional initialization functions and
is normally a function call like furtherInit(broker) or CMNoHook.
Use CMNoHook if no further intialization is required.
@return The function table of this instance provider.
*/
CMPIInstanceMI* CMInstanceMIStub(chars pfx, chars pn,
CMPIBroker *broker, statement hook);
#else

#if defined(CMPI_VER_100)
#define CMInstanceMIStubChange(pfx) pfx##ModifyInstance
#else
#define CMInstanceMIStubChange(pfx) pfx##SetInstance
#endif

#define CMInstanceMIStub(pfx,pn,broker,hook) \
static CMPIInstanceMIFT instMIFT__={ \
CMPICurrentVersion, \
CMPICurrentVersion, \
"instance" #pn, \
pfx##Cleanup, \
pfx##EnumInstanceNames, \
pfx##EnumInstances, \
pfx##GetInstance, \
pfx##CreateInstance, \
CMInstanceMIStubChange(pfx), \
pfx##DeleteInstance, \
pfx##ExecQuery, \
}; \
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


Note - the CMGetCharPtr() macro is actually redefined in cmpiutil.h to better handle the case when CMPIString objects are null, which always used to cause a crash - are you sure you are picking up the redefined one in cmpiutil.h?

- Gareth

Dr. Gareth S. Bestor
IBM Linux Technology Center
M/S DES2-01
15300 SW Koll Parkway, Beaverton, OR 97006
503-578-3186, T/L 775-3186, Fax 503-578-3186

Inactive hide details for Jim Fehlig <jfehlig@xxxxxxxxxx>Jim Fehlig <jfehlig@xxxxxxxxxx>




          Jim Fehlig <jfehlig@xxxxxxxxxx>
          Sent by: xen-cim-bounces@xxxxxxxxxxxxxxxxxxx

          04/24/06 05:01 PM



To: xen-cim@xxxxxxxxxxxxxxxxxxx
cc:
Subject: [Xen-cim] Provider Initialize functions


Most of the providers have an initialize function that is called when
for example the <ProviderName>_Create_InstanceMI function is  executed.  
The initialize function is provided in calls to the various CM*MIStub
macros.  The second parameter of the initialize function (ctx) is not
defined anywhere that I can find but is referenced during execution of
the initialize function and crashes the cimom.  Only one of the
providers does anything useful in the initialization function -
Xen_CompterSystemIndication.  All of them however print some debug info
and in doing so reference the bogus context and crash.  I simply
commented all of the offending

_SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER,
context, NULL))));

statements in the various initialized routines to avoid the crash.

Do we anticipate needing the initialization routines?  If not, I can
remove them.  Xen_ComputerSystemIndication apparently needs one although
I doubt it works given the bogus context parameter.

BTW, I now have all of the providers working on SLES/openwbem.  The "get
it working on suse/openwbem" patch will be committed to the repository
after some cleanup, e.g. like the issue described above.

Regards,
Jim

_______________________________________________
Xen-cim mailing list
Xen-cim@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-cim

GIF image

_______________________________________________
Xen-cim mailing list
Xen-cim@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-cim
<Prev in Thread] Current Thread [Next in Thread>