diff options
author | Radek Novacek <rnovacek@redhat.com> | 2012-07-30 09:47:34 +0200 |
---|---|---|
committer | Radek Novacek <rnovacek@redhat.com> | 2012-07-30 09:47:34 +0200 |
commit | 4c44beca56b4334a50518a91a7ce2835e00bc00e (patch) | |
tree | a62d32707f9ff39585f2f3f27a80dc1ac5a553c8 /src/fan/cmpiLinux_Fan.c | |
parent | 91821cba81c92e9a204fb3d9637d3fe5dbfd73c0 (diff) | |
download | openlmi-providers-4c44beca56b4334a50518a91a7ce2835e00bc00e.tar.gz openlmi-providers-4c44beca56b4334a50518a91a7ce2835e00bc00e.tar.xz openlmi-providers-4c44beca56b4334a50518a91a7ce2835e00bc00e.zip |
fan: port Fan provider to KonkretCMPI
Diffstat (limited to 'src/fan/cmpiLinux_Fan.c')
-rw-r--r-- | src/fan/cmpiLinux_Fan.c | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/src/fan/cmpiLinux_Fan.c b/src/fan/cmpiLinux_Fan.c deleted file mode 100644 index 8088a70..0000000 --- a/src/fan/cmpiLinux_Fan.c +++ /dev/null @@ -1,128 +0,0 @@ -/* This file is part of cmpiLinux_FanProvider. - * - * cmpiLinux_FanProvider is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * cmpiLinux_FanProvider 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with cmpiLinux_FanProvider. If not, see - * <http://www.gnu.org/licenses/>. - */ -#ifndef _XOPEN_SOURCE - //this is for strdup - #define _XOPEN_SOURCE 500 -#endif -#include <stdlib.h> -#include <string.h> -#include <stdbool.h> -#include <stdint.h> -#include <cmpi/cmpimacs.h> -#include <sblim/OSBase_Common.h> -#include <sblim/cmpiOSBase_Common.h> - -#include "cmpiLinux_Fan.h" - -static CMPIArray * _get_AccessibleFeatures( - CMPIBroker const *_broker, - CMPIStatus *rc, - struct cim_fan const *sptr) -{ - int index = 0; - uint16_t value = 1; - unsigned int i = 1; - - CMPIArray *res = CMNewArray(_broker, 8, CMPI_uint16, rc); - if (!res) { - CMSetStatusWithChars(_broker, rc, CMPI_RC_ERR_FAILED, - "CMNewArray(_broker, 8, CMPI_uint16, rc)"); - _OSBASE_TRACE(2, ("--- _get_AccessibleFeatures failed: %s", - CMGetCharPtr(rc->msg))); - }else { - while (i <= CIM_FAN_AF_FEATURE_MAX) { - if (i & sptr->accessible_features) { - CMSetArrayElementAt(res, index++, (CMPIValue*)(&value), - CMPI_uint16); - } - ++value; - i = i << 1; - } - } - return res; -} - -CMPIObjectPath * _makePath_Fan( - CMPIBroker const *_broker, - CMPIContext const *ctx, - CMPIObjectPath const *cop, - struct cim_fan *sptr, - CMPIStatus *rc) -{ - return _makePath_FanCommon(_ClassName, _broker, ctx, cop, sptr, rc); -} - -CMPIInstance * _makeInst_Fan( - CMPIBroker const *_broker, - CMPIContext const *ctx, - CMPIObjectPath const *cop, - char const **properties, - struct cim_fan *sptr, - CMPIStatus *rc) -{ - CMPIObjectPath *op; - CMPIInstance *ci; - CMPIValue val; - - _OSBASE_TRACE(2, ("--- _makeInst_Fan() called")); - if (!(ci = _makeInst_FanCommon(_ClassName, _broker, ctx, cop, properties, - sptr, rc, &op))) { - return NULL; - } - - // CoolingDevice - val.boolean = true; - CMSetProperty(ci, "ActiveCooling", &val, CMPI_boolean); - - // CIM_Fan - // Linux_Fan - val.array = _get_AccessibleFeatures(_broker, rc, sptr); - if (!rc->rc) { - CMSetProperty(ci, "AccessibleFeatures", &val, CMPI_uint16A); - } - if (!rc->rc && sptr->accessible_features & CIM_FAN_AF_MIN_SPEED) { - val.uint64 = (uint64_t) sptr->min_speed; - CMSetProperty(ci, "MinSpeed", &val, CMPI_uint64); - } - if (!rc->rc && sptr->accessible_features & CIM_FAN_AF_MAX_SPEED) { - val.uint64 = (uint64_t) sptr->max_speed; - CMSetProperty(ci, "MaxSpeed", &val, CMPI_uint64); - } - if (!rc->rc && sptr->accessible_features & CIM_FAN_AF_DIV) { - CMSetProperty(ci, "Divisor", &sptr->divisor, CMPI_uint32); - } - if (!rc->rc && sptr->accessible_features & CIM_FAN_AF_PULSES) { - CMSetProperty(ci, "Pulses", &sptr->pulses, CMPI_uint32); - } - if (!rc->rc && sptr->accessible_features & CIM_FAN_AF_BEEP) { - val.boolean = sptr->beep; - CMSetProperty(ci, "Beep", &val, CMPI_boolean); - } - if (!rc->rc && sptr->accessible_features & CIM_FAN_AF_ALARM) { - CMSetProperty(ci, "Alarm", &sptr->alarm, CMPI_boolean); - } - if (!rc->rc && sptr->accessible_features & CIM_FAN_AF_ALARM_MIN) { - CMSetProperty(ci, "MinAlarm", &sptr->alarm_min, CMPI_boolean); - } - if (!rc->rc && sptr->accessible_features & CIM_FAN_AF_ALARM_MAX) { - CMSetProperty(ci, "MaxAlarm", &sptr->alarm_max, CMPI_boolean); - } - - _OSBASE_TRACE(2, ("--- _makeInst_Fan() exited")); - return ci; -} - |