os-cmpi-xen

changeset 139:3ccb96bfe206

Converted profile registration classes to 'Cmpilify' single, read-only interface.

In the process split Xen_RegisteredSVProfile and Xen_RegisteredVSProfile
into separate libraries.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
author Jim Fehlig <jfehlig@novell.com>
date Thu Aug 02 17:54:59 2007 -0600 (2007-08-02)
parents c0beaacf5b03
children 93e1e1824ab0
files ChangeLog schema/Xen_RegisteredSVProfile.mof schema/Xen_RegisteredSVProfile.registration schema/Xen_RegisteredVSProfile.mof schema/Xen_RegisteredVSProfile.registration src/Makefile.am src/Xen_RegSVProfile.c src/Xen_RegVSProfile.c src/Xen_RegisteredProfiles.c
line diff
     1.1 --- a/ChangeLog	Thu Aug 02 17:50:46 2007 -0600
     1.2 +++ b/ChangeLog	Thu Aug 02 17:54:59 2007 -0600
     1.3 @@ -1,3 +1,11 @@
     1.4 +-------------------------------------------------------------------
     1.5 +Thu Aug  2 17:52:15 MDT 2007 - jfehlig@novell.com
     1.6 +
     1.7 +         - Converted profile registration classes to 'Cmpilify'
     1.8 +           single, read-only interface.  In the process split
     1.9 +           Xen_RegisteredSVProfile and Xen_RegisteredVSProfile
    1.10 +           into separate libraries.
    1.11 +
    1.12  -------------------------------------------------------------------
    1.13  Fri Jul 27 15:56:35 MDT 2007 - jfehlig@novell.com
    1.14  
     2.1 --- a/schema/Xen_RegisteredSVProfile.mof	Thu Aug 02 17:50:46 2007 -0600
     2.2 +++ b/schema/Xen_RegisteredSVProfile.mof	Thu Aug 02 17:54:59 2007 -0600
     2.3 @@ -3,7 +3,7 @@
     2.4  // ==================================================================
     2.5  // Xen_RegisteredSVProfile
     2.6  // ==================================================================
     2.7 -[Provider ("cmpi:Xen_RegisteredProfiles"),
     2.8 +[Provider ("cmpi:Xen_RegisteredSVProfile"),
     2.9   Description (
    2.10          "A class derived from CIM_RegisteredProfile used to "
    2.11          "advertise conformance to the System Virtualization Profile.")]
     3.1 --- a/schema/Xen_RegisteredSVProfile.registration	Thu Aug 02 17:50:46 2007 -0600
     3.2 +++ b/schema/Xen_RegisteredSVProfile.registration	Thu Aug 02 17:54:59 2007 -0600
     3.3 @@ -1,2 +1,2 @@
     3.4  # Classname Namespace ProviderName ProviderModule ProviderTypes ...
     3.5 -Xen_RegisteredSVProfile Interop Xen_RegisteredProfiles Xen_RegisteredProfiles instance
     3.6 +Xen_RegisteredSVProfile Interop Xen_RegisteredSVProfile Xen_RegisteredSVProfile instance
     4.1 --- a/schema/Xen_RegisteredVSProfile.mof	Thu Aug 02 17:50:46 2007 -0600
     4.2 +++ b/schema/Xen_RegisteredVSProfile.mof	Thu Aug 02 17:54:59 2007 -0600
     4.3 @@ -3,7 +3,7 @@
     4.4  // ==================================================================
     4.5  // Xen_RegisteredSVProfile
     4.6  // ==================================================================
     4.7 -[Provider ("cmpi:Xen_RegisteredProfiles"),
     4.8 +[Provider ("cmpi:Xen_RegisteredVSProfile"),
     4.9   Description (
    4.10          "A class derived from CIM_RegisteredProfile used to "
    4.11          "advertise conformance to the Virtual System Profile.")]
     5.1 --- a/schema/Xen_RegisteredVSProfile.registration	Thu Aug 02 17:50:46 2007 -0600
     5.2 +++ b/schema/Xen_RegisteredVSProfile.registration	Thu Aug 02 17:54:59 2007 -0600
     5.3 @@ -1,2 +1,2 @@
     5.4  # Classname Namespace ProviderName ProviderModule ProviderTypes ...
     5.5 -Xen_RegisteredVSProfile Interop Xen_RegisteredProfiles Xen_RegisteredProfiles instance
     5.6 +Xen_RegisteredVSProfile Interop Xen_RegisteredVSProfile Xen_RegisteredVSProfile instance
     6.1 --- a/src/Makefile.am	Thu Aug 02 17:50:46 2007 -0600
     6.2 +++ b/src/Makefile.am	Thu Aug 02 17:54:59 2007 -0600
     6.3 @@ -113,7 +113,8 @@ provider_LTLIBRARIES = \
     6.4  	libXen_MemorySettingAllocationFromPool.la \
     6.5  	libXen_ElementConformsToSVProfile.la \
     6.6  	libXen_ElementConformsToVSProfile.la \
     6.7 -	libXen_RegisteredProfiles.la \
     6.8 +	libXen_RegisteredSVProfile.la \
     6.9 +	libXen_RegisteredVSProfile.la \
    6.10  	libXen_ComputerSystemCapabilities.la \
    6.11  	libXen_VirtualSystemManagementCapabilities.la \
    6.12  	libXen_CSElementCapabilities.la \
    6.13 @@ -354,9 +355,13 @@ libXen_ElementConformsToVSProfile_la_SOU
    6.14  libXen_ElementConformsToVSProfile_la_LIBADD = libXen_ProviderCommon.la
    6.15  libXen_ElementConformsToVSProfile_la_LDFLAGS = -module -avoid-version -no-undefined
    6.16  
    6.17 -libXen_RegisteredProfiles_la_SOURCES = Xen_RegisteredProfiles.c
    6.18 -libXen_RegisteredProfiles_la_LIBADD = libXen_ProviderCommon.la
    6.19 -libXen_RegisteredProfiles_la_LDFLAGS = -module -avoid-version -no-undefined
    6.20 +libXen_RegisteredSVProfile_la_SOURCES = Xen_RegSVProfile.c
    6.21 +libXen_RegisteredSVProfile_la_LIBADD = libXen_ProviderCommon.la
    6.22 +libXen_RegisteredSVProfile_la_LDFLAGS = -module -avoid-version -no-undefined
    6.23 +
    6.24 +libXen_RegisteredVSProfile_la_SOURCES = Xen_RegVSProfile.c
    6.25 +libXen_RegisteredVSProfile_la_LIBADD = libXen_ProviderCommon.la
    6.26 +libXen_RegisteredVSProfile_la_LDFLAGS = -module -avoid-version -no-undefined
    6.27  
    6.28  libXen_ComputerSystemCapabilities_la_SOURCES = Xen_ComputerSystemCapabilities.c
    6.29  libXen_ComputerSystemCapabilities_la_CFLAGS = -I../ @LIBXEN_CFLAGS@
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/Xen_RegSVProfile.c	Thu Aug 02 17:54:59 2007 -0600
     7.3 @@ -0,0 +1,106 @@
     7.4 +// Copyright (C) 2007 Novell, Inc.
     7.5 +//
     7.6 +//    This library is free software; you can redistribute it and/or
     7.7 +//    modify it under the terms of the GNU Lesser General Public
     7.8 +//    License as published by the Free Software Foundation; either
     7.9 +//    version 2.1 of the License, or (at your option) any later version.
    7.10 +//
    7.11 +//    This library is distributed in the hope that it will be useful,
    7.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    7.14 +//    Lesser General Public License for more details.
    7.15 +//
    7.16 +//    You should have received a copy of the GNU Lesser General Public
    7.17 +//    License along with this library; if not, write to the Free Software
    7.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    7.19 +// ============================================================================
    7.20 +// Authors:       Jim Fehlig, <jfehlig@novell.com>
    7.21 +// Contributors:
    7.22 +// Description:   Implements Xen_RegisteredSVProfile
    7.23 +//                (DSP1042 System Virtualizaiton Profile)
    7.24 +// ============================================================================
    7.25 +
    7.26 +/* Common declarations for each CMPI "Cimpler" instance provider */
    7.27 +// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    7.28 +#include <cmpidt.h>
    7.29 +#include <cmpimacs.h>
    7.30 +
    7.31 +#include "cmpilify.h"
    7.32 +
    7.33 +
    7.34 +static const CMPIInstanceMI* mi;
    7.35 +
    7.36 +
    7.37 +#define _BROKER (((CMPILIFYInstance1ROMI*)(mi->hdl))->brkr)
    7.38 +#define _CLASS (((CMPILIFYInstance1ROMI*)(mi->hdl))->cn)
    7.39 +#define _KEYS (((CMPILIFYInstance1ROMI*)(mi->hdl))->kys)
    7.40 +
    7.41 +// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    7.42 +
    7.43 +#include <string.h>
    7.44 +
    7.45 +#include "cmpitrace.h"
    7.46 +#include "provider_common.h"
    7.47 +
    7.48 +
    7.49 +/* Class keys */
    7.50 +static const char *keys[] = {"InstanceID", NULL};
    7.51 +
    7.52 +
    7.53 +static CMPIrc load()
    7.54 +{
    7.55 +   return CMPI_RC_OK;
    7.56 +}
    7.57 +
    7.58 +
    7.59 +static CMPIrc unload(const int terminating)
    7.60 +{
    7.61 +   (void)terminating;
    7.62 +   
    7.63 +   return CMPI_RC_OK;
    7.64 +}
    7.65 +
    7.66 +
    7.67 +/* Nothing to get, all static properties. */
    7.68 +static CMPIrc get(void **res, const char** properties)
    7.69 +{
    7.70 +   (void)res;
    7.71 +   (void)properties;
    7.72 +   
    7.73 +   return CMPI_RC_OK;
    7.74 +}
    7.75 +
    7.76 +
    7.77 +static void release(void *res)
    7.78 +{
    7.79 +   return;
    7.80 +}
    7.81 +
    7.82 +
    7.83 +/* Set CMPIInstance properties from the resource data. */
    7.84 +static CMPIrc setproperties(CMPIInstance *inst, const void *res,
    7.85 +                            const char **properties)
    7.86 +{
    7.87 +   if (CMIsNullObject(inst))
    7.88 +      return CMPI_RC_ERR_FAILED;
    7.89 +
    7.90 +   /* Setup a filter to only return the desired properties. */
    7.91 +   CMSetPropertyFilter(inst, properties, keys);
    7.92 +   CMSetProperty(inst, "InstanceID",
    7.93 +                 (CMPIValue *)"Xen:SystemVirtualizationProfile", CMPI_chars);
    7.94 +   CMSetProperty(inst, "RegisteredName",
    7.95 +                 (CMPIValue *)"DSP1042 System Virtualization Profile", CMPI_chars);
    7.96 +   
    7.97 +   int registeredOrg = 2; // "DMTF"
    7.98 +   CMSetProperty(inst, "RegisteredOrganization",
    7.99 +                 (CMPIValue *)&registeredOrg, CMPI_uint16);
   7.100 +   
   7.101 +   CMSetProperty(inst, "RegisteredVersion", (CMPIValue *)"0.7.3", CMPI_chars);
   7.102 +
   7.103 +   return CMPI_RC_OK;
   7.104 +}
   7.105 +
   7.106 +
   7.107 +/* Setup CMPILIFY function tables and instance provider entry point.*/
   7.108 +/* CMPILIFYInstance1ROMIStub(<CLASS>,<PROVIDERNAME>,<KEYS>,<MIHANDLE>) */
   7.109 +CMPILIFYInstance1ROMIStub(Xen_RegisteredSVProfile, Xen_RegisteredSVProfile, keys, mi)
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/src/Xen_RegVSProfile.c	Thu Aug 02 17:54:59 2007 -0600
     8.3 @@ -0,0 +1,106 @@
     8.4 +// Copyright (C) 2007 Novell, Inc.
     8.5 +//
     8.6 +//    This library is free software; you can redistribute it and/or
     8.7 +//    modify it under the terms of the GNU Lesser General Public
     8.8 +//    License as published by the Free Software Foundation; either
     8.9 +//    version 2.1 of the License, or (at your option) any later version.
    8.10 +//
    8.11 +//    This library is distributed in the hope that it will be useful,
    8.12 +//    but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.13 +//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    8.14 +//    Lesser General Public License for more details.
    8.15 +//
    8.16 +//    You should have received a copy of the GNU Lesser General Public
    8.17 +//    License along with this library; if not, write to the Free Software
    8.18 +//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    8.19 +// ============================================================================
    8.20 +// Authors:       Jim Fehlig, <jfehlig@novell.com>
    8.21 +// Contributors:
    8.22 +// Description:   Implements Xen_RegisteredVSProfile
    8.23 +//                (DSP1057 Virtual System Profile)
    8.24 +// ============================================================================
    8.25 +
    8.26 +/* Common declarations for each CMPI "Cimpler" instance provider */
    8.27 +// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    8.28 +#include <cmpidt.h>
    8.29 +#include <cmpimacs.h>
    8.30 +
    8.31 +#include "cmpilify.h"
    8.32 +
    8.33 +
    8.34 +static const CMPIInstanceMI* mi;
    8.35 +
    8.36 +
    8.37 +#define _BROKER (((CMPILIFYInstance1ROMI*)(mi->hdl))->brkr)
    8.38 +#define _CLASS (((CMPILIFYInstance1ROMI*)(mi->hdl))->cn)
    8.39 +#define _KEYS (((CMPILIFYInstance1ROMI*)(mi->hdl))->kys)
    8.40 +
    8.41 +// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    8.42 +
    8.43 +#include <string.h>
    8.44 +
    8.45 +#include "cmpitrace.h"
    8.46 +#include "provider_common.h"
    8.47 +
    8.48 +
    8.49 +/* Class keys */
    8.50 +static const char *keys[] = {"InstanceID", NULL};
    8.51 +
    8.52 +
    8.53 +static CMPIrc load()
    8.54 +{
    8.55 +   return CMPI_RC_OK;
    8.56 +}
    8.57 +
    8.58 +
    8.59 +static CMPIrc unload(const int terminating)
    8.60 +{
    8.61 +   (void)terminating;
    8.62 +   
    8.63 +   return CMPI_RC_OK;
    8.64 +}
    8.65 +
    8.66 +
    8.67 +/* Nothing to get, all static properties. */
    8.68 +static CMPIrc get(void **res, const char** properties)
    8.69 +{
    8.70 +   (void)res;
    8.71 +   (void)properties;
    8.72 +   
    8.73 +   return CMPI_RC_OK;
    8.74 +}
    8.75 +
    8.76 +
    8.77 +static void release(void *res)
    8.78 +{
    8.79 +   return;
    8.80 +}
    8.81 +
    8.82 +
    8.83 +/* Set CMPIInstance properties from the resource data. */
    8.84 +static CMPIrc setproperties(CMPIInstance *inst, const void *res,
    8.85 +                            const char **properties)
    8.86 +{
    8.87 +   if (CMIsNullObject(inst))
    8.88 +      return CMPI_RC_ERR_FAILED;
    8.89 +
    8.90 +   /* Setup a filter to only return the desired properties. */
    8.91 +   CMSetPropertyFilter(inst, properties, keys);
    8.92 +   CMSetProperty(inst, "InstanceID",
    8.93 +                 (CMPIValue *)"Xen:VirtualSystemProfile", CMPI_chars);
    8.94 +   CMSetProperty(inst, "RegisteredName",
    8.95 +                 (CMPIValue *)"DSP1057 Virtual System Profile", CMPI_chars);
    8.96 +   
    8.97 +   int registeredOrg = 2; // "DMTF"
    8.98 +   CMSetProperty(inst, "RegisteredOrganization",
    8.99 +                 (CMPIValue *)&registeredOrg, CMPI_uint16);
   8.100 +   
   8.101 +   CMSetProperty(inst, "RegisteredVersion", (CMPIValue *)"0.7.7", CMPI_chars);
   8.102 +
   8.103 +   return CMPI_RC_OK;
   8.104 +}
   8.105 +
   8.106 +
   8.107 +/* Setup CMPILIFY function tables and instance provider entry point.*/
   8.108 +/* CMPILIFYInstance1ROMIStub(<CLASS>,<PROVIDERNAME>,<KEYS>,<MIHANDLE>) */
   8.109 +CMPILIFYInstance1ROMIStub(Xen_RegisteredVSProfile, Xen_RegisteredVSProfile, keys, mi)
     9.1 --- a/src/Xen_RegisteredProfiles.c	Thu Aug 02 17:50:46 2007 -0600
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,411 +0,0 @@
     9.4 -// Copyright (C) 2006 Novell, Inc.
     9.5 -//
     9.6 -//    This library is free software; you can redistribute it and/or
     9.7 -//    modify it under the terms of the GNU Lesser General Public
     9.8 -//    License as published by the Free Software Foundation; either
     9.9 -//    version 2.1 of the License, or (at your option) any later version.
    9.10 -//
    9.11 -//    This library is distributed in the hope that it will be useful,
    9.12 -//    but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.13 -//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    9.14 -//    Lesser General Public License for more details.
    9.15 -//
    9.16 -//    You should have received a copy of the GNU Lesser General Public
    9.17 -//    License along with this library; if not, write to the Free Software
    9.18 -//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    9.19 -// ============================================================================
    9.20 -// Authors:       Jim Fehlig, <jfehlig@novell.com>
    9.21 -// Contributors:
    9.22 -// Description:
    9.23 -// ============================================================================
    9.24 -
    9.25 -#include <string.h>
    9.26 -
    9.27 -#include "provider_common.h"
    9.28 -
    9.29 -/* Include the required CMPI data types, function headers, and macros */
    9.30 -#include "cmpidt.h"
    9.31 -#include "cmpift.h"
    9.32 -#include "cmpimacs.h"
    9.33 -
    9.34 -// ----------------------------------------------------------------------------
    9.35 -// COMMON GLOBAL VARIABLES
    9.36 -// ----------------------------------------------------------------------------
    9.37 -
    9.38 -/* Handle to the CIM broker. Initialized when the provider lib is loaded. */
    9.39 -static const CMPIBroker *_BROKER;
    9.40 -
    9.41 -/* Include utility functions */
    9.42 -#include "cmpiutil.h"
    9.43 -
    9.44 -/* Include _SBLIM_TRACE() logging support */
    9.45 -#include "cmpitrace.h"
    9.46 -
    9.47 -
    9.48 -// ============================================================================
    9.49 -// CMPI INSTANCE PROVIDER FUNCTION TABLE
    9.50 -// ============================================================================
    9.51 -
    9.52 -// ----------------------------------------------------------------------------
    9.53 -// Info for the class supported by the instance provider
    9.54 -// ----------------------------------------------------------------------------
    9.55 -
    9.56 -/* Name of the class implemented by this instance provider. */
    9.57 -/*** CUSTOMIZE FOR EACH PROVIDER ***/
    9.58 -static char * SVP_CLASSNAME = "Xen_RegisteredSVProfile";
    9.59 -static char * VSP_CLASSNAME = "Xen_RegisteredVSProfile";
    9.60 -static char * _NAMESPACE = "Interop";
    9.61 -
    9.62 -/* NULL terminated list of key properties of this class. */
    9.63 -/*** CUSTOMIZE FOR EACH PROVIDER ***/
    9.64 -const static char * _KEYNAMES[] = {"InstanceID", NULL};
    9.65 -
    9.66 -/* Additional static class data */
    9.67 -const static char * SVP_NAME = "System Virtualization Profile";
    9.68 -const static char * SVP_INST_ID = "Xen:SystemVirtualizationProfile";
    9.69 -const static char * SVP_VERSION = "0.7.3";
    9.70 -const static char * VSP_NAME = "Virtual System Profile";
    9.71 -const static char * VSP_INST_ID = "Xen:VirtualSystemProfile";
    9.72 -const static char * VSP_VERSION = "0.7.7";
    9.73 -
    9.74 -
    9.75 -static int generateObjectPath(const char *className,
    9.76 -                              CMPIObjectPath **op,
    9.77 -                              CMPIStatus *status)
    9.78 -{
    9.79 -   const char *instId;
    9.80 -   
    9.81 -   if (strcmp(className, SVP_CLASSNAME) == 0)
    9.82 -      instId = SVP_INST_ID;
    9.83 -   else if (strcmp(className, VSP_CLASSNAME) == 0)
    9.84 -      instId = VSP_INST_ID;
    9.85 -   else {
    9.86 -      _SBLIM_TRACE(1,("--- Invalid class - %s", className));
    9.87 -      CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR, "Invalid class");
    9.88 -      return 1;
    9.89 -   }
    9.90 -      
    9.91 -   *op = CMNewObjectPath(_BROKER, _NAMESPACE, className, status);
    9.92 -   if ((status->rc != CMPI_RC_OK) || CMIsNullObject(*op)) {
    9.93 -      _SBLIM_TRACE(1,("--- CMNewObjectPath() failed - %s", CMGetCharPtr(status->msg)));
    9.94 -      CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR, "Cannot create new CMPIOjbectPath");
    9.95 -      return 1;
    9.96 -   }
    9.97 -      
    9.98 -   CMAddKey(*op, "InstanceID", (CMPIValue *)instId, CMPI_chars);
    9.99 -   return 0;
   9.100 -}
   9.101 -
   9.102 -static int generateInstance(const char *className,
   9.103 -                            CMPIInstance **inst,
   9.104 -                            const char ** properties,
   9.105 -                            CMPIStatus *status)
   9.106 -{
   9.107 -   const char *instId;
   9.108 -   const char *profileName;
   9.109 -   const char *profileVersion;
   9.110 -   
   9.111 -   if (strcmp(className, SVP_CLASSNAME) == 0) {
   9.112 -      instId = SVP_INST_ID;
   9.113 -      profileName = SVP_NAME;
   9.114 -      profileVersion = SVP_VERSION;
   9.115 -   }
   9.116 -   else if (strcmp(className, VSP_CLASSNAME) == 0) {
   9.117 -      instId = VSP_INST_ID;
   9.118 -      profileName = VSP_NAME;
   9.119 -      profileVersion = VSP_VERSION;
   9.120 -   }
   9.121 -   else {
   9.122 -      _SBLIM_TRACE(1,("--- Invalid class - %s", className));
   9.123 -      CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR, "Invalid class");
   9.124 -      return 1;
   9.125 -   }
   9.126 -   
   9.127 -   *inst = _CMNewInstance(_BROKER, _NAMESPACE, (char *)className, status);
   9.128 -   if ((status->rc != CMPI_RC_OK) || CMIsNullObject(*inst)) {
   9.129 -      _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status->msg)));
   9.130 -      CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
   9.131 -      return 1;
   9.132 -   }
   9.133 -      
   9.134 -   /* Setup a filter to only return the desired properties. */
   9.135 -   CMSetPropertyFilter(*inst, properties, _KEYNAMES);
   9.136 -   
   9.137 -   CMSetProperty(*inst, "InstanceID",(CMPIValue *)instId, CMPI_chars);
   9.138 -   CMSetProperty(*inst, "RegisteredName",(CMPIValue *)profileName, CMPI_chars);
   9.139 -   
   9.140 -   int registeredOrg = 2; // "DMTF"
   9.141 -   CMSetProperty(*inst, "RegisteredOrganization",(CMPIValue *)&registeredOrg, CMPI_uint16);
   9.142 -   
   9.143 -   CMSetProperty(*inst, "RegisteredVersion",(CMPIValue *)profileVersion, CMPI_chars);
   9.144 -   return 0;
   9.145 -}
   9.146 -
   9.147 -
   9.148 -// ----------------------------------------------------------------------------
   9.149 -// Cleanup()
   9.150 -// Perform any necessary cleanup immediately before this provider is unloaded.
   9.151 -// ----------------------------------------------------------------------------
   9.152 -static CMPIStatus Cleanup(
   9.153 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   9.154 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   9.155 -        CMPIBoolean terminating)   /* [in] True if MB is terminating */
   9.156 -{
   9.157 -   CMPIStatus status = { CMPI_RC_OK, NULL };	/* Return status of CIM operations. */
   9.158 -
   9.159 -   _SBLIM_ENTER("Cleanup");
   9.160 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   9.161 -   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   9.162 -
   9.163 -   /* Nothing needs to be done for cleanup. */
   9.164 -   _SBLIM_RETURNSTATUS(status);
   9.165 -}
   9.166 -
   9.167 -// ----------------------------------------------------------------------------
   9.168 -// EnumInstanceNames()
   9.169 -// Return a list of all the instances names (return their object paths only).
   9.170 -// ----------------------------------------------------------------------------
   9.171 -static CMPIStatus EnumInstanceNames(
   9.172 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   9.173 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   9.174 -		const CMPIResult * results,		/* [out] Results of this operation. */
   9.175 -		const CMPIObjectPath * reference) 	/* [in] Contains target namespace and classname. */
   9.176 -{
   9.177 -   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   9.178 -   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   9.179 -   char * className = CMGetCharPtr(CMGetClassName(reference, NULL));
   9.180 -  
   9.181 -   _SBLIM_ENTER("EnumInstanceNames");
   9.182 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   9.183 -   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   9.184 -   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   9.185 -   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   9.186 -   _SBLIM_TRACE(2, ("--- class name=\"%s\"", className));
   9.187 -
   9.188 -   /* Should only exist in Interop namespace */
   9.189 -   if (strcmp(namespace, "Interop") != 0) {
   9.190 -      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for System Virtualization Profile", namespace));
   9.191 -      goto exit;
   9.192 -   }
   9.193 -   
   9.194 -   CMPIObjectPath *op = NULL;
   9.195 -   if (generateObjectPath(className, &op, &status))
   9.196 -      goto exit;
   9.197 -   
   9.198 -   _SBLIM_TRACE(2, ("--- returning object path=\"%s\"", CMGetCharPtr(CDToString(_BROKER, op, NULL))));
   9.199 -
   9.200 -   CMReturnObjectPath(results, op);
   9.201 -
   9.202 -exit:
   9.203 -   CMReturnDone(results);
   9.204 -   _SBLIM_RETURNSTATUS(status);
   9.205 -}
   9.206 -
   9.207 -// ----------------------------------------------------------------------------
   9.208 -// EnumInstances()
   9.209 -// Return a list of all the instances (return all the instance data).
   9.210 -// ----------------------------------------------------------------------------
   9.211 -static CMPIStatus EnumInstances(
   9.212 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   9.213 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   9.214 -		const CMPIResult * results,		/* [out] Results of this operation. */
   9.215 -		const CMPIObjectPath * reference,	/* [in] Contains target namespace and classname. */
   9.216 -		const char ** properties)	/* [in] List of desired properties (NULL=all). */
   9.217 -{
   9.218 -   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   9.219 -   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   9.220 -   char * className = CMGetCharPtr(CMGetClassName(reference, NULL));
   9.221 -
   9.222 -   _SBLIM_ENTER("EnumInstances");
   9.223 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   9.224 -   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   9.225 -   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   9.226 -   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   9.227 -   _SBLIM_TRACE(2, ("--- class name=\"%s\"", className));
   9.228 -
   9.229 -   /* Should only exist in Interop namespace */
   9.230 -   if (strcmp(namespace, "Interop") != 0) {
   9.231 -      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for System Virtualization Profile", namespace));
   9.232 -      goto exit;
   9.233 -   }
   9.234 -
   9.235 -   CMPIInstance *instance = NULL;
   9.236 -   if (generateInstance(className, &instance, properties, &status))
   9.237 -         goto exit;
   9.238 -   
   9.239 -   CMReturnInstance(results, instance);
   9.240 -   
   9.241 - exit:
   9.242 -   CMReturnDone(results);
   9.243 -   _SBLIM_RETURNSTATUS(status);
   9.244 -}
   9.245 -
   9.246 -// ----------------------------------------------------------------------------
   9.247 -// GetInstance()
   9.248 -// Return the instance data for the specified instance only.
   9.249 -// ----------------------------------------------------------------------------
   9.250 -static CMPIStatus GetInstance(
   9.251 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   9.252 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   9.253 -		const CMPIResult * results,		/* [out] Results of this operation. */
   9.254 -		const CMPIObjectPath * reference,	/* [in] Contains the target namespace, classname and object path. */
   9.255 -		const char ** properties)		/* [in] List of desired properties (NULL=all). */
   9.256 -{
   9.257 -   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   9.258 -   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   9.259 -   char * className = CMGetCharPtr(CMGetClassName(reference, NULL));
   9.260 -
   9.261 -   _SBLIM_ENTER("GetInstance");
   9.262 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   9.263 -   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   9.264 -   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   9.265 -   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   9.266 -   _SBLIM_TRACE(2, ("--- class name=\"%s\"", className));
   9.267 -
   9.268 -   /* Should only exist in Interop namespace */
   9.269 -   if (strcmp(namespace, "Interop") != 0) {
   9.270 -      _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for System Virtualization Profile", namespace));
   9.271 -      goto exit;
   9.272 -   }
   9.273 -
   9.274 -   /* Verify InstanceID is what we expect. */
   9.275 -   CMPIData data = CMGetKey(reference, "InstanceID", &status);
   9.276 -   if ((status.rc != CMPI_RC_OK) || CMIsNullValue(data)) {
   9.277 -      _SBLIM_TRACE(1,("--- Unable to extract InstanceID key from object path"));
   9.278 -      goto exit;
   9.279 -   }
   9.280 -   
   9.281 -   char *instId = CMGetCharPtr(data.value.string);
   9.282 -   if (instId == NULL ||
   9.283 -       (strcmp(instId, SVP_INST_ID) && strcmp(instId, VSP_INST_ID))) {
   9.284 -      _SBLIM_TRACE(1,("--- \"%s\" is not a valid InstanceID value", (instId ? instId : "NULL")));
   9.285 -      goto exit;
   9.286 -   }
   9.287 -
   9.288 -   CMPIInstance *instance = NULL;
   9.289 -   if (generateInstance(className, &instance, properties, &status))
   9.290 -         goto exit;
   9.291 -
   9.292 -   CMReturnInstance(results, instance);
   9.293 -
   9.294 -   _SBLIM_TRACE(2,("--- instance found"));
   9.295 -
   9.296 -exit:
   9.297 -   CMReturnDone(results);
   9.298 -   _SBLIM_RETURNSTATUS(status);
   9.299 -}
   9.300 -
   9.301 -// ----------------------------------------------------------------------------
   9.302 -// SetInstance()
   9.303 -// Save modified instance data for the specified instance.
   9.304 -// ----------------------------------------------------------------------------
   9.305 -static CMPIStatus SetInstance(
   9.306 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   9.307 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   9.308 -		const CMPIResult * results,		/* [out] Results of this operation. */
   9.309 -		const CMPIObjectPath * reference,	/* [in] Contains the target namespace, classname and object path. */
   9.310 -		const CMPIInstance * newinstance,	/* [in] Contains the new instance data. */
   9.311 -        const char **properties)
   9.312 -{
   9.313 -   CMPIStatus status;	/* Return status of CIM operations. */
   9.314 -   
   9.315 -   CMSetStatus(&status, CMPI_RC_ERR_NOT_SUPPORTED);
   9.316 -   CMReturnDone(results);
   9.317 -
   9.318 -   return (status);
   9.319 -}
   9.320 -
   9.321 -// ----------------------------------------------------------------------------
   9.322 -// CreateInstance()
   9.323 -// Create a new instance from the specified instance data.
   9.324 -// ----------------------------------------------------------------------------
   9.325 -static CMPIStatus CreateInstance(
   9.326 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   9.327 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   9.328 -		const CMPIResult * results,		/* [out] Results of this operation. */
   9.329 -		const CMPIObjectPath * reference,	/* [in] Contains the target namespace, classname and object path. */
   9.330 -		const CMPIInstance * newinstance)	/* [in] Contains the new instance data. */
   9.331 -{
   9.332 -   CMPIStatus status;	/* Return status of CIM operations. */
   9.333 -   
   9.334 -   CMSetStatus(&status, CMPI_RC_ERR_NOT_SUPPORTED);
   9.335 -   CMReturnDone(results);
   9.336 -
   9.337 -   return (status);
   9.338 -}
   9.339 -
   9.340 -// ----------------------------------------------------------------------------
   9.341 -// DeleteInstance()
   9.342 -// Delete or remove the specified instance from the system.
   9.343 -// ----------------------------------------------------------------------------
   9.344 -static CMPIStatus DeleteInstance(
   9.345 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   9.346 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   9.347 -		const CMPIResult * results,		/* [out] Results of this operation. */
   9.348 -		const CMPIObjectPath * reference)	/* [in] Contains the target namespace, classname and object path. */
   9.349 -{
   9.350 -   CMPIStatus status;	/* Return status of CIM operations. */
   9.351 -   
   9.352 -   CMSetStatus(&status, CMPI_RC_ERR_NOT_SUPPORTED);
   9.353 -   CMReturnDone(results);
   9.354 -
   9.355 -   return (status);
   9.356 -}
   9.357 -
   9.358 -
   9.359 -// ----------------------------------------------------------------------------
   9.360 -// ExecQuery()
   9.361 -// Return a list of all the instances that satisfy the specified query filter.
   9.362 -// ----------------------------------------------------------------------------
   9.363 -static CMPIStatus ExecQuery(
   9.364 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   9.365 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   9.366 -		const CMPIResult * results,		/* [out] Results of this operation. */
   9.367 -		const CMPIObjectPath * reference,	/* [in] Contains the target namespace and classname. */
   9.368 -		const char * language,		/* [in] Name of the query language. */
   9.369 -		const char * query)			/* [in] Text of the query written in the query language. */
   9.370 -{
   9.371 -   CMPIStatus status = {CMPI_RC_OK, NULL};      /* Return status of CIM operations. */
   9.372 -   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   9.373 -
   9.374 -   _SBLIM_ENTER("ExecQuery");
   9.375 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   9.376 -   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   9.377 -   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   9.378 -   _SBLIM_TRACE(2, ("--- language=\"%s\"", language));
   9.379 -   _SBLIM_TRACE(2, ("--- query=\"%s\"", query));
   9.380 -   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   9.381 -
   9.382 -   /* EXECQUERY() IS NOT YET SUPPORTED FOR THIS CLASS */
   9.383 -   CMSetStatus(&status, CMPI_RC_ERR_NOT_SUPPORTED);
   9.384 -
   9.385 -   CMReturnDone(results);
   9.386 -
   9.387 -exit:
   9.388 -   _SBLIM_RETURNSTATUS(status);
   9.389 -}
   9.390 -
   9.391 -// ----------------------------------------------------------------------------
   9.392 -// Initialize()
   9.393 -// Perform any necessary initialization immediately after this provider is
   9.394 -// first loaded.
   9.395 -// ----------------------------------------------------------------------------
   9.396 -static void Initialize(
   9.397 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   9.398 -		const CMPIContext * context)		/* [in] Additional context info, if any. */
   9.399 -{
   9.400 -   CMPIString *temp;
   9.401 -   
   9.402 -   _SBLIM_ENTER("Initialize");
   9.403 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   9.404 -   //   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   9.405 -
   9.406 -   /* Nothing needs to be done to initialize this provider */
   9.407 -   _SBLIM_RETURN();
   9.408 -}
   9.409 -
   9.410 -// ============================================================================
   9.411 -// CMPI INSTANCE PROVIDER FUNCTION TABLE SETUP
   9.412 -// ============================================================================
   9.413 -CMInstanceMIStub( , Xen_RegisteredProfiles, _BROKER, Initialize(&mi, ctx));
   9.414 -