summaryrefslogtreecommitdiffstats
path: root/src/hardware/LMI_MemorySystemDeviceProvider.c
diff options
context:
space:
mode:
authorPeter Schiffer <pschiffe@redhat.com>2013-07-25 20:34:30 +0200
committerPeter Schiffer <pschiffe@redhat.com>2013-07-25 20:34:30 +0200
commit1e773b6af3066658ccc7eb7c4092894d76285f32 (patch)
treeaed7ab0bea8498708db63605dbe57f6bcecf97ac /src/hardware/LMI_MemorySystemDeviceProvider.c
parented078aa12fa4932bf915886d4c64eae6375d0172 (diff)
downloadopenlmi-providers-1e773b6af3066658ccc7eb7c4092894d76285f32.tar.gz
openlmi-providers-1e773b6af3066658ccc7eb7c4092894d76285f32.tar.xz
openlmi-providers-1e773b6af3066658ccc7eb7c4092894d76285f32.zip
Hardware: Added associations to the CIM_ComputerSystem class
New providers: * LMI_ProcessorSystemDeviceProvider * LMI_MemorySystemDeviceProvider * LMI_PCIDeviceSystemDeviceProvider * LMI_BatterySystemDeviceProvider * LMI_ChassisComputerSystemPackageProvider
Diffstat (limited to 'src/hardware/LMI_MemorySystemDeviceProvider.c')
-rw-r--r--src/hardware/LMI_MemorySystemDeviceProvider.c254
1 files changed, 254 insertions, 0 deletions
diff --git a/src/hardware/LMI_MemorySystemDeviceProvider.c b/src/hardware/LMI_MemorySystemDeviceProvider.c
new file mode 100644
index 0000000..d4d310a
--- /dev/null
+++ b/src/hardware/LMI_MemorySystemDeviceProvider.c
@@ -0,0 +1,254 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Peter Schiffer <pschiffe@redhat.com>
+ */
+
+#include <konkret/konkret.h>
+#include "LMI_MemorySystemDevice.h"
+#include "LMI_Hardware.h"
+#include "globals.h"
+
+static const CMPIBroker* _cb;
+
+static void LMI_MemorySystemDeviceInitialize()
+{
+}
+
+static CMPIStatus LMI_MemorySystemDeviceCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_MemorySystemDeviceEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ return KDefaultEnumerateInstanceNames(
+ _cb, mi, cc, cr, cop);
+}
+
+static CMPIStatus LMI_MemorySystemDeviceEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ LMI_MemorySystemDevice lmi_mem_sys_device;
+ CIM_ComputerSystemRef cim_cs;
+ LMI_MemoryRef lmi_mem;
+ CMPIObjectPath *o;
+ CMPIStatus st;
+ const char *ns = KNameSpace(cop);
+
+ CIM_ComputerSystemRef_Init(&cim_cs, _cb, ns);
+ CIM_ComputerSystemRef_Set_Name(&cim_cs, get_system_name());
+ CIM_ComputerSystemRef_Set_CreationClassName(&cim_cs,
+ get_system_creation_class_name());
+ o = CIM_ComputerSystemRef_ToObjectPath(&cim_cs, &st);
+ CMSetClassName(o, get_system_creation_class_name());
+
+ LMI_MemorySystemDevice_Init(&lmi_mem_sys_device, _cb, ns);
+
+ LMI_MemoryRef_Init(&lmi_mem, _cb, ns);
+ LMI_MemoryRef_Set_SystemCreationClassName(&lmi_mem,
+ get_system_creation_class_name());
+ LMI_MemoryRef_Set_SystemName(&lmi_mem, get_system_name());
+ LMI_MemoryRef_Set_CreationClassName(&lmi_mem, ORGID "_" MEM_CLASS_NAME);
+ LMI_MemoryRef_Set_DeviceID(&lmi_mem, "0");
+
+ LMI_MemorySystemDevice_SetObjectPath_GroupComponent(
+ &lmi_mem_sys_device, o);
+ LMI_MemorySystemDevice_Set_PartComponent(&lmi_mem_sys_device,
+ &lmi_mem);
+
+ KReturnInstance(cr, lmi_mem_sys_device);
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_MemorySystemDeviceGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ return KDefaultGetInstance(
+ _cb, mi, cc, cr, cop, properties);
+}
+
+static CMPIStatus LMI_MemorySystemDeviceCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_MemorySystemDeviceModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char**properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_MemorySystemDeviceDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_MemorySystemDeviceExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_MemorySystemDeviceAssociationCleanup(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_MemorySystemDeviceAssociators(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole,
+ const char** properties)
+{
+ return KDefaultAssociators(
+ _cb,
+ mi,
+ cc,
+ cr,
+ cop,
+ LMI_MemorySystemDevice_ClassName,
+ assocClass,
+ resultClass,
+ role,
+ resultRole,
+ properties);
+}
+
+static CMPIStatus LMI_MemorySystemDeviceAssociatorNames(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole)
+{
+ return KDefaultAssociatorNames(
+ _cb,
+ mi,
+ cc,
+ cr,
+ cop,
+ LMI_MemorySystemDevice_ClassName,
+ assocClass,
+ resultClass,
+ role,
+ resultRole);
+}
+
+static CMPIStatus LMI_MemorySystemDeviceReferences(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role,
+ const char** properties)
+{
+ return KDefaultReferences(
+ _cb,
+ mi,
+ cc,
+ cr,
+ cop,
+ LMI_MemorySystemDevice_ClassName,
+ assocClass,
+ role,
+ properties);
+}
+
+static CMPIStatus LMI_MemorySystemDeviceReferenceNames(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role)
+{
+ return KDefaultReferenceNames(
+ _cb,
+ mi,
+ cc,
+ cr,
+ cop,
+ LMI_MemorySystemDevice_ClassName,
+ assocClass,
+ role);
+}
+
+CMInstanceMIStub(
+ LMI_MemorySystemDevice,
+ LMI_MemorySystemDevice,
+ _cb,
+ LMI_MemorySystemDeviceInitialize())
+
+CMAssociationMIStub(
+ LMI_MemorySystemDevice,
+ LMI_MemorySystemDevice,
+ _cb,
+ LMI_MemorySystemDeviceInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "LMI_MemorySystemDevice",
+ "LMI_MemorySystemDevice",
+ "instance association")