[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-cim] Provider Initialize functions
 
 
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 <pn>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: <pfx>Cleanup, <pfx>EnumInstanceNames, 
                <pfx>EnumInstances, <pfx>GetInstance, <pfx>CreateInstance, 
                <pfx>SetInstance, <pfx>DeleteInstance and <pfx>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 <pn>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  
 
 Jim Fehlig <jfehlig@xxxxxxxxxx> 
 
 
 
 
 
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 
  
_______________________________________________
Xen-cim mailing list
Xen-cim@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-cim
 
 
    
     |