os-cmpi-xen

changeset 129:6494910456a8

Ported Xen_Memory to 'Cmpilify' interface.

Removed corresponding resource files that are no longer used.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
author Jim Fehlig <jfehlig@novell.com>
date Mon Jul 16 17:22:22 2007 -0600 (2007-07-16)
parents 0bf03964b16c
children e82eeb0764d6
files ChangeLog src/Makefile.am src/Xen_Memory.c src/Xen_Memory_Resource.c src/Xen_Memory_Resource.h
line diff
     1.1 --- a/ChangeLog	Mon Jul 16 12:33:53 2007 -0600
     1.2 +++ b/ChangeLog	Mon Jul 16 17:22:22 2007 -0600
     1.3 @@ -1,3 +1,9 @@
     1.4 +-------------------------------------------------------------------
     1.5 +Mon Jul 16 17:20:05 MDT 2007 - jfehlig@novell.com
     1.6 +
     1.7 +         - Ported Xen_Memory to 'Cmpilify' interface.  Removed
     1.8 +           corresponding resource files that are no longer used.
     1.9 +
    1.10  -------------------------------------------------------------------
    1.11  Mon Jul 16 12:31:38 MDT 2007 - jfehlig@novell.com
    1.12  
     2.1 --- a/src/Makefile.am	Mon Jul 16 12:33:53 2007 -0600
     2.2 +++ b/src/Makefile.am	Mon Jul 16 17:22:22 2007 -0600
     2.3 @@ -48,7 +48,6 @@ noinst_HEADERS = \
     2.4  	xen_utils.h \
     2.5  	Xen_ComputerSystem_Resource.h \
     2.6  	Xen_VirtualSystemManagementService_Resource.h \
     2.7 -	Xen_Memory_Resource.h \
     2.8  	Xen_NetworkPort_Resource.h \
     2.9  	Xen_Console_Resource.h \
    2.10  	Xen_VirtualizationCapabilities_Resource.h \
    2.11 @@ -152,7 +151,7 @@ libXen_HostedVirtualSystemManagementServ
    2.12  libXen_HostedVirtualSystemManagementService_la_LIBADD = libXen_ProviderCommon.la
    2.13  libXen_HostedVirtualSystemManagementService_la_LDFLAGS = -module -avoid-version -no-undefined
    2.14  
    2.15 -libXen_Memory_la_SOURCES = Xen_Memory.c Xen_Memory_Resource.c
    2.16 +libXen_Memory_la_SOURCES = Xen_Memory.c
    2.17  libXen_Memory_la_CFLAGS = -I../ @LIBXEN_CFLAGS@
    2.18  libXen_Memory_la_LIBADD = libXen_ProviderCommon.la
    2.19  libXen_Memory_la_LDFLAGS = -module -avoid-version -no-undefined
     3.1 --- a/src/Xen_Memory.c	Mon Jul 16 12:33:53 2007 -0600
     3.2 +++ b/src/Xen_Memory.c	Mon Jul 16 17:22:22 2007 -0600
     3.3 @@ -17,629 +17,339 @@
     3.4  // Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
     3.5  //                Tokunbo Adeshiyan, <tokunbo@us.ibm.com>
     3.6  // Contributors:  Jim Fehlig, <jfehlig@novell.com>
     3.7 +//		          Raj Subrahmanian <raj.subrahmanian@unisys.com>
     3.8  // Description:
     3.9  // ============================================================================
    3.10  
    3.11 -/* Include the required CMPI data types, function headers, and macros */
    3.12 -#include "cmpidt.h"
    3.13 -#include "cmpift.h"
    3.14 -#include "cmpimacs.h"
    3.15 +/* Common declarations for each CMPI "Cimpler" instance provider */
    3.16 +// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    3.17 +#include <cmpidt.h>
    3.18 +#include <cmpimacs.h>
    3.19 +
    3.20 +#include "cmpilify.h"
    3.21 +
    3.22 +
    3.23 +static const CMPIInstanceMI* mi;
    3.24 +
    3.25  
    3.26 -/* Include utility functions */
    3.27 -#include "cmpiutil.h"
    3.28 +#define _BROKER (((CMPILIFYInstanceMI*)(mi->hdl))->brkr)
    3.29 +#define _CLASS (((CMPILIFYInstanceMI*)(mi->hdl))->cn)
    3.30 +#define _KEYS (((CMPILIFYInstanceMI*)(mi->hdl))->kys)
    3.31 +
    3.32 +// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    3.33  
    3.34 -/* Include _SBLIM_TRACE() logging support */
    3.35 +#include <stdlib.h>
    3.36 +#include <assert.h>
    3.37 +
    3.38 +#include <xen_common.h>
    3.39 +#include <xen_host.h>
    3.40 +#include <xen_vm.h>
    3.41 +#include <xen_vm_metrics.h>
    3.42 +
    3.43  #include "cmpitrace.h"
    3.44 -
    3.45 -/* Include Xen utilities */
    3.46  #include "xen_utils.h"
    3.47  
    3.48 -/* Include the abstract resource access functions and abstracted _RESOURCES and _RESOURCE data types. */
    3.49 -#include "Xen_Memory_Resource.h"
    3.50 -
    3.51  
    3.52 -// ----------------------------------------------------------------------------
    3.53 -// COMMON GLOBAL VARIABLES
    3.54 -// ----------------------------------------------------------------------------
    3.55 +/* C struct to store the data for all resources. */
    3.56 +typedef struct {
    3.57 +   xen_vm_set *domains;
    3.58 +   size_t cur_domain;
    3.59 +} memory_resources;
    3.60  
    3.61 -/* Handle to the CIM broker. Initialized when the provider lib is loaded. */
    3.62 -static const CMPIBroker *_BROKER;
    3.63  
    3.64  /* Xen session object.  Initialize when the provider is loaded, close when
    3.65   * provider unloaded. */
    3.66  static xen_utils_session *session = NULL;
    3.67  
    3.68  
    3.69 -// ============================================================================
    3.70 -// CMPI INSTANCE PROVIDER FUNCTION TABLE
    3.71 -// ============================================================================
    3.72 -
    3.73 -// ----------------------------------------------------------------------------
    3.74 -// Info for the class supported by the instance provider
    3.75 -// ----------------------------------------------------------------------------
    3.76 -
    3.77 -/* Name of the class implemented by this instance provider. */
    3.78 -/*** CUSTOMIZE FOR EACH PROVIDER ***/
    3.79 -static char * _CLASSNAME = "Xen_Memory";
    3.80 -
    3.81 -/* NULL terminated list of key properties of this class. */
    3.82 -/*** CUSTOMIZE FOR EACH PROVIDER ***/
    3.83 -const static char * _KEYNAMES[] = {"SystemName", "SystemCreationClassName", "DeviceID", "CreationClassName", NULL};
    3.84 +static CMPIrc load()
    3.85 +{
    3.86 +   /* Initialized Xen session object. */
    3.87 +   if (!session)
    3.88 +      xen_utils_xen_init(&session);
    3.89  
    3.90 -// ----------------------------------------------------------------------------
    3.91 -// Cleanup()
    3.92 -// Perform any necessary cleanup immediately before this provider is unloaded.
    3.93 -// ----------------------------------------------------------------------------
    3.94 -static CMPIStatus Cleanup(
    3.95 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
    3.96 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
    3.97 -        CMPIBoolean terminating)   /* [in] True if MB is terminating */
    3.98 +   return CMPI_RC_OK;
    3.99 +}
   3.100 +
   3.101 +
   3.102 +static CMPIrc unload(const int terminating)
   3.103  {
   3.104 -   CMPIStatus status = { CMPI_RC_OK, NULL };	/* Return status of CIM operations. */
   3.105 -
   3.106 -   _SBLIM_ENTER("Cleanup");
   3.107 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   3.108 -   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   3.109 -
   3.110 +   (void)terminating;
   3.111 +   
   3.112 +   /* Close Xen session object. */
   3.113     if (session) {
   3.114        xen_utils_xen_close(session);
   3.115        session = NULL;
   3.116     }
   3.117 -   _SBLIM_RETURNSTATUS(status);
   3.118 +
   3.119 +   return CMPI_RC_OK;
   3.120  }
   3.121  
   3.122 -// ----------------------------------------------------------------------------
   3.123 -// EnumInstanceNames()
   3.124 -// Return a list of all the instances names (return their object paths only).
   3.125 -// ----------------------------------------------------------------------------
   3.126 -static CMPIStatus EnumInstanceNames(
   3.127 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   3.128 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   3.129 -		const CMPIResult * results,		/* [out] Results of this operation. */
   3.130 -		const CMPIObjectPath * reference) 	/* [in] Contains target namespace and classname. */
   3.131 +
   3.132 +static CMPIrc begin(void **res_list, const char **properties)
   3.133  {
   3.134 -   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   3.135 -   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   3.136 -   _RESOURCE * resource;			/* Handle to each system resource. */
   3.137 -   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   3.138 -   int found = 0;				/* Found any instances? */
   3.139 -  
   3.140 -   _SBLIM_ENTER("EnumInstanceNames");
   3.141 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   3.142 -   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   3.143 -   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   3.144 -   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   3.145 -
   3.146 +   memory_resources *resources;
   3.147 +   
   3.148     if (!xen_utils_validate_session(&session)) {
   3.149 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_METHOD_NOT_AVAILABLE, "Unable to connect to xen daemon");
   3.150 -      goto exit;
   3.151 -   }
   3.152 -
   3.153 -   /* Get a handle to the list of system resources. */
   3.154 -   if (!Xen_Memory_getResources(session, &resources)) {
   3.155 -      _SBLIM_TRACE(1,("--- _getResources() failed"));
   3.156 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
   3.157 -      goto exit;
   3.158 -   }
   3.159 -
   3.160 -   /* Enumerate thru the list of system resources and return a CMPIInstance for each. */
   3.161 -   while (Xen_Memory_getNextResource(session, resources, &resource)) {
   3.162 -      /* Create a new CMPIInstance to store this resource. */
   3.163 -      CMPIInstance * instance = _CMNewInstance(_BROKER, namespace, _CLASSNAME, &status);
   3.164 -      if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) {
   3.165 -         _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
   3.166 -         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
   3.167 -         goto exit;
   3.168 -      }
   3.169 -
   3.170 -      /* Set the instance property values from the resource data. */
   3.171 -      if (!Xen_Memory_setInstanceFromResource(session, resource, instance, _BROKER)) {
   3.172 -         _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
   3.173 -         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set property values from resource data");
   3.174 -         goto exit;
   3.175 -      }
   3.176 -
   3.177 -      /* Free the resource data. */
   3.178 -      if (!Xen_Memory_freeResource(resource)) {
   3.179 -         _SBLIM_TRACE(1,("--- _freeResource() failed"));
   3.180 -         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
   3.181 -         goto exit;
   3.182 -      }
   3.183 -
   3.184 -      /* Return the CMPIObjectPath for this instance. */
   3.185 -      CMPIObjectPath * objectpath = CMGetObjectPath(instance, &status);
   3.186 -      if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) {
   3.187 -         _SBLIM_TRACE(1,("--- CMGetObjectPath() failed - %s", CMGetCharPtr(status.msg)));
   3.188 -         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot get CMPIObjectPath for instance");
   3.189 -         goto exit;
   3.190 -      }
   3.191 -      CMSetNameSpace(objectpath, namespace); /* Note - CMGetObjectPath() does not preserve the namespace! */
   3.192 -     
   3.193 -      _SBLIM_TRACE(3,("--- objectpath=\"%s\"", CMGetCharPtr(CDToString(_BROKER, objectpath, NULL))));
   3.194 -      CMReturnObjectPath(results, objectpath);
   3.195 -      found++;
   3.196 -   }
   3.197 -
   3.198 -   _SBLIM_TRACE(2,("--- %d object paths found", found));
   3.199 -   CMReturnDone(results);
   3.200 -
   3.201 -exit:
   3.202 -   /* Free the list of system resources. */
   3.203 -   if (!Xen_Memory_freeResources(resources)) {
   3.204 -      _SBLIM_TRACE(1,("--- _freeResources() failed"));
   3.205 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
   3.206 -   }
   3.207 -  
   3.208 -   _SBLIM_RETURNSTATUS(status);
   3.209 -}
   3.210 -
   3.211 -// ----------------------------------------------------------------------------
   3.212 -// EnumInstances()
   3.213 -// Return a list of all the instances (return all the instance data).
   3.214 -// ----------------------------------------------------------------------------
   3.215 -static CMPIStatus EnumInstances(
   3.216 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   3.217 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   3.218 -		const CMPIResult * results,		/* [out] Results of this operation. */
   3.219 -		const CMPIObjectPath * reference,	/* [in] Contains target namespace and classname. */
   3.220 -		const char ** properties)	/* [in] List of desired properties (NULL=all). */
   3.221 -{
   3.222 -   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   3.223 -   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   3.224 -   _RESOURCE * resource;			/* Handle to each system resource. */
   3.225 -   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   3.226 -   int found = 0;				/* Found any resource instances? */
   3.227 -
   3.228 -   _SBLIM_ENTER("EnumInstances");
   3.229 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   3.230 -   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   3.231 -   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   3.232 -   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   3.233 -
   3.234 -   if (!xen_utils_validate_session(&session)) {
   3.235 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_METHOD_NOT_AVAILABLE, "Unable to connect to xen daemon");
   3.236 -      goto exit;
   3.237 -   }
   3.238 -
   3.239 -   /* Get a handle to the list of system resources. */
   3.240 -   if (!Xen_Memory_getResources(session, &resources)) {
   3.241 -      _SBLIM_TRACE(1,("--- _getResources() failed"));
   3.242 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
   3.243 -      goto exit;
   3.244 +      _SBLIM_TRACE(_SBLIM_TRACE_LEVEL_ERROR,
   3.245 +                   ("--- Unable to establish connection with Xend"));
   3.246 +      return CMPI_RC_ERR_FAILED;
   3.247     }
   3.248  
   3.249 -   /* Enumerate thru the list of system resources and return a CMPIInstance for each. */
   3.250 -   while (Xen_Memory_getNextResource(session, resources, &resource)) {
   3.251 -      /* Create a new CMPIInstance to store this resource. */
   3.252 -      CMPIInstance * instance = _CMNewInstance(_BROKER, namespace, _CLASSNAME, &status);
   3.253 -      if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) {
   3.254 -         _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
   3.255 -         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
   3.256 -         goto exit;
   3.257 -      }
   3.258 -
   3.259 -      /* Setup a filter to only return the desired properties. */
   3.260 -      status = CMSetPropertyFilter(instance, properties, _KEYNAMES);
   3.261 -      if (status.rc != CMPI_RC_OK) {
   3.262 -         _SBLIM_TRACE(1, ("--- CMSetPropertyFilter() failed - %s", CMGetCharPtr(status.msg)));
   3.263 -         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Cannot set property filter");
   3.264 -         goto exit;
   3.265 -      }
   3.266 -
   3.267 -      /* Set the instance property values from the resource data. */
   3.268 -      if (!Xen_Memory_setInstanceFromResource(session, resource, instance, _BROKER)) {
   3.269 -         _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
   3.270 -         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set property values from resource data");
   3.271 -         goto exit;
   3.272 -      }
   3.273 -
   3.274 -      /* Free the resource data. */
   3.275 -      if (!Xen_Memory_freeResource(resource)) {
   3.276 -         _SBLIM_TRACE(1,("--- _freeResource() failed"));
   3.277 -         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
   3.278 -         goto exit;
   3.279 -      }
   3.280 -
   3.281 -      /* Return the CMPIInstance for this instance. */
   3.282 -      _SBLIM_TRACE(3,("--- instance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, instance, NULL))));
   3.283 -      CMReturnInstance(results, instance);
   3.284 -      found++;
   3.285 -   }
   3.286 -
   3.287 -   _SBLIM_TRACE(2,("--- %d instances found", found));
   3.288 -   CMReturnDone(results);
   3.289 -
   3.290 -exit:
   3.291 -   /* Free the list of system resources. */
   3.292 -   if (!Xen_Memory_freeResources(resources)) {
   3.293 -      _SBLIM_TRACE(1,("--- _freeResources() failed"));
   3.294 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
   3.295 -   }
   3.296 -
   3.297 -   _SBLIM_RETURNSTATUS(status);
   3.298 -}
   3.299 +   /* malloc a new handle for the resources list. */
   3.300 +   resources = (memory_resources *)calloc(1, sizeof(memory_resources));
   3.301 +   if (resources == NULL)
   3.302 +      return CMPI_RC_ERR_FAILED;
   3.303  
   3.304 -// ----------------------------------------------------------------------------
   3.305 -// GetInstance()
   3.306 -// Return the instance data for the specified instance only.
   3.307 -// ----------------------------------------------------------------------------
   3.308 -static CMPIStatus GetInstance(
   3.309 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   3.310 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   3.311 -		const CMPIResult * results,		/* [out] Results of this operation. */
   3.312 -		const CMPIObjectPath * reference,	/* [in] Contains the target namespace, classname and object path. */
   3.313 -		const char ** properties)		/* [in] List of desired properties (NULL=all). */
   3.314 -{
   3.315 -   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   3.316 -   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   3.317 -   _RESOURCE * resource;			/* Handle to the system resource. */
   3.318 -   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   3.319 -   int found = 0;				/* Found the target instance? */
   3.320 -
   3.321 -   _SBLIM_ENTER("GetInstance");
   3.322 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   3.323 -   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   3.324 -   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   3.325 -   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   3.326 -
   3.327 -   if (!xen_utils_validate_session(&session)) {
   3.328 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_METHOD_NOT_AVAILABLE, "Unable to connect to xen daemon");
   3.329 -      goto exit;
   3.330 -   }
   3.331 -
   3.332 -   /* Get a handle to the list of system resources. */
   3.333 -   if (!Xen_Memory_getResources(session, &resources)) {
   3.334 -      _SBLIM_TRACE(1,("--- _getResources() failed"));
   3.335 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
   3.336 -      goto exit;
   3.337 -   }
   3.338 -
   3.339 -   /* Get the target resource. */
   3.340 -   found = Xen_Memory_getResourceForObjectPath(session, resources, &resource, reference);
   3.341 -   if (!found || (resource == NULL)) {
   3.342 -      _SBLIM_TRACE(1,("--- Target instance not found"));
   3.343 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_FOUND, "Target instance not found");
   3.344 -      goto exit;
   3.345 -   }
   3.346 -
   3.347 -   /* Create a new CMPIInstance to store this resource. */
   3.348 -   CMPIInstance * instance = _CMNewInstance(_BROKER, namespace, _CLASSNAME, &status);
   3.349 -   if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) {
   3.350 -      _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg)));
   3.351 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance");
   3.352 -      goto exit;
   3.353 -   }
   3.354 -
   3.355 -   /* Setup a filter to only return the desired properties. */
   3.356 -   status = CMSetPropertyFilter(instance, properties, _KEYNAMES);
   3.357 -   if (status.rc != CMPI_RC_OK) {
   3.358 -      _SBLIM_TRACE(1, ("--- CMSetPropertyFilter() failed - %s", CMGetCharPtr(status.msg)));
   3.359 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Cannot set property filter");
   3.360 -      goto exit;
   3.361 -   }
   3.362 -
   3.363 -   /* Set the instance property values from the resource data. */
   3.364 -   if (!Xen_Memory_setInstanceFromResource(session, resource, instance, _BROKER)) {
   3.365 -      _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
   3.366 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set property values from resource data");
   3.367 -      goto exit;
   3.368 -   }
   3.369 -
   3.370 -   /* Free the resource data. */
   3.371 -   if (!Xen_Memory_freeResource(resource)) {
   3.372 -      _SBLIM_TRACE(1,("--- _freeResource() failed"));
   3.373 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
   3.374 -      goto exit;
   3.375 +   if(!xen_host_get_resident_vms(session->xen, &(resources->domains),
   3.376 +                                 session->host)) {
   3.377 +      _SBLIM_TRACE(_SBLIM_TRACE_LEVEL_ERROR,
   3.378 +                   ("--- Failed to retrieve list of domains from host"));
   3.379 +      _SBLIM_TRACE_FUNCTION(_SBLIM_TRACE_LEVEL_ERROR,
   3.380 +                            xen_utils_trace_error(session->xen));
   3.381 +      free(resources);
   3.382 +      return CMPI_RC_ERR_FAILED;
   3.383     }
   3.384  
   3.385 -   /* Return the CMPIInstance for this instance. */
   3.386 -   _SBLIM_TRACE(3,("--- instance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, instance, NULL))));
   3.387 -   CMReturnInstance(results, instance);
   3.388 -
   3.389 -   _SBLIM_TRACE(2,("--- instance found"));
   3.390 -   CMReturnDone(results);
   3.391 -
   3.392 -exit:
   3.393 -   /* Free the list of system resources. */
   3.394 -   if (!Xen_Memory_freeResources(resources)) {
   3.395 -      _SBLIM_TRACE(1,("--- _freeResources() failed"));
   3.396 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
   3.397 -   }
   3.398 -
   3.399 -   _SBLIM_RETURNSTATUS(status);
   3.400 +   *res_list = (void *)resources;
   3.401 +   return CMPI_RC_OK;
   3.402  }
   3.403  
   3.404 -// ----------------------------------------------------------------------------
   3.405 -// SetInstance()
   3.406 -// Save modified instance data for the specified instance.
   3.407 -// ----------------------------------------------------------------------------
   3.408 -static CMPIStatus SetInstance(
   3.409 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   3.410 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   3.411 -		const CMPIResult * results,		/* [out] Results of this operation. */
   3.412 -		const CMPIObjectPath * reference,	/* [in] Contains the target namespace, classname and object path. */
   3.413 -		const CMPIInstance * newinstance,	/* [in] Contains the new instance data. */
   3.414 -        const char **properties)
   3.415 +
   3.416 +static void end(void *res_list)
   3.417  {
   3.418 -   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   3.419 -   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   3.420 -   _RESOURCE * resource;	       		/* Handle to the system resource. */
   3.421 -   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   3.422 -   int found = 0;				/* Found the target instance? */
   3.423 -
   3.424 -   _SBLIM_ENTER("SetInstance");
   3.425 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   3.426 -   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   3.427 -   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   3.428 -   _SBLIM_TRACE(2, ("--- newinstance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, newinstance, NULL))));
   3.429 -   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   3.430 -
   3.431 -   if (!xen_utils_validate_session(&session)) {
   3.432 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_METHOD_NOT_AVAILABLE, "Unable to connect to xen daemon");
   3.433 -      goto exit;
   3.434 -   }
   3.435 -
   3.436 -   /* Get a handle to the list of system resources. */
   3.437 -   if (!Xen_Memory_getResources(session, &resources)) {
   3.438 -      _SBLIM_TRACE(1,("--- _getResources() failed"));
   3.439 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
   3.440 -      goto exit;
   3.441 +   if (res_list) {
   3.442 +      xen_vm_set_free(((memory_resources *)res_list)->domains);
   3.443 +      free(res_list);
   3.444     }
   3.445 -
   3.446 -   /* Get the target resource. */
   3.447 -   found = Xen_Memory_getResourceForObjectPath(session, resources, &resource, reference);
   3.448 -   if (!found || (resource == NULL)) {
   3.449 -      _SBLIM_TRACE(1,("--- Target instance not found"));
   3.450 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_FOUND, "Target instance not found");
   3.451 -      goto exit;
   3.452 -   }
   3.453 -
   3.454 -   _SBLIM_TRACE(2,("--- instance found", found));
   3.455 -
   3.456 -   /* Update the target resource data with the new instance property values. */
   3.457 -   int rc = Xen_Memory_setResourceFromInstance(resource, newinstance, _BROKER);
   3.458 -
   3.459 -   /* Free the resource data. */
   3.460 -   if (!Xen_Memory_freeResource(resource)) {
   3.461 -      _SBLIM_TRACE(1,("--- _freeResource() failed"));
   3.462 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
   3.463 -      goto exit;
   3.464 -   }
   3.465 -
   3.466 -   if (rc != 1) {
   3.467 -      if (rc == -1) {
   3.468 -         _SBLIM_TRACE(1,("--- _setResourceFromInstance() unsupported"));
   3.469 -         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
   3.470 -      } else {
   3.471 -         _SBLIM_TRACE(1,("--- _setResourceFromInstance() failed"));
   3.472 -         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set resource data from instance properties");
   3.473 -      }
   3.474 -      goto exit;
   3.475 -   }
   3.476 -
   3.477 -exit:
   3.478 -   /* Free the list of system resources. */
   3.479 -   if (!Xen_Memory_freeResources(resources)) {
   3.480 -      _SBLIM_TRACE(1,("--- _freeResources() failed"));
   3.481 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
   3.482 -   }
   3.483 -
   3.484 -   _SBLIM_RETURNSTATUS(status);
   3.485  }
   3.486  
   3.487 -// ----------------------------------------------------------------------------
   3.488 -// CreateInstance()
   3.489 -// Create a new instance from the specified instance data.
   3.490 -// ----------------------------------------------------------------------------
   3.491 -static CMPIStatus CreateInstance(
   3.492 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   3.493 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   3.494 -		const CMPIResult * results,		/* [out] Results of this operation. */
   3.495 -		const CMPIObjectPath * reference,	/* [in] Contains the target namespace, classname and object path. */
   3.496 -		const CMPIInstance * newinstance)	/* [in] Contains the new instance data. */
   3.497 -{
   3.498 -   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   3.499 -   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   3.500 -   _RESOURCE * resource;			/* Handle to the system resource. */
   3.501 -   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   3.502 -   int found = 0;				/* Found the target instance? */
   3.503 -
   3.504 -   _SBLIM_ENTER("CreateInstance");
   3.505 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   3.506 -   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   3.507 -   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   3.508 -   _SBLIM_TRACE(2, ("--- newinstance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, newinstance, NULL))));
   3.509 -   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   3.510 -
   3.511 -   if (!xen_utils_validate_session(&session)) {
   3.512 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_METHOD_NOT_AVAILABLE, "Unable to connect to xen daemon");
   3.513 -      goto exit;
   3.514 -   }
   3.515 -
   3.516 -   /* WORKAROUND FOR PEGASUS BUG?! reference does not contain object path, only namespace & classname. */
   3.517 -   reference = CMGetObjectPath(newinstance, NULL);
   3.518  
   3.519 -   /* Get a handle to the list of system resources. */
   3.520 -   if (!Xen_Memory_getResources(session, &resources)) {
   3.521 -      _SBLIM_TRACE(1,("--- _getResources() failed"));
   3.522 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
   3.523 -      goto exit;
   3.524 -   }
   3.525 -
   3.526 -   /* Get the target resource. */
   3.527 -   found = Xen_Memory_getResourceForObjectPath(session, resources, &resource, reference);
   3.528 -
   3.529 -   /* Free the resource data. */
   3.530 -   if (!Xen_Memory_freeResource(resource)) {
   3.531 -      _SBLIM_TRACE(1,("--- _freeResource() failed"));
   3.532 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
   3.533 -      goto exit;
   3.534 -   }
   3.535 +/* Iterator to get the next resource from the resources list. */
   3.536 +static CMPIrc getnext(void *res_list, void **res, const char **properties)
   3.537 +{
   3.538 +   memory_resources *resources = (memory_resources *)res_list;
   3.539  
   3.540 -   if (found) {
   3.541 -      _SBLIM_TRACE(1,("--- Target instance already exists"));
   3.542 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_ALREADY_EXISTS, "Target instance already exists");
   3.543 -      goto exit;
   3.544 -   }
   3.545 +   if (resources == NULL)
   3.546 +      return CMPI_RC_ERR_FAILED;
   3.547  
   3.548 -   /* Create a new resource with the new instance property values. */
   3.549 -   int rc = Xen_Memory_createResourceFromInstance(resources, &resource, newinstance, _BROKER);
   3.550 -   if (rc != 1) {
   3.551 -      if (rc == -1) {
   3.552 -         _SBLIM_TRACE(1,("--- _createResourceFromInstance() unsupported"));
   3.553 -         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
   3.554 -      } else {
   3.555 -         _SBLIM_TRACE(1,("--- _createResourceFromInstance() failed"));
   3.556 -         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to create resource data from instance properties");
   3.557 -      }
   3.558 -      goto exit;
   3.559 -   }
   3.560 -
   3.561 -   /* Return the object path for the newly created instance. */
   3.562 -   CMPIObjectPath * objectpath = CMGetObjectPath(newinstance, NULL);
   3.563 -   CMSetNameSpace(objectpath, namespace);
   3.564 -   CMReturnObjectPath(results, objectpath);
   3.565 -   CMReturnDone(results);
   3.566 +   session->xen->ok = true;
   3.567  
   3.568 -exit:
   3.569 -   /* Free the list of system resources. */
   3.570 -   if (!Xen_Memory_freeResources(resources)) {
   3.571 -      _SBLIM_TRACE(1,("--- _freeResources() failed"));
   3.572 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
   3.573 -   }
   3.574 -
   3.575 -   _SBLIM_RETURNSTATUS(status);
   3.576 -}
   3.577 -
   3.578 -// ----------------------------------------------------------------------------
   3.579 -// DeleteInstance()
   3.580 -// Delete or remove the specified instance from the system.
   3.581 -// ----------------------------------------------------------------------------
   3.582 -static CMPIStatus DeleteInstance(
   3.583 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   3.584 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   3.585 -		const CMPIResult * results,		/* [out] Results of this operation. */
   3.586 -		const CMPIObjectPath * reference)	/* [in] Contains the target namespace, classname and object path. */
   3.587 -{
   3.588 -   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   3.589 -   _RESOURCES * resources = NULL;			/* Handle to the list of system resources. */
   3.590 -   _RESOURCE * resource;		/* Handle to the system resource. */
   3.591 -   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   3.592 -   int found = 0;				/* Found the target instance? */
   3.593 -
   3.594 -   _SBLIM_ENTER("DeleteInstance");
   3.595 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   3.596 -   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   3.597 -   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   3.598 -   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   3.599 -
   3.600 -   if (!xen_utils_validate_session(&session)) {
   3.601 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_METHOD_NOT_AVAILABLE, "Unable to connect to xen daemon");
   3.602 -      goto exit;
   3.603 -   }
   3.604 +   /* Get next memory resource.  Ignore inactive domains. */
   3.605 +   while (resources->cur_domain < resources->domains->size) {
   3.606 +      xen_vm_record *vm_rec;
   3.607 +      if (!xen_vm_get_record(session->xen, &vm_rec,
   3.608 +                          resources->domains->contents[resources->cur_domain])) {
   3.609 +         _SBLIM_TRACE(_SBLIM_TRACE_LEVEL_ERROR,
   3.610 +                      ("--- Failed to retrieve VM record from xend"));
   3.611 +         _SBLIM_TRACE_FUNCTION(_SBLIM_TRACE_LEVEL_ERROR,
   3.612 +                               xen_utils_trace_error(session->xen));
   3.613 +         return CMPI_RC_ERR_FAILED;
   3.614 +      }
   3.615 +      
   3.616 +      if (vm_rec->power_state == XEN_VM_POWER_STATE_HALTED) {
   3.617 +         xen_vm_record_free(vm_rec);
   3.618 +         resources->cur_domain++;
   3.619 +         continue;
   3.620 +      }
   3.621  
   3.622 -   /* Get a handle to the list of system resources. */
   3.623 -   if (!Xen_Memory_getResources(session, &resources)) {
   3.624 -      _SBLIM_TRACE(1,("--- _getResources() failed"));
   3.625 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources");
   3.626 -      goto exit;
   3.627 -   }
   3.628 -
   3.629 -   /* Get the target resource. */
   3.630 -   found = Xen_Memory_getResourceForObjectPath(session, resources, &resource, reference);
   3.631 -   if (!found || (resource == NULL)) {
   3.632 -      _SBLIM_TRACE(1,("--- Target instance not found"));
   3.633 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_FOUND, "Target instance not found");
   3.634 -      goto exit;
   3.635 +      resources->cur_domain++;
   3.636 +      *res = (void *)vm_rec;
   3.637 +      return CMPI_RC_OK;
   3.638     }
   3.639 -
   3.640 -   _SBLIM_TRACE(2,("--- instance found", found));
   3.641 -
   3.642 -   /* Delete the target resource. */
   3.643 -   int rc = Xen_Memory_deleteResource(resources, resource);
   3.644 -
   3.645 -   /* Free the resource data. */
   3.646 -   if (!Xen_Memory_freeResource(resource)) {
   3.647 -      _SBLIM_TRACE(1,("--- _freeResource() failed"));
   3.648 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data");
   3.649 -      goto exit;
   3.650 -   }
   3.651 -
   3.652 -   if (rc != 1) {
   3.653 -      if (rc == -1) {
   3.654 -         _SBLIM_TRACE(1,("--- __deleteResource() unsupported"));
   3.655 -         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
   3.656 -      } else {
   3.657 -         _SBLIM_TRACE(1,("--- _deleteResource() failed"));
   3.658 -         CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to delete resource");
   3.659 -      }
   3.660 -      goto exit;
   3.661 -   }
   3.662 -
   3.663 -exit:
   3.664 -   /* Free the list of system resources. */
   3.665 -   if (!Xen_Memory_freeResources(resources)) {
   3.666 -      _SBLIM_TRACE(1,("--- _freeResources() failed"));
   3.667 -      CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources");
   3.668 -   }
   3.669 -
   3.670 -   _SBLIM_RETURNSTATUS(status);
   3.671 +   
   3.672 +   return CMPI_RC_ERR_NOT_FOUND;
   3.673  }
   3.674  
   3.675  
   3.676 -// ----------------------------------------------------------------------------
   3.677 -// ExecQuery()
   3.678 -// Return a list of all the instances that satisfy the specified query filter.
   3.679 -// ----------------------------------------------------------------------------
   3.680 -static CMPIStatus ExecQuery(
   3.681 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   3.682 -		const CMPIContext * context,		/* [in] Additional context info, if any. */
   3.683 -		const CMPIResult * results,		/* [out] Results of this operation. */
   3.684 -		const CMPIObjectPath * reference,	/* [in] Contains the target namespace and classname. */
   3.685 -		const char * language,		/* [in] Name of the query language. */
   3.686 -		const char * query)			/* [in] Text of the query written in the query language. */
   3.687 +static CMPIrc get(const void *res_id, void **res, const char **properties)
   3.688  {
   3.689 -   CMPIStatus status = {CMPI_RC_OK, NULL};      /* Return status of CIM operations. */
   3.690 -   char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */
   3.691 +   CMPIInstance *inst = (CMPIInstance *)res_id;
   3.692 +   CMPIData data;
   3.693 +   CMPIStatus status = {CMPI_RC_OK, NULL};
   3.694 +   char *prop_val;
   3.695 +   
   3.696 +   if (CMIsNullObject(inst) || res == NULL)
   3.697 +      return CMPI_RC_ERR_FAILED;
   3.698 +
   3.699 +   /* Obtain the target domain name from instance's "SystemName" property. */
   3.700 +   data = CMGetProperty(inst, "SystemName", &status);
   3.701 +   if ((status.rc != CMPI_RC_OK) || CMIsNullValue(data))
   3.702 +      return CMPI_RC_ERR_FAILED;
   3.703 +
   3.704 +   prop_val = CMGetCharPtr(data.value.string);
   3.705 +   if ((prop_val == NULL) || (*prop_val == '\0'))
   3.706 +      return CMPI_RC_ERR_FAILED;
   3.707 +
   3.708 +   if (!xen_utils_validate_session(&session)) {
   3.709 +      _SBLIM_TRACE(_SBLIM_TRACE_LEVEL_ERROR,
   3.710 +                   ("--- Unable to establish connection with Xend"));
   3.711 +      return CMPI_RC_ERR_FAILED;
   3.712 +   }
   3.713 +   
   3.714 +   /* Get the domain data for the target domain name. */
   3.715 +   xen_vm_set *vms;
   3.716 +   if (!xen_vm_get_by_name_label(session->xen, &vms, prop_val)) {
   3.717 +      _SBLIM_TRACE(_SBLIM_TRACE_LEVEL_WARNING,
   3.718 +                   ("--- Failed to retrieve domain %s", prop_val));
   3.719 +      _SBLIM_TRACE_FUNCTION(_SBLIM_TRACE_LEVEL_ERROR,
   3.720 +                            xen_utils_trace_error(session->xen));
   3.721 +      return CMPI_RC_ERR_FAILED;
   3.722 +   }
   3.723 +
   3.724 +   assert(vms->size == 1);
   3.725 +   xen_vm_record *vm_rec;
   3.726 +   if (!xen_vm_get_record(session->xen, &vm_rec, vms->contents[0])) {
   3.727 +      _SBLIM_TRACE(_SBLIM_TRACE_LEVEL_ERROR,
   3.728 +                   ("--- Failed to retrieve domain record for %s", prop_val));
   3.729 +      _SBLIM_TRACE_FUNCTION(_SBLIM_TRACE_LEVEL_ERROR,
   3.730 +                            xen_utils_trace_error(session->xen));
   3.731 +      xen_vm_set_free(vms);
   3.732 +      return CMPI_RC_ERR_FAILED;
   3.733 +   }
   3.734  
   3.735 -   _SBLIM_ENTER("ExecQuery");
   3.736 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   3.737 -   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   3.738 -   _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL))));
   3.739 -   _SBLIM_TRACE(2, ("--- language=\"%s\"", language));
   3.740 -   _SBLIM_TRACE(2, ("--- query=\"%s\"", query));
   3.741 -   _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace));
   3.742 +   xen_vm_set_free(vms);
   3.743 +
   3.744 +   /* 
   3.745 +    * Xen_Memory instances only exist when domain is not inactive.
   3.746 +    * Incoming object path must be from a previously active domain.
   3.747 +    */
   3.748 +   if (vm_rec->power_state == XEN_VM_POWER_STATE_HALTED) {
   3.749 +         xen_vm_record_free(vm_rec);
   3.750 +         return CMPI_RC_ERR_NOT_FOUND;
   3.751 +   }
   3.752 +   
   3.753 +   *res = (void *)vm_rec;
   3.754 +   return CMPI_RC_OK;
   3.755 +}
   3.756 +
   3.757 +
   3.758 +static void release(void *res)
   3.759 +{
   3.760 +   if (res)
   3.761 +      xen_vm_record_free((xen_vm_record *)res);
   3.762 +}
   3.763 +
   3.764  
   3.765 -   /* EXECQUERY() IS NOT YET SUPPORTED FOR THIS CLASS */
   3.766 -   CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL);
   3.767 +static CMPIrc add(const void *res_id, const void *res)
   3.768 +{
   3.769 +   (void)res_id;
   3.770 +   (void)res;
   3.771 +   
   3.772 +   return CMPI_RC_ERR_NOT_SUPPORTED; /* unsupported */
   3.773 +}
   3.774 +
   3.775  
   3.776 -   CMReturnDone(results);
   3.777 +static CMPIrc delete(const void *res_id)
   3.778 +{
   3.779 +   (void)res_id;
   3.780 +   
   3.781 +   return  CMPI_RC_ERR_NOT_SUPPORTED; /* unsupported */
   3.782 +}
   3.783 +
   3.784  
   3.785 -exit:
   3.786 -   _SBLIM_RETURNSTATUS(status);
   3.787 +static CMPIrc modify(const void *res_id, const void *modified_res,
   3.788 +                     const char **properties)
   3.789 +{
   3.790 +   (void)res_id;
   3.791 +   (void)modified_res;
   3.792 +   (void)properties;
   3.793 +   
   3.794 +   return CMPI_RC_ERR_NOT_SUPPORTED; /* unsupported */
   3.795  }
   3.796  
   3.797 -// ----------------------------------------------------------------------------
   3.798 -// Initialize()
   3.799 -// Perform any necessary initialization immediately after this provider is
   3.800 -// first loaded.
   3.801 -// ----------------------------------------------------------------------------
   3.802 -static void Initialize(
   3.803 -		CMPIInstanceMI * self,		/* [in] Handle to this provider (i.e. 'self'). */
   3.804 -		const CMPIContext * context)		/* [in] Additional context info, if any. */
   3.805 +
   3.806 +/* Set CMPIInstance properties from the resource data. */
   3.807 +static CMPIrc setproperties(CMPIInstance *inst, const void *res,
   3.808 +                            const char **properties)
   3.809  {
   3.810 -   _SBLIM_ENTER("Initialize");
   3.811 -   _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName));
   3.812 -   //   _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL))));
   3.813 +   xen_vm_record *vm_rec = (xen_vm_record *)res;
   3.814 +
   3.815 +   (void)properties;
   3.816 +   
   3.817 +   if (vm_rec == NULL)
   3.818 +      return CMPI_RC_ERR_FAILED;
   3.819 +
   3.820 +   if (CMIsNullObject(inst))
   3.821 +      return CMPI_RC_ERR_FAILED;
   3.822 +
   3.823 +   /* Set the CMPIInstance properties from the resource data. */
   3.824 +   CMSetProperty(inst, "SystemCreationClassName",
   3.825 +                 (CMPIValue *)"Xen_ComputerSystem", CMPI_chars);
   3.826 +   CMSetProperty(inst, "SystemName",
   3.827 +                 (CMPIValue *)vm_rec->name_label, CMPI_chars);
   3.828 +   CMSetProperty(inst, "CreationClassName",
   3.829 +                 (CMPIValue *)"Xen_Memory", CMPI_chars);
   3.830 +   
   3.831 +   CMSetProperty(inst, "DeviceID",(CMPIValue *)"Memory0", CMPI_chars);
   3.832 +
   3.833 +   CMSetProperty(inst, "Caption",(CMPIValue *)"Main Memory", CMPI_chars);
   3.834 +   CMSetProperty(inst, "Description",
   3.835 +                 (CMPIValue *)"Main Memory", CMPI_chars);
   3.836 +   CMSetProperty(inst, "Purpose",(CMPIValue *)"Main Memory", CMPI_chars);
   3.837 +   CMSetProperty(inst, "Name",(CMPIValue *)"Memory0", CMPI_chars);
   3.838  
   3.839 -   /* Initialized Xen session object. */
   3.840 -   if (session == NULL)
   3.841 -      xen_utils_xen_init(&session);
   3.842 +   /* BlockSize should be set to 1 as per Core/CIM_StorageExtent.mof. */
   3.843 +   uint64_t blocksize = 1;
   3.844 +   CMSetProperty(inst, "BlockSize", (CMPIValue *)&blocksize, CMPI_uint64);
   3.845 +
   3.846 +   int64_t blocks = vm_rec->memory_dynamic_max;
   3.847 +   CMSetProperty(inst, "NumberOfBlocks", (CMPIValue *)&blocks, CMPI_uint64);
   3.848  
   3.849 -   _SBLIM_RETURN();
   3.850 +   // Get the memory_actual
   3.851 +   if (vm_rec->metrics->is_record)
   3.852 +      blocks = vm_rec->metrics->u.record->memory_actual;
   3.853 +   else {
   3.854 +      if (!xen_vm_metrics_get_memory_actual(session->xen, &blocks,
   3.855 +                                            vm_rec->metrics->u.handle)) {
   3.856 +         _SBLIM_TRACE(_SBLIM_TRACE_LEVEL_ERROR,
   3.857 +                      ("--- Failed to retrieve domain memory usage"));
   3.858 +         _SBLIM_TRACE_FUNCTION(_SBLIM_TRACE_LEVEL_ERROR,
   3.859 +                               xen_utils_trace_error(session->xen));
   3.860 +         return CMPI_RC_ERR_FAILED;
   3.861 +      }
   3.862 +   }
   3.863 +   
   3.864 +   CMSetProperty(inst, "ConsumableBlocks", (CMPIValue *)&blocks, CMPI_uint64);
   3.865 +   CMSetProperty(inst, "Status", (CMPIValue *)"OK", CMPI_chars);
   3.866 +   
   3.867 +   return CMPI_RC_OK;
   3.868  }
   3.869  
   3.870 -// ============================================================================
   3.871 -// CMPI INSTANCE PROVIDER FUNCTION TABLE SETUP
   3.872 -// ============================================================================
   3.873 -CMInstanceMIStub( , Xen_Memory, _BROKER, Initialize(&mi, ctx));
   3.874 +
   3.875 +/*
   3.876 + * Set resource data from the CMPIInstance properties.  Only needs to
   3.877 + * be implemented if add() and/or modify() are supported.
   3.878 + */
   3.879 +static CMPIrc extract(void **res, const CMPIInstance *inst,
   3.880 +                      const char **properties)
   3.881 +{
   3.882 +   (void)res;
   3.883 +   (void)inst;
   3.884 +   (void)properties;
   3.885 +   
   3.886 +   return CMPI_RC_ERR_NOT_SUPPORTED;  /* unsupported */
   3.887 +}
   3.888 +
   3.889 +
   3.890 +/* Get resource id from CMPIInstance properties. */
   3.891 +static CMPIrc extractid(void **res_id, const CMPIInstance* inst)
   3.892 +{
   3.893 +   *res_id = (void *)inst;
   3.894 +   return CMPI_RC_OK;
   3.895 +}
   3.896 +
   3.897 +
   3.898 +/* Release resource id created in resId4inst(). */
   3.899 +static void releaseid(void* res_id)
   3.900 +{
   3.901 +   (void)res_id;
   3.902 +}
   3.903 +
   3.904 +
   3.905 +/* Setup CMPILIFY function tables and instance provider entry point.*/
   3.906 +/* CMPILIFYInstanceMIStub(<CLASS>,<PROVIDER_NAME>,<keys>,<CMPIInstanceMI_HANDLE>) */
   3.907 +static char * keys[] = {"SystemCreationClassName", "SystemName",
   3.908 +                        "CreationClassName", "DeviceID", NULL};
   3.909 +
   3.910 +CMPILIFYInstanceMIStub(Xen_Memory, Xen_Memory, keys, mi)
     4.1 --- a/src/Xen_Memory_Resource.c	Mon Jul 16 12:33:53 2007 -0600
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,223 +0,0 @@
     4.4 -// Copyright (C) 2006 IBM Corporation
     4.5 -//
     4.6 -//    This library is free software; you can redistribute it and/or
     4.7 -//    modify it under the terms of the GNU Lesser General Public
     4.8 -//    License as published by the Free Software Foundation; either
     4.9 -//    version 2.1 of the License, or (at your option) any later version.
    4.10 -//
    4.11 -//    This library is distributed in the hope that it will be useful,
    4.12 -//    but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.13 -//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    4.14 -//    Lesser General Public License for more details.
    4.15 -//
    4.16 -//    You should have received a copy of the GNU Lesser General Public
    4.17 -//    License along with this library; if not, write to the Free Software
    4.18 -//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    4.19 -// ============================================================================
    4.20 -// Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
    4.21 -//                Tokunbo Adeshiyan, <tokunbo@us.ibm.com>
    4.22 -// Contributors:  Jim Fehlig, <jfehlig@novell.com>
    4.23 -//		  Raj Subrahmanian <raj.subrahmanian@unisys.com>
    4.24 -// Description:
    4.25 -// ============================================================================
    4.26 -
    4.27 -#include <xen_common.h>
    4.28 -#include <xen_vm.h>
    4.29 -#include <xen_vm_metrics.h>
    4.30 -
    4.31 -#include <stdlib.h>
    4.32 -#include <assert.h>
    4.33 -
    4.34 -#include "Xen_Memory_Resource.h"
    4.35 -
    4.36 -/* Include the required CMPI data types, function headers, and macros. */
    4.37 -#include "cmpidt.h"
    4.38 -#include "cmpift.h"
    4.39 -#include "cmpimacs.h"
    4.40 -
    4.41 -#include "xen_utils.h"
    4.42 -
    4.43 -// ----------------------------------------------------------------------------
    4.44 -
    4.45 -/* Get a handle to the list of all system resources for this class. */
    4.46 -int Xen_Memory_getResources(xen_utils_session *session,
    4.47 -                            _RESOURCES ** resources)
    4.48 -{
    4.49 -   return xen_utils_get_domain_resources(session, resources);
    4.50 -}
    4.51 -
    4.52 -// ----------------------------------------------------------------------------
    4.53 -
    4.54 -/* Free/deallocate/cleanup the resources list after use. */
    4.55 -int Xen_Memory_freeResources(_RESOURCES * resources)
    4.56 -{
    4.57 -   return xen_utils_free_domain_resources(resources);
    4.58 -}
    4.59 -
    4.60 -// ----------------------------------------------------------------------------
    4.61 -
    4.62 -/* Iterator to get the next resource from the resources list. */
    4.63 -int Xen_Memory_getNextResource(xen_utils_session *session,
    4.64 -                               _RESOURCES * resources,
    4.65 -                               _RESOURCE ** resource)
    4.66 -{
    4.67 -   /* Check if reached the end of the list of Xen domain names. */
    4.68 -   if (!XEN_UTILS_MORE_DOMAIN_RESOURCES(resources))
    4.69 -      return 0;
    4.70 -
    4.71 -   /* Get the current domain. */
    4.72 -   if (!xen_utils_get_next_domain_resource(session, resources, resource))
    4.73 -      return 0;
    4.74 -
    4.75 -   /* Only serve up memory devices if the domain is not halted */
    4.76 -   if ((*resource)->power_state == XEN_VM_POWER_STATE_HALTED)
    4.77 -      goto NextDomain;
    4.78 -
    4.79 -   return 1;
    4.80 -
    4.81 - NextDomain:
    4.82 -   /* All memory devices in this domain have been exhausted. */
    4.83 -   /* Start serving up memory devices for the next domain, if it exists */
    4.84 -   Xen_Memory_freeResource(*resource);
    4.85 -   if (!XEN_UTILS_MORE_DOMAIN_RESOURCES(resources))
    4.86 -      return 0;
    4.87 -
    4.88 -   /* Get the next domain resource. */
    4.89 -   if (!xen_utils_get_next_domain_resource(session, resources, resource))
    4.90 -      return 0;
    4.91 -
    4.92 -   /* Only serve up block devices if the domain is not inactive */
    4.93 -   if ((*resource)->power_state == XEN_VM_POWER_STATE_HALTED)
    4.94 -      goto NextDomain;
    4.95 -
    4.96 -   return 1;
    4.97 -}
    4.98 -
    4.99 -// ----------------------------------------------------------------------------
   4.100 -
   4.101 -/* Get the specific resource that matches the CMPI object path. */
   4.102 -int Xen_Memory_getResourceForObjectPath(xen_utils_session *session,
   4.103 -                                        _RESOURCES * resources,
   4.104 -                                        _RESOURCE ** resource,
   4.105 -                                        const CMPIObjectPath * objectpath)
   4.106 -{
   4.107 -   CMPIStatus status = {CMPI_RC_OK, NULL};	/* Return status of CIM operations. */
   4.108 -
   4.109 -   if (resources == NULL) return 0;
   4.110 -   if (CMIsNullObject(objectpath)) return 0;
   4.111 -
   4.112 -   /* Obtain the target domain name from the CMPIObjectPath "SystemName" key. */
   4.113 -   CMPIData namedata = CMGetKey(objectpath, "SystemName", &status);
   4.114 -   if ((status.rc != CMPI_RC_OK) || CMIsNullValue(namedata)) return 0;
   4.115 -
   4.116 -   /* Extract the domain name string from the CMPIString. */
   4.117 -   char * domainname = CMGetCharPtr(namedata.value.string);
   4.118 -   if ((domainname == NULL) || (*domainname == '\0')) return 0;
   4.119 -
   4.120 -   /* Get the domain data for the target domain name. */
   4.121 -   xen_vm_set *vms;
   4.122 -   if (!xen_vm_get_by_name_label(session->xen, &vms, domainname)) {
   4.123 -      /* Error is in session object! */
   4.124 -      *resource = NULL;
   4.125 -      return 0;
   4.126 -   }
   4.127 -
   4.128 -   assert(vms->size == 1);
   4.129 -   if (!xen_vm_get_record(session->xen, resource, vms->contents[0])) {
   4.130 -      /* Error description in session object! */
   4.131 -      xen_vm_set_free(vms);
   4.132 -      return 0;
   4.133 -   }
   4.134 -
   4.135 -   xen_vm_set_free(vms);
   4.136 -
   4.137 -   return 1;
   4.138 -}
   4.139 -
   4.140 -// ----------------------------------------------------------------------------
   4.141 -
   4.142 -/* Free/deallocate/cleanup the resource after use. */
   4.143 -int Xen_Memory_freeResource(_RESOURCE * resource)
   4.144 -{
   4.145 -   return xen_utils_free_domain_resource(resource);
   4.146 -}
   4.147 -
   4.148 -// ---------------------------------------------------------------------------- 
   4.149 -
   4.150 -/* Set the property values of a CMPI instance from a specific resource. 
   4.151 -   Added session parameter so that the memory_actual value can be picked up from xen_vm_metrics : Raj Subrahmanian 04/04/2007*/
   4.152 -int Xen_Memory_setInstanceFromResource(xen_utils_session *session,
   4.153 -				       _RESOURCE * resource,
   4.154 -                                       const CMPIInstance * instance,
   4.155 -                                       const CMPIBroker * broker)
   4.156 -{
   4.157 -   if (resource == NULL) return 0;
   4.158 -   if (CMIsNullObject(instance)) return 0;
   4.159 -
   4.160 -   /* Set the CMPIInstance properties from the resource data. */
   4.161 -   CMSetProperty(instance, "SystemCreationClassName",(CMPIValue *)"Xen_ComputerSystem", CMPI_chars);
   4.162 -   CMSetProperty(instance, "SystemName",(CMPIValue *)resource->name_label, CMPI_chars);
   4.163 -   CMSetProperty(instance, "CreationClassName",(CMPIValue *)"Xen_Memory", CMPI_chars);
   4.164 -   CMSetProperty(instance, "DeviceID",(CMPIValue *)"Memory1", CMPI_chars);
   4.165 -
   4.166 -   CMSetProperty(instance, "Caption",(CMPIValue *)"Main Memory", CMPI_chars);
   4.167 -   CMSetProperty(instance, "Description",(CMPIValue *)"Main Memory", CMPI_chars);
   4.168 -   CMSetProperty(instance, "Purpose",(CMPIValue *)"Main Memory", CMPI_chars);
   4.169 -   CMSetProperty(instance, "Name",(CMPIValue *)"Memory1", CMPI_chars);
   4.170 -
   4.171 -   /* BlockSize should be set to 1 as per Core/CIM_StorageExtent.mof. */
   4.172 -   uint64_t blocksize = 1;
   4.173 -   CMSetProperty(instance, "BlockSize", (CMPIValue *)&blocksize, CMPI_uint64);
   4.174 -
   4.175 -   int64_t blocks = resource->memory_dynamic_max;
   4.176 -   CMSetProperty(instance, "NumberOfBlocks", (CMPIValue *)&blocks, CMPI_uint64);
   4.177 -   
   4.178 -   // Get the memory_actual
   4.179 -   if (resource->metrics->is_record)
   4.180 -	blocks=resource->metrics->u.record->memory_actual;
   4.181 -   else	
   4.182 -	xen_vm_metrics_get_memory_actual(session->xen, &blocks, resource->metrics->u.handle);
   4.183 -   CMSetProperty(instance, "ConsumableBlocks", (CMPIValue *)&blocks, CMPI_uint64);
   4.184 -
   4.185 -   if (resource->power_state == XEN_VM_POWER_STATE_RUNNING) 
   4.186 -      CMSetProperty(instance, "Status", (CMPIValue *)"OK", CMPI_chars);
   4.187 -   else
   4.188 -      CMSetProperty(instance, "Status", (CMPIValue *)"No Contact", CMPI_chars);
   4.189 -
   4.190 -   return 1;
   4.191 -}
   4.192 -
   4.193 -// ----------------------------------------------------------------------------
   4.194 -
   4.195 -/* Delete the specified resource from the system. */
   4.196 -int Xen_Memory_deleteResource(_RESOURCES * resources, _RESOURCE * resource)
   4.197 -{
   4.198 -   /* Unsupported. */
   4.199 -   return -1;
   4.200 -}
   4.201 -
   4.202 -// ----------------------------------------------------------------------------
   4.203 -
   4.204 -/* Modify the specified resource using the property values of a CMPI instance. */
   4.205 -int Xen_Memory_setResourceFromInstance(_RESOURCE * resource,
   4.206 -                                       const CMPIInstance * instance,
   4.207 -                                       const CMPIBroker * broker)
   4.208 -{
   4.209 -   /* TODO - support ballooning DomU memory here */
   4.210 -
   4.211 -   /* Unsupported. */
   4.212 -   return -1;
   4.213 -}
   4.214 -
   4.215 -// ----------------------------------------------------------------------------
   4.216 -
   4.217 -/* Create a new resource using the property values of a CMPI instance. */
   4.218 -int Xen_Memory_createResourceFromInstance(_RESOURCES * resources,
   4.219 -                                          _RESOURCE ** resource,
   4.220 -                                          const CMPIInstance * instance,
   4.221 -                                          const CMPIBroker * broker)
   4.222 -{
   4.223 -   /* Unsupported. */
   4.224 -   return -1;
   4.225 -}
   4.226 -
     5.1 --- a/src/Xen_Memory_Resource.h	Mon Jul 16 12:33:53 2007 -0600
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,101 +0,0 @@
     5.4 -// Copyright (C) 2006 IBM Corporation
     5.5 -//
     5.6 -//    This library is free software; you can redistribute it and/or
     5.7 -//    modify it under the terms of the GNU Lesser General Public
     5.8 -//    License as published by the Free Software Foundation; either
     5.9 -//    version 2.1 of the License, or (at your option) any later version.
    5.10 -//
    5.11 -//    This library is distributed in the hope that it will be useful,
    5.12 -//    but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.13 -//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    5.14 -//    Lesser General Public License for more details.
    5.15 -//
    5.16 -//    You should have received a copy of the GNU Lesser General Public
    5.17 -//    License along with this library; if not, write to the Free Software
    5.18 -//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    5.19 -// ============================================================================
    5.20 -// Authors:       Dr. Gareth S. Bestor, <bestor@us.ibm.com>
    5.21 -//                Tokunbo Adeshiyan, <tokunbo@us.ibm.com>
    5.22 -// Contributors:  Jim Fehlig, <jfehlig@novell.com>
    5.23 -// Description:
    5.24 -// ============================================================================
    5.25 -
    5.26 -/* Include required libxen headers. */
    5.27 -#include <xen_common.h>
    5.28 -#include <xen_vm.h>
    5.29 -
    5.30 -#include "xen_utils.h"
    5.31 -
    5.32 -/*** CUSTOMIZE FOR EACH PROVIDER ***/
    5.33 -/* DEFINE A HANDLE TO REPRESENT THE 'LIST' OF ALL SYSTEM RESOURCES.
    5.34 -   THE MAIN PROVIDER CODE DOES NOT NEED TO KNOW THE PARTICULARS OF HOW THIS
    5.35 -   LIST IS IMPLEMENTED - IT MAY BE AN ARRAY, LINKED LIST, FILE, ETC.
    5.36 -   THIS HANDLE IS PASSED INTO THE APPROPRIATE RESOURCE ACCESS METHODS WHEN
    5.37 -   ACCESSING/ITERATING/ADDING/REMOVING RESOURCES INSTANCES. */
    5.38 -typedef xen_domain_resources  _RESOURCES;
    5.39 -
    5.40 -/*** CUSTOMIZE FOR EACH PROVIDER ***/
    5.41 -/* DEFINE A HANDLE TO BE USED FOR EACH INSTANCE OF A SYSTEM RESOURCE.
    5.42 -   THE MAIN PROVIDER CODE DOES NOT NEED TO KNOW THE PARTICULARS OF HOW EACH
    5.43 -   RESOURCE IS REPRESENTED, BUT TYPICALLY IT IS A STRUCTURE MIRRORING THE
    5.44 -   PROPERTIES IN THE CIM CLASS. THIS HANDLE IS PASSED BETWEEN THE RESOURCE
    5.45 -   ACCESS METHODS WHEN MANIPULATING SPECIFIC RESOURCE INSTANCES. */
    5.46 -typedef xen_vm_record  _RESOURCE;
    5.47 -
    5.48 -
    5.49 -/* NOTHING BELOW THIS LINE SHOULD NEED TO BE CHANGED. */
    5.50 -
    5.51 -/* Include the required CMPI data types. */
    5.52 -#include "cmpidt.h"
    5.53 -
    5.54 -// ----------------------------------------------------------------------------
    5.55 -// Generic resource access methods for CMPI providers.
    5.56 -// Return value:
    5.57 -//	-1 = Unsupported
    5.58 -//	 0 = Failed
    5.59 -//	 1 = OK
    5.60 -// ----------------------------------------------------------------------------
    5.61 -
    5.62 -/* Get a handle to the list of all system resources for this class. */
    5.63 -int Xen_Memory_getResources(xen_utils_session *session,
    5.64 -                            _RESOURCES ** resources);
    5.65 -
    5.66 -/* Free/deallocate/cleanup the resources list after use. */
    5.67 -int Xen_Memory_freeResources(_RESOURCES * resources);
    5.68 -
    5.69 -/* Iterator to get the next resource from the resources list. */
    5.70 -int Xen_Memory_getNextResource(xen_utils_session *session,
    5.71 -                               _RESOURCES * resources,
    5.72 -                               _RESOURCE ** resource);
    5.73 -
    5.74 -/* Get the specific resource that matches the CMPI object path. */
    5.75 -int Xen_Memory_getResourceForObjectPath(xen_utils_session *session,
    5.76 -                                        _RESOURCES * resources,
    5.77 -                                        _RESOURCE ** resource,
    5.78 -                                        const CMPIObjectPath * objectpath);
    5.79 -
    5.80 -/* Free/deallocate/cleanup a resource after use. */
    5.81 -int Xen_Memory_freeResource(_RESOURCE * resource);
    5.82 -
    5.83 -/* Set the property values of a CMPI instance from a specific resource. */
    5.84 -int Xen_Memory_setInstanceFromResource(xen_utils_session *session,
    5.85 -				       _RESOURCE * resource,
    5.86 -                                       const CMPIInstance * instance,
    5.87 -                                       const CMPIBroker * broker);
    5.88 -
    5.89 -// THE FOLLOWING METHODS MAY/NOT BE SUPPORTED BY THE SYSTEM FOR THIS CLASS
    5.90 -
    5.91 -/* Delete the specified resource from the system. */
    5.92 -int Xen_Memory_deleteResource(_RESOURCES * resources, _RESOURCE * resource);
    5.93 -
    5.94 -/* Modify the specified resource using the property values of a CMPI instance. */
    5.95 -int Xen_Memory_setResourceFromInstance(_RESOURCE * resource,
    5.96 -                                       const CMPIInstance * instance,
    5.97 -                                       const CMPIBroker * broker);
    5.98 -
    5.99 -/* Create a new resource using the property values of a CMPI instance. */
   5.100 -int Xen_Memory_createResourceFromInstance(_RESOURCES * resources,
   5.101 -                                          _RESOURCE ** resource,
   5.102 -                                          const CMPIInstance * instance,
   5.103 -                                          const CMPIBroker * broker);
   5.104 -