summaryrefslogtreecommitdiffstats
path: root/src/hardware/LMI_ChassisComputerSystemPackageProvider.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hardware/LMI_ChassisComputerSystemPackageProvider.c')
-rw-r--r--src/hardware/LMI_ChassisComputerSystemPackageProvider.c266
1 files changed, 266 insertions, 0 deletions
diff --git a/src/hardware/LMI_ChassisComputerSystemPackageProvider.c b/src/hardware/LMI_ChassisComputerSystemPackageProvider.c
new file mode 100644
index 0000000..d0fc004
--- /dev/null
+++ b/src/hardware/LMI_ChassisComputerSystemPackageProvider.c
@@ -0,0 +1,266 @@
+/*
+ * 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_ChassisComputerSystemPackage.h"
+#include "LMI_Hardware.h"
+#include "globals.h"
+#include "dmidecode.h"
+
+static const CMPIBroker* _cb;
+
+static void LMI_ChassisComputerSystemPackageInitialize()
+{
+}
+
+static CMPIStatus LMI_ChassisComputerSystemPackageCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_ChassisComputerSystemPackageEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ return KDefaultEnumerateInstanceNames(
+ _cb, mi, cc, cr, cop);
+}
+
+static CMPIStatus LMI_ChassisComputerSystemPackageEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ LMI_ChassisComputerSystemPackage lmi_chassis_cs_pkg;
+ CIM_ComputerSystemRef cim_cs;
+ LMI_ChassisRef lmi_chassis;
+ CMPIObjectPath *o;
+ CMPIStatus st;
+ const char *ns = KNameSpace(cop);
+ DmiChassis dmi_chassis;
+
+ if (dmi_get_chassis(&dmi_chassis) != 0) {
+ goto done;
+ }
+
+ 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_ChassisComputerSystemPackage_Init(&lmi_chassis_cs_pkg, _cb, ns);
+
+ LMI_ChassisRef_Init(&lmi_chassis, _cb, ns);
+ LMI_ChassisRef_Set_CreationClassName(&lmi_chassis,
+ ORGID "_" CHASSIS_CLASS_NAME);
+ if (strcmp(dmi_chassis.serial_number, "Not Specified") == 0) {
+ LMI_ChassisRef_Set_Tag(&lmi_chassis, "0");
+ } else {
+ LMI_ChassisRef_Set_Tag(&lmi_chassis, dmi_chassis.serial_number);
+ }
+
+ LMI_ChassisComputerSystemPackage_SetObjectPath_Dependent(
+ &lmi_chassis_cs_pkg, o);
+ LMI_ChassisComputerSystemPackage_Set_Antecedent(&lmi_chassis_cs_pkg,
+ &lmi_chassis);
+ LMI_ChassisComputerSystemPackage_Set_PlatformGUID(&lmi_chassis_cs_pkg, "0");
+
+ KReturnInstance(cr, lmi_chassis_cs_pkg);
+
+done:
+ dmi_free_chassis(&dmi_chassis);
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_ChassisComputerSystemPackageGetInstance(
+ 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_ChassisComputerSystemPackageCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_ChassisComputerSystemPackageModifyInstance(
+ 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_ChassisComputerSystemPackageDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus LMI_ChassisComputerSystemPackageExecQuery(
+ 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_ChassisComputerSystemPackageAssociationCleanup(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus LMI_ChassisComputerSystemPackageAssociators(
+ 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_ChassisComputerSystemPackage_ClassName,
+ assocClass,
+ resultClass,
+ role,
+ resultRole,
+ properties);
+}
+
+static CMPIStatus LMI_ChassisComputerSystemPackageAssociatorNames(
+ 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_ChassisComputerSystemPackage_ClassName,
+ assocClass,
+ resultClass,
+ role,
+ resultRole);
+}
+
+static CMPIStatus LMI_ChassisComputerSystemPackageReferences(
+ 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_ChassisComputerSystemPackage_ClassName,
+ assocClass,
+ role,
+ properties);
+}
+
+static CMPIStatus LMI_ChassisComputerSystemPackageReferenceNames(
+ 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_ChassisComputerSystemPackage_ClassName,
+ assocClass,
+ role);
+}
+
+CMInstanceMIStub(
+ LMI_ChassisComputerSystemPackage,
+ LMI_ChassisComputerSystemPackage,
+ _cb,
+ LMI_ChassisComputerSystemPackageInitialize())
+
+CMAssociationMIStub(
+ LMI_ChassisComputerSystemPackage,
+ LMI_ChassisComputerSystemPackage,
+ _cb,
+ LMI_ChassisComputerSystemPackageInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "LMI_ChassisComputerSystemPackage",
+ "LMI_ChassisComputerSystemPackage",
+ "instance association")