os-cmpi-xen

view src/Xen_MemoryPool_Resource.h @ 121:4868ace2726b

Add initial consistence checks in test suite for Xen_MemoryPool, Xen_ProcessorPool and Xen_VirtualSystemManagementService.

Signed-off-by: Luke Szymanski <Lukasz.Szymanski@Unisys.com>
author Jim Fehlig <jfehlig@novell.com>
date Fri Jun 08 10:22:05 2007 -0600 (2007-06-08)
parents acaabfa6fb4a
children
line source
1 // Copyright (C) 2006 IBM Corporation
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 // ============================================================================
17 // Authors: Dr. Gareth S. Bestor, <bestor@us.ibm.com>
18 // Contributors: Jim Fehlig, <jfehlig@novell.com>
19 // Description:
20 // ============================================================================
22 /*** CUSTOMIZE FOR EACH PROVIDER ***/
23 /* DEFINE A HANDLE TO REPRESENT THE 'LIST' OF ALL SYSTEM RESOURCES.
24 THE MAIN PROVIDER CODE DOES NOT NEED TO KNOW THE PARTICULARS OF HOW THIS
25 LIST IS IMPLEMENTED - IT MAY BE AN ARRAY, LINKED LIST, FILE, ETC.
26 THIS HANDLE IS PASSED INTO THE APPROPRIATE RESOURCE ACCESS METHODS WHEN
27 ACCESSING/ITERATING/ADDING/REMOVING RESOURCES INSTANCES. */
28 typedef struct {
29 int finished;
30 } _RESOURCES;
32 /*** CUSTOMIZE FOR EACH PROVIDER ***/
33 /* DEFINE A HANDLE TO BE USED FOR EACH INSTANCE OF A SYSTEM RESOURCE.
34 THE MAIN PROVIDER CODE DOES NOT NEED TO KNOW THE PARTICULARS OF HOW EACH
35 RESOURCE IS REPRESENTED, BUT TYPICALLY IT IS A STRUCTURE MIRRORING THE
36 PROPERTIES IN THE CIM CLASS. THIS HANDLE IS PASSED BETWEEN THE RESOURCE
37 ACCESS METHODS WHEN MANIPULATING SPECIFIC RESOURCE INSTANCES. */
38 typedef struct {
39 unsigned long long capacity;
40 unsigned long long reserved;
41 } _RESOURCE;
43 /* NOTHING BELOW THIS LINE SHOULD NEED TO BE CHANGED. */
45 /* Include the required CMPI data types. */
46 #include "cmpidt.h"
48 // ----------------------------------------------------------------------------
49 // Generic resource access methods for CMPI providers.
50 // Return value:
51 // -1 = Unsupported
52 // 0 = Failed
53 // 1 = OK
54 // ----------------------------------------------------------------------------
56 /* Get a handle to the list of all system resources for this class. */
57 int Xen_MemoryPool_getResources( _RESOURCES ** resources );
59 /* Free/deallocate/cleanup the resources list after use. */
60 int Xen_MemoryPool_freeResources( _RESOURCES * resources );
62 /* Iterator to get the next resource from the resources list. */
63 int Xen_MemoryPool_getNextResource( _RESOURCES * resources, _RESOURCE ** resource );
65 /* Get the specific resource that matches the CMPI object path. */
66 int Xen_MemoryPool_getResourceForObjectPath( _RESOURCES * resources, _RESOURCE ** resource, const CMPIObjectPath * objectpath );
68 /* Free/deallocate/cleanup a resource after use. */
69 int Xen_MemoryPool_freeResource( _RESOURCE * resource );
71 /* Set the property values of a CMPI instance from a specific resource. */
72 int Xen_MemoryPool_setInstanceFromResource( _RESOURCE * resource, const CMPIInstance * instance, const CMPIBroker * broker );
74 // THE FOLLOWING METHODS MAY/NOT BE SUPPORTED BY THE SYSTEM FOR THIS CLASS
76 /* Delete the specified resource from the system. */
77 int Xen_MemoryPool_deleteResource( _RESOURCES * resources, _RESOURCE * resource );
79 /* Modify the specified resource using the property values of a CMPI instance. */
80 int Xen_MemoryPool_setResourceFromInstance( _RESOURCE * resource, const CMPIInstance * instance, const CMPIBroker * broker );
82 /* Create a new resource using the property values of a CMPI instance. */
83 int Xen_MemoryPool_createResourceFromInstance( _RESOURCES * resources, _RESOURCE ** resource, const CMPIInstance * instance, const CMPIBroker * broker );