os-cmpi-xen
annotate src/Xen_ProcessorPool.c @ 31:33d4316c01a2
Fixed compilation warings throughout the project. Nearly all files touched.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
author | jfehlig@jfehlig3.provo.novell.com |
---|---|
date | Tue Oct 24 11:30:03 2006 -0600 (2006-10-24) |
parents | 16d625984bc4 |
children | 75b18359b74d |
rev | line source |
---|---|
jbulpin@0 | 1 // Copyright (C) 2006 IBM Corporation |
jbulpin@0 | 2 // |
jbulpin@0 | 3 // This library is free software; you can redistribute it and/or |
jbulpin@0 | 4 // modify it under the terms of the GNU Lesser General Public |
jbulpin@0 | 5 // License as published by the Free Software Foundation; either |
jbulpin@0 | 6 // version 2.1 of the License, or (at your option) any later version. |
jbulpin@0 | 7 // |
jbulpin@0 | 8 // This library is distributed in the hope that it will be useful, |
jbulpin@0 | 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
jbulpin@0 | 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
jbulpin@0 | 11 // Lesser General Public License for more details. |
jbulpin@0 | 12 // |
jbulpin@0 | 13 // You should have received a copy of the GNU Lesser General Public |
jbulpin@0 | 14 // License along with this library; if not, write to the Free Software |
jbulpin@0 | 15 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
jbulpin@0 | 16 // ============================================================================ |
jbulpin@0 | 17 // Authors: Dr. Gareth S. Bestor, <bestor@us.ibm.com> |
jfehlig@25 | 18 // Jim Fehlig, <jfehlig@novell.com> |
jbulpin@0 | 19 // Contributors: |
jbulpin@0 | 20 // Description: |
jbulpin@0 | 21 // ============================================================================ |
jbulpin@0 | 22 |
jbulpin@0 | 23 /* Include the required CMPI data types, function headers, and macros */ |
jbulpin@0 | 24 #include "cmpidt.h" |
jbulpin@0 | 25 #include "cmpift.h" |
jbulpin@0 | 26 #include "cmpimacs.h" |
jbulpin@0 | 27 |
jfehlig@25 | 28 #include "provider_common.h" |
jbulpin@0 | 29 |
jbulpin@0 | 30 // ---------------------------------------------------------------------------- |
jbulpin@0 | 31 // COMMON GLOBAL VARIABLES |
jbulpin@0 | 32 // ---------------------------------------------------------------------------- |
jbulpin@0 | 33 |
jbulpin@0 | 34 /* Handle to the CIM broker. Initialized when the provider lib is loaded. */ |
jfehlig@31 | 35 static const CMPIBroker *_BROKER; |
jbulpin@0 | 36 |
jbulpin@0 | 37 /* Include utility functions */ |
jbulpin@0 | 38 #include "cmpiutil.h" |
jbulpin@0 | 39 |
jbulpin@0 | 40 /* Include _SBLIM_TRACE() logging support */ |
jbulpin@0 | 41 #include "cmpitrace.h" |
jbulpin@0 | 42 |
jbulpin@0 | 43 /* Include the abstract resource access functions and abstracted _RESOURCES and _RESOURCE data types. */ |
jbulpin@0 | 44 #include "Xen_ProcessorPool_Resource.h" |
jbulpin@0 | 45 |
jbulpin@0 | 46 |
jbulpin@0 | 47 // ============================================================================ |
jbulpin@0 | 48 // CMPI INSTANCE PROVIDER FUNCTION TABLE |
jbulpin@0 | 49 // ============================================================================ |
jbulpin@0 | 50 |
jbulpin@0 | 51 // ---------------------------------------------------------------------------- |
jbulpin@0 | 52 // Info for the class supported by the instance provider |
jbulpin@0 | 53 // ---------------------------------------------------------------------------- |
jbulpin@0 | 54 |
jbulpin@0 | 55 /* Name of the class implemented by this instance provider. */ |
jbulpin@0 | 56 /*** CUSTOMIZE FOR EACH PROVIDER ***/ |
jbulpin@0 | 57 static char * _CLASSNAME = "Xen_ProcessorPool"; |
jbulpin@0 | 58 |
jbulpin@0 | 59 /* NULL terminated list of key properties of this class. */ |
jbulpin@0 | 60 /*** CUSTOMIZE FOR EACH PROVIDER ***/ |
jfehlig@14 | 61 const static char * _KEYNAMES[] = {"InstanceID", NULL}; |
jbulpin@0 | 62 |
jbulpin@0 | 63 // ---------------------------------------------------------------------------- |
jbulpin@0 | 64 // Cleanup() |
jbulpin@0 | 65 // Perform any necessary cleanup immediately before this provider is unloaded. |
jbulpin@0 | 66 // ---------------------------------------------------------------------------- |
jbulpin@0 | 67 static CMPIStatus Cleanup( |
jbulpin@0 | 68 CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ |
jfehlig@31 | 69 const CMPIContext * context, /* [in] Additional context info, if any. */ |
jfehlig@31 | 70 CMPIBoolean terminating) /* [in] True if MB is terminating */ |
jbulpin@0 | 71 { |
jbulpin@0 | 72 CMPIStatus status = { CMPI_RC_OK, NULL }; /* Return status of CIM operations. */ |
jbulpin@0 | 73 |
jbulpin@0 | 74 _SBLIM_ENTER("Cleanup"); |
jbulpin@0 | 75 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); |
jbulpin@0 | 76 _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); |
jbulpin@0 | 77 |
jbulpin@0 | 78 /* Nothing needs to be done for cleanup. */ |
jbulpin@0 | 79 _SBLIM_RETURNSTATUS(status); |
jbulpin@0 | 80 } |
jbulpin@0 | 81 |
jbulpin@0 | 82 // ---------------------------------------------------------------------------- |
jbulpin@0 | 83 // EnumInstanceNames() |
jbulpin@0 | 84 // Return a list of all the instances names (return their object paths only). |
jbulpin@0 | 85 // ---------------------------------------------------------------------------- |
jbulpin@0 | 86 static CMPIStatus EnumInstanceNames( |
jbulpin@0 | 87 CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ |
jfehlig@31 | 88 const CMPIContext * context, /* [in] Additional context info, if any. */ |
jfehlig@31 | 89 const CMPIResult * results, /* [out] Results of this operation. */ |
jfehlig@31 | 90 const CMPIObjectPath * reference) /* [in] Contains target namespace and classname. */ |
jbulpin@0 | 91 { |
jbulpin@0 | 92 CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */ |
jfehlig@25 | 93 _RESOURCES * resources = NULL; /* Handle to the list of system resources. */ |
jbulpin@0 | 94 _RESOURCE * resource; /* Handle to each system resource. */ |
jbulpin@0 | 95 char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ |
jbulpin@0 | 96 int found = 0; /* Found any instances? */ |
jbulpin@0 | 97 |
jbulpin@0 | 98 _SBLIM_ENTER("EnumInstanceNames"); |
jbulpin@0 | 99 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); |
jbulpin@0 | 100 _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); |
jbulpin@0 | 101 _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); |
jbulpin@0 | 102 _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); |
jbulpin@0 | 103 |
jfehlig@25 | 104 if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) { |
jfehlig@25 | 105 _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME)); |
jfehlig@25 | 106 goto exit; |
jfehlig@25 | 107 } |
jfehlig@25 | 108 |
jbulpin@0 | 109 /* Get a handle to the list of system resources. */ |
jbulpin@0 | 110 if (!Xen_ProcessorPool_getResources(&resources)) { |
jbulpin@0 | 111 _SBLIM_TRACE(1,("--- _getResources() failed")); |
jbulpin@0 | 112 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources"); |
jbulpin@0 | 113 goto exit; |
jbulpin@0 | 114 } |
jbulpin@0 | 115 |
jbulpin@0 | 116 /* Enumerate thru the list of system resources and return a CMPIInstance for each. */ |
jfehlig@16 | 117 while (Xen_ProcessorPool_getNextResource(resources, &resource, _BROKER, context)) { |
jbulpin@0 | 118 /* Create a new CMPIInstance to store this resource. */ |
jbulpin@0 | 119 CMPIInstance * instance = _CMNewInstance(_BROKER, namespace, _CLASSNAME, &status); |
jbulpin@0 | 120 if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { |
jbulpin@0 | 121 _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg))); |
jbulpin@0 | 122 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance"); |
jbulpin@0 | 123 goto exit; |
jbulpin@0 | 124 } |
jbulpin@0 | 125 |
jbulpin@0 | 126 /* Set the instance property values from the resource data. */ |
jbulpin@0 | 127 if (!Xen_ProcessorPool_setInstanceFromResource(resource, instance, _BROKER)) { |
jbulpin@0 | 128 _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed")); |
jbulpin@0 | 129 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set property values from resource data"); |
jbulpin@0 | 130 goto exit; |
jbulpin@0 | 131 } |
jbulpin@0 | 132 |
jbulpin@0 | 133 /* Free the resource data. */ |
jbulpin@0 | 134 if (!Xen_ProcessorPool_freeResource(resource)) { |
jbulpin@0 | 135 _SBLIM_TRACE(1,("--- _freeResource() failed")); |
jbulpin@0 | 136 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data"); |
jbulpin@0 | 137 goto exit; |
jbulpin@0 | 138 } |
jbulpin@0 | 139 |
jbulpin@0 | 140 /* Return the CMPIObjectPath for this instance. */ |
jbulpin@0 | 141 CMPIObjectPath * objectpath = CMGetObjectPath(instance, &status); |
jbulpin@0 | 142 if ((status.rc != CMPI_RC_OK) || CMIsNullObject(objectpath)) { |
jbulpin@0 | 143 _SBLIM_TRACE(1,("--- CMGetObjectPath() failed - %s", CMGetCharPtr(status.msg))); |
jbulpin@0 | 144 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot get CMPIObjectPath for instance"); |
jbulpin@0 | 145 goto exit; |
jbulpin@0 | 146 } |
jbulpin@0 | 147 CMSetNameSpace(objectpath, namespace); /* Note - CMGetObjectPath() does not preserve the namespace! */ |
jbulpin@0 | 148 |
jbulpin@0 | 149 _SBLIM_TRACE(3,("--- objectpath=\"%s\"", CMGetCharPtr(CDToString(_BROKER, objectpath, NULL)))); |
jbulpin@0 | 150 CMReturnObjectPath(results, objectpath); |
jbulpin@0 | 151 found++; |
jbulpin@0 | 152 } |
jbulpin@0 | 153 |
jbulpin@0 | 154 _SBLIM_TRACE(2,("--- %d object paths found", found)); |
jbulpin@0 | 155 CMReturnDone(results); |
jbulpin@0 | 156 |
jbulpin@0 | 157 exit: |
jbulpin@0 | 158 /* Free the list of system resources. */ |
jbulpin@0 | 159 if (!Xen_ProcessorPool_freeResources(resources)) { |
jbulpin@0 | 160 _SBLIM_TRACE(1,("--- _freeResources() failed")); |
jbulpin@0 | 161 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources"); |
jbulpin@0 | 162 } |
jbulpin@0 | 163 |
jbulpin@0 | 164 _SBLIM_RETURNSTATUS(status); |
jbulpin@0 | 165 } |
jbulpin@0 | 166 |
jbulpin@0 | 167 // ---------------------------------------------------------------------------- |
jbulpin@0 | 168 // EnumInstances() |
jbulpin@0 | 169 // Return a list of all the instances (return all the instance data). |
jbulpin@0 | 170 // ---------------------------------------------------------------------------- |
jbulpin@0 | 171 static CMPIStatus EnumInstances( |
jbulpin@0 | 172 CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ |
jfehlig@31 | 173 const CMPIContext * context, /* [in] Additional context info, if any. */ |
jfehlig@31 | 174 const CMPIResult * results, /* [out] Results of this operation. */ |
jfehlig@31 | 175 const CMPIObjectPath * reference, /* [in] Contains target namespace and classname. */ |
jbulpin@0 | 176 const char ** properties) /* [in] List of desired properties (NULL=all). */ |
jbulpin@0 | 177 { |
jbulpin@0 | 178 CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */ |
jfehlig@25 | 179 _RESOURCES * resources = NULL; /* Handle to the list of system resources. */ |
jbulpin@0 | 180 _RESOURCE * resource; /* Handle to each system resource. */ |
jbulpin@0 | 181 char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ |
jbulpin@0 | 182 int found = 0; /* Found any resource instances? */ |
jbulpin@0 | 183 |
jbulpin@0 | 184 _SBLIM_ENTER("EnumInstances"); |
jbulpin@0 | 185 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); |
jbulpin@0 | 186 _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); |
jbulpin@0 | 187 _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); |
jbulpin@0 | 188 _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); |
jbulpin@0 | 189 |
jfehlig@25 | 190 if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) { |
jfehlig@25 | 191 _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME)); |
jfehlig@25 | 192 goto exit; |
jfehlig@25 | 193 } |
jfehlig@25 | 194 |
jbulpin@0 | 195 /* Get a handle to the list of system resources. */ |
jbulpin@0 | 196 if (!Xen_ProcessorPool_getResources(&resources)) { |
jbulpin@0 | 197 _SBLIM_TRACE(1,("--- _getResources() failed")); |
jbulpin@0 | 198 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources"); |
jbulpin@0 | 199 goto exit; |
jbulpin@0 | 200 } |
jbulpin@0 | 201 |
jbulpin@0 | 202 /* Enumerate thru the list of system resources and return a CMPIInstance for each. */ |
jfehlig@16 | 203 while (Xen_ProcessorPool_getNextResource(resources, &resource, _BROKER, context)) { |
jbulpin@0 | 204 /* Create a new CMPIInstance to store this resource. */ |
jbulpin@0 | 205 CMPIInstance * instance = _CMNewInstance(_BROKER, namespace, _CLASSNAME, &status); |
jbulpin@0 | 206 if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { |
jbulpin@0 | 207 _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg))); |
jbulpin@0 | 208 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance"); |
jbulpin@0 | 209 goto exit; |
jbulpin@0 | 210 } |
jbulpin@0 | 211 |
jbulpin@0 | 212 /* Setup a filter to only return the desired properties. */ |
jbulpin@0 | 213 status = CMSetPropertyFilter(instance, properties, _KEYNAMES); |
jbulpin@0 | 214 if (status.rc != CMPI_RC_OK) { |
jbulpin@0 | 215 _SBLIM_TRACE(1, ("--- CMSetPropertyFilter() failed - %s", CMGetCharPtr(status.msg))); |
jbulpin@0 | 216 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Cannot set property filter"); |
jbulpin@0 | 217 goto exit; |
jbulpin@0 | 218 } |
jbulpin@0 | 219 |
jbulpin@0 | 220 /* Set the instance property values from the resource data. */ |
jbulpin@0 | 221 if (!Xen_ProcessorPool_setInstanceFromResource(resource, instance, _BROKER)) { |
jbulpin@0 | 222 _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed")); |
jbulpin@0 | 223 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set property values from resource data"); |
jbulpin@0 | 224 goto exit; |
jbulpin@0 | 225 } |
jbulpin@0 | 226 |
jbulpin@0 | 227 /* Free the resource data. */ |
jbulpin@0 | 228 if (!Xen_ProcessorPool_freeResource(resource)) { |
jbulpin@0 | 229 _SBLIM_TRACE(1,("--- _freeResource() failed")); |
jbulpin@0 | 230 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data"); |
jbulpin@0 | 231 goto exit; |
jbulpin@0 | 232 } |
jbulpin@0 | 233 |
jbulpin@0 | 234 /* Return the CMPIInstance for this instance. */ |
jbulpin@0 | 235 _SBLIM_TRACE(3,("--- instance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, instance, NULL)))); |
jbulpin@0 | 236 CMReturnInstance(results, instance); |
jbulpin@0 | 237 found++; |
jbulpin@0 | 238 } |
jbulpin@0 | 239 |
jbulpin@0 | 240 _SBLIM_TRACE(2,("--- %d instances found", found)); |
jbulpin@0 | 241 CMReturnDone(results); |
jbulpin@0 | 242 |
jbulpin@0 | 243 exit: |
jbulpin@0 | 244 /* Free the list of system resources. */ |
jbulpin@0 | 245 if (!Xen_ProcessorPool_freeResources(resources)) { |
jbulpin@0 | 246 _SBLIM_TRACE(1,("--- _freeResources() failed")); |
jbulpin@0 | 247 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources"); |
jbulpin@0 | 248 } |
jbulpin@0 | 249 |
jbulpin@0 | 250 _SBLIM_RETURNSTATUS(status); |
jbulpin@0 | 251 } |
jbulpin@0 | 252 |
jbulpin@0 | 253 // ---------------------------------------------------------------------------- |
jbulpin@0 | 254 // GetInstance() |
jbulpin@0 | 255 // Return the instance data for the specified instance only. |
jbulpin@0 | 256 // ---------------------------------------------------------------------------- |
jbulpin@0 | 257 static CMPIStatus GetInstance( |
jbulpin@0 | 258 CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ |
jfehlig@31 | 259 const CMPIContext * context, /* [in] Additional context info, if any. */ |
jfehlig@31 | 260 const CMPIResult * results, /* [out] Results of this operation. */ |
jfehlig@31 | 261 const CMPIObjectPath * reference, /* [in] Contains the target namespace, classname and object path. */ |
jbulpin@0 | 262 const char ** properties) /* [in] List of desired properties (NULL=all). */ |
jbulpin@0 | 263 { |
jbulpin@0 | 264 CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */ |
jfehlig@25 | 265 _RESOURCES * resources = NULL; /* Handle to the list of system resources. */ |
jbulpin@0 | 266 _RESOURCE * resource; /* Handle to the system resource. */ |
jbulpin@0 | 267 char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ |
jbulpin@0 | 268 int found = 0; /* Found the target instance? */ |
jbulpin@0 | 269 |
jbulpin@0 | 270 _SBLIM_ENTER("GetInstance"); |
jbulpin@0 | 271 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); |
jbulpin@0 | 272 _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); |
jbulpin@0 | 273 _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); |
jbulpin@0 | 274 _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); |
jbulpin@0 | 275 |
jfehlig@25 | 276 if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) { |
jfehlig@25 | 277 _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME)); |
jfehlig@25 | 278 goto exit; |
jfehlig@25 | 279 } |
jfehlig@25 | 280 |
jbulpin@0 | 281 /* Get a handle to the list of system resources. */ |
jbulpin@0 | 282 if (!Xen_ProcessorPool_getResources(&resources)) { |
jbulpin@0 | 283 _SBLIM_TRACE(1,("--- _getResources() failed")); |
jbulpin@0 | 284 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources"); |
jbulpin@0 | 285 goto exit; |
jbulpin@0 | 286 } |
jbulpin@0 | 287 |
jbulpin@0 | 288 /* Get the target resource. */ |
jfehlig@16 | 289 found = Xen_ProcessorPool_getResourceForObjectPath(resources, &resource, reference, _BROKER, context); |
jbulpin@0 | 290 if (!found || (resource == NULL)) { |
jbulpin@0 | 291 _SBLIM_TRACE(1,("--- Target instance not found")); |
jbulpin@0 | 292 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_FOUND, "Target instance not found"); |
jbulpin@0 | 293 goto exit; |
jbulpin@0 | 294 } |
jbulpin@0 | 295 |
jbulpin@0 | 296 /* Create a new CMPIInstance to store this resource. */ |
jbulpin@0 | 297 CMPIInstance * instance = _CMNewInstance(_BROKER, namespace, _CLASSNAME, &status); |
jbulpin@0 | 298 if ((status.rc != CMPI_RC_OK) || CMIsNullObject(instance)) { |
jbulpin@0 | 299 _SBLIM_TRACE(1,("--- CMNewInstance() failed - %s", CMGetCharPtr(status.msg))); |
jbulpin@0 | 300 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERROR, "Cannot create new CMPIInstance"); |
jbulpin@0 | 301 goto exit; |
jbulpin@0 | 302 } |
jbulpin@0 | 303 |
jbulpin@0 | 304 /* Setup a filter to only return the desired properties. */ |
jbulpin@0 | 305 status = CMSetPropertyFilter(instance, properties, _KEYNAMES); |
jbulpin@0 | 306 if (status.rc != CMPI_RC_OK) { |
jbulpin@0 | 307 _SBLIM_TRACE(1, ("--- CMSetPropertyFilter() failed - %s", CMGetCharPtr(status.msg))); |
jbulpin@0 | 308 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Cannot set property filter"); |
jbulpin@0 | 309 goto exit; |
jbulpin@0 | 310 } |
jbulpin@0 | 311 |
jbulpin@0 | 312 /* Set the instance property values from the resource data. */ |
jbulpin@0 | 313 if (!Xen_ProcessorPool_setInstanceFromResource(resource, instance, _BROKER)) { |
jbulpin@0 | 314 _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed")); |
jbulpin@0 | 315 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set property values from resource data"); |
jbulpin@0 | 316 goto exit; |
jbulpin@0 | 317 } |
jbulpin@0 | 318 |
jbulpin@0 | 319 /* Free the resource data. */ |
jbulpin@0 | 320 if (!Xen_ProcessorPool_freeResource(resource)) { |
jbulpin@0 | 321 _SBLIM_TRACE(1,("--- _freeResource() failed")); |
jbulpin@0 | 322 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data"); |
jbulpin@0 | 323 goto exit; |
jbulpin@0 | 324 } |
jbulpin@0 | 325 |
jbulpin@0 | 326 /* Return the CMPIInstance for this instance. */ |
jbulpin@0 | 327 _SBLIM_TRACE(3,("--- instance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, instance, NULL)))); |
jbulpin@0 | 328 CMReturnInstance(results, instance); |
jbulpin@0 | 329 |
jbulpin@0 | 330 _SBLIM_TRACE(2,("--- instance found")); |
jbulpin@0 | 331 CMReturnDone(results); |
jbulpin@0 | 332 |
jbulpin@0 | 333 exit: |
jbulpin@0 | 334 /* Free the list of system resources. */ |
jbulpin@0 | 335 if (!Xen_ProcessorPool_freeResources(resources)) { |
jbulpin@0 | 336 _SBLIM_TRACE(1,("--- _freeResources() failed")); |
jbulpin@0 | 337 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources"); |
jbulpin@0 | 338 } |
jbulpin@0 | 339 |
jbulpin@0 | 340 _SBLIM_RETURNSTATUS(status); |
jbulpin@0 | 341 } |
jbulpin@0 | 342 |
jbulpin@0 | 343 // ---------------------------------------------------------------------------- |
jbulpin@0 | 344 // SetInstance() |
jbulpin@0 | 345 // Save modified instance data for the specified instance. |
jbulpin@0 | 346 // ---------------------------------------------------------------------------- |
jbulpin@0 | 347 static CMPIStatus SetInstance( |
jbulpin@0 | 348 CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ |
jfehlig@31 | 349 const CMPIContext * context, /* [in] Additional context info, if any. */ |
jfehlig@31 | 350 const CMPIResult * results, /* [out] Results of this operation. */ |
jfehlig@31 | 351 const CMPIObjectPath * reference, /* [in] Contains the target namespace, classname and object path. */ |
jfehlig@31 | 352 const CMPIInstance * newinstance, /* [in] Contains the new instance data. */ |
jfehlig@31 | 353 const char **properties) |
jbulpin@0 | 354 { |
jbulpin@0 | 355 CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */ |
jfehlig@25 | 356 _RESOURCES * resources = NULL; /* Handle to the list of system resources. */ |
jbulpin@0 | 357 _RESOURCE * resource; /* Handle to the system resource. */ |
jbulpin@0 | 358 char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ |
jbulpin@0 | 359 int found = 0; /* Found the target instance? */ |
jbulpin@0 | 360 |
jbulpin@0 | 361 _SBLIM_ENTER("SetInstance"); |
jbulpin@0 | 362 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); |
jbulpin@0 | 363 _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); |
jbulpin@0 | 364 _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); |
jbulpin@0 | 365 _SBLIM_TRACE(2, ("--- newinstance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, newinstance, NULL)))); |
jbulpin@0 | 366 _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); |
jbulpin@0 | 367 |
jfehlig@25 | 368 if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) { |
jfehlig@25 | 369 _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME)); |
jfehlig@25 | 370 goto exit; |
jfehlig@25 | 371 } |
jfehlig@25 | 372 |
jbulpin@0 | 373 /* Get a handle to the list of system resources. */ |
jbulpin@0 | 374 if (!Xen_ProcessorPool_getResources(&resources)) { |
jbulpin@0 | 375 _SBLIM_TRACE(1,("--- _getResources() failed")); |
jbulpin@0 | 376 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources"); |
jbulpin@0 | 377 goto exit; |
jbulpin@0 | 378 } |
jbulpin@0 | 379 |
jbulpin@0 | 380 /* Get the target resource. */ |
jfehlig@16 | 381 found = Xen_ProcessorPool_getResourceForObjectPath(resources, &resource, reference, _BROKER, context); |
jbulpin@0 | 382 if (!found || (resource == NULL)) { |
jbulpin@0 | 383 _SBLIM_TRACE(1,("--- Target instance not found")); |
jbulpin@0 | 384 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_FOUND, "Target instance not found"); |
jbulpin@0 | 385 goto exit; |
jbulpin@0 | 386 } |
jbulpin@0 | 387 |
jbulpin@0 | 388 _SBLIM_TRACE(2,("--- instance found", found)); |
jbulpin@0 | 389 |
jbulpin@0 | 390 /* Update the target resource data with the new instance property values. */ |
jbulpin@0 | 391 int rc = Xen_ProcessorPool_setResourceFromInstance(resource, newinstance, _BROKER); |
jbulpin@0 | 392 |
jbulpin@0 | 393 /* Free the resource data. */ |
jbulpin@0 | 394 if (!Xen_ProcessorPool_freeResource(resource)) { |
jbulpin@0 | 395 _SBLIM_TRACE(1,("--- _freeResource() failed")); |
jbulpin@0 | 396 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data"); |
jbulpin@0 | 397 goto exit; |
jbulpin@0 | 398 } |
jbulpin@0 | 399 |
jbulpin@0 | 400 if (rc != 1) { |
jbulpin@0 | 401 if (rc == -1) { |
jbulpin@0 | 402 _SBLIM_TRACE(1,("--- _setResourceFromInstance() unsupported")); |
jbulpin@0 | 403 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); |
jbulpin@0 | 404 } else { |
jbulpin@0 | 405 _SBLIM_TRACE(1,("--- _setResourceFromInstance() failed")); |
jbulpin@0 | 406 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set resource data from instance properties"); |
jbulpin@0 | 407 } |
jbulpin@0 | 408 goto exit; |
jbulpin@0 | 409 } |
jbulpin@0 | 410 |
jbulpin@0 | 411 exit: |
jbulpin@0 | 412 /* Free the list of system resources. */ |
jbulpin@0 | 413 if (!Xen_ProcessorPool_freeResources(resources)) { |
jbulpin@0 | 414 _SBLIM_TRACE(1,("--- _freeResources() failed")); |
jbulpin@0 | 415 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources"); |
jbulpin@0 | 416 } |
jbulpin@0 | 417 |
jbulpin@0 | 418 _SBLIM_RETURNSTATUS(status); |
jbulpin@0 | 419 } |
jbulpin@0 | 420 |
jbulpin@0 | 421 // ---------------------------------------------------------------------------- |
jbulpin@0 | 422 // CreateInstance() |
jbulpin@0 | 423 // Create a new instance from the specified instance data. |
jbulpin@0 | 424 // ---------------------------------------------------------------------------- |
jbulpin@0 | 425 static CMPIStatus CreateInstance( |
jbulpin@0 | 426 CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ |
jfehlig@31 | 427 const CMPIContext * context, /* [in] Additional context info, if any. */ |
jfehlig@31 | 428 const CMPIResult * results, /* [out] Results of this operation. */ |
jfehlig@31 | 429 const CMPIObjectPath * reference, /* [in] Contains the target namespace, classname and object path. */ |
jfehlig@31 | 430 const CMPIInstance * newinstance) /* [in] Contains the new instance data. */ |
jbulpin@0 | 431 { |
jbulpin@0 | 432 CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */ |
jfehlig@25 | 433 _RESOURCES * resources = NULL; /* Handle to the list of system resources. */ |
jbulpin@0 | 434 _RESOURCE * resource; /* Handle to the system resource. */ |
jbulpin@0 | 435 char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ |
jbulpin@0 | 436 int found = 0; /* Found the target instance? */ |
jbulpin@0 | 437 |
jbulpin@0 | 438 _SBLIM_ENTER("CreateInstance"); |
jbulpin@0 | 439 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); |
jbulpin@0 | 440 _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); |
jbulpin@0 | 441 _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); |
jbulpin@0 | 442 _SBLIM_TRACE(2, ("--- newinstance=\"%s\"", CMGetCharPtr(CDToString(_BROKER, newinstance, NULL)))); |
jbulpin@0 | 443 _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); |
jbulpin@0 | 444 |
jfehlig@25 | 445 if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) { |
jfehlig@25 | 446 _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME)); |
jfehlig@25 | 447 goto exit; |
jfehlig@25 | 448 } |
jfehlig@25 | 449 |
jbulpin@0 | 450 /* WORKAROUND FOR PEGASUS BUG?! reference does not contain object path, only namespace & classname. */ |
jbulpin@0 | 451 reference = CMGetObjectPath(newinstance, NULL); |
jbulpin@0 | 452 |
jbulpin@0 | 453 /* Get a handle to the list of system resources. */ |
jbulpin@0 | 454 if (!Xen_ProcessorPool_getResources(&resources)) { |
jbulpin@0 | 455 _SBLIM_TRACE(1,("--- _getResources() failed")); |
jbulpin@0 | 456 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources"); |
jbulpin@0 | 457 goto exit; |
jbulpin@0 | 458 } |
jbulpin@0 | 459 |
jbulpin@0 | 460 /* Get the target resource. */ |
jfehlig@16 | 461 found = Xen_ProcessorPool_getResourceForObjectPath(resources, &resource, reference, _BROKER, context); |
jbulpin@0 | 462 |
jbulpin@0 | 463 /* Free the resource data. */ |
jbulpin@0 | 464 if (!Xen_ProcessorPool_freeResource(resource)) { |
jbulpin@0 | 465 _SBLIM_TRACE(1,("--- _freeResource() failed")); |
jbulpin@0 | 466 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data"); |
jbulpin@0 | 467 goto exit; |
jbulpin@0 | 468 } |
jbulpin@0 | 469 |
jbulpin@0 | 470 if (found) { |
jbulpin@0 | 471 _SBLIM_TRACE(1,("--- Target instance already exists")); |
jbulpin@0 | 472 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_ALREADY_EXISTS, "Target instance already exists"); |
jbulpin@0 | 473 goto exit; |
jbulpin@0 | 474 } |
jbulpin@0 | 475 |
jbulpin@0 | 476 /* Create a new resource with the new instance property values. */ |
jbulpin@0 | 477 int rc = Xen_ProcessorPool_createResourceFromInstance(resources, &resource, newinstance, _BROKER); |
jbulpin@0 | 478 if (rc != 1) { |
jbulpin@0 | 479 if (rc == -1) { |
jbulpin@0 | 480 _SBLIM_TRACE(1,("--- _createResourceFromInstance() unsupported")); |
jbulpin@0 | 481 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); |
jbulpin@0 | 482 } else { |
jbulpin@0 | 483 _SBLIM_TRACE(1,("--- _createResourceFromInstance() failed")); |
jbulpin@0 | 484 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to create resource data from instance properties"); |
jbulpin@0 | 485 } |
jbulpin@0 | 486 goto exit; |
jbulpin@0 | 487 } |
jbulpin@0 | 488 |
jbulpin@0 | 489 /* Return the object path for the newly created instance. */ |
jbulpin@0 | 490 CMPIObjectPath * objectpath = CMGetObjectPath(newinstance, NULL); |
jbulpin@0 | 491 CMSetNameSpace(objectpath, namespace); |
jbulpin@0 | 492 CMReturnObjectPath(results, objectpath); |
jbulpin@0 | 493 CMReturnDone(results); |
jbulpin@0 | 494 |
jbulpin@0 | 495 exit: |
jbulpin@0 | 496 /* Free the list of system resources. */ |
jbulpin@0 | 497 if (!Xen_ProcessorPool_freeResources(resources)) { |
jbulpin@0 | 498 _SBLIM_TRACE(1,("--- _freeResources() failed")); |
jbulpin@0 | 499 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources"); |
jbulpin@0 | 500 } |
jbulpin@0 | 501 |
jbulpin@0 | 502 _SBLIM_RETURNSTATUS(status); |
jbulpin@0 | 503 } |
jbulpin@0 | 504 |
jbulpin@0 | 505 // ---------------------------------------------------------------------------- |
jbulpin@0 | 506 // DeleteInstance() |
jbulpin@0 | 507 // Delete or remove the specified instance from the system. |
jbulpin@0 | 508 // ---------------------------------------------------------------------------- |
jbulpin@0 | 509 static CMPIStatus DeleteInstance( |
jbulpin@0 | 510 CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ |
jfehlig@31 | 511 const CMPIContext * context, /* [in] Additional context info, if any. */ |
jfehlig@31 | 512 const CMPIResult * results, /* [out] Results of this operation. */ |
jfehlig@31 | 513 const CMPIObjectPath * reference) /* [in] Contains the target namespace, classname and object path. */ |
jbulpin@0 | 514 { |
jbulpin@0 | 515 CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */ |
jfehlig@25 | 516 _RESOURCES * resources = NULL; /* Handle to the list of system resources. */ |
jbulpin@0 | 517 _RESOURCE * resource; /* Handle to the system resource. */ |
jbulpin@0 | 518 char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ |
jbulpin@0 | 519 int found = 0; /* Found the target instance? */ |
jbulpin@0 | 520 |
jbulpin@0 | 521 _SBLIM_ENTER("DeleteInstance"); |
jbulpin@0 | 522 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); |
jbulpin@0 | 523 _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); |
jbulpin@0 | 524 _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); |
jbulpin@0 | 525 _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); |
jbulpin@0 | 526 |
jfehlig@25 | 527 if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) { |
jfehlig@25 | 528 _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME)); |
jfehlig@25 | 529 goto exit; |
jfehlig@25 | 530 } |
jfehlig@25 | 531 |
jbulpin@0 | 532 /* Get a handle to the list of system resources. */ |
jbulpin@0 | 533 if (!Xen_ProcessorPool_getResources(&resources)) { |
jbulpin@0 | 534 _SBLIM_TRACE(1,("--- _getResources() failed")); |
jbulpin@0 | 535 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to get list of system resources"); |
jbulpin@0 | 536 goto exit; |
jbulpin@0 | 537 } |
jbulpin@0 | 538 |
jbulpin@0 | 539 /* Get the target resource. */ |
jfehlig@16 | 540 found = Xen_ProcessorPool_getResourceForObjectPath(resources, &resource, reference, _BROKER, context); |
jbulpin@0 | 541 if (!found || (resource == NULL)) { |
jbulpin@0 | 542 _SBLIM_TRACE(1,("--- Target instance not found")); |
jbulpin@0 | 543 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_FOUND, "Target instance not found"); |
jbulpin@0 | 544 goto exit; |
jbulpin@0 | 545 } |
jbulpin@0 | 546 |
jbulpin@0 | 547 _SBLIM_TRACE(2,("--- instance found", found)); |
jbulpin@0 | 548 |
jbulpin@0 | 549 /* Delete the target resource. */ |
jbulpin@0 | 550 int rc = Xen_ProcessorPool_deleteResource(resources, resource); |
jbulpin@0 | 551 |
jbulpin@0 | 552 /* Free the resource data. */ |
jbulpin@0 | 553 if (!Xen_ProcessorPool_freeResource(resource)) { |
jbulpin@0 | 554 _SBLIM_TRACE(1,("--- _freeResource() failed")); |
jbulpin@0 | 555 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free resource data"); |
jbulpin@0 | 556 goto exit; |
jbulpin@0 | 557 } |
jbulpin@0 | 558 |
jbulpin@0 | 559 if (rc != 1) { |
jbulpin@0 | 560 if (rc == -1) { |
jbulpin@0 | 561 _SBLIM_TRACE(1,("--- __deleteResource() unsupported")); |
jbulpin@0 | 562 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); |
jbulpin@0 | 563 } else { |
jbulpin@0 | 564 _SBLIM_TRACE(1,("--- _deleteResource() failed")); |
jbulpin@0 | 565 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to delete resource"); |
jbulpin@0 | 566 } |
jbulpin@0 | 567 goto exit; |
jbulpin@0 | 568 } |
jbulpin@0 | 569 |
jbulpin@0 | 570 exit: |
jbulpin@0 | 571 /* Free the list of system resources. */ |
jbulpin@0 | 572 if (!Xen_ProcessorPool_freeResources(resources)) { |
jbulpin@0 | 573 _SBLIM_TRACE(1,("--- _freeResources() failed")); |
jbulpin@0 | 574 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to free list of system resources"); |
jbulpin@0 | 575 } |
jbulpin@0 | 576 |
jbulpin@0 | 577 _SBLIM_RETURNSTATUS(status); |
jbulpin@0 | 578 } |
jbulpin@0 | 579 |
jbulpin@0 | 580 |
jbulpin@0 | 581 // ---------------------------------------------------------------------------- |
jbulpin@0 | 582 // ExecQuery() |
jbulpin@0 | 583 // Return a list of all the instances that satisfy the specified query filter. |
jbulpin@0 | 584 // ---------------------------------------------------------------------------- |
jbulpin@0 | 585 static CMPIStatus ExecQuery( |
jbulpin@0 | 586 CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ |
jfehlig@31 | 587 const CMPIContext * context, /* [in] Additional context info, if any. */ |
jfehlig@31 | 588 const CMPIResult * results, /* [out] Results of this operation. */ |
jfehlig@31 | 589 const CMPIObjectPath * reference, /* [in] Contains the target namespace and classname. */ |
jfehlig@31 | 590 const char * language, /* [in] Name of the query language. */ |
jfehlig@31 | 591 const char * query) /* [in] Text of the query written in the query language. */ |
jbulpin@0 | 592 { |
jbulpin@0 | 593 CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */ |
jbulpin@0 | 594 char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); /* Target namespace. */ |
jbulpin@0 | 595 |
jbulpin@0 | 596 _SBLIM_ENTER("ExecQuery"); |
jbulpin@0 | 597 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); |
jbulpin@0 | 598 _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); |
jbulpin@0 | 599 _SBLIM_TRACE(2, ("--- reference=\"%s\"", CMGetCharPtr(CDToString(_BROKER, reference, NULL)))); |
jbulpin@0 | 600 _SBLIM_TRACE(2, ("--- language=\"%s\"", language)); |
jbulpin@0 | 601 _SBLIM_TRACE(2, ("--- query=\"%s\"", query)); |
jbulpin@0 | 602 _SBLIM_TRACE(2, ("--- namespace=\"%s\"", namespace)); |
jbulpin@0 | 603 |
jfehlig@25 | 604 if (strcmp(namespace, HOST_INSTRUMENTATION_NS) == 0) { |
jfehlig@25 | 605 _SBLIM_TRACE(1,("--- \"%s\" is not a valid namespace for %s", namespace, _CLASSNAME)); |
jfehlig@25 | 606 goto exit; |
jfehlig@25 | 607 } |
jfehlig@25 | 608 |
jbulpin@0 | 609 /* EXECQUERY() IS NOT YET SUPPORTED FOR THIS CLASS */ |
jbulpin@0 | 610 CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_NOT_SUPPORTED, NULL); |
jbulpin@0 | 611 |
jbulpin@0 | 612 CMReturnDone(results); |
jbulpin@0 | 613 |
jbulpin@0 | 614 exit: |
jbulpin@0 | 615 _SBLIM_RETURNSTATUS(status); |
jbulpin@0 | 616 } |
jbulpin@0 | 617 |
jbulpin@0 | 618 // ---------------------------------------------------------------------------- |
jbulpin@0 | 619 // Initialize() |
jbulpin@0 | 620 // Perform any necessary initialization immediately after this provider is |
jbulpin@0 | 621 // first loaded. |
jbulpin@0 | 622 // ---------------------------------------------------------------------------- |
jbulpin@0 | 623 static void Initialize( |
jbulpin@0 | 624 CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ |
jfehlig@31 | 625 const CMPIContext * context) /* [in] Additional context info, if any. */ |
jbulpin@0 | 626 { |
jbulpin@0 | 627 _SBLIM_ENTER("Initialize"); |
jbulpin@0 | 628 _SBLIM_TRACE(2, ("--- self=\"%s\"", self->ft->miName)); |
jfehlig@1 | 629 // _SBLIM_TRACE(2, ("--- context=\"%s\"", CMGetCharPtr(CDToString(_BROKER, context, NULL)))); |
jbulpin@0 | 630 |
jbulpin@0 | 631 /* Nothing needs to be done to initialize this provider */ |
jbulpin@0 | 632 _SBLIM_RETURN(); |
jbulpin@0 | 633 } |
jbulpin@0 | 634 |
jbulpin@0 | 635 // ============================================================================ |
jbulpin@0 | 636 // CMPI INSTANCE PROVIDER FUNCTION TABLE SETUP |
jbulpin@0 | 637 // ============================================================================ |
jfehlig@1 | 638 CMInstanceMIStub( , Xen_ProcessorPool, _BROKER, Initialize(&mi, ctx)); |