From: <su...@us...> - 2008-07-18 06:56:13
|
Revision: 6851 http://openhpi.svn.sourceforge.net/openhpi/?rev=6851&view=rev Author: sutula Date: 2008-07-18 06:56:16 +0000 (Fri, 18 Jul 2008) Log Message: ----------- [ 1823713 ] Memory leak noticed in the daemon Modified Paths: -------------- openhpi/trunk/src/plugin.c openhpi/trunk/utils/announcement_utils.c Modified: openhpi/trunk/src/plugin.c =================================================================== --- openhpi/trunk/src/plugin.c 2008-07-18 06:06:21 UTC (rev 6850) +++ openhpi/trunk/src/plugin.c 2008-07-18 06:56:16 UTC (rev 6851) @@ -543,7 +543,6 @@ struct oh_handler *handler = NULL; char *plugin_name = NULL; static unsigned int handler_id = 1; - unsigned int *hidp; if (!handler_config) { err("ERROR creating new handler. Invalid parameter."); @@ -557,7 +556,6 @@ } handler = (struct oh_handler *)g_malloc0(sizeof(struct oh_handler)); - hidp = (unsigned int *)g_malloc0(sizeof(unsigned int)); plugin = oh_get_plugin(plugin_name); if(!plugin) { /* Attempt to load plugin here once */ @@ -583,7 +581,6 @@ g_static_rec_mutex_lock(&oh_handlers.lock); handler->id = handler_id++; g_static_rec_mutex_unlock(&oh_handlers.lock); - *hidp = handler->id; handler->plugin_name = (char *)g_hash_table_lookup(handler_config, "plugin"); handler->config = handler_config; handler->refcount = 0; @@ -592,7 +589,6 @@ return handler; cleanexit: - g_free(hidp); g_free(handler); return NULL; } Modified: openhpi/trunk/utils/announcement_utils.c =================================================================== --- openhpi/trunk/utils/announcement_utils.c 2008-07-18 06:06:21 UTC (rev 6850) +++ openhpi/trunk/utils/announcement_utils.c 2008-07-18 06:56:16 UTC (rev 6851) @@ -261,6 +261,7 @@ while (annlist != NULL) { myentry = (oh_ann_entry *) annlist->data; if (srchid == myentry->annentry.EntryId) { + free(annlist->data); ann->annentries = g_list_remove(ann->annentries, myentry); return SA_OK; @@ -278,6 +279,7 @@ myentry = (oh_ann_entry *) annlist->data; if (sev == SAHPI_ALL_SEVERITIES || sev == myentry->annentry.Severity) { + free(annlist->data); ann->annentries = g_list_remove(ann->annentries, myentry); annlist = g_list_first(ann->annentries); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pd...@us...> - 2008-10-01 19:20:43
|
Revision: 6883 http://openhpi.svn.sourceforge.net/openhpi/?rev=6883&view=rev Author: pdphan Date: 2008-10-01 19:20:26 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Enable redundant domains with multiple daemon connections, Feature 1945076 Modified Paths: -------------- openhpi/trunk/Makefile.am openhpi/trunk/clients/Makefile.am openhpi/trunk/configure.ac openhpi/trunk/hpi_shell/Makefile.am openhpi/trunk/hpi_shell/commands.c openhpi/trunk/openhpid/Makefile.am openhpi/trunk/openhpid/oh_client.cpp openhpi/trunk/openhpid/oh_client_conf.c openhpi/trunk/openhpid/oh_client_session.cpp openhpi/trunk/openhpid/openhpid.cpp openhpi/trunk/rt-env.sh.in Modified: openhpi/trunk/Makefile.am =================================================================== --- openhpi/trunk/Makefile.am 2008-10-01 19:18:29 UTC (rev 6882) +++ openhpi/trunk/Makefile.am 2008-10-01 19:20:26 UTC (rev 6883) @@ -41,6 +41,7 @@ EXTRA_DIST = openhpi.spec.in \ openhpi.conf.example \ + openhpiclient.conf.example \ README.daemon \ $(shell find $(srcdir)/include -name '*.h') @@ -108,7 +109,7 @@ $(top_srcdir)/utils/sahpiatca_enum_utils.h: make -C $(top_builddir)/utils sahpiatca_enum_utils.h -install-data-local: openhpi.pc openhpi.conf.example +install-data-local: openhpi.pc openhpi.conf.example openhpiclient.conf.example $(mkinstalldirs) $(DESTDIR)$(libdir)/pkgconfig $(INSTALL_DATA) openhpi.pc $(DESTDIR)$(libdir)/pkgconfig $(mkinstalldirs) $(DESTDIR)$(VARPATH) @@ -117,16 +118,19 @@ if test ! -e $(DESTDIR)$(sysconfdir)/openhpi/openhpi.conf; then \ $(INSTALL_DATA) $(top_srcdir)/openhpi.conf.example $(DESTDIR)$(sysconfdir)/openhpi/openhpi.conf; \ fi + if test ! -e $(DESTDIR)$(sysconfdir)/openhpi/openhpiclient.conf; then \ + $(INSTALL_DATA) $(top_srcdir)/openhpiclient.conf.example $(DESTDIR)$(sysconfdir)/openhpi/openhpiclient.conf; \ + fi uninstall-local: rm -f $(DESTDIR)$(libdir)/pkgconfig/openhpi.pc if cmp $(top_srcdir)/openhpi.conf.example $(DESTDIR)$(sysconfdir)/openhpi/openhpi.conf; then \ - : \ - else \ rm -f $(DESTDIR)$(sysconfdir)/openhpi/openhpi.conf; \ fi + if cmp $(top_srcdir)/openhpiclient.conf.example $(DESTDIR)$(sysconfdir)/openhpi/openhpiclient.conf; then \ + rm -f $(DESTDIR)$(sysconfdir)/openhpi/openhpiclient.conf; \ + fi - rpm: dist rm -rf $(top_srcdir)/rpm mkdir -p $(top_srcdir)/rpm/RPMS Modified: openhpi/trunk/clients/Makefile.am =================================================================== --- openhpi/trunk/clients/Makefile.am 2008-10-01 19:18:29 UTC (rev 6882) +++ openhpi/trunk/clients/Makefile.am 2008-10-01 19:20:26 UTC (rev 6883) @@ -7,11 +7,7 @@ COMMONLIBS = @STATIC_PLUGIN_LIBS@ @STATIC_PLUGIN_EXTRA_LIBS@ -if OH_DAEMON_ENABLED COMMONLIBS += $(top_builddir)/openhpid/libopenhpi.la -else -COMMONLIBS += $(top_builddir)/src/libopenhpi.la -endif CLIENTS_SRC = clients.c Modified: openhpi/trunk/configure.ac =================================================================== --- openhpi/trunk/configure.ac 2008-10-01 19:18:29 UTC (rev 6882) +++ openhpi/trunk/configure.ac 2008-10-01 19:20:26 UTC (rev 6883) @@ -142,30 +142,17 @@ AC_SUBST(XML2_LIB) AC_SUBST(XML2_INCLUDE) -dnl Enable the marshal directory only when needed by -dnl the deamon +dnl Build daemon statically or dynamically. openhpid_static="no" -oh_daemon_enabled="no" +ENABLED_DIRS="$ENABLED_DIRS openhpid" AC_ARG_ENABLE([daemon], - [ --enable-daemon build HPI daemon and client library [[default=yes]]], - [if test "x$enableval" = "xyes"; then - ENABLED_DIRS="$ENABLED_DIRS openhpid" - AC_DEFINE([OH_DAEMON_ENABLED],[1],[Build daemon and client libs]) - oh_daemon_enabled="yes" - elif test "x$enableval" = "xstatic"; then - ENABLED_DIRS="$ENABLED_DIRS openhpid" + [ --enable-dynamic-daemon build HPI daemon and client library non-statically[[default=yes]]], + [if test "x$enableval" = "xno"; then openhpid_static="yes" - AC_DEFINE([OH_DAEMON_ENABLED],[1],[Build daemon and client libs]) - oh_daemon_enabled="yes" fi], - [ - ENABLED_DIRS="$ENABLED_DIRS openhpid" - AC_DEFINE([OH_DAEMON_ENABLED],[1],[Build daemon and client libs]) - oh_daemon_enabled="yes" - openhpid_dinamic="yes"]) + [openhpid_static="no"]) -AM_CONDITIONAL(OH_DAEMON_ENABLED, test x$oh_daemon_enabled = xyes) AM_CONDITIONAL(OPENHPID_STATIC, test x$openhpid_static = xyes) @@ -398,13 +385,9 @@ fi ]) +dnl enable marshal library +AC_SUBST(MARSHALDIR,marshal) -dnl enable marshal library when needed -if test "x$oh_daemon_enabled" = "xyes"; then - AC_SUBST(MARSHALDIR,marshal) -fi - - dnl dnl create static plugin config dnl Modified: openhpi/trunk/hpi_shell/Makefile.am =================================================================== --- openhpi/trunk/hpi_shell/Makefile.am 2008-10-01 19:18:29 UTC (rev 6882) +++ openhpi/trunk/hpi_shell/Makefile.am 2008-10-01 19:20:26 UTC (rev 6883) @@ -8,17 +8,12 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/utils -if OH_DAEMON_ENABLED INCLUDES += -I$(top_srcdir)/openhpid \ -I$(top_srcdir)/marshal \ -DCLIENT COMMONLIBS = $(top_builddir)/marshal/libohtcpconnx.la \ $(top_builddir)/utils/libopenhpiutils.la \ $(top_builddir)/openhpid/libopenhpi.la -else -COMMONLIBS = $(top_builddir)/src/libopenhpi.la \ - @STATIC_PLUGIN_LIBS@ @STATIC_PLUGIN_EXTRA_LIBS@ -endif bin_PROGRAMS = hpi_shell Modified: openhpi/trunk/hpi_shell/commands.c =================================================================== --- openhpi/trunk/hpi_shell/commands.c 2008-10-01 19:18:29 UTC (rev 6882) +++ openhpi/trunk/hpi_shell/commands.c 2008-10-01 19:20:26 UTC (rev 6883) @@ -113,7 +113,9 @@ static ret_code_t add_config(void) { -#ifndef OH_DAEMON_ENABLED +#if 0 +// This code needs to call oHpi APIs instead of internal functions + SaErrorT rv; term_def_t *term; struct oh_parsed_config config = {NULL, NULL, 0, 0, 0, 0}; Modified: openhpi/trunk/openhpid/Makefile.am =================================================================== --- openhpi/trunk/openhpid/Makefile.am 2008-10-01 19:18:29 UTC (rev 6882) +++ openhpi/trunk/openhpid/Makefile.am 2008-10-01 19:20:26 UTC (rev 6883) @@ -17,21 +17,6 @@ MAINTAINERCLEANFILES = Makefile.in *~ -REMOTE_SOURCES = \ - config.c \ - domain.c \ - event.c \ - threaded.c \ - alarm.c \ - hotswap.c \ - lock.c \ - plugin.c \ - plugin_static.c \ - init.c \ - safhpi.c \ - session.c \ - ohpi.c - INCLUDES = \ @OPENHPI_INCLUDES@ -I$(top_srcdir)/marshal @OH_SSL_INCLUDES@ @@ -42,16 +27,17 @@ sbin_PROGRAMS = openhpid openhpid_SOURCES = openhpid.cpp -nodist_openhpid_SOURCES = $(REMOTE_SOURCES) -openhpid_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/marshal/libohtcpconnx.la + +openhpid_LDADD = $(top_builddir)/src/libopenhpi.la \ + $(top_builddir)/utils/libopenhpiutils.la \ + $(top_builddir)/marshal/libohtcpconnx.la if HAVE_OPENSSL openhpid_LDADD += $(top_builddir)/$(SSLDIR)/libopenhpi_ssl.la endif openhpid_LDFLAGS = -export-dynamic -# this is defined with ./configure --enable-daemon=static +# this is defined with ./configure --disable-dynamicdaemon if OPENHPID_STATIC openhpid_LDFLAGS += -static else @@ -67,22 +53,11 @@ libopenhpi_la_LIBADD = $(top_builddir)/marshal/libohtcpconnx.la -lstdc++ \ $(top_builddir)/utils/libopenhpiutils.la - -$(REMOTE_SOURCES): - if test ! -f $@ -a ! -L $@; then \ - if test -f $(top_srcdir)/src/$@; then \ - ln -s $(top_srcdir)/src/$@; \ - else \ - ln -s $(top_builddir)/src/$@; \ - fi \ - fi - install-data-local: $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/init.d $(INSTALL) -m 0755 openhpid.sh $(DESTDIR)$(sysconfdir)/init.d/openhpid -uninstall-local: rm -f $(DESTDIR)$(sysconfdir)/init.d/openhpid clean-local: - rm -f *~ core core.* $(REMOTE_SOURCES) + rm -f *~ core core.* Modified: openhpi/trunk/openhpid/oh_client.cpp =================================================================== --- openhpi/trunk/openhpid/oh_client.cpp 2008-10-01 19:18:29 UTC (rev 6882) +++ openhpi/trunk/openhpid/oh_client.cpp 2008-10-01 19:20:26 UTC (rev 6883) @@ -150,6 +150,7 @@ char cmd[] = "saHpiSessionOpen"; pcstrmsock pinst = NULL; SaHpiDomainIdT default_did = SAHPI_UNSPECIFIED_DOMAIN_ID; + if (!SessionId || SecurityParams) return SA_ERR_HPI_INVALID_PARAMS; @@ -184,6 +185,7 @@ oh_delete_connx(pinst); return SA_ERR_HPI_INVALID_PARAMS; } + *SessionId = oh_open_session(DomainId, domain_sid, pinst); return err; Modified: openhpi/trunk/openhpid/oh_client_conf.c =================================================================== --- openhpi/trunk/openhpid/oh_client_conf.c 2008-10-01 19:18:29 UTC (rev 6882) +++ openhpi/trunk/openhpid/oh_client_conf.c 2008-10-01 19:20:26 UTC (rev 6883) @@ -32,7 +32,7 @@ enum { HPI_CLIENT_CONF_TOKEN_DOMAIN = G_TOKEN_LAST, - HPI_CLIENT_CONF_TOKEN_DEFAULT, + HPI_CLIENT_CONF_TOKEN_DEFAULT, HPI_CLIENT_CONF_TOKEN_HOST, HPI_CLIENT_CONF_TOKEN_PORT } hpiClientConfType; @@ -51,6 +51,7 @@ .name = "default", .token = HPI_CLIENT_CONF_TOKEN_DEFAULT }, + { .name = "host", .token = HPI_CLIENT_CONF_TOKEN_HOST Modified: openhpi/trunk/openhpid/oh_client_session.cpp =================================================================== --- openhpi/trunk/openhpid/oh_client_session.cpp 2008-10-01 19:18:29 UTC (rev 6882) +++ openhpi/trunk/openhpid/oh_client_session.cpp 2008-10-01 19:20:26 UTC (rev 6883) @@ -41,6 +41,7 @@ int oh_client_init(void) { + char *tmp_env_str = NULL; // Initialize GLIB thread engine if (!g_thread_supported()) { g_thread_init(NULL); @@ -69,8 +70,14 @@ NULL, g_free ); /* TODO: Have a default openhpiclient.conf file in /etc */ - oh_load_client_config(OH_CLIENT_DEFAULT_CONF, domains); + if ((tmp_env_str = getenv("OPENHPICLIENT_CONF")) != NULL) { + oh_load_client_config(tmp_env_str, domains); + } else { + oh_load_client_config(OH_CLIENT_DEFAULT_CONF, domains); + } + + /* Check to see if a default domain exists, if not, add it */ domain_conf = (struct oh_domain_conf *)g_hash_table_lookup(domains, @@ -238,7 +245,7 @@ if (!sid || !pinst) return 0; - + client_session = g_new0(struct oh_client_session, 1); g_static_rec_mutex_lock(&sessions_sem); Modified: openhpi/trunk/openhpid/openhpid.cpp =================================================================== --- openhpi/trunk/openhpid/openhpid.cpp 2008-10-01 19:18:29 UTC (rev 6882) +++ openhpi/trunk/openhpid/openhpid.cpp 2008-10-01 19:20:26 UTC (rev 6883) @@ -31,6 +31,7 @@ #include <getopt.h> #include <limits.h> #include "strmsock.h" +#include "oh_domain.h" extern "C" { @@ -494,8 +495,8 @@ hm, pReq, &domain_id ) < 0 ) return eResultError; - ret = saHpiSessionOpen( domain_id, &session_id, securityparams ); - + // patched version ret = saHpiSessionOpen( SAHPI_UNSPECIFIED_DOMAIN_ID, &session_id, securityparams ); + ret = saHpiSessionOpen( OH_DEFAULT_DOMAIN_ID, &session_id, securityparams ); thrdinst->header.m_len = HpiMarshalReply1( hm, pReq, &ret, &session_id ); // this is used in case the connection ever breaks! Modified: openhpi/trunk/rt-env.sh.in =================================================================== --- openhpi/trunk/rt-env.sh.in 2008-10-01 19:18:29 UTC (rev 6882) +++ openhpi/trunk/rt-env.sh.in 2008-10-01 19:20:26 UTC (rev 6883) @@ -5,6 +5,7 @@ #OPENHPI_DEBUG=YES OPENHPI_UID_MAP=@abs_top_srcdir@/uid_map OPENHPI_CONF=@abs_top_srcdir@/openhpi.conf +OPENHPICLIENT_CONF=@abs_top_srcdir@/openhpiclient.conf OPENHPI_PLUGIN_ROOT=@abs_top_builddir@/plugins OPENHPI_PATH=${OPENHPI_PLUGIN_ROOT}/dummy:${OPENHPI_PLUGIN_ROOT}/ipmi:${OPENHPI_PLUGIN_ROOT}/ipmidirect:${OPENHPI_PLUGIN_ROOT}/watchdog:${OPENHPI_PLUGIN_ROOT}/sysfs:${OPENHPI_PLUGIN_ROOT}/snmp_bc:${OPENHPI_PLUGIN_ROOT}/simulator:${LTDL_LIBRARY_PATH} # the following entries are for the hpi daemon and client @@ -15,6 +16,9 @@ cp @abs_top_srcdir@/openhpi.conf.example @abs_top_srcdir@/openhpi.conf fi +if [ ! -f @abs_top_srcdir@/openhpiclient.conf ]; then + cp @abs_top_srcdir@/openhpiclient.conf.example @abs_top_srcdir@/openhpiclient.conf +fi -export OPENHPI_DEBUG OPENHPI_DEBUG_TRACE OPENHPI_UID_MAP OPENHPI_CONF OPENHPI_PATH +export OPENHPI_DEBUG OPENHPI_DEBUG_TRACE OPENHPI_UID_MAP OPENHPI_CONF OPENHPI_PATH OPENHPICLIENT_CONF export OPENHPI_DAEMON_HOST OPENHPI_DAEMON_PORT This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2008-11-20 05:09:01
|
Revision: 6917 http://openhpi.svn.sourceforge.net/openhpi/?rev=6917&view=rev Author: pgraghu Date: 2008-11-20 05:08:51 +0000 (Thu, 20 Nov 2008) Log Message: ----------- [2220086] New ABI for saHpiResourceFailedRemove() SAF HPI API - Added the new ABI in .h file Modified Paths: -------------- openhpi/trunk/include/oh_handler.h openhpi/trunk/src/plugin.c Modified: openhpi/trunk/include/oh_handler.h =================================================================== --- openhpi/trunk/include/oh_handler.h 2008-11-19 15:12:34 UTC (rev 6916) +++ openhpi/trunk/include/oh_handler.h 2008-11-20 05:08:51 UTC (rev 6917) @@ -214,6 +214,11 @@ SaErrorT (*set_resource_severity)(void *hnd, SaHpiResourceIdT id, SaHpiSeverityT sev); + /*** + * saHpiResourceFailedRemove, passed down to plugin + **/ + SaErrorT (*resource_failed_remove)(void *hnd, + SaHpiResourceIdT rid); /***************** * EVENT LOG ABIs Modified: openhpi/trunk/src/plugin.c =================================================================== --- openhpi/trunk/src/plugin.c 2008-11-19 15:12:34 UTC (rev 6916) +++ openhpi/trunk/src/plugin.c 2008-11-20 05:08:51 UTC (rev 6917) @@ -746,7 +746,7 @@ (*abi)->set_resource_severity = lt_dlsym(plugin->dl_handle, "oh_set_resource_severity"); (*abi)->resource_failed_remove = lt_dlsym(plugin->dl_handle, - "oh_set_resource_failed_remove"); + "oh_resource_failed_remove"); (*abi)->get_el_info = lt_dlsym(plugin->dl_handle, "oh_get_el_info"); (*abi)->get_el_caps = lt_dlsym(plugin->dl_handle, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pg...@us...> - 2008-12-17 14:11:58
|
Revision: 6921 http://openhpi.svn.sourceforge.net/openhpi/?rev=6921&view=rev Author: pgraghu Date: 2008-12-17 14:11:47 +0000 (Wed, 17 Dec 2008) Log Message: ----------- [2420921] Supporting hardware failure events in OA SOAP plugin Modified Paths: -------------- openhpi/trunk/plugins/oa_soap/Makefile.am openhpi/trunk/plugins/oa_soap/debug/hpi_control_get.c openhpi/trunk/plugins/oa_soap/debug/hpi_control_set.c openhpi/trunk/plugins/oa_soap/debug/soaptest.c openhpi/trunk/plugins/oa_soap/oa_soap.h openhpi/trunk/plugins/oa_soap/oa_soap_calls.c openhpi/trunk/plugins/oa_soap/oa_soap_calls.h openhpi/trunk/plugins/oa_soap/oa_soap_control.c openhpi/trunk/plugins/oa_soap/oa_soap_control.h openhpi/trunk/plugins/oa_soap/oa_soap_discover.c openhpi/trunk/plugins/oa_soap/oa_soap_discover.h openhpi/trunk/plugins/oa_soap/oa_soap_event.c openhpi/trunk/plugins/oa_soap/oa_soap_event.h openhpi/trunk/plugins/oa_soap/oa_soap_fan_event.c openhpi/trunk/plugins/oa_soap/oa_soap_fan_event.h openhpi/trunk/plugins/oa_soap/oa_soap_interconnect_event.c openhpi/trunk/plugins/oa_soap/oa_soap_interconnect_event.h openhpi/trunk/plugins/oa_soap/oa_soap_inventory.c openhpi/trunk/plugins/oa_soap/oa_soap_inventory.h openhpi/trunk/plugins/oa_soap/oa_soap_oa_event.c openhpi/trunk/plugins/oa_soap/oa_soap_oa_event.h openhpi/trunk/plugins/oa_soap/oa_soap_ps_event.c openhpi/trunk/plugins/oa_soap/oa_soap_ps_event.h openhpi/trunk/plugins/oa_soap/oa_soap_re_discover.c openhpi/trunk/plugins/oa_soap/oa_soap_re_discover.h openhpi/trunk/plugins/oa_soap/oa_soap_sensor.c openhpi/trunk/plugins/oa_soap/oa_soap_sensor.h openhpi/trunk/plugins/oa_soap/oa_soap_server_event.c openhpi/trunk/plugins/oa_soap/oa_soap_server_event.h openhpi/trunk/plugins/oa_soap/oa_soap_utils.c openhpi/trunk/plugins/oa_soap/oa_soap_utils.h Added Paths: ----------- openhpi/trunk/include/SaHpiOaSoap.h openhpi/trunk/plugins/oa_soap/oa_soap_enclosure_event.c openhpi/trunk/plugins/oa_soap/oa_soap_enclosure_event.h openhpi/trunk/plugins/oa_soap/oa_soap_lcd_event.c openhpi/trunk/plugins/oa_soap/oa_soap_lcd_event.h openhpi/trunk/plugins/oa_soap/oa_soap_resources.c openhpi/trunk/plugins/oa_soap/oa_soap_resources.h Added: openhpi/trunk/include/SaHpiOaSoap.h =================================================================== --- openhpi/trunk/include/SaHpiOaSoap.h (rev 0) +++ openhpi/trunk/include/SaHpiOaSoap.h 2008-12-17 14:11:47 UTC (rev 6921) @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2008, Hewlett-Packard Development Company, LLP + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * Neither the name of the Hewlett-Packard Corporation, nor the names + * of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Author(s) + * Raghavendra P.G. <rag...@hp...> + * Raghavendra M.S. <rag...@hp...> + */ + +#ifndef __SAHPIOASOAP_H +#define __SAHPIOASOAP_H + +/* Sensor Numbers used in OA SOAP plugin + * + * On adding new sensor, the following data structures may require updation. + * Please update accordingly. + * 1. New sensor class in plugin/oa_soap/oa_soap_sensor.h + * 2. Max sensor class in plugin/oa_soap/oa_soap_resources.h + * 3. New sensor event assert state in plugin/oa_soap/oa_soap_sensor.h + * 4. Max sensor event assert state mapping array in + * plugin/oa_soap/oa_soap_resources.c + * 5. Max sensor enum value mapping array in plugin/oa_soap/oa_soap_resources.c + * 6. Global sensor array in plugin/oa_soap/oa_soap_resources.c + * 7. Sensor event array in global sensor array in + * plugin/oa_soap/oa_soap_resources.c + * 8. Global sensor enum value mapping array in + * plugin/oa_soap/oa_soap_resources.c + * 9. Global sensor event assert state mapping array in + * plugin/oa_soap/oa_soap_resources.c + */ + +/* Operational status sensor */ +#define OA_SOAP_SEN_OPER_STATUS (SaHpiSensorNumT) 0x000 +/* Predictive faliure sensor */ +#define OA_SOAP_SEN_PRED_FAIL (SaHpiSensorNumT) 0x001 +/* Thermal reading sensor */ +#define OA_SOAP_SEN_TEMP_STATUS (SaHpiSensorNumT) 0x002 +/* Redundancy sensor */ +#define OA_SOAP_SEN_REDUND (SaHpiSensorNumT) 0x003 +/* Fan speed sensor */ +#define OA_SOAP_SEN_FAN_SPEED (SaHpiSensorNumT) 0x004 +/* Power reading sensor */ +#define OA_SOAP_SEN_PWR_STATUS (SaHpiSensorNumT) 0x005 +/* Internal data error sensor */ +#define OA_SOAP_SEN_INT_DATA_ERR (SaHpiSensorNumT) 0x006 +/* Management processor error sensor */ +#define OA_SOAP_SEN_MP_ERR (SaHpiSensorNumT) 0x007 +/* Power supply subsystem power input sensor */ +#define OA_SOAP_SEN_IN_PWR (SaHpiSensorNumT) 0x008 +/* Power supply subsystem power output sensor */ +#define OA_SOAP_SEN_OUT_PWR (SaHpiSensorNumT) 0x009 +/* Power supply subsystem power capacity sensor */ +#define OA_SOAP_SEN_PWR_CAPACITY (SaHpiSensorNumT) 0x00a +/* Thermal warning sensor */ +#define OA_SOAP_SEN_THERM_WARN (SaHpiSensorNumT) 0x00b +/* Thermal danger sensor */ +#define OA_SOAP_SEN_THERM_DANGER (SaHpiSensorNumT) 0x00c +/* IO configuration error sensor */ +#define OA_SOAP_SEN_IO_CONFIG_ERR (SaHpiSensorNumT) 0x00d +/* Device power request error sensor */ +#define OA_SOAP_SEN_DEV_PWR_REQ (SaHpiSensorNumT) 0x00e +/* Insufficient cooling error sensor */ +#define OA_SOAP_SEN_INSUF_COOL (SaHpiSensorNumT) 0x00f +/* Device location error sensor */ +#define OA_SOAP_SEN_DEV_LOC_ERR (SaHpiSensorNumT) 0x010 +/* Device failure sensor */ +#define OA_SOAP_SEN_DEV_FAIL (SaHpiSensorNumT) 0x011 +/* Device degraded sensor */ +#define OA_SOAP_SEN_DEV_DEGRAD (SaHpiSensorNumT) 0x012 +/* AC failure sensor */ +#define OA_SOAP_SEN_AC_FAIL (SaHpiSensorNumT) 0x013 +/* i2c buses sensor */ +#define OA_SOAP_SEN_I2C_BUS (SaHpiSensorNumT) 0x014 +/* Redundancy error sensor */ +#define OA_SOAP_SEN_REDUND_ERR (SaHpiSensorNumT) 0x015 +/* Enclosure aggregate operational status sensor */ +#define OA_SOAP_SEN_ENC_AGR_OPER (SaHpiSensorNumT) 0x016 +/* Enclosure aggregate predictive failure sensor */ +#define OA_SOAP_SEN_ENC_AGR_PRED_FAIL (SaHpiSensorNumT) 0x017 +/* Enclosure OA redundancy sensor */ +#define OA_SOAP_SEN_OA_REDUND (SaHpiSensorNumT) 0x018 +/* Enclosure OA link status sensor */ +#define OA_SOAP_SEN_OA_LINK_STATUS (SaHpiSensorNumT) 0x019 +/* Interconnect CPU fault sensor */ +#define OA_SOAP_SEN_CPU_FAULT (SaHpiSensorNumT) 0x01a +/* Interconnect health LED sensor */ +#define OA_SOAP_SEN_HEALTH_LED (SaHpiSensorNumT) 0x01b +/* Health status operational sensor */ +#define OA_SOAP_SEN_HEALTH_OPER (SaHpiSensorNumT) 0x01c +/* Health status predictive failure sensor */ +#define OA_SOAP_SEN_HEALTH_PRED_FAIL (SaHpiSensorNumT) 0x01d +/* Device missing sensor */ +#define OA_SOAP_SEN_DEV_MISS (SaHpiSensorNumT) 0x01e +/* Device power sequence sensor */ +#define OA_SOAP_SEN_DEV_PWR_SEQ (SaHpiSensorNumT) 0x01f +/* Device bonding sensor */ +#define OA_SOAP_SEN_DEV_BOND (SaHpiSensorNumT) 0x020 +/* Network configuration sensor */ +#define OA_SOAP_SEN_NET_CONFIG (SaHpiSensorNumT) 0x021 +/* Firmware mismatch */ +#define OA_SOAP_SEN_FW_MISMATCH (SaHpiSensorNumT) 0x022 +/* Profile unassigned error sensor */ +#define OA_SOAP_SEN_PROF_UNASSIGN_ERR (SaHpiSensorNumT) 0x023 +/* Device not supported sensor */ +#define OA_SOAP_SEN_DEV_NOT_SUPPORT (SaHpiSensorNumT) 0x024 +/* Too low power request sensor */ +#define OA_SOAP_SEN_TOO_LOW_PWR_REQ (SaHpiSensorNumT) 0x025 +/* Call HP sensor */ +#define OA_SOAP_SEN_CALL_HP (SaHpiSensorNumT) 0x026 +/* Device informational sensor */ +#define OA_SOAP_SEN_DEV_INFO (SaHpiSensorNumT) 0x027 +/* Storage device missing sensor */ +#define OA_SOAP_SEN_STORAGE_DEV_MISS (SaHpiSensorNumT) 0x028 +/* Enclosure ID mismatch sensor */ +#define OA_SOAP_SEN_ENC_ID_MISMATCH (SaHpiSensorNumT) 0x029 +/* Device mix match sensor */ +#define OA_SOAP_SEN_DEV_MIX_MATCH (SaHpiSensorNumT) 0x02a +/* Power capping error sensor */ +#define OA_SOAP_SEN_GRPCAP_ERR (SaHpiSensorNumT) 0x02b +/* IML recorded errors sensor */ +#define OA_SOAP_SEN_IML_ERR (SaHpiSensorNumT) 0x02c +/* Duplicate management IP address sensor */ +#define OA_SOAP_SEN_DUP_MGMT_IP_ADDR (SaHpiSensorNumT) 0x02d + +/* Control numbers used in OA SOAP plugin + * On adding new control, control array in in plugin/oa_soap/oa_soap_resources.c + * may require updation. + */ +/* UID control */ +#define OA_SOAP_UID_CNTRL (SaHpiCtrlNumT) 0x000 +/* Power control */ +#define OA_SOAP_PWR_CNTRL (SaHpiCtrlNumT) 0x001 +/* LCD Button Lock control */ +#define OA_SOAP_LCD_BUTN_LCK_CNTRL (SaHpiCtrlNumT) 0x002 + +/* Custom inventory Area and fields used in OA SOAP plugin + * On adding new inventory area or field, fan zone mapping rray in in + * plugin/oa_soap/oa_soap_resources.c may require updation. + */ +/* Fan Zone field type for storing the device bays */ +#define OA_SOAP_INV_FZ_DEV_BAY (SaHpiIdrIdT) 0x100 +/* Fan Zone field type for storing the fan bays */ +#define OA_SOAP_INV_FZ_FAN_BAY (SaHpiIdrIdT) 0x101 +/* Fan field type for storing the shared status */ +#define OA_SOAP_INV_FAN_SHARED (SaHpiIdrIdT) 0x102 +/* Fan field type for storing the Fan zone number */ +#define OA_SOAP_INV_FZ_NUM (SaHpiIdrIdT) 0x103 + +#endif Modified: openhpi/trunk/plugins/oa_soap/Makefile.am =================================================================== --- openhpi/trunk/plugins/oa_soap/Makefile.am 2008-12-17 09:44:07 UTC (rev 6920) +++ openhpi/trunk/plugins/oa_soap/Makefile.am 2008-12-17 14:11:47 UTC (rev 6921) @@ -48,18 +48,24 @@ oa_soap_hotswap.c \ oa_soap_utils.h \ oa_soap_utils.c \ + oa_soap_resources.h \ + oa_soap_resources.c \ oa_soap_discover.h \ oa_soap_discover.c \ oa_soap_re_discover.h \ oa_soap_re_discover.c \ oa_soap_event.h \ oa_soap_event.c \ + oa_soap_enclosure_event.h \ + oa_soap_enclosure_event.c \ oa_soap_oa_event.h \ oa_soap_oa_event.c \ oa_soap_ps_event.h \ oa_soap_ps_event.c \ oa_soap_fan_event.h \ oa_soap_fan_event.c \ + oa_soap_lcd_event.h \ + oa_soap_lcd_event.c \ oa_soap_server_event.h \ oa_soap_server_event.c \ oa_soap_interconnect_event.h \ Modified: openhpi/trunk/plugins/oa_soap/debug/hpi_control_get.c =================================================================== --- openhpi/trunk/plugins/oa_soap/debug/hpi_control_get.c 2008-12-17 09:44:07 UTC (rev 6920) +++ openhpi/trunk/plugins/oa_soap/debug/hpi_control_get.c 2008-12-17 14:11:47 UTC (rev 6921) @@ -67,6 +67,12 @@ printf("\nPlease enter the resource id: "); scanf("%d", &resourceid); + printf("\nSupported controls on the resource are:"); + printf("\nUID LED control(Press 0)"); + printf("\nPower control(Press 1)"); + printf("\nEnter your option:"); + scanf("%d", &controlNumber); + rv = saHpiControlGet(sessionid, resourceid, controlNumber, &controlMode, &controlState); if (rv != SA_OK) { Modified: openhpi/trunk/plugins/oa_soap/debug/hpi_control_set.c =================================================================== --- openhpi/trunk/plugins/oa_soap/debug/hpi_control_set.c 2008-12-17 09:44:07 UTC (rev 6920) +++ openhpi/trunk/plugins/oa_soap/debug/hpi_control_set.c 2008-12-17 14:11:47 UTC (rev 6921) @@ -67,6 +67,12 @@ printf("\nPlease enter the resource id: "); scanf("%d", &resourceid); + printf("\nSupported controls on the resource are:"); + printf("\nUID LED control(Press 0)"); + printf("\nPower control(Press 1)"); + printf("\nEnter your option:"); + scanf("%d", &controlNumber); + printf("Possible control mode options are: \n"); printf("\tPress 1 for AUTO MODE \n"); printf("\tPress 2 for MANUAL MODE \n"); Modified: openhpi/trunk/plugins/oa_soap/debug/soaptest.c =================================================================== --- openhpi/trunk/plugins/oa_soap/debug/soaptest.c 2008-12-17 09:44:07 UTC (rev 6920) +++ openhpi/trunk/plugins/oa_soap/debug/soaptest.c 2008-12-17 14:11:47 UTC (rev 6921) @@ -877,6 +877,17 @@ } } + /* Try setLcdButtonLock call */ + printf("\nSetting LCD button lock to on and off\n"); + if (soap_setLcdButtonLock(con, HPOA_TRUE)) { + err("failed soap_setLcdButtonLock() wth TRUE in main"); + } else { + /* Revert back the LCD button lock */ + if (soap_setLcdButtonLock(con, HPOA_FALSE)) { + err("failed soap_setLcdButtonLock() with FALSE in main"); + } + } + #if 1 /* Sometimes, we want to skip events */ /* Try to subscribe for events */ Modified: openhpi/trunk/plugins/oa_soap/oa_soap.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap.h 2008-12-17 09:44:07 UTC (rev 6920) +++ openhpi/trunk/plugins/oa_soap/oa_soap.h 2008-12-17 14:11:47 UTC (rev 6921) @@ -48,18 +48,65 @@ #include "oa_soap_calls.h" +/* The resource numbers in OA SOAP. The rpt and rdr arrays are indexed based on + * the entity numbers defined below. + * On supporting a new resource in OA SOAP plugin, please update the rpt and rdr + * arrays in oa_soap_resources.c + */ +/* Enclosure */ +#define OA_SOAP_ENT_ENC 0 +/* Server Blade */ +#define OA_SOAP_ENT_SERV 1 +/* IO Blade */ +#define OA_SOAP_ENT_IO 2 +/* Storage Blade */ +#define OA_SOAP_ENT_STORAGE 3 +/* Switch Blade */ +#define OA_SOAP_ENT_SWITCH 4 +/* Onboard Administrator */ +#define OA_SOAP_ENT_OA 5 +/* Power Subsystem */ +#define OA_SOAP_ENT_PS_SUBSYS 6 +/* Power supply */ +#define OA_SOAP_ENT_PS 7 +/* Thermal subsystem */ +#define OA_SOAP_ENT_THERM_SUBSYS 8 +/* Fan Zone */ +#define OA_SOAP_ENT_FZ 9 +/* Fan */ +#define OA_SOAP_ENT_FAN 10 +/* LCD */ +#define OA_SOAP_ENT_LCD 11 + +/* The different enclosure types supported by OA SOAP + * + * If a new enclosure is added, please update the OA_SOAP_MAX_FAN. Add + * entries for the new enclosure in oa_soap_fz_map_arr in + * oa_soap_resources.c file. + */ +#define OA_SOAP_ENC_C7000 0 +#define OA_SOAP_ENC_C3000 1 + +/* Max Blade in HP BladeSystem c7000 c-Class enclosure*/ +#define OA_SOAP_C7000_MAX_BLADE 16 +/* Max Blade in HP BladeSystem c3000 c-Class enclosure*/ +#define OA_SOAP_C3000_MAX_BLADE 8 + +/* Maximum Fan Zones present in different HP BladeSystem c-Class enclosures */ +#define OA_SOAP_C7000_MAX_FZ 4 +#define OA_SOAP_C3000_MAX_FZ 1 + +/* Maximum fans supported in an enclosure + * + * If the max fan is changed, please update entries to + * oa_soap_fz_map_arr in oa_soap_resources.c file + */ +#define OA_SOAP_MAX_FAN 10 + /* Definitions for the different RDR instrument ids */ +/* TODO: Move below definitons to SaHpiOaSoap.h file */ #define OA_SOAP_RES_INV_NUM (SaHpiIdrIdT) 0x000 #define OA_SOAP_RES_CNTRL_NUM (SaHpiCtrlNumT) 0x001 -#define OA_SOAP_RES_SEN_TEMP_NUM (SaHpiSensorNumT) 0x002 -#define OA_SOAP_RES_SEN_EXH_TEMP_NUM (SaHpiSensorNumT) 0x003 -#define OA_SOAP_RES_SEN_FAN_NUM (SaHpiSensorNumT) 0x004 -#define OA_SOAP_RES_SEN_POWER_NUM (SaHpiSensorNumT) 0x005 -#define OA_SOAP_RES_SEN_PRES_NUM (SaHpiSensorNumT) 0x006 -#define OA_SOAP_RES_SEN_OPR_NUM (SaHpiSensorNumT) 0x007 -#define OA_SOAP_RES_SEN_IN_POWER_NUM (SaHpiSensorNumT) 0x008 -#define OA_SOAP_RES_SEN_OUT_POWER_NUM (SaHpiSensorNumT) 0x009 -#define OA_SOAP_RES_SEN_POWER_CAPACITY_NUM (SaHpiSensorNumT) 0x00a /* SOAP XML calls timeout values for event thread and hpi calls */ #define HPI_CALL_TIMEOUT 10 @@ -132,9 +179,12 @@ { SaHpiResourceIdT enclosure_rid; SaHpiResourceIdT power_subsystem_rid; + SaHpiResourceIdT thermal_subsystem_rid; + SaHpiResourceIdT lcd_rid; struct resource_status oa; struct resource_status server; struct resource_status interconnect; + struct resource_status fan_zone; struct resource_status fan; struct resource_status ps_unit; }; @@ -147,6 +197,8 @@ SOAP_CON *active_con; struct oa_info *oa_1; struct oa_info *oa_2; + /* Type of the enclsoure */ + SaHpiInt32T enc_type; GMutex *mutex; }; Modified: openhpi/trunk/plugins/oa_soap/oa_soap_calls.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_calls.c 2008-12-17 09:44:07 UTC (rev 6920) +++ openhpi/trunk/plugins/oa_soap/oa_soap_calls.c 2008-12-17 14:11:47 UTC (rev 6921) @@ -1659,3 +1659,9 @@ return(soap_request(con, SET_INTERCONNECT_TRAY_UID, request->bayNumber, uid)); } + +int soap_setLcdButtonLock(SOAP_CON *con, + enum hpoa_boolean buttonLock) +{ + return(soap_request(con, SET_LCD_BUTTON_LOCK, buttonLock)); +} Modified: openhpi/trunk/plugins/oa_soap/oa_soap_calls.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_calls.h 2008-12-17 09:44:07 UTC (rev 6920) +++ openhpi/trunk/plugins/oa_soap/oa_soap_calls.h 2008-12-17 14:11:47 UTC (rev 6921) @@ -218,6 +218,10 @@ "<hpoa:uid>%s</hpoa:uid>" \ "</hpoa:setInterconnectTrayUid>\n" +#define SET_LCD_BUTTON_LOCK \ + "<hpoa:setLcdButtonLock>" \ + "<hpoa:buttonLock>%d</hpoa:buttonLock>" \ + "</hpoa:setLcdButtonLock>\n" /* Enumerated types used for specific SOAP commands */ OA_SOAP_ENUM(hpoa_boolean, @@ -2016,6 +2020,8 @@ int soap_setInterconnectTrayUid(SOAP_CON *con, const struct setInterconnectTrayUid *request); +int soap_setLcdButtonLock(SOAP_CON *con, + enum hpoa_boolean buttonLock); /* Function prototypes for OA SOAP helper functions */ void soap_getExtraData(xmlNode *extraData, struct extraDataInfo *result); Modified: openhpi/trunk/plugins/oa_soap/oa_soap_control.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_control.c 2008-12-17 09:44:07 UTC (rev 6920) +++ openhpi/trunk/plugins/oa_soap/oa_soap_control.c 2008-12-17 14:11:47 UTC (rev 6921) @@ -31,6 +31,7 @@ * Author(s) * Raghavendra M.S. <rag...@hp...> * Shuah Khan <shu...@hp...> + * Raghavendra P.G. <rag...@hp...> * * This file handles all the control functionality related apis. * @@ -40,15 +41,48 @@ * oa_soap_set_control_state - Control ABI to set the control * state the resource * - * build_server_control_rdr - Creates and adds the control rdr - * to the server resource + * oa_soap_build_control_rdr - Creates and adds the control rdr * - * build_interconnect_control_rdr - Creates and adds the control rdr - * to the interconnect resource + * oa_soap_set_lcd_butn_lck_cntrl()- Sets the LCD button lock control + * + * oa_soap_get_lcd_butn_lck_cntrl()- Gets the LCD button lock control + * + * oa_soap_set_pwr_cntrl() - Sets the power control + * + * oa_soap_get_pwr_cntrl() - Gets the power control + * + * oa_soap_set_uid_cntrl() - Sets the UID control + * + * oa_soap_get_uid_cntrl() - Gets the UID control + * */ #include "oa_soap_control.h" +/* Forward declaraction for static functions */ +static SaErrorT oa_soap_set_lcd_butn_lck_cntrl(struct oh_handler_state + *oh_handler, + SaHpiRptEntryT *rpt, + SaHpiCtrlStateDigitalT + control_state); +static SaErrorT oa_soap_get_lcd_butn_lck_cntrl(struct oh_handler_state + *oh_handler, + SaHpiRptEntryT *rpt, + SaHpiCtrlStateDigitalT + *control_state); +static SaErrorT oa_soap_set_pwr_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDigitalT control_state); +static SaErrorT oa_soap_get_pwr_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDigitalT *control_state); +static SaErrorT oa_soap_set_uid_cntrl(struct oh_handler_state *oh_handler, + SaHpiRptEntryT *rpt, + SaHpiCtrlStateDigitalT control_state); +static SaErrorT oa_soap_get_uid_cntrl(struct oh_handler_state *oh_handler, + SaHpiRptEntryT *rpt, + SaHpiCtrlStateDigitalT *control_state); + /** * oa_soap_get_control_state * @oh_handler: Handler data pointer @@ -73,7 +107,7 @@ * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter * SA_ERR_HPI_INVALID_RESOURCE - Resource does not exist * SA_ERR_HPI_NOT_PRESENT - Control not present - * SA_ERR_INTERNAL_ERROR - Internal error encountered + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered **/ SaErrorT oa_soap_get_control_state(void *oh_handler, SaHpiResourceIdT resource_id, @@ -90,7 +124,7 @@ SaHpiCtrlStateT ctrl_state; SaHpiCtrlRecDigitalT *digital = NULL; SaHpiCtrlRecT *ctrl = NULL; - SaHpiPowerStateT power_state; + SaHpiCtrlStateDigitalT control_digital_state; if (oh_handler == NULL || mode == NULL || state == NULL) { err("Invalid parameter."); @@ -127,26 +161,36 @@ digital = &(ctrl->TypeUnion.Digital); - rv = oa_soap_get_power_state(handler, resource_id, &power_state); - if (rv != SA_OK) { - err("Failed to get the power state RDR"); - return rv; - } - - /* Based on the power state, map into the appropriate control state */ - switch (power_state) { - case SAHPI_POWER_ON: - digital->Default = SAHPI_CTRL_STATE_ON; - break; - case SAHPI_POWER_OFF: - digital->Default = SAHPI_CTRL_STATE_OFF; - break; + switch (rdr_num){ + case OA_SOAP_PWR_CNTRL: + rv = oa_soap_get_pwr_cntrl(handler, resource_id, + &control_digital_state); + if (rv != SA_OK) { + err("Failed to get the power state RDR"); + return rv; + } + break; + case OA_SOAP_UID_CNTRL: + rv = oa_soap_get_uid_cntrl(handler, rpt, + &control_digital_state); + if (rv != SA_OK) { + err("Failed to get the uid status"); + return rv; + } + break; + case OA_SOAP_LCD_BUTN_LCK_CNTRL: + rv = oa_soap_get_lcd_butn_lck_cntrl(handler, rpt, + &control_digital_state); + if (rv != SA_OK) { + err("Failed to get the LCD button lock status"); + return rv; + } + break; default: - err("Invalid power state"); + err("Invalid control rdr num"); return SA_ERR_HPI_INTERNAL_ERROR; } - - ctrl_state.StateUnion.Digital = digital->Default; + ctrl_state.StateUnion.Digital = control_digital_state; /* Return the appropriately mapped control state */ *state = ctrl_state; return rv; @@ -179,7 +223,7 @@ * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter * SA_ERR_HPI_INVALID_RESOURCE - Resource does not exist * SA_ERR_HPI_NOT_PRESENT - Control not present - * SA_ERR_INTERNAL_ERROR - Internal error encountered + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered * SA_ERR_HPI_INVALID_DATA - Invalid Control Mode/State specified * SA_ERR_HPI_UNSUPPORTED_PARAMS - Setting the control mode * to AUTO mode is not supported @@ -196,7 +240,6 @@ SaHpiRptEntryT *rpt = NULL; SaHpiRdrT *rdr = NULL; SaHpiCtrlRecT *ctrl = NULL; - SaHpiPowerStateT power_state; if (oh_handler == NULL || state == NULL) { err("Invalid parameter."); @@ -216,15 +259,15 @@ return SA_ERR_HPI_CAPABILITY; } - rdr = oh_get_rdr_by_type (handler->rptcache, resource_id, SAHPI_CTRL_RDR, - rdr_num); + rdr = oh_get_rdr_by_type (handler->rptcache, resource_id, + SAHPI_CTRL_RDR, rdr_num); if (rdr == NULL) { err("INVALID RDR NUMBER"); return (SA_ERR_HPI_NOT_PRESENT); } ctrl = &(rdr->RdrTypeUnion.CtrlRec); - /* Validate the state specified in the parameter list */ + /* Validate the state specified in the parameter list */ rv = oh_valid_ctrl_state_mode ((ctrl), mode, state); if (rv != SA_OK) { err("Control state specified is invalid"); @@ -237,78 +280,79 @@ return SA_ERR_HPI_UNSUPPORTED_PARAMS; } + /* Return error for Non digital type control request */ + if (state->Type != SAHPI_CTRL_TYPE_DIGITAL) { + err("Control type not supported"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + /* If control mode is MANUAL and specified state is of digital type, * then the control state is updated with specified state value */ - if (state->Type == SAHPI_CTRL_TYPE_DIGITAL) { - ctrl->TypeUnion.Digital.Default = state->StateUnion.Digital; - switch (state->StateUnion.Digital) { - case SAHPI_CTRL_STATE_OFF: - power_state = SAHPI_POWER_OFF; - rv = oa_soap_set_power_state(handler, - resource_id, - power_state); - if (rv != SA_OK) { - err("Set power state failed"); - return (rv); - } - break; - case SAHPI_CTRL_STATE_ON: - power_state = SAHPI_POWER_ON; - rv = oa_soap_set_power_state(handler, - resource_id, - power_state); - if (rv != SA_OK) { - err("Set power state failed"); - return (rv); - } - break; - default: - err("Invalid control state"); - return (SA_ERR_HPI_INTERNAL_ERROR); - } - } - - return rv; + ctrl->TypeUnion.Digital.Default = state->StateUnion.Digital; + switch (rdr_num) { + case OA_SOAP_PWR_CNTRL: + rv = oa_soap_set_pwr_cntrl(handler, resource_id, + state->StateUnion.Digital); + if (rv != SA_OK) { + err("Set power state failed"); + return rv; + } + break; + case OA_SOAP_UID_CNTRL: + rv = oa_soap_set_uid_cntrl(handler, rpt, + state->StateUnion.Digital); + if (rv != SA_OK) { + err("Set uid state failed"); + return rv; + } + break; + case OA_SOAP_LCD_BUTN_LCK_CNTRL: + rv = oa_soap_set_lcd_butn_lck_cntrl(handler, rpt, + state->StateUnion.Digital); + if (rv != SA_OK) { + err("Failed to set the LCD button lock status"); + return rv; + } + break; + default: + err("Invalid control rdr num"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + return SA_OK; } /** - * build_server_control_rdr + * oa_soap_build_control_rdr: * @oh_handler: Handler data pointer - * @rdr_num: Control rdr number - * @rdr: RDR pointer + * @rdr: Pointer to the rdr structure + * @resource_id: Resource ID + * @control_num: Control rdr number * * Purpose: - * Creates and adds the control rdr to server resource + * Builds the control rdr. * * Detailed Description: - * - Models the power state of server blade as a control object of - * digital type - * - Plug-in does not support changing the control mode, mode is set - * as Manual mode and as read only + * - Retrieves and populates the control rdr contents from global controls + * array based in control num. * * Return values: - * SA_OK - Normal case + * SA_OK - Normal case. * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter - * SA_ERR_HPI_INTERNAL_ERROR - oa_soap plugin has encountered an OA error + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered **/ -SaErrorT build_server_control_rdr(struct oh_handler_state *oh_handler, - SaHpiInt32T rdr_num, - SaHpiRdrT *rdr) +SaErrorT oa_soap_build_control_rdr(struct oh_handler_state *oh_handler, + SaHpiRdrT *rdr, + SaHpiResourceIdT resource_id, + SaHpiCtrlNumT control_num) { - char *server_ctrl_str = SERVER_CONTROL_STRING; - struct oa_soap_handler *oa_handler = NULL; - SaHpiResourceIdT resource_id; SaHpiRptEntryT *rpt = NULL; - if (oh_handler == NULL || rdr == NULL) { + if (oh_handler == NULL || rdr == NULL) { err("Invalid parameters"); return SA_ERR_HPI_INVALID_PARAMS; } - oa_handler = (struct oa_soap_handler *) oh_handler->data; - resource_id = - oa_handler->oa_soap_resources.server.resource_id[rdr_num - 1]; rpt = oh_get_resource_by_id(oh_handler->rptcache, resource_id); if (!rpt) { err("Could not find blade resource rpt"); @@ -318,86 +362,504 @@ /* Set the control rdr with default values */ rdr->Entity = rpt->ResourceEntity; rdr->RdrType = SAHPI_CTRL_RDR; - rdr->RdrTypeUnion.CtrlRec.Num = OA_SOAP_RES_CNTRL_NUM; - rdr->RdrTypeUnion.CtrlRec.OutputType = SAHPI_CTRL_POWER_STATE; - rdr->RdrTypeUnion.CtrlRec.Type = SAHPI_CTRL_TYPE_DIGITAL; - rdr->RdrTypeUnion.CtrlRec.TypeUnion.Digital.Default = - SAHPI_CTRL_STATE_ON; - rdr->RdrTypeUnion.CtrlRec.DefaultMode.Mode = SAHPI_CTRL_MODE_MANUAL; - rdr->RdrTypeUnion.CtrlRec.DefaultMode.ReadOnly = SAHPI_TRUE; - rdr->RdrTypeUnion.CtrlRec.WriteOnly = SAHPI_FALSE; - rdr->IdString.DataType = SAHPI_TL_TYPE_TEXT; - rdr->IdString.Language = SAHPI_LANG_ENGLISH; - rdr->IdString.DataLength = strlen (server_ctrl_str) + 1; - snprintf((char *) rdr->IdString.Data, - rdr->IdString.DataLength, "%s", server_ctrl_str); + rdr->RdrTypeUnion.CtrlRec = oa_soap_cntrl_arr[control_num].control; + oh_init_textbuffer(&(rdr->IdString)); + oh_append_textbuffer(&(rdr->IdString), + oa_soap_cntrl_arr[control_num].comment); return SA_OK; } /** - * build_interconnect_control_rdr + * oa_soap_get_uid_cntrl * @oh_handler: Handler data pointer - * @rdr_num: Control rdr number - * @rdr: Control rdr pointer + * @rpt: Pointer to the rpt structure + * @control_state: Pointer to digital control state * * Purpose: - * Creates and adds control rdr to interconnect resource + * Retrieves the UID status of the resource * * Detailed Description: - * - Models the power state of interconnect blade as a control object of - * digital type - * - Plug-in does not support changing the control mode, mode is set - * as Manual mode and as read only + * - Retrieves the UID status of different resources based on entity type. * * Return values: - * SA_OK - Normal case + * SA_OK - Normal case. * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter - * SA_ERR_HPI_INTERNAL_ERROR - oa_soap plugin has encountered an OA error + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered **/ -SaErrorT build_interconnect_control_rdr(struct oh_handler_state *oh_handler, - SaHpiInt32T rdr_num, - SaHpiRdrT *rdr) +static SaErrorT oa_soap_get_uid_cntrl(struct oh_handler_state *oh_handler, + SaHpiRptEntryT *rpt, + SaHpiCtrlStateDigitalT *control_state) { - char *interconnect_ctrl_str = INTERCONNECT_CONTROL_STRING; + SaErrorT rv = SA_OK; + SaHpiInt32T bay_number; struct oa_soap_handler *oa_handler = NULL; - SaHpiResourceIdT resource_id; - SaHpiRptEntryT *rpt = NULL; + struct enclosureStatus enclosure_status_response; + struct getOaStatus oa_status_request; + struct oaStatus oa_status_response; + struct getBladeStatus server_status_request; + struct bladeStatus server_status_response; + struct getInterconnectTrayStatus interconnect_status_request; + struct interconnectTrayStatus interconnect_status_response; + enum uidStatus uid_status; - if (oh_handler == NULL || rdr == NULL) { + if (oh_handler == NULL || rpt == NULL || control_state == NULL) { err("Invalid parameters"); return SA_ERR_HPI_INVALID_PARAMS; } oa_handler = (struct oa_soap_handler *) oh_handler->data; - resource_id = - oa_handler->oa_soap_resources.interconnect.resource_id[rdr_num - 1]; - rpt = oh_get_resource_by_id(oh_handler->rptcache, resource_id); - if (!rpt) { - err("Could not find blade resource rpt"); - return(SA_ERR_HPI_INTERNAL_ERROR); + + /* Check whether the re-discovery is started by trying to lock the + * oa_handler mutex + */ + rv = lock_oa_soap_handler(oa_handler); + if (rv != SA_OK) { + err("OA SOAP handler is locked"); + return rv; } + + bay_number = rpt->ResourceEntity.Entry[0].EntityLocation; + switch (rpt->ResourceEntity.Entry[0].EntityType) { + case (SAHPI_ENT_SYSTEM_CHASSIS): + /* Make a soap call to get the enclosure UID status */ + rv = soap_getEnclosureStatus(oa_handler->active_con, + &enclosure_status_response); + if (rv != SOAP_OK) { + err("Get enclosure status failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + uid_status = enclosure_status_response.uid; + break; + case (SAHPI_ENT_SYS_MGMNT_MODULE): + /* Make a soap call to get the OA UID status */ + oa_status_request.bayNumber = bay_number; + rv = soap_getOaStatus(oa_handler->active_con, + &oa_status_request, + &oa_status_response); + if (rv != SOAP_OK) { + err("Get OA status failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + uid_status = oa_status_response.uid; + break; + case (SAHPI_ENT_SYSTEM_BLADE): + case (SAHPI_ENT_IO_BLADE): + case (SAHPI_ENT_DISK_BLADE): + /* Make a soap call to get the Blade UID status */ + server_status_request.bayNumber = bay_number; + rv = soap_getBladeStatus(oa_handler->active_con, + &server_status_request, + &server_status_response); + if (rv != SOAP_OK) { + err("Get Blade status failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + uid_status = server_status_response.uid; + break; + case (SAHPI_ENT_SWITCH_BLADE): + /* Make a soap call to get the Interconnect + * UID status + */ + interconnect_status_request.bayNumber = bay_number; + rv = soap_getInterconnectTrayStatus( + oa_handler->active_con, + &interconnect_status_request, + &interconnect_status_response); + if (rv != SOAP_OK) { + err("Get Interconnect status failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + uid_status = interconnect_status_response.uid; + break; + default: + err("Invalid Resource Type"); + return (SA_ERR_HPI_INTERNAL_ERROR); + } - /* Set the control rdr with default values */ - rdr->Entity = rpt->ResourceEntity; - rdr->RdrType = SAHPI_CTRL_RDR; - rdr->RdrTypeUnion.CtrlRec.Num = OA_SOAP_RES_CNTRL_NUM; - rdr->RdrTypeUnion.CtrlRec.OutputType = SAHPI_CTRL_POWER_STATE; - rdr->RdrTypeUnion.CtrlRec.Type = SAHPI_CTRL_TYPE_DIGITAL; - rdr->RdrTypeUnion.CtrlRec.TypeUnion.Digital.Default = - SAHPI_CTRL_STATE_ON; - rdr->RdrTypeUnion.CtrlRec.DefaultMode.Mode = SAHPI_CTRL_MODE_MANUAL; - rdr->RdrTypeUnion.CtrlRec.DefaultMode.ReadOnly = SAHPI_TRUE; - rdr->RdrTypeUnion.CtrlRec.WriteOnly = SAHPI_FALSE; - rdr->IdString.DataType = SAHPI_TL_TYPE_TEXT; - rdr->IdString.Language = SAHPI_LANG_ENGLISH; - rdr->IdString.DataLength = strlen(interconnect_ctrl_str) + 1; - snprintf((char *) rdr->IdString.Data, - rdr->IdString.DataLength, "%s", interconnect_ctrl_str); + switch (uid_status) { + case UID_ON: + *control_state = SAHPI_CTRL_STATE_ON; + break; + case UID_OFF: + case UID_NO_OP: + *control_state = SAHPI_CTRL_STATE_OFF; + break; + default: + err("Invalid uid status"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + return SA_OK; +} +/** + * oa_soap_set_uid_cntrl + * @oh_handler: Handler data pointer + * @rpt: Pointer to the rpt structure + * @control_state: Digital control state + * + * Purpose: + * Sets the UID status of the resource + * + * Detailed Description: + * - Sets the UID status of different resources based on entity type. + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_set_uid_cntrl(struct oh_handler_state *oh_handler, + SaHpiRptEntryT *rpt, + SaHpiCtrlStateDigitalT control_state) +{ + SaErrorT rv = SA_OK; + SaHpiInt32T bay_number; + struct oa_soap_handler *oa_handler = NULL; + struct setEnclosureUid enclosure_uid; + struct setOaUid oa_uid; + struct setBladeUid blade_uid; + struct setInterconnectTrayUid interconnect_uid; + enum uidStatus uid_status; + + if (oh_handler == NULL || rpt == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + + /* Check whether the re-discovery is started by trying to lock the + * oa_handler mutex + */ + rv = lock_oa_soap_handler(oa_handler); + if (rv != SA_OK) { + err("OA SOAP handler is locked"); + return rv; + } + + /* Return error if the control state is PULSE_ON or PULSE_OFF */ + if ((control_state == SAHPI_CTRL_STATE_PULSE_ON) || + (control_state == SAHPI_CTRL_STATE_PULSE_OFF)) { + err("Setting the control state to PULSE ON/OFF not supported"); + return SA_ERR_HPI_INVALID_DATA; + } + + /* Map the control state to uid status */ + if (control_state == SAHPI_CTRL_STATE_ON) { + uid_status = UID_CMD_ON; + } else { + uid_status = UID_CMD_OFF; + } + + /* Get the bay_number of the resource */ + bay_number = rpt->ResourceEntity.Entry[0].EntityLocation; + switch (rpt->ResourceEntity.Entry[0].EntityType) { + case (SAHPI_ENT_SYSTEM_CHASSIS): + /* Make a soap call to set Enclosure UID */ + enclosure_uid.uid = uid_status; + rv = soap_setEnclosureUid(oa_handler->active_con, + &enclosure_uid); + if (rv != SOAP_OK) { + err("Set enclosure UID failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + break; + case (SAHPI_ENT_SYS_MGMNT_MODULE): + /* Make a soap call to set OA UID */ + oa_uid.uid = uid_status; + oa_uid.bayNumber = bay_number; + rv = soap_setOaUid(oa_handler->active_con, + &oa_uid); + if (rv != SOAP_OK) { + err("Set OA UID failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + break; + case (SAHPI_ENT_SYSTEM_BLADE): + case (SAHPI_ENT_IO_BLADE): + case (SAHPI_ENT_DISK_BLADE): + /* Make a soap call to set Blade UID */ + blade_uid.uid = uid_status; + blade_uid.bayNumber = bay_number; + rv = soap_setBladeUid(oa_handler->active_con, + &blade_uid); + if (rv != SOAP_OK) { + err("Set Blade UID failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + break; + case (SAHPI_ENT_SWITCH_BLADE): + /* Make a soap call to set Interconnect UID */ + interconnect_uid.uid = uid_status; + interconnect_uid.bayNumber = bay_number; + rv = soap_setInterconnectTrayUid(oa_handler->active_con, + &interconnect_uid); + if (rv != SOAP_OK) { + err("Set Interconnect UID failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + break; + default: + err("Invalid Resource Type"); + return (SA_ERR_HPI_INTERNAL_ERROR); + } return SA_OK; } +/** + * oa_soap_get_pwr_cntrl: + * @oh_handler: Handler data pointer + * @resource_id: Resource id + * @control state: Pointer to digital control state + * + * Purpose: + * Gets the control state of power controls on resource + * + * Detailed Description: + * - Gets the power state of resource and maps it to control state + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_get_pwr_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDigitalT *control_state) +{ + SaErrorT rv = SA_OK; + SaHpiPowerStateT power_state; + + if (oh_handler == NULL || control_state == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + rv = oa_soap_get_power_state(oh_handler, resource_id, + &power_state); + if (rv != SA_OK) { + err("Failed to get the power state RDR"); + return rv; + } + + switch (power_state) { + case SAHPI_POWER_ON: + *control_state = SAHPI_CTRL_STATE_ON; + break; + case SAHPI_POWER_OFF: + *control_state = SAHPI_CTRL_STATE_OFF; + break; + default: + err("Invalid power state"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + return SA_OK; +} + +/** + * oa_soap_set_pwr_cntrl: + * @oh_handler: Handler data pointer + * @resource_id: Resource id + * @control state: Digital control state + * + * Purpose: + * Sets the control state of power controls on resource + * + * Detailed Description: + * - Sets the power state of resource after mapping the control state + * appropriate power state + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_set_pwr_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDigitalT control_state) +{ + SaErrorT rv = SA_OK; + SaHpiPowerStateT power_state; + + if (oh_handler == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + /* Return error if the control state is PULSE_ON or PULSE_OFF */ + if ((control_state == SAHPI_CTRL_STATE_PULSE_ON) || + (control_state == SAHPI_CTRL_STATE_PULSE_OFF)) { + err("Setting the control state to PULSE ON/OFF not supported"); + return SA_ERR_HPI_INVALID_DATA; + } + + if (control_state == SAHPI_CTRL_STATE_ON) { + power_state = SAHPI_POWER_ON; + } else { + power_state = SAHPI_POWER_OFF; + } + + rv = oa_soap_set_power_state(oh_handler, resource_id, + power_state); + if (rv != SA_OK) { + err("Failed to set the power state of resource"); + return rv; + } + return SA_OK; +} + +/** + * oa_soap_get_lcd_butn_lck_cntrl_state + * @oh_handler: Handler data pointer + * @rpt: Pointer to the rpt structure + * @control_state: Pointer to digital control state + * + * Purpose: + * Retrieves the LCD button lock state + * + * Detailed Description: + * NA + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_get_lcd_butn_lck_cntrl(struct oh_handler_state + *oh_handler, + SaHpiRptEntryT *rpt, + SaHpiCtrlStateDigitalT + *control_state) +{ + SaErrorT rv = SA_OK; + struct oa_soap_handler *oa_handler = NULL; + struct lcdStatus status; + + if (oh_handler == NULL || rpt == NULL || control_state == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + + if (rpt->ResourceEntity.Entry[0].EntityType != + SAHPI_ENT_DISPLAY_PANEL) { + err("LCD button lock is supported only on LCD"); + err("Requested on wrong resource type %d", + rpt->ResourceEntity.Entry[0].EntityType); + return SA_ERR_HPI_INVALID_PARAMS; + } + + /* Check whether the re-discovery is started by trying to lock the + * oa_handler mutex + */ + rv = lock_oa_soap_handler(oa_handler); + if (rv != SA_OK) { + err("OA SOAP handler is locked"); + return rv; + } + + /* Make a soap call to set Enclosure UID */ + rv = soap_getLcdStatus(oa_handler->active_con, &status); + if (rv != SOAP_OK) { + err("Get LCD status SOAP call failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + switch (status.buttonLock) { + case HPOA_TRUE: + *control_state = SAHPI_CTRL_STATE_ON; + break; + case HPOA_FALSE: + *control_state = SAHPI_CTRL_STATE_OFF; + break; + default: + err("Invalid LCD button lock state"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + return SA_OK; +} + +/** + * oa_soap_set_lcd_butn_lck_cntrl_state + * @oh_handler: Handler data pointer + * @rpt: Pointer to the rpt structure + * @control_state: Digital control state + * + * Purpose: + * Sets the LCD button lock state + * + * Detailed Description: + * - The LCD button lock control is supported only for LCD resource + * - PULSE_ON and PULSE_OFF control states are not supported. If requested + * by the user, then error message is returned + * - Sets the LCD button lock control to requested state + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_set_lcd_butn_lck_cntrl(struct oh_handler_state + *oh_handler, + SaHpiRptEntryT *rpt, + SaHpiCtrlStateDigitalT + control_state) +{ + SaErrorT rv = SA_OK; + struct oa_soap_handler *oa_handler = NULL; + enum hpoa_boolean lcd_button_lock; + + if (oh_handler == NULL || rpt == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + + if (rpt->ResourceEntity.Entry[0].EntityType != + SAHPI_ENT_DISPLAY_PANEL) { + err("LCD button lock is supported only on LCD"); + err("Requested on wrong resource type %d", + rpt->ResourceEntity.Entry[0].EntityType); + return SA_ERR_HPI_INVALID_PARAMS; + } + + /* Return error if the control state is PULSE_ON or PULSE_OFF */ + if ((control_state == SAHPI_CTRL_STATE_PULSE_ON) || + (control_state == SAHPI_CTRL_STATE_PULSE_OFF)) { + err("Setting the control state to PULSE ON/OFF not supported"); + return SA_ERR_HPI_INVALID_DATA; + } + + /* Map the control state to LCD button lock state */ + if (control_state == SAHPI_CTRL_STATE_ON) { + lcd_button_lock = HPOA_TRUE; + } else { + lcd_button_lock = HPOA_FALSE; + } + + /* Check whether the re-discovery is started by trying to lock the + * oa_handler mutex + */ + rv = lock_oa_soap_handler(oa_handler); + if (rv != SA_OK) { + err("OA SOAP handler is locked"); + return rv; + } + + rv = soap_setLcdButtonLock(oa_handler->active_con, lcd_button_lock); + if (rv != SOAP_OK) { + err("Set LCD button lock SOAP call failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + return SA_OK; +} + void *oh_get_control_state (void *, SaHpiResourceIdT, SaHpiCtrlNumT, Modified: openhpi/trunk/plugins/oa_soap/oa_soap_control.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_control.h 2008-12-17 09:44:07 UTC (rev 6920) +++ openhpi/trunk/plugins/oa_soap/oa_soap_control.h 2008-12-17 14:11:47 UTC (rev 6921) @@ -37,8 +37,10 @@ #define _OA_SOAP_CONTROL_H /* Include files */ +#include <SaHpiOaSoap.h> #include "oa_soap.h" #include "oa_soap_power.h" +#include "oa_soap_resources.h" /* Tag for the control rdr */ #define SERVER_CONTROL_STRING "Server Power Control" @@ -57,11 +59,9 @@ SaHpiCtrlModeT mode, SaHpiCtrlStateT *state); -SaErrorT build_server_control_rdr(struct oh_handler_state *oh_handler, - SaHpiInt32T rdr_num, - SaHpiRdrT *rdr); +SaErrorT oa_soap_build_control_rdr(struct oh_handler_state *oh_handler, + SaHpiRdrT *rdr, + SaHpiResourceIdT resource_id, + SaHpiCtrlNumT control_num); -SaErrorT build_interconnect_control_rdr(struct oh_handler_state *oh_handler, - SaHpiInt32T rdr_num, - SaHpiRdrT *rdr); #endif Modified: openhpi/trunk/plugins/oa_soap/oa_soap_discover.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_discover.c 2008-12-17 09:44:07 UTC (rev 6920) +++ openhpi/trunk/plugins/oa_soap/oa_soap_discover.c 2008-12-17 14:11:47 UTC (rev 6921) @@ -72,11 +72,11 @@ * discover_interconnect() - Discovers the interconnect blades * along with their capabilities * - * discover_fan_rpt() - Builds the fan RPT entry + * oa_soap_discover_fan_rpt() - Builds the fan RPT entry * - * discover_fan_rdr() - Builds the fan RDRs + * oa_soap_discover_fan_rdr() - Builds the fan RDRs * - * discover_fan() - Discovers the fan along with + * oa_soap_discover_fan() - Discovers the fan along with * its capabilities * * discover_power_subsystem_rpt() - Builds the power subsystem RPT entry @@ -101,10 +101,57 @@ * discover_oa() - Discovers the onboard administrator * along with its capabilities * + * oa_soap_parse_diag_ex() - Parses the diagnosticChecksEx + * structure + * + * oa_soap_get_health_val() - Gets the healthStatus value from + * extraData structure + * + * oa_soap_build_rpt() - Generic function to build the RPT + * entry + * + * oa_soap_build_therm_subsys_rdr()- Builds the thermal subsystem RDR + * + * oa_soap_disc_therm_subsys() - Discovers the thermal subsystem + * + * oa_soap_build_fz_rdr() - Builds the fan zone RDR + * + * oa_soap_get_fz_arr() - Gets the fan zone array information + * from OA + * + * oa_soap_disc_fz() - Discovers the fan zones + * + * oa_soap_build_lcd_rdr() - Builds the LCD RDR + * + * oa_soap_disc_lcd() - Discovers the LCD + * + * oa_soap_populate_event() - Populates the event structure with + * default values + * + * oa_soap_push_disc_res() - Pushes the discovered resources + * information to openhpi framework + * */ #include "oa_soap_discover.h" +/* Forward declaration for static functions */ +static SaErrorT oa_soap_build_enc_info(struct oh_handler_state *oh_handler, + struct enclosureInfo *info); +static SaErrorT oa_soap_build_therm_subsys_rdr(struct oh_handler_state + *oh_handler, + SaHpiResourceIdT resource_id); +static SaErrorT oa_soap_build_fz_rdr(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + struct fanZone *fan_zone); +static SaErrorT oa_soap_disc_therm_subsys(struct oh_handler_state *oh_handler); +static SaErrorT oa_soap_disc_fz(struct oh_handler_state *oh_handler); +static SaErrorT oa_soap_disc_fan(struct oh_handler_state *oh_handler); +static SaErrorT oa_soap_build_lcd_rdr(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id); +static SaErrorT oa_soap_disc_lcd(struct oh_handler_state *oh_handler); +static void oa_soap_push_disc_res(struct oh_handler_state *oh_handler); + /** * oa_soap_discover_resources * @oh_handler: Pointer to openhpi handler @@ -347,8 +394,22 @@ return rv; } + dbg(" Discovering Thermal Subsystem .............."); + rv = oa_soap_disc_therm_subsys(oh_handler); + if (rv != SA_OK) { + err("Failed to discover Thermal Subsystem "); + return rv; + } + + dbg(" Discovering Fan Zone ......................."); + rv = oa_soap_disc_fz(oh_handler); + if (rv != SA_OK) { + err("Failed to discover Fan Zone "); + return rv; + } + dbg(" Discovering Fan ............................"); - rv = discover_fan(oh_handler); + rv = oa_soap_disc_fan(oh_handler); if (rv != SA_OK) { err("Failed to discover Fan "); return rv; @@ -375,17 +436,20 @@ return rv; } - rv = push_discovered_resource_events(oh_handler); - if (rv != SA_OK) { - err("Failed to push the resources to openhpi RPTable"); - return rv; - } + dbg(" Discovering LCD ............................."); + rv = oa_soap_disc_lcd(oh_handler); + if (rv != SA_OK) { + err("Failed to discover LCD"); + return rv; + } + oa_soap_push_disc_res(oh_handler); + return SA_OK; } /** - * build_enclosure_info + * oa_soap_build_enc_info * @oh_handler: Pointer to openhpi handler * @info: Pointer to enclosure info structure * @@ -396,17 +460,21 @@ * Detailed Description: * - Gets the maximum number bays for server blades, interconnect, * OA, fans and power supply + * - Creates the resource id matrix for the server blades, interconnect, + * OA, thermal subsystem, fan zones, fans, power subsystem and + * power supply * - Creates the presence matrix for the server blades, interconnect, * OA, fans and power supply - * - Initialize the presence matrix to ABSENT + * - Initialize the presence matrix to ABSENT and resource id matrix to + * UNSPECIFIED_ID * * Return values: * SA_OK - on success. * SA_ERR_HPI_INVALID_PARAMS - on wrong parameters * SA_ERR_HPI_INTERNAL_ERROR - on failure. **/ -SaErrorT build_enclosure_info(struct oh_handler_state *oh_handler, - struct enclosureInfo *info) +static SaErrorT oa_soap_build_enc_info(struct oh_handler_state *oh_handler, + struct enclosureInfo *info) { struct oa_soap_handler *oa_handler = NULL; SaHpiInt32T i; @@ -422,10 +490,31 @@ return SA_ERR_HPI_INVALID_PARAMS; } + /* Find the enclosure type and max fan zones */ + switch (info->bladeBays) { + case OA_SOAP_C7000_MAX_BLADE: + oa_handler->enc_type = OA_SOAP_ENC_C7000; + oa_handler->oa_soap_resources.fan_zone.max_bays = + OA_SOAP_C7000_MAX_FZ; + break; + case OA_SOAP_C3000_MAX_BLADE: + oa_handler->enc_type = OA_SOAP_ENC_C3000; + oa_handler->oa_soap_resources.fan_zone.max_bays = + OA_SOAP_C3000_MAX_FZ; + break; + default: + err("Invalid number (%d) of server bays detected", + info->bladeBays); + return SA_ERR_HPI_INTERNAL_ERROR; + } + oa_handler->oa_soap_resources.enclosure_rid = SAHPI_UNSPECIFIED_RESOURCE_ID; oa_handler->oa_soap_resources.power_subsystem_rid = SAHPI_UNSPECIFIED_RESOURCE_ID; + oa_handler->oa_soap_resources.thermal_subsystem_rid = + SAHPI_UNSPECIFIED_RESOURCE_ID; + oa_handler->oa_soap_resources.lcd_rid =... [truncated message content] |
From: <pg...@us...> - 2008-12-20 07:52:52
|
Revision: 6923 http://openhpi.svn.sourceforge.net/openhpi/?rev=6923&view=rev Author: pgraghu Date: 2008-12-20 07:52:42 +0000 (Sat, 20 Dec 2008) Log Message: ----------- [2056128] Requesting support for additional temperature sensors Modified Paths: -------------- openhpi/trunk/include/SaHpiOaSoap.h openhpi/trunk/plugins/oa_soap/debug/soaptest.c openhpi/trunk/plugins/oa_soap/oa_soap_calls.c openhpi/trunk/plugins/oa_soap/oa_soap_calls.h openhpi/trunk/plugins/oa_soap/oa_soap_discover.c openhpi/trunk/plugins/oa_soap/oa_soap_discover.h openhpi/trunk/plugins/oa_soap/oa_soap_event.c openhpi/trunk/plugins/oa_soap/oa_soap_re_discover.c openhpi/trunk/plugins/oa_soap/oa_soap_resources.c openhpi/trunk/plugins/oa_soap/oa_soap_resources.h openhpi/trunk/plugins/oa_soap/oa_soap_sensor.c openhpi/trunk/plugins/oa_soap/oa_soap_sensor.h openhpi/trunk/plugins/oa_soap/oa_soap_server_event.c openhpi/trunk/plugins/oa_soap/oa_soap_server_event.h Modified: openhpi/trunk/include/SaHpiOaSoap.h =================================================================== --- openhpi/trunk/include/SaHpiOaSoap.h 2008-12-17 16:33:58 UTC (rev 6922) +++ openhpi/trunk/include/SaHpiOaSoap.h 2008-12-20 07:52:42 UTC (rev 6923) @@ -80,9 +80,9 @@ /* Thermal warning sensor */ #define OA_SOAP_SEN_THERM_WARN (SaHpiSensorNumT) 0x00b /* Thermal danger sensor */ -#define OA_SOAP_SEN_THERM_DANGER (SaHpiSensorNumT) 0x00c +#define OA_SOAP_SEN_THERM_DANGER (SaHpiSensorNumT) 0x00c /* IO configuration error sensor */ -#define OA_SOAP_SEN_IO_CONFIG_ERR (SaHpiSensorNumT) 0x00d +#define OA_SOAP_SEN_IO_CONFIG_ERR (SaHpiSensorNumT) 0x00d /* Device power request error sensor */ #define OA_SOAP_SEN_DEV_PWR_REQ (SaHpiSensorNumT) 0x00e /* Insufficient cooling error sensor */ @@ -147,6 +147,70 @@ #define OA_SOAP_SEN_IML_ERR (SaHpiSensorNumT) 0x02c /* Duplicate management IP address sensor */ #define OA_SOAP_SEN_DUP_MGMT_IP_ADDR (SaHpiSensorNumT) 0x02d +/* Server Blade System zone1 */ +#define OA_SOAP_SEN_BLADE_SYSTEM_ZONE1 (SaHpiSensorNumT) 0x02e +/* Server Blade System zone2 */ +#define OA_SOAP_SEN_BLADE_SYSTEM_ZONE2 (SaHpiSensorNumT) 0x02f +/* Server Blade System zone3 */ +#define OA_SOAP_SEN_BLADE_SYSTEM_ZONE3 (SaHpiSensorNumT) 0x030 +/* Server Blade System zone4 */ +#define OA_SOAP_SEN_BLADE_SYSTEM_ZONE4 (SaHpiSensorNumT) 0x031 +/* Server Blade CPU zone1 */ +#define OA_SOAP_SEN_BLADE_CPU_ZONE1 (SaHpiSensorNumT) 0x032 +/* Server Blade CPU zone2 */ +#define OA_SOAP_SEN_BLADE_CPU_ZONE2 (SaHpiSensorNumT) 0x033 +/* Server Blade CPU zone3 */ +#define OA_SOAP_SEN_BLADE_CPU_ZONE3 (SaHpiSensorNumT) 0x034 +/* Server Blade CPU zone4 */ +#define OA_SOAP_SEN_BLADE_CPU_ZONE4 (SaHpiSensorNumT) 0x035 +/* Server Blade Memory zone1 */ +#define OA_SOAP_SEN_BLADE_MEM_ZONE1 (SaHpiSensorNumT) 0x036 +/* Server Blade Memory zone2 */ +#define OA_SOAP_SEN_BLADE_MEM_ZONE2 (SaHpiSensorNumT) 0x037 +/* Server Blade Memory zone3 */ +#define OA_SOAP_SEN_BLADE_MEM_ZONE3 (SaHpiSensorNumT) 0x038 +/* Server Blade Memory zone4 */ +#define OA_SOAP_SEN_BLADE_MEM_ZONE4 (SaHpiSensorNumT) 0x039 +/* Storage Blade Disk zone1 */ +#define OA_SOAP_SEN_BLADE_DISK_ZONE1 (SaHpiSensorNumT) 0x03a +/* Storage Blade Disk zone2 */ +#define OA_SOAP_SEN_BLADE_DISK_ZONE2 (SaHpiSensorNumT) 0x03b +/* Storage Blade Disk zone3 */ +#define OA_SOAP_SEN_BLADE_DISK_ZONE3 (SaHpiSensorNumT) 0x03c +/* Storage Blade Disk zone4 */ +#define OA_SOAP_SEN_BLADE_DISK_ZONE4 (SaHpiSensorNumT) 0x03d +/* Server Blade CPU1 */ +#define OA_SOAP_SEN_BLADE_CPU1_1 (SaHpiSensorNumT) 0x03e +/* Server Blade CPU1 */ +#define OA_SOAP_SEN_BLADE_CPU1_2 (SaHpiSensorNumT) 0x03f +/* Server Blade CPU1 */ +#define OA_SOAP_SEN_BLADE_CPU1_3 (SaHpiSensorNumT) 0x040 +/* Server Blade CPU1 */ +#define OA_SOAP_SEN_BLADE_CPU1_4 (SaHpiSensorNumT) 0x041 +/* Server Blade CPU2 */ +#define OA_SOAP_SEN_BLADE_CPU2_1 (SaHpiSensorNumT) 0x042 +/* Server Blade CPU2 */ +#define OA_SOAP_SEN_BLADE_CPU2_2 (SaHpiSensorNumT) 0x043 +/* Server Blade CPU2 */ +#define OA_SOAP_SEN_BLADE_CPU2_3 (SaHpiSensorNumT) 0x044 +/* Server Blade CPU2 */ +#define OA_SOAP_SEN_BLADE_CPU2_4 (SaHpiSensorNumT) 0x045 +/* Server Blade CPU3 */ +#define OA_SOAP_SEN_BLADE_CPU3_1 (SaHpiSensorNumT) 0x046 +/* Server Blade CPU3 */ +#define OA_SOAP_SEN_BLADE_CPU3_2 (SaHpiSensorNumT) 0x047 +/* Server Blade CPU3 */ +#define OA_SOAP_SEN_BLADE_CPU3_3 (SaHpiSensorNumT) 0x048 +/* Server Blade CPU3 */ +#define OA_SOAP_SEN_BLADE_CPU3_4 (SaHpiSensorNumT) 0x049 +/* Server Blade CPU4 */ +#define OA_SOAP_SEN_BLADE_CPU4_1 (SaHpiSensorNumT) 0x04a +/* Server Blade CPU4 */ +#define OA_SOAP_SEN_BLADE_CPU4_2 (SaHpiSensorNumT) 0x04b +/* Server Blade CPU4 */ +#define OA_SOAP_SEN_BLADE_CPU4_3 (SaHpiSensorNumT) 0x04c +/* Server Blade CPU4 */ +#define OA_SOAP_SEN_BLADE_CPU4_4 (SaHpiSensorNumT) 0x04d /* Control numbers used in OA SOAP plugin * On adding new control, control array in in plugin/oa_soap/oa_soap_resources.c Modified: openhpi/trunk/plugins/oa_soap/debug/soaptest.c =================================================================== --- openhpi/trunk/plugins/oa_soap/debug/soaptest.c 2008-12-17 16:33:58 UTC (rev 6922) +++ openhpi/trunk/plugins/oa_soap/debug/soaptest.c 2008-12-20 07:52:42 UTC (rev 6923) @@ -109,6 +109,9 @@ struct getFanZoneArrayResponse fanZoneArray_response; struct fanZone fanZone; struct fanInfo fanInfo; + struct getBladeThermalInfoArray getBladeThermalInfoArray_request; + struct bladeThermalInfoArrayResponse getBladeThermalInfoArray_response; + struct bladeThermalInfo bladeThermalInfo; byte bay; int slot; int i; @@ -887,8 +890,47 @@ err("failed soap_setLcdButtonLock() with FALSE in main"); } } - + for (slot = 1; slot <= 2; slot++) { + getBladeThermalInfoArray_request.bayNumber = slot; + if (soap_getBladeThermalInfoArray(con, + &getBladeThermalInfoArray_request, + &getBladeThermalInfoArray_response)) { + err("failed soap_getBladeThermalInfoArray in main"); + continue; + } + while (getBladeThermalInfoArray_response.bladeThermalInfoArray) { + soap_bladeThermalInfo( + getBladeThermalInfoArray_response.bladeThermalInfoArray, + &bladeThermalInfo); + + printf("sensorNumber =%d\n", bladeThermalInfo.sensorNumber); + printf("sensorType =%d\n", bladeThermalInfo.sensorType); + printf("entityId =%d\n", bladeThermalInfo.entityId); + printf("entityInstance =%d\n", bladeThermalInfo.entityInstance); + printf("criticalThreshold =%d\n", bladeThermalInfo. + criticalThreshold); + printf("cautionThreshold =%d\n", bladeThermalInfo. + cautionThreshold); + printf("temperatureC =%d\n", bladeThermalInfo. + temperatureC); + printf("oem =%d\n", bladeThermalInfo.oem); + printf("description=%s\n", bladeThermalInfo.description); + if (bladeThermalInfo.extraData) { + soap_getExtraData(bladeThermalInfo.extraData, + &extraDataInfo_response); + printf("%s:%s\n", extraDataInfo_response.name, + extraDataInfo_response.value); + } + + getBladeThermalInfoArray_response.bladeThermalInfoArray = + soap_next_node(getBladeThermalInfoArray_response. + bladeThermalInfoArray); + } + } + + + #if 1 /* Sometimes, we want to skip events */ /* Try to subscribe for events */ if (soap_subscribeForEvents(con, &subscribeForEvents_response)) { Modified: openhpi/trunk/plugins/oa_soap/oa_soap_calls.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_calls.c 2008-12-17 16:33:58 UTC (rev 6922) +++ openhpi/trunk/plugins/oa_soap/oa_soap_calls.c 2008-12-20 07:52:42 UTC (rev 6923) @@ -633,6 +633,17 @@ response->extraData = soap_walk_tree(node, "extraData"); } +/* parse_getBladeThermalInfoArray - Parses a bladeThermalInfoArrayResponse + * structure */ +static void parse_getBladeThermalInfoArray(xmlNode *node, + struct bladeThermalInfoArrayResponse *response) +{ + response->bladeThermalInfoArray = + soap_walk_tree(node, + "bladeThermalInfoArray:bladeThermalInfo"); + +} + /* parse_getAllEvents - Parses a getAllEventsResponse structure */ static void parse_getAllEvents(xmlNode *node, struct getAllEventsResponse *response) @@ -939,6 +950,22 @@ result->extraData = soap_walk_tree(node, "extraData"); } +void soap_bladeThermalInfo(xmlNode *node, struct bladeThermalInfo * result) +{ + result->sensorNumber = atoi(soap_tree_value(node, "sensorNumber")); + result->sensorType = atoi(soap_tree_value(node, "sensorType")); + result->entityId = atoi(soap_tree_value(node, "entityId")); + result->entityInstance = atoi(soap_tree_value(node, "entityInstance")); + result->criticalThreshold = + atoi(soap_tree_value(node, "criticalThreshold")); + result->cautionThreshold = + atoi(soap_tree_value(node, "cautionThreshold")); + result->temperatureC = atoi(soap_tree_value(node, "temperatureC")); + result->oem = atoi(soap_tree_value(node, "oem")); + result->description = soap_tree_value(node, "description"); + result->extraData = soap_walk_tree(node, "extraData"); +} + /* soap_getEventInfo - Walks list of eventInfo nodes, providing details * on each event. Used after calling soap_getAllEvents(). * @@ -961,6 +988,9 @@ result->queueSize = atoi(str); else result->queueSize = -1; + if ((str = soap_tree_value(events, "numValue"))) { + result->numValue = atoi(str); + } result->extraData = soap_walk_tree(events, "extraData"); /* The remainder depends on what sort of data is returned by the OA. @@ -1665,3 +1695,18 @@ { return(soap_request(con, SET_LCD_BUTTON_LOCK, buttonLock)); } + +int soap_getBladeThermalInfoArray(SOAP_CON *con, + struct getBladeThermalInfoArray *request, + struct bladeThermalInfoArrayResponse *response) +{ + SOAP_PARM_CHECK + if (! (ret = soap_request(con, GET_BLADE_THERMAL_INFO_ARRAY, + request->bayNumber))) { + parse_getBladeThermalInfoArray(soap_walk_doc(con->doc, + "Body:" + "getBladeThermalInfoArrayResponse"), + response); + } + return(ret); +} Modified: openhpi/trunk/plugins/oa_soap/oa_soap_calls.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_calls.h 2008-12-17 16:33:58 UTC (rev 6922) +++ openhpi/trunk/plugins/oa_soap/oa_soap_calls.h 2008-12-20 07:52:42 UTC (rev 6923) @@ -195,6 +195,11 @@ "<hpoa:getLcdStatus>" \ "</hpoa:getLcdStatus>\n" +#define GET_BLADE_THERMAL_INFO_ARRAY \ + "<hpoa:getBladeThermalInfoArray>" \ + "<hpoa:bayNumber>%d</hpoa:bayNumber>" \ + "</hpoa:getBladeThermalInfoArray>\n" + #define SET_ENCLOSURE_UID \ "<hpoa:setEnclosureUid>" \ "<hpoa:uid>%s</hpoa:uid>" \ @@ -1854,6 +1859,7 @@ enum eventType event; time_t eventTimeStamp; int queueSize; + int numValue; union _hpoa__data eventData; enum enum_eventInfo enum_eventInfo; xmlNode *extraData; /* Items are struct extraDataInfo */ @@ -1864,6 +1870,30 @@ xmlNode *eventInfoArray; }; +struct getBladeThermalInfoArray +{ + int bayNumber; +}; + +struct bladeThermalInfoArrayResponse +{ + xmlNode *bladeThermalInfoArray; /* Items are struct bladeThermalInfo */ +}; + +struct bladeThermalInfo +{ + byte sensorNumber; + byte sensorType; + byte entityId; + byte entityInstance; + byte criticalThreshold; + byte cautionThreshold; + byte temperatureC; + byte oem; + char *description; + xmlNode *extraData; /* Items are struct extraDataInfo */ +}; + struct setBladePower { int bayNumber; @@ -1904,7 +1934,6 @@ enum uidControl uid; }; - /* Main OA SOAP Function prototypes */ int soap_subscribeForEvents(SOAP_CON *connection, struct eventPid *response); @@ -2023,6 +2052,11 @@ int soap_setLcdButtonLock(SOAP_CON *con, enum hpoa_boolean buttonLock); +int soap_getBladeThermalInfoArray(SOAP_CON *con, + struct getBladeThermalInfoArray *request, + struct bladeThermalInfoArrayResponse + *response); + /* Function prototypes for OA SOAP helper functions */ void soap_getExtraData(xmlNode *extraData, struct extraDataInfo *result); void soap_getDiagnosticChecksEx(xmlNode *diag, @@ -2040,5 +2074,6 @@ void soap_fanZone(xmlNode *fanZone, struct fanZone *result); void soap_fanInfo(xmlNode *fanZone, struct fanInfo *result); void soap_deviceBayArray(xmlNode *node, byte *bay); +void soap_bladeThermalInfo(xmlNode *node, struct bladeThermalInfo *result); #endif /* _INC_OASOAP_CALLS_H_ */ Modified: openhpi/trunk/plugins/oa_soap/oa_soap_discover.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_discover.c 2008-12-17 16:33:58 UTC (rev 6922) +++ openhpi/trunk/plugins/oa_soap/oa_soap_discover.c 2008-12-20 07:52:42 UTC (rev 6923) @@ -131,6 +131,9 @@ * oa_soap_push_disc_res() - Pushes the discovered resources * information to openhpi framework * + * oa_soap_build_blade_thermal_rdr() - Builds or Enables the thermal + * sensors of blade resource + * */ #include "oa_soap_discover.h" @@ -1463,6 +1466,9 @@ return SA_ERR_HPI_INTERNAL_ERROR; } + /* Set power status of discovered blade resource initially as POWER ON*/ + oa_soap_bay_pwr_status[response->bayNumber -1] = SAHPI_POWER_ON; + /* Get the power state of the server blade to determine the * hotswap state. The hotswap state of the server will be * maintained in the private data area of the server RPT. @@ -1491,6 +1497,12 @@ case SAHPI_POWER_OFF: hotswap_state->currentHsState = SAHPI_HS_STATE_INACTIVE; + + /* Change the power state to POWER OFF for + * blade entry in oa_soap_bay_pwr_status array + */ + oa_soap_bay_pwr_status[response->bayNumber -1] = + SAHPI_POWER_OFF; break; default: @@ -1634,6 +1646,7 @@ * @con: Pointer to the soap client handler. * @response: Server blade info response structure * @resource_id: Resource id + * @name: Blade resource name * * Purpose: * Populate the server blade RDR. @@ -1661,16 +1674,16 @@ SaErrorT build_server_rdr(struct oh_handler_state *oh_handler, SOAP_CON *con, SaHpiInt32T bay_number, - SaHpiResourceIdT resource_id) + SaHpiResourceIdT resource_id, + char *name) { SaErrorT rv = SA_OK; SaHpiRdrT rdr; SaHpiRptEntryT *rpt = NULL; struct oa_soap_inventory *inventory = NULL; struct oa_soap_sensor_info *sensor_info = NULL; - struct getThermalInfo thermal_request; - struct thermalInfo thermal_response; - SaHpiBoolT event_support = SAHPI_FALSE; + struct getBladeThermalInfoArray thermal_request; + struct bladeThermalInfoArrayResponse thermal_response; struct getBladeStatus status_request; struct bladeStatus status_response; SaHpiInt32T sensor_status; @@ -1702,18 +1715,22 @@ } /* Make a soap call to OA requesting for the server thermal status */ - thermal_request.sensorType = SENSOR_TYPE_BLADE; thermal_request.bayNumber = bay_number; - rv = soap_getThermalInfo(con, &thermal_request, &thermal_response); + rv = soap_getBladeThermalInfoArray(con, &thermal_request, + &thermal_response); if (rv != SOAP_OK) { - err("Get thermalInfo failed for enclosure"); + err("getBladeThermalInfo failed for blade"); return SA_ERR_HPI_INTERNAL_ERROR; } - /* Build thermal sensor rdr for the enclosure */ - OA_SOAP_BUILD_THRESHOLD_SENSOR_RDR(OA_SOAP_SEN_TEMP_STATUS, - thermal_response) + /* Build the thermal sensors based on the blade name*/ + rv = oa_soap_build_blade_thermal_rdr(oh_handler, thermal_response, rpt, + name); + if (rv != SA_OK) { + err("Failed to build thermal rdr"); + return SA_ERR_HPI_INTERNAL_ERROR; + } /* Build power sensor rdr for server */ OA_SOAP_BUILD_SENSOR_RDR(OA_SOAP_SEN_PWR_STATUS) @@ -1870,6 +1887,7 @@ struct getBladeInfo request; struct bladeInfo response; SaHpiResourceIdT resource_id; + char blade_name[MAX_NAME_LEN]; if (oh_handler == NULL) { err("Invalid parameters"); @@ -1898,6 +1916,10 @@ continue; } + /* Copy the blade name from response for future processing */ + convert_lower_to_upper(response.name, strlen(response.name), + blade_name, MAX_NAME_LEN); + /* Build rpt entry for server */ rv = build_discovered_server_rpt(oh_handler, oa_handler->active_con, &response, &resource_id); @@ -1915,7 +1937,7 @@ /* Build rdr entry for server */ rv = build_server_rdr(oh_handler, oa_handler->active_con, i, - resource_id); + resource_id, blade_name); if (rv != SA_OK) { err("Failed to add Server rdr"); /* Reset resource_status structure to default values */ @@ -3873,5 +3895,180 @@ return; } +/** + * oa_soap_build_blade_thermal_rdr: + * @oh_handler : Pointer to openhpi handler + * @thermal_response : bladeThermalInfoArrayResponse response + * structure + * @rpt : Pointer to rpt structure + * @name : Blade name + * + * Purpose: Builds the thermal sensors of blade resource + * + * Detailed Description: + * - Parses the bladethermalInfoArray responses + * - For a particular blade type, then thermal sensor rdrs are built + * based on static information available in + * "oa_soap_static_thermal_sensor_config" array for the blade type. + * - While the sensors are being built, if the soap response is NULL then + * the sensor is left in the disable state, else the response is verified + * to check whether the sensor can be enabled for monitoring and is + * enabled if monitoring is supported. + * - The response contains thermal info for different components, zones + * inside the blade. + * - In addition, the bladeThermalInfo sensor of same type in response can + * repeat (Like multiple system zones, cpu_zones, cpu information). + * When there is such multiple instance of the bladeThermalInfo structure + * in the response, sensor numbers are generated as follows: + * For each sensor type, a base sensor number is defined + * First occurrence of this sensor type in the response structure + * is modeled with + * sensor number = base sensor number + * Any later occurrences of the same sensor type in response is + * modeled with + * sensor number = sensor number of previous instance of + * the same sensor type + 1 + * - Currently plugin considers maximum 4 occurrences of thermal info of + * same sensor type for thermal sensor modeling(For example only 4 + * system zone thermal sensors will be modeled even if the blade is able + * to provide more than 4 thermal sensors of system zone type) + * - Finally the bladeThermalInfo structure instance does not contain + * any field identifier to unique distinguish itself into a particular + * sensor type, hence the description field in the bladeThermalInfo + * structure is used as the key to distinguish into particular sensor + * type category. + * - If this module is called during the discovery, then thermal sensors + * rdr are built for sensors supported by blade + * + * Return values: + * SA_OK - on success + * SA_ERR_HPI_INTERNAL_ERROR - on failure + **/ +SaErrorT oa_soap_build_blade_thermal_rdr(struct oh_handler_state *oh_handler, + struct bladeThermalInfoArrayResponse + response, + SaHpiRptEntryT *rpt, + char *name) +{ + SaErrorT rv = SA_OK; + SaHpiBoolT bld_stable = SAHPI_FALSE; + SaHpiInt32T i, j, sen_num, sen_count; + enum oa_soap_blade_type bld_index = OTHER_BLADE_TYPE; + SaHpiRdrT rdr; + struct oa_soap_sensor_info *sensor_info = NULL; + struct bladeThermalInfoArrayResponse temp_response; + struct bladeThermalInfo bld_thrm_info; + struct extraDataInfo extra_data_info; + SaHpiSensorRecT *sensor = NULL; + + if (response.bladeThermalInfoArray != NULL) + bld_stable = SAHPI_TRUE; + + /* Resolve the blade name to blade type enum . + * If the blade name did not match any of the existing blade type + * string, then it is considered OTHER_BLADE_TYPE + */ + for (i=0; i< OA_SOAP_MAX_BLD_TYPE -1 ; i++) { + if (strstr(name, oa_soap_bld_type_str[i])) { + bld_index = i; + break; + } + } + + /* Fetch the thermal sensor information from static thermal sensor + * meant for blade type under discovery + */ + for (i = 0; i < OA_SOAP_MAX_THRM_SEN; i++) { + sen_count = oa_soap_static_thrm_sen_config[bld_index] + [i].sensor_count; + /* Do not add any sensor rdr if the sensor count is zero */ + if (sen_count == 0) + continue; + + for (j = 0; j< sen_count; j++) { + memset(&rdr, 0, sizeof(SaHpiRdrT)); + sen_num = + oa_soap_static_thrm_sen_config[bld_index][i]. + base_sen_num + j; + rv = oa_soap_build_sen_rdr(oh_handler, rpt->ResourceId, + &rdr, &sensor_info, sen_num); + if (rv != SA_OK) { + err("Failed to create rdr for sensor %x", + sen_num); + return rv; + } + + /* Initialize the sensor enable state as disabled */ + sensor_info->sensor_enable = SAHPI_FALSE; + if (bld_stable == SAHPI_FALSE) { + dbg("Blade not in stable state, leaving sensor" + " in disable state"); + } else { + /* Call the following function to retrieve + * the correct instance of bladeThermalInfo + * response. + */ + temp_response = response; + rv = oa_soap_get_bld_thrm_sen_data(sen_num, + temp_response, + &bld_thrm_info); + + if (rv != SA_OK) { + err("Could not find the matching" + " sensors info from blade"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + /* Check for the "SensorPresent" value in + * bladeThermalInfo structure. + * If the value is true, then enable the sensor + * built statically in previous step + */ + soap_getExtraData(bld_thrm_info.extraData, + &extra_data_info); + + if ((extra_data_info.value != NULL) && + (!(strcasecmp(extra_data_info.value, + "true")))) { + sensor_info->sensor_enable = SAHPI_TRUE; + + sensor = &(rdr.RdrTypeUnion.SensorRec); + /* Updating the rdr with actual upper + * critical threshold value provided by + * OA + */ + sensor->DataFormat.Range.Max.Value. + SensorFloat64 = + sensor_info->threshold.UpCritical.Value. + SensorFloat64 = + bld_thrm_info.criticalThreshold; + + /* Updating the rdr with actual upper + * caution threshold value provided by + * OA + */ + sensor->DataFormat.Range.NormalMax.Value. + SensorFloat64 = + sensor_info->threshold.UpMajor.Value. + SensorFloat64 = + bld_thrm_info.cautionThreshold; + } else { + dbg("Sensor %s not enabled for blade", + bld_thrm_info.description); + } + } + + rv = oh_add_rdr(oh_handler->rptcache, rpt->ResourceId, + &rdr, sensor_info, 0); + if (rv != SA_OK) { + err("Failed to add rdr"); + return rv; + } + } + } + return SA_OK; +} + + void * oh_discover_resources (void *) __attribute__ ((weak, alias("oa_soap_discover_resources"))); Modified: openhpi/trunk/plugins/oa_soap/oa_soap_discover.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_discover.h 2008-12-17 16:33:58 UTC (rev 6922) +++ openhpi/trunk/plugins/oa_soap/oa_soap_discover.h 2008-12-20 07:52:42 UTC (rev 6923) @@ -192,7 +192,8 @@ SaErrorT build_server_rdr(struct oh_handler_state *oh_handler, SOAP_CON *con, SaHpiInt32T bay_number, - SaHpiResourceIdT resource_id); + SaHpiResourceIdT resource_id, + char *name); SaErrorT discover_server(struct oh_handler_state *oh_handler); @@ -272,4 +273,10 @@ struct oh_event *event, GSList **assert_sensors); +SaErrorT oa_soap_build_blade_thermal_rdr( + struct oh_handler_state *oh_handler, + struct bladeThermalInfoArrayResponse thermal_response, + SaHpiRptEntryT *rpt, + char *name); + #endif Modified: openhpi/trunk/plugins/oa_soap/oa_soap_event.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_event.c 2008-12-17 16:33:58 UTC (rev 6922) +++ openhpi/trunk/plugins/oa_soap/oa_soap_event.c 2008-12-20 07:52:42 UTC (rev 6923) @@ -748,7 +748,7 @@ break; case EVENT_BLADE_STATUS: dbg("EVENT_BLADE_STATUS"); - oa_soap_proc_server_status(oh_handler, + oa_soap_proc_server_status(oh_handler, con, &(event.eventData.bladeStatus)); break; @@ -776,12 +776,12 @@ break; case EVENT_BLADE_SHUTDOWN: dbg("EVENT_BLADE_SHUTDOWN"); - oa_soap_proc_server_status(oh_handler, + oa_soap_proc_server_status(oh_handler, con, &(event.eventData.bladeStatus)); break; case EVENT_BLADE_FAULT: dbg("EVENT_BLADE_FAULT"); - oa_soap_proc_server_status(oh_handler, + oa_soap_proc_server_status(oh_handler, con, &(event.eventData.bladeStatus)); break; case EVENT_BLADE_INFO: @@ -818,7 +818,7 @@ break; case EVENT_ILO_DEAD: dbg("EVENT_ILO_DEAD"); - oa_soap_proc_server_status(oh_handler, + oa_soap_proc_server_status(oh_handler, con, &(event.eventData.bladeStatus)); break; case EVENT_RACK_SERVICE_STARTED: @@ -831,7 +831,7 @@ break; case EVENT_ILO_ALIVE: dbg("EVENT_ILO_ALIVE"); - oa_soap_proc_server_status(oh_handler, + oa_soap_proc_server_status(oh_handler, con, &(event.eventData.bladeStatus)); break; case EVENT_PERSONALITY_CHECK: @@ -839,8 +839,9 @@ break; case EVENT_BLADE_POST_COMPLETE: - dbg("EVENT_BLADE_POST_COMPLETE " - "-- Not processed"); + dbg("EVENT_BLADE_POST_COMPLETE"); + oa_soap_serv_post_comp(oh_handler, con, + event.numValue); break; case EVENT_BLADE_SIGNATURE_CHANGED: Modified: openhpi/trunk/plugins/oa_soap/oa_soap_re_discover.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_re_discover.c 2008-12-17 16:33:58 UTC (rev 6922) +++ openhpi/trunk/plugins/oa_soap/oa_soap_re_discover.c 2008-12-20 07:52:42 UTC (rev 6923) @@ -1012,6 +1012,7 @@ SaHpiResourceIdT resource_id; SaHpiRptEntryT *rpt; GSList *asserted_sensors = NULL; + char blade_name[MAX_NAME_LEN]; if (oh_handler == NULL || info == NULL || con == NULL) { err("Invalid parameters"); @@ -1030,6 +1031,10 @@ return SA_ERR_HPI_INTERNAL_ERROR; } + /* Copy the blade name from response for future processing */ + convert_lower_to_upper(response.name, strlen(response.name), + blade_name, MAX_NAME_LEN); + /* Build the server RPR entry */ rv = build_discovered_server_rpt(oh_handler, con, info, &resource_id); if (rv != SA_OK) { @@ -1045,7 +1050,8 @@ response.serialNumber, resource_id, RES_PRESENT); /* Build the server RDR */ - rv = build_server_rdr(oh_handler, con, bay_number, resource_id); + rv = build_server_rdr(oh_handler, con, bay_number, resource_id, + blade_name); if (rv != SA_OK) { err("build inserted server RDR failed"); /* Free the inventory info from inventory RDR */ @@ -2372,7 +2378,7 @@ } /* Check the server sensor states */ - oa_soap_proc_server_status(oh_handler, &response); + oa_soap_proc_server_status(oh_handler, con, &response); return SA_OK; } Modified: openhpi/trunk/plugins/oa_soap/oa_soap_resources.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_resources.c 2008-12-17 16:33:58 UTC (rev 6922) +++ openhpi/trunk/plugins/oa_soap/oa_soap_resources.c 2008-12-20 07:52:42 UTC (rev 6923) @@ -726,14 +726,14 @@ /* Update the value with critical threshold * reading */ - .UpCritical.Value.SensorFloat64 = 0x0, + .UpCritical.Value.SensorFloat64 = 43, .UpMajor.IsSupported = SAHPI_TRUE, .UpMajor.Type = SAHPI_SENSOR_READING_TYPE_FLOAT64, /* Update the value with major threshold * reading */ - .UpMajor.Value.SensorFloat64 = 0x0, + .UpMajor.Value.SensorFloat64 = 38, }, }, .sensor_class = OA_SOAP_TEMP_CLASS, @@ -924,7 +924,7 @@ }, }, }, - .comment = "Thermal status", + .comment = "Ambient Zone Thermal Status", }, /* Redundancy status sensor */ { @@ -4219,6 +4219,2438 @@ }, .comment = "Duplicate management IP address", }, + /* System zone1 sensor */ + { + .sensor = { + .Num = OA_SOAP_SEN_BLADE_SYSTEM_ZONE1, + .Type = SAHPI_TEMPERATURE, + .Category = SAHPI_EC_THRESHOLD, + .EnableCtrl = SAHPI_TRUE, + .EventCtrl = SAHPI_SEC_READ_ONLY, + .Events = SAHPI_ES_UNSPECIFIED, + .DataFormat = { + .IsSupported = SAHPI_TRUE, + .ReadingType = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + .BaseUnits = SAHPI_SU_DEGREES_C, + .ModifierUnits = SAHPI_SU_UNSPECIFIED, + .ModifierUse = SAHPI_SMUU_NONE, + .Percentage = SAHPI_FALSE, + .Range.Flags = SAHPI_SRF_MAX | + SAHPI_SRF_NORMAL_MAX, + .Range.Max.IsSupported = SAHPI_TRUE, + .Range.Max.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Max value should be replaced + * with Max value retrieved from OA + */ + .Range.Max.Value.SensorFloat64 = 85, + .Range.NormalMax.IsSupported = SAHPI_TRUE, + .Range.NormalMax.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Normal Max value should be + * replaced with Normal Max value retrieved + * from OA + */ + .Range.NormalMax.Value.SensorFloat64 = 80, + .AccuracyFactor = 0, + }, + .ThresholdDefn = { + .IsAccessible = SAHPI_TRUE, + .ReadThold = SAHPI_ES_UPPER_CRIT | + SAHPI_ES_UPPER_MAJOR, + .WriteThold = 0x0, + }, + .Oem = 0, + }, + .sensor_info = { + .current_state = SAHPI_ES_UNSPECIFIED, + .sensor_enable = SAHPI_TRUE, + .event_enable = SAHPI_FALSE, + .assert_mask = OA_SOAP_STM_UNSPECIFED, + .deassert_mask = OA_SOAP_STM_UNSPECIFED, + .sensor_reading = { + .IsSupported = SAHPI_TRUE, + .Type = SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with current reading */ + .Value.SensorFloat64 = 0x0, + }, + .threshold = { + .UpCritical.IsSupported = SAHPI_TRUE, + .UpCritical.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with critical threshold + * reading + */ + .UpCritical.Value.SensorFloat64 = 85, + .UpMajor.IsSupported = SAHPI_TRUE, + .UpMajor.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with major threshold + * reading + */ + .UpMajor.Value.SensorFloat64 = 80, + }, + }, + .sensor_class = OA_SOAP_BLADE_THERMAL_CLASS, + .comment = "System Zone thermal status", + }, + /* System zone2 sensor */ + { + .sensor = { + .Num = OA_SOAP_SEN_BLADE_SYSTEM_ZONE2, + .Type = SAHPI_TEMPERATURE, + .Category = SAHPI_EC_THRESHOLD, + .EnableCtrl = SAHPI_TRUE, + .EventCtrl = SAHPI_SEC_READ_ONLY, + .Events = SAHPI_ES_UNSPECIFIED, + .DataFormat = { + .IsSupported = SAHPI_TRUE, + .ReadingType = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + .BaseUnits = SAHPI_SU_DEGREES_C, + .ModifierUnits = SAHPI_SU_UNSPECIFIED, + .ModifierUse = SAHPI_SMUU_NONE, + .Percentage = SAHPI_FALSE, + .Range.Flags = SAHPI_SRF_MAX | + SAHPI_SRF_NORMAL_MAX, + .Range.Max.IsSupported = SAHPI_TRUE, + .Range.Max.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Max value should be replaced + * with Max value retrieved from OA + */ + .Range.Max.Value.SensorFloat64 = 85, + .Range.NormalMax.IsSupported = SAHPI_TRUE, + .Range.NormalMax.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Normal Max value should be + * replaced with Normal Max value retrieved + * from OA + */ + .Range.NormalMax.Value.SensorFloat64 = 80, + .AccuracyFactor = 0, + }, + .ThresholdDefn = { + .IsAccessible = SAHPI_TRUE, + .ReadThold = SAHPI_ES_UPPER_CRIT | + SAHPI_ES_UPPER_MAJOR, + .WriteThold = 0x0, + }, + .Oem = 0, + }, + .sensor_info = { + .current_state = SAHPI_ES_UNSPECIFIED, + .sensor_enable = SAHPI_TRUE, + .event_enable = SAHPI_FALSE, + .assert_mask = OA_SOAP_STM_UNSPECIFED, + .deassert_mask = OA_SOAP_STM_UNSPECIFED, + .sensor_reading = { + .IsSupported = SAHPI_TRUE, + .Type = SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with current reading */ + .Value.SensorFloat64 = 0x0, + }, + .threshold = { + .UpCritical.IsSupported = SAHPI_TRUE, + .UpCritical.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with critical threshold + * reading + */ + .UpCritical.Value.SensorFloat64 = 85, + .UpMajor.IsSupported = SAHPI_TRUE, + .UpMajor.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with major threshold + * reading + */ + .UpMajor.Value.SensorFloat64 = 80, + }, + }, + .sensor_class = OA_SOAP_BLADE_THERMAL_CLASS, + .comment = "System Zone thermal status", + }, + /* System zone3 sensor */ + { + .sensor = { + .Num = OA_SOAP_SEN_BLADE_SYSTEM_ZONE3, + .Type = SAHPI_TEMPERATURE, + .Category = SAHPI_EC_THRESHOLD, + .EnableCtrl = SAHPI_TRUE, + .EventCtrl = SAHPI_SEC_READ_ONLY, + .Events = SAHPI_ES_UNSPECIFIED, + .DataFormat = { + .IsSupported = SAHPI_TRUE, + .ReadingType = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + .BaseUnits = SAHPI_SU_DEGREES_C, + .ModifierUnits = SAHPI_SU_UNSPECIFIED, + .ModifierUse = SAHPI_SMUU_NONE, + .Percentage = SAHPI_FALSE, + .Range.Flags = SAHPI_SRF_MAX | + SAHPI_SRF_NORMAL_MAX, + .Range.Max.IsSupported = SAHPI_TRUE, + .Range.Max.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Max value should be replaced + * with Max value retrieved from OA + */ + .Range.Max.Value.SensorFloat64 = 85, + .Range.NormalMax.IsSupported = SAHPI_TRUE, + .Range.NormalMax.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Normal Max value should be + * replaced with Normal Max value retrieved + * from OA + */ + .Range.NormalMax.Value.SensorFloat64 = 80, + .AccuracyFactor = 0, + }, + .ThresholdDefn = { + .IsAccessible = SAHPI_TRUE, + .ReadThold = SAHPI_ES_UPPER_CRIT | + SAHPI_ES_UPPER_MAJOR, + .WriteThold = 0x0, + }, + .Oem = 0, + }, + .sensor_info = { + .current_state = SAHPI_ES_UNSPECIFIED, + .sensor_enable = SAHPI_TRUE, + .event_enable = SAHPI_FALSE, + .assert_mask = OA_SOAP_STM_UNSPECIFED, + .deassert_mask = OA_SOAP_STM_UNSPECIFED, + .sensor_reading = { + .IsSupported = SAHPI_TRUE, + .Type = SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with current reading */ + .Value.SensorFloat64 = 0x0, + }, + .threshold = { + .UpCritical.IsSupported = SAHPI_TRUE, + .UpCritical.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with critical threshold + * reading + */ + .UpCritical.Value.SensorFloat64 = 85, + .UpMajor.IsSupported = SAHPI_TRUE, + .UpMajor.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with major threshold + * reading + */ + .UpMajor.Value.SensorFloat64 = 80, + }, + }, + .sensor_class = OA_SOAP_BLADE_THERMAL_CLASS, + .comment = "System Zone thermal status", + }, + /* System zone4 sensor */ + { + .sensor = { + .Num = OA_SOAP_SEN_BLADE_SYSTEM_ZONE4, + .Type = SAHPI_TEMPERATURE, + .Category = SAHPI_EC_THRESHOLD, + .EnableCtrl = SAHPI_TRUE, + .EventCtrl = SAHPI_SEC_READ_ONLY, + .Events = SAHPI_ES_UNSPECIFIED, + .DataFormat = { + .IsSupported = SAHPI_TRUE, + .ReadingType = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + .BaseUnits = SAHPI_SU_DEGREES_C, + .ModifierUnits = SAHPI_SU_UNSPECIFIED, + .ModifierUse = SAHPI_SMUU_NONE, + .Percentage = SAHPI_FALSE, + .Range.Flags = SAHPI_SRF_MAX | + SAHPI_SRF_NORMAL_MAX, + .Range.Max.IsSupported = SAHPI_TRUE, + .Range.Max.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Max value should be replaced + * with Max value retrieved from OA + */ + .Range.Max.Value.SensorFloat64 = 85, + .Range.NormalMax.IsSupported = SAHPI_TRUE, + .Range.NormalMax.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Normal Max value should be + * replaced with Normal Max value retrieved + * from OA + */ + .Range.NormalMax.Value.SensorFloat64 = 80, + .AccuracyFactor = 0, + }, + .ThresholdDefn = { + .IsAccessible = SAHPI_TRUE, + .ReadThold = SAHPI_ES_UPPER_CRIT | + SAHPI_ES_UPPER_MAJOR, + .WriteThold = 0x0, + }, + .Oem = 0, + }, + .sensor_info = { + .current_state = SAHPI_ES_UNSPECIFIED, + .sensor_enable = SAHPI_TRUE, + .event_enable = SAHPI_FALSE, + .assert_mask = OA_SOAP_STM_UNSPECIFED, + .deassert_mask = OA_SOAP_STM_UNSPECIFED, + .sensor_reading = { + .IsSupported = SAHPI_TRUE, + .Type = SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with current reading */ + .Value.SensorFloat64 = 0x0, + }, + .threshold = { + .UpCritical.IsSupported = SAHPI_TRUE, + .UpCritical.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with critical threshold + * reading + */ + .UpCritical.Value.SensorFloat64 = 85, + .UpMajor.IsSupported = SAHPI_TRUE, + .UpMajor.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with major threshold + * reading + */ + .UpMajor.Value.SensorFloat64 = 80, + }, + }, + .sensor_class = OA_SOAP_BLADE_THERMAL_CLASS, + .comment = "System Zone thermal status", + }, + /* CPU zone1 sensor */ + { + .sensor = { + .Num = OA_SOAP_SEN_BLADE_CPU_ZONE1, + .Type = SAHPI_TEMPERATURE, + .Category = SAHPI_EC_THRESHOLD, + .EnableCtrl = SAHPI_TRUE, + .EventCtrl = SAHPI_SEC_READ_ONLY, + .Events = SAHPI_ES_UNSPECIFIED, + .DataFormat = { + .IsSupported = SAHPI_TRUE, + .ReadingType = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + .BaseUnits = SAHPI_SU_DEGREES_C, + .ModifierUnits = SAHPI_SU_UNSPECIFIED, + .ModifierUse = SAHPI_SMUU_NONE, + .Percentage = SAHPI_FALSE, + .Range.Flags = SAHPI_SRF_MAX | + SAHPI_SRF_NORMAL_MAX, + .Range.Max.IsSupported = SAHPI_TRUE, + .Range.Max.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Max value should be replaced + * with Max value retrieved from OA + */ + .Range.Max.Value.SensorFloat64 = 70, + .Range.NormalMax.IsSupported = SAHPI_TRUE, + .Range.NormalMax.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Normal Max value should be + * replaced with Normal Max value retrieved + * from OA + */ + .Range.NormalMax.Value.SensorFloat64 = 65, + .AccuracyFactor = 0, + }, + .ThresholdDefn = { + .IsAccessible = SAHPI_TRUE, + .ReadThold = SAHPI_ES_UPPER_CRIT | + SAHPI_ES_UPPER_MAJOR, + .WriteThold = 0x0, + }, + .Oem = 0, + }, + .sensor_info = { + .current_state = SAHPI_ES_UNSPECIFIED, + .sensor_enable = SAHPI_TRUE, + .event_enable = SAHPI_FALSE, + .assert_mask = OA_SOAP_STM_UNSPECIFED, + .deassert_mask = OA_SOAP_STM_UNSPECIFED, + .sensor_reading = { + .IsSupported = SAHPI_TRUE, + .Type = SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with current reading */ + .Value.SensorFloat64 = 0x0, + }, + .threshold = { + .UpCritical.IsSupported = SAHPI_TRUE, + .UpCritical.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with critical threshold + * reading + */ + .UpCritical.Value.SensorFloat64 = 70, + .UpMajor.IsSupported = SAHPI_TRUE, + .UpMajor.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with major threshold + * reading + */ + .UpMajor.Value.SensorFloat64 = 65, + }, + }, + .sensor_class = OA_SOAP_BLADE_THERMAL_CLASS, + .comment = "CPU Zone thermal status", + }, + /* CPU zone2 sensor */ + { + .sensor = { + .Num = OA_SOAP_SEN_BLADE_CPU_ZONE2, + .Type = SAHPI_TEMPERATURE, + .Category = SAHPI_EC_THRESHOLD, + .EnableCtrl = SAHPI_TRUE, + .EventCtrl = SAHPI_SEC_READ_ONLY, + .Events = SAHPI_ES_UNSPECIFIED, + .DataFormat = { + .IsSupported = SAHPI_TRUE, + .ReadingType = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + .BaseUnits = SAHPI_SU_DEGREES_C, + .ModifierUnits = SAHPI_SU_UNSPECIFIED, + .ModifierUse = SAHPI_SMUU_NONE, + .Percentage = SAHPI_FALSE, + .Range.Flags = SAHPI_SRF_MAX | + SAHPI_SRF_NORMAL_MAX, + .Range.Max.IsSupported = SAHPI_TRUE, + .Range.Max.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Max value should be replaced + * with Max value retrieved from OA + */ + .Range.Max.Value.SensorFloat64 = 70, + .Range.NormalMax.IsSupported = SAHPI_TRUE, + .Range.NormalMax.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Normal Max value should be + * replaced with Normal Max value retrieved + * from OA + */ + .Range.NormalMax.Value.SensorFloat64 = 65, + .AccuracyFactor = 0, + }, + .ThresholdDefn = { + .IsAccessible = SAHPI_TRUE, + .ReadThold = SAHPI_ES_UPPER_CRIT | + SAHPI_ES_UPPER_MAJOR, + .WriteThold = 0x0, + }, + .Oem = 0, + }, + .sensor_info = { + .current_state = SAHPI_ES_UNSPECIFIED, + .sensor_enable = SAHPI_TRUE, + .event_enable = SAHPI_FALSE, + .assert_mask = OA_SOAP_STM_UNSPECIFED, + .deassert_mask = OA_SOAP_STM_UNSPECIFED, + .sensor_reading = { + .IsSupported = SAHPI_TRUE, + .Type = SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with current reading */ + .Value.SensorFloat64 = 0x0, + }, + .threshold = { + .UpCritical.IsSupported = SAHPI_TRUE, + .UpCritical.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with critical threshold + * reading + */ + .UpCritical.Value.SensorFloat64 = 70, + .UpMajor.IsSupported = SAHPI_TRUE, + .UpMajor.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with major threshold + * reading + */ + .UpMajor.Value.SensorFloat64 = 65, + }, + }, + .sensor_class = OA_SOAP_BLADE_THERMAL_CLASS, + .comment = "CPU Zone thermal status", + }, + /* CPU zone3 sensor */ + { + .sensor = { + .Num = OA_SOAP_SEN_BLADE_CPU_ZONE3, + .Type = SAHPI_TEMPERATURE, + .Category = SAHPI_EC_THRESHOLD, + .EnableCtrl = SAHPI_TRUE, + .EventCtrl = SAHPI_SEC_READ_ONLY, + .Events = SAHPI_ES_UNSPECIFIED, + .DataFormat = { + .IsSupported = SAHPI_TRUE, + .ReadingType = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + .BaseUnits = SAHPI_SU_DEGREES_C, + .ModifierUnits = SAHPI_SU_UNSPECIFIED, + .ModifierUse = SAHPI_SMUU_NONE, + .Percentage = SAHPI_FALSE, + .Range.Flags = SAHPI_SRF_MAX | + SAHPI_SRF_NORMAL_MAX, + .Range.Max.IsSupported = SAHPI_TRUE, + .Range.Max.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Max value should be replaced + * with Max value retrieved from OA + */ + .Range.Max.Value.SensorFloat64 = 70, + .Range.NormalMax.IsSupported = SAHPI_TRUE, + .Range.NormalMax.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Normal Max value should be + * replaced with Normal Max value retrieved + * from OA + */ + .Range.NormalMax.Value.SensorFloat64 = 65, + .AccuracyFactor = 0, + }, + .ThresholdDefn = { + .IsAccessible = SAHPI_TRUE, + .ReadThold = SAHPI_ES_UPPER_CRIT | + SAHPI_ES_UPPER_MAJOR, + .WriteThold = 0x0, + }, + .Oem = 0, + }, + .sensor_info = { + .current_state = SAHPI_ES_UNSPECIFIED, + .sensor_enable = SAHPI_TRUE, + .event_enable = SAHPI_FALSE, + .assert_mask = OA_SOAP_STM_UNSPECIFED, + .deassert_mask = OA_SOAP_STM_UNSPECIFED, + .sensor_reading = { + .IsSupported = SAHPI_TRUE, + .Type = SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with current reading */ + .Value.SensorFloat64 = 0x0, + }, + .threshold = { + .UpCritical.IsSupported = SAHPI_TRUE, + .UpCritical.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with critical threshold + * reading + */ + .UpCritical.Value.SensorFloat64 = 70, + .UpMajor.IsSupported = SAHPI_TRUE, + .UpMajor.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with major threshold + * reading + */ + .UpMajor.Value.SensorFloat64 = 65, + }, + }, + .sensor_class = OA_SOAP_BLADE_THERMAL_CLASS, + .comment = "CPU Zone thermal status", + }, + /* CPU zone4 sensor */ + { + .sensor = { + .Num = OA_SOAP_SEN_BLADE_CPU_ZONE4, + .Type = SAHPI_TEMPERATURE, + .Category = SAHPI_EC_THRESHOLD, + .EnableCtrl = SAHPI_TRUE, + .EventCtrl = SAHPI_SEC_READ_ONLY, + .Events = SAHPI_ES_UNSPECIFIED, + .DataFormat = { + .IsSupported = SAHPI_TRUE, + .ReadingType = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + .BaseUnits = SAHPI_SU_DEGREES_C, + .ModifierUnits = SAHPI_SU_UNSPECIFIED, + .ModifierUse = SAHPI_SMUU_NONE, + .Percentage = SAHPI_FALSE, + .Range.Flags = SAHPI_SRF_MAX | + SAHPI_SRF_NORMAL_MAX, + .Range.Max.IsSupported = SAHPI_TRUE, + .Range.Max.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Max value should be replaced + * with Max value retrieved from OA + */ + .Range.Max.Value.SensorFloat64 = 70, + .Range.NormalMax.IsSupported = SAHPI_TRUE, + .Range.NormalMax.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Normal Max value should be + * replaced with Normal Max value retrieved + * from OA + */ + .Range.NormalMax.Value.SensorFloat64 = 65, + .AccuracyFactor = 0, + }, + .ThresholdDefn = { + .IsAccessible = SAHPI_TRUE, + .ReadThold = SAHPI_ES_UPPER_CRIT | + SAHPI_ES_UPPER_MAJOR, + .WriteThold = 0x0, + }, + .Oem = 0, + }, + .sensor_info = { + .current_state = SAHPI_ES_UNSPECIFIED, + .sensor_enable = SAHPI_TRUE, + .event_enable = SAHPI_FALSE, + .assert_mask = OA_SOAP_STM_UNSPECIFED, + .deassert_mask = OA_SOAP_STM_UNSPECIFED, + .sensor_reading = { + .IsSupported = SAHPI_TRUE, + .Type = SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with current reading */ + .Value.SensorFloat64 = 0x0, + }, + .threshold = { + .UpCritical.IsSupported = SAHPI_TRUE, + .UpCritical.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with critical threshold + * reading + */ + .UpCritical.Value.SensorFloat64 = 70, + .UpMajor.IsSupported = SAHPI_TRUE, + .UpMajor.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with major threshold + * reading + */ + .UpMajor.Value.SensorFloat64 = 65, + }, + }, + .sensor_class = OA_SOAP_BLADE_THERMAL_CLASS, + .comment = "CPU Zone thermal status", + }, + /* Memory zone1 sensor */ + { + .sensor = { + .Num = OA_SOAP_SEN_BLADE_MEM_ZONE1, + .Type = SAHPI_TEMPERATURE, + .Category = SAHPI_EC_THRESHOLD, + .EnableCtrl = SAHPI_TRUE, + .EventCtrl = SAHPI_SEC_READ_ONLY, + .Events = SAHPI_ES_UNSPECIFIED, + .DataFormat = { + .IsSupported = SAHPI_TRUE, + .ReadingType = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + .BaseUnits = SAHPI_SU_DEGREES_C, + .ModifierUnits = SAHPI_SU_UNSPECIFIED, + .ModifierUse = SAHPI_SMUU_NONE, + .Percentage = SAHPI_FALSE, + .Range.Flags = SAHPI_SRF_MAX | + SAHPI_SRF_NORMAL_MAX, + .Range.Max.IsSupported = SAHPI_TRUE, + .Range.Max.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Max value should be replaced + * with Max value retrieved from OA + */ + .Range.Max.Value.SensorFloat64 = 100, + .Range.NormalMax.IsSupported = SAHPI_TRUE, + .Range.NormalMax.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Normal Max value should be + * replaced with Normal Max value retrieved + * from OA + */ + .Range.NormalMax.Value.SensorFloat64 = 85, + .AccuracyFactor = 0, + }, + .ThresholdDefn = { + .IsAccessible = SAHPI_TRUE, + .ReadThold = SAHPI_ES_UPPER_CRIT | + SAHPI_ES_UPPER_MAJOR, + .WriteThold = 0x0, + }, + .Oem = 0, + }, + .sensor_info = { + .current_state = SAHPI_ES_UNSPECIFIED, + .sensor_enable = SAHPI_TRUE, + .event_enable = SAHPI_FALSE, + .assert_mask = OA_SOAP_STM_UNSPECIFED, + .deassert_mask = OA_SOAP_STM_UNSPECIFED, + .sensor_reading = { + .IsSupported = SAHPI_TRUE, + .Type = SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with current reading */ + .Value.SensorFloat64 = 0x0, + }, + .threshold = { + .UpCritical.IsSupported = SAHPI_TRUE, + .UpCritical.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with critical threshold + * reading + */ + .UpCritical.Value.SensorFloat64 = 100, + .UpMajor.IsSupported = SAHPI_TRUE, + .UpMajor.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with major threshold + * reading + */ + .UpMajor.Value.SensorFloat64 = 85, + }, + }, + .sensor_class = OA_SOAP_BLADE_THERMAL_CLASS, + .comment = "Memory Zone thermal status", + }, + /* Memory zone2 sensor */ + { + .sensor = { + .Num = OA_SOAP_SEN_BLADE_MEM_ZONE2, + .Type = SAHPI_TEMPERATURE, + .Category = SAHPI_EC_THRESHOLD, + .EnableCtrl = SAHPI_TRUE, + .EventCtrl = SAHPI_SEC_READ_ONLY, + .Events = SAHPI_ES_UNSPECIFIED, + .DataFormat = { + .IsSupported = SAHPI_TRUE, + .ReadingType = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + .BaseUnits = SAHPI_SU_DEGREES_C, + .ModifierUnits = SAHPI_SU_UNSPECIFIED, + .ModifierUse = SAHPI_SMUU_NONE, + .Percentage = SAHPI_FALSE, + .Range.Flags = SAHPI_SRF_MAX | + SAHPI_SRF_NORMAL_MAX, + .Range.Max.IsSupported = SAHPI_TRUE, + .Range.Max.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Max value should be replaced + * with Max value retrieved from OA + */ + .Range.Max.Value.SensorFloat64 = 100, + .Range.NormalMax.IsSupported = SAHPI_TRUE, + .Range.NormalMax.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Normal Max value should be + * replaced with Normal Max value retrieved + * from OA + */ + .Range.NormalMax.Value.SensorFloat64 = 85, + .AccuracyFactor = 0, + }, + .ThresholdDefn = { + .IsAccessible = SAHPI_TRUE, + .ReadThold = SAHPI_ES_UPPER_CRIT | + SAHPI_ES_UPPER_MAJOR, + .WriteThold = 0x0, + }, + .Oem = 0, + }, + .sensor_info = { + .current_state = SAHPI_ES_UNSPECIFIED, + .sensor_enable = SAHPI_TRUE, + .event_enable = SAHPI_FALSE, + .assert_mask = OA_SOAP_STM_UNSPECIFED, + .deassert_mask = OA_SOAP_STM_UNSPECIFED, + .sensor_reading = { + .IsSupported = SAHPI_TRUE, + .Type = SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with current reading */ + .Value.SensorFloat64 = 0x0, + }, + .threshold = { + .UpCritical.IsSupported = SAHPI_TRUE, + .UpCritical.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with critical threshold + * reading + */ + .UpCritical.Value.SensorFloat64 = 100, + .UpMajor.IsSupported = SAHPI_TRUE, + .UpMajor.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with major threshold + * reading + */ + .UpMajor.Value.SensorFloat64 = 85, + }, + }, + .sensor_class = OA_SOAP_BLADE_THERMAL_CLASS, + .comment = "Memory Zone thermal status", + }, + /* Memory zone3 sensor */ + { + .sensor = { + .Num = OA_SOAP_SEN_BLADE_MEM_ZONE3, + .Type = SAHPI_TEMPERATURE, + .Category = SAHPI_EC_THRESHOLD, + .EnableCtrl = SAHPI_TRUE, + .EventCtrl = SAHPI_SEC_READ_ONLY, + .Events = SAHPI_ES_UNSPECIFIED, + .DataFormat = { + .IsSupported = SAHPI_TRUE, + .ReadingType = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + .BaseUnits = SAHPI_SU_DEGREES_C, + .ModifierUnits = SAHPI_SU_UNSPECIFIED, + .ModifierUse = SAHPI_SMUU_NONE, + .Percentage = SAHPI_FALSE, + .Range.Flags = SAHPI_SRF_MAX | + SAHPI_SRF_NORMAL_MAX, + .Range.Max.IsSupported = SAHPI_TRUE, + .Range.Max.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Max value should be replaced + * with Max value retrieved from OA + */ + .Range.Max.Value.SensorFloat64 = 100, + .Range.NormalMax.IsSupported = SAHPI_TRUE, + .Range.NormalMax.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Normal Max value should be + * replaced with Normal Max value retrieved + * from OA + */ + .Range.NormalMax.Value.SensorFloat64 = 85, + .AccuracyFactor = 0, + }, + .ThresholdDefn = { + .IsAccessible = SAHPI_TRUE, + .ReadThold = SAHPI_ES_UPPER_CRIT | + SAHPI_ES_UPPER_MAJOR, + .WriteThold = 0x0, + }, + .Oem = 0, + }, + .sensor_info = { + .current_state = SAHPI_ES_UNSPECIFIED, + .sensor_enable = SAHPI_TRUE, + .event_enable = SAHPI_FALSE, + .assert_mask = OA_SOAP_STM_UNSPECIFED, + .deassert_mask = OA_SOAP_STM_UNSPECIFED, + .sensor_reading = { + .IsSupported = SAHPI_TRUE, + .Type = SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with current reading */ + .Value.SensorFloat64 = 0x0, + }, + .threshold = { + .UpCritical.IsSupported = SAHPI_TRUE, + .UpCritical.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with critical threshold + * reading + */ + .UpCritical.Value.SensorFloat64 = 100, + .UpMajor.IsSupported = SAHPI_TRUE, + .UpMajor.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with major threshold + * reading + */ + .UpMajor.Value.SensorFloat64 = 85, + }, + }, + .sensor_class = OA_SOAP_BLADE_THERMAL_CLASS, + .comment = "Memory Zone thermal status", + }, + /* Memory zone4 sensor */ + { + .sensor = { + .Num = OA_SOAP_SEN_BLADE_MEM_ZONE4, + .Type = SAHPI_TEMPERATURE, + .Category = SAHPI_EC_THRESHOLD, + .EnableCtrl = SAHPI_TRUE, + .EventCtrl = SAHPI_SEC_READ_ONLY, + .Events = SAHPI_ES_UNSPECIFIED, + .DataFormat = { + .IsSupported = SAHPI_TRUE, + .ReadingType = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + .BaseUnits = SAHPI_SU_DEGREES_C, + .ModifierUnits = SAHPI_SU_UNSPECIFIED, + .ModifierUse = SAHPI_SMUU_NONE, + .Percentage = SAHPI_FALSE, + .Range.Flags = SAHPI_SRF_MAX | + SAHPI_SRF_NORMAL_MAX, + .Range.Max.IsSupported = SAHPI_TRUE, + .Range.Max.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Max value should be replaced + * with Max value retrieved from OA + */ + .Range.Max.Value.SensorFloat64 = 100, + .Range.NormalMax.IsSupported = SAHPI_TRUE, + .Range.NormalMax.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Normal Max value should be + * replaced with Normal Max value retrieved + * from OA + */ + .Range.NormalMax.Value.SensorFloat64 = 85, + .AccuracyFactor = 0, + }, + .ThresholdDefn = { + .IsAccessible = SAHPI_TRUE, + .ReadThold = SAHPI_ES_UPPER_CRIT | + SAHPI_ES_UPPER_MAJOR, + .WriteThold = 0x0, + }, + .Oem = 0, + }, + .sensor_info = { + .current_state = SAHPI_ES_UNSPECIFIED, + .sensor_enable = SAHPI_TRUE, + .event_enable = SAHPI_FALSE, + .assert_mask = OA_SOAP_STM_UNSPECIFED, + .deassert_mask = OA_SOAP_STM_UNSPECIFED, + .sensor_reading = { + .IsSupported = SAHPI_TRUE, + .Type = SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with current reading */ + .Value.SensorFloat64 = 0x0, + }, + .threshold = { + .UpCritical.IsSupported = SAHPI_TRUE, + .UpCritical.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with critical threshold + * reading + */ + .UpCritical.Value.SensorFloat64 = 100, + .UpMajor.IsSupported = SAHPI_TRUE, + .UpMajor.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with major threshold + * reading + */ + .UpMajor.Value.SensorFloat64 = 85, + }, + }, + .sensor_class = OA_SOAP_BLADE_THERMAL_CLASS, + .comment = "Memory Zone thermal status", + }, + /* Disk zone1 sensor */ + { + .sensor = { + .Num = OA_SOAP_SEN_BLADE_DISK_ZONE1, + .Type = SAHPI_TEMPERATURE, + .Category = SAHPI_EC_THRESHOLD, + .EnableCtrl = SAHPI_TRUE, + .EventCtrl = SAHPI_SEC_READ_ONLY, + .Events = SAHPI_ES_UNSPECIFIED, + .DataFormat = { + .IsSupported = SAHPI_TRUE, + .ReadingType = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + .BaseUnits = SAHPI_SU_DEGREES_C, + .ModifierUnits = SAHPI_SU_UNSPECIFIED, + .ModifierUse = SAHPI_SMUU_NONE, + .Percentage = SAHPI_FALSE, + .Range.Flags = SAHPI_SRF_MAX | + SAHPI_SRF_NORMAL_MAX, + .Range.Max.IsSupported = SAHPI_TRUE, + .Range.Max.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Max value should be replaced + * with Max value retrieved from OA + */ + .Range.Max.Value.SensorFloat64 = 100, + .Range.NormalMax.IsSupported = SAHPI_TRUE, + .Range.NormalMax.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* This default Normal Max value should be + * replaced with Normal Max value retrieved + * from OA + */ + .Range.NormalMax.Value.SensorFloat64 = 85, + .AccuracyFactor = 0, + }, + .ThresholdDefn = { + .IsAccessible = SAHPI_TRUE, + .ReadThold = SAHPI_ES_UPPER_CRIT | + SAHPI_ES_UPPER_MAJOR, + .WriteThold = 0x0, + }, + .Oem = 0, + }, + .sensor_info = { + .current_state = SAHPI_ES_UNSPECIFIED, + .sensor_enable = SAHPI_TRUE, + .event_enable = SAHPI_FALSE, + .assert_mask = OA_SOAP_STM_UNSPECIFED, + .deassert_mask = OA_SOAP_STM_UNSPECIFED, + .sensor_reading = { + .IsSupported = SAHPI_TRUE, + .Type = SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with current reading */ + .Value.SensorFloat64 = 0x0, + }, + .threshold = { + .UpCritical.IsSupported = SAHPI_TRUE, + .UpCritical.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with critical threshold + * reading + */ + .UpCritical.Value.SensorFloat64 = 100, + .UpMajor.IsSupported = SAHPI_TRUE, + .UpMajor.Type = + SAHPI_SENSOR_READING_TYPE_FLOAT64, + /* Update the value with major threshold + * reading + */ + .UpMajor.Value.SensorFloat64 = 85, + }, + }, + .sensor_class = OA_SOAP_BLADE_THERMAL_CLASS, + .comment = "Disk Zone thermal status", + }, + /* Disk zone2 sensor */ + { + .sensor = { + .Num = OA_SOAP_SEN_BLADE_DISK_ZONE2, + .Type = SAHPI_TEMPERATURE, + .Category = SAHPI_EC_THRESHOLD, + .En... [truncated message content] |
From: <pg...@us...> - 2009-01-25 08:26:56
|
Revision: 6942 http://openhpi.svn.sourceforge.net/openhpi/?rev=6942&view=rev Author: pgraghu Date: 2009-01-25 08:26:47 +0000 (Sun, 25 Jan 2009) Log Message: ----------- [2220356] Supporting the graceful shutdown for openhpi daemon Modified Paths: -------------- openhpi/trunk/include/oh_event.h openhpi/trunk/include/oh_plugin.h openhpi/trunk/marshal/strmsock.cpp openhpi/trunk/openhpid/openhpid.cpp openhpi/trunk/openhpid/openhpid.sh.in openhpi/trunk/plugins/simulator/sim_init.c openhpi/trunk/src/event.c openhpi/trunk/src/init.c openhpi/trunk/src/plugin.c openhpi/trunk/src/threaded.c openhpi/trunk/ssl/oh_ssl.c openhpi/trunk/ssl/oh_ssl.h Modified: openhpi/trunk/include/oh_event.h =================================================================== --- openhpi/trunk/include/oh_event.h 2009-01-23 11:13:00 UTC (rev 6941) +++ openhpi/trunk/include/oh_event.h 2009-01-25 08:26:47 UTC (rev 6942) @@ -112,6 +112,7 @@ SaErrorT oh_harvest_events(void); SaErrorT oh_process_events(void); void oh_event_free(struct oh_event *e, int only_rdrs); +void oh_event_queue_free(void); struct oh_event *oh_dup_event(struct oh_event *old_event); #ifdef __cplusplus Modified: openhpi/trunk/include/oh_plugin.h =================================================================== --- openhpi/trunk/include/oh_plugin.h 2009-01-23 11:13:00 UTC (rev 6941) +++ openhpi/trunk/include/oh_plugin.h 2009-01-25 08:26:47 UTC (rev 6942) @@ -74,6 +74,7 @@ /* Finalization of plugins and handlers. */ void oh_close_handlers(void); +int oh_exit_ltdl(void); /* Plugin interface functions */ struct oh_plugin *oh_get_plugin(char *plugin_name); Modified: openhpi/trunk/marshal/strmsock.cpp =================================================================== --- openhpi/trunk/marshal/strmsock.cpp 2009-01-23 11:13:00 UTC (rev 6941) +++ openhpi/trunk/marshal/strmsock.cpp 2009-01-25 08:26:47 UTC (rev 6942) @@ -36,6 +36,8 @@ #define INADDR_NONE 0xffffffff #endif +// server socket timeout +#define SERVER_SOCK_TIMEOUT 2 /*--------------------------------------------------------------------*/ /* Stream Sockets base class methods */ @@ -151,7 +153,13 @@ if (len < 0) { errcode = errno; - printf("Reading from socket returned and error: %d\n", errcode); // Debug + /* EWOULDBLOCK error code means there is no data to read + * and not an error condition + */ + if (errcode != EWOULDBLOCK) { + printf("Reading from socket returned and error: %d\n", + errcode); // Debug + } return true; } else if (len == 0) { //connection has been aborted by the peer Close(); @@ -346,6 +354,7 @@ { int Rc; // return code int so_reuseaddr = TRUE; // socket reuse flag + struct timeval tv; // get a server socket ss = socket(domain, type, protocol); @@ -356,6 +365,11 @@ // set the socket option to reuse the address setsockopt(ss, SOL_SOCKET, SO_REUSEADDR, &so_reuseaddr, sizeof(so_reuseaddr)); + tv.tv_sec = SERVER_SOCK_TIMEOUT; + tv.tv_usec = 0; + // set the socket option to timeout + setsockopt(ss, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + // bind the server socket to a port memset(&addr, 0, sizeof (addr)); addr.sin_family = domain; Modified: openhpi/trunk/openhpid/openhpid.cpp =================================================================== --- openhpi/trunk/openhpid/openhpid.cpp 2009-01-23 11:13:00 UTC (rev 6941) +++ openhpi/trunk/openhpid/openhpid.cpp 2009-01-25 08:26:47 UTC (rev 6942) @@ -69,7 +69,7 @@ } -#define CLIENT_TIMEOUT 0 // Unlimited +#define CLIENT_TIMEOUT 2 /* Set to 2 second timeout */ #define PID_FILE "/var/run/openhpid.pid" static bool stop_server = FALSE; @@ -97,6 +97,17 @@ #define PVERBOSE3(msg, ...) if (verbose_flag) printf("CRITICAL: "msg, ## __VA_ARGS__) /*--------------------------------------------------------------------*/ +/* Function: shutdown_signal */ +/*--------------------------------------------------------------------*/ + +void shutdown_signal(int sig) +{ + dbg("Recieved the signal for shutdown"); + stop_server = TRUE; + return; +} + +/*--------------------------------------------------------------------*/ /* Function: display_help */ /*--------------------------------------------------------------------*/ @@ -139,6 +150,9 @@ char pid_buf[256]; int pfile, len, pid = 0; + /* Catch the termination signal */ + signal(SIGUSR1, shutdown_signal); + /* get the command line options */ while (1) { c = getopt_long(argc, argv, "nvc:p:f:s:t:", long_options, @@ -289,21 +303,23 @@ // wait for a connection and then service the connection while (TRUE) { - if (stop_server) { break; } if (servinst->Accept()) { + if (servinst->GetErrcode() == EWOULDBLOCK) { + PVERBOSE3("%p Timeout accepting server socket.\n", servinst); + continue; + } PVERBOSE1("Error accepting server socket."); + stop_server = TRUE; break; } PVERBOSE1("### Spawning thread to handle connection. ###"); psstrmsock thrdinst = new sstrmsock(*servinst); g_thread_pool_push(thrdpool, (gpointer)thrdinst, NULL); - - } servinst->CloseSrv(); @@ -311,8 +327,15 @@ // ensure all threads are complete g_thread_pool_free(thrdpool, FALSE, TRUE); + delete servinst; - delete servinst; + /* Do a graceful shutdown */ + oh_finit(); + + /* Release the pid_file and configfile */ + if (pid_file) + g_free(pid_file); + g_free(configfile); return 0; } @@ -404,8 +427,8 @@ PVERBOSE3("%p Timeout reading socket.\n", thrdid); } else { PVERBOSE3("%p Error reading socket.\n", thrdid); + stop = true; } - goto thrd_cleanup; } else { switch( thrdinst->header.m_type ) { @@ -427,9 +450,11 @@ break; } } + /* Check for the shutdown signal */ + if(stop_server) + stop = true; } - thrd_cleanup: // if necessary, clean up HPI lib data if (session_id != 0) { saHpiSessionClose( session_id ); Modified: openhpi/trunk/openhpid/openhpid.sh.in =================================================================== --- openhpi/trunk/openhpid/openhpid.sh.in 2009-01-23 11:13:00 UTC (rev 6941) +++ openhpi/trunk/openhpid/openhpid.sh.in 2009-01-25 08:26:47 UTC (rev 6942) @@ -166,6 +166,44 @@ } +shutdown() { + case "${lsbtype}" in + + rh | lsb | suse) + echo -n $"Shutting down $prog: " + killproc -s SIGUSR1 @prefix@/sbin/openhpid + RETVAL=$? + ;; + + gentoo) + ebegin "Shutting down $prog: " + start-stop-daemon --stop --signal SIGUSR1 --quiet --exec @prefix@/sbin/openhpid + RETVAL=$? + ;; + + nolsb) + echo -n $"Shutting down $prog: " + if test -f /var/run/openhpid.pid && test "`cat /var/run/openhpid.pid`" != "" + then + kill -s SIGUSR1 "`cat /var/run/openhpid.pid`" + RETVAL=$? + else + RETVAL=0 + fi + ;; + + esac + + print_outcome + + if test "$RETVAL" -eq 0 && test -f /var/run/openhpid.pid + then + rm -f /var/lock/openhpid + rm -f /var/run/openhpid.pid + fi + +} + dstatus() { echo $"Checking for $prog daemon: " @@ -225,6 +263,9 @@ stop) stop ;; + shutdown) + shutdown + ;; restart) restart ;; @@ -235,6 +276,6 @@ force_reload ;; *) - echo $"Usage: $0 {start|stop|restart|status|force-reload}" + echo $"Usage: $0 {start|stop|shutdown|restart|status|force-reload}" exit 1 esac Modified: openhpi/trunk/plugins/simulator/sim_init.c =================================================================== --- openhpi/trunk/plugins/simulator/sim_init.c 2009-01-23 11:13:00 UTC (rev 6941) +++ openhpi/trunk/plugins/simulator/sim_init.c 2009-01-25 08:26:47 UTC (rev 6942) @@ -203,9 +203,39 @@ SaErrorT sim_close(void *hnd) { struct oh_handler_state *state = hnd; + SaHpiRdrT *tmp_rdr; + SaHpiRptEntryT *tmp_entry; + struct simAnnunciatorInfo *info = NULL; + SaHpiResourceIdT rid = SAHPI_FIRST_ENTRY; + SaHpiEntryIdT rdrid = SAHPI_FIRST_ENTRY; - /* TODO: we may need to do more here than just this! */ -// g_free(state->rptcache); + /* Release the Annuciators */ + tmp_entry = oh_get_resource_by_id(state->rptcache, rid); + while (tmp_entry != NULL) { + rid = tmp_entry->ResourceId; + /* Travers all RDRs for the ANNUNCIATOR RDR */ + rdrid = SAHPI_FIRST_ENTRY; + tmp_rdr = oh_get_rdr_by_id(state->rptcache, rid, rdrid); + while (tmp_rdr != NULL) { + rdrid = tmp_rdr->RecordId; + if (tmp_rdr->RdrType == SAHPI_ANNUNCIATOR_RDR) { + /* Get the annunciators */ + info = (struct simAnnunciatorInfo *) + oh_get_rdr_data(state->rptcache, + rid, rdrid); + /* Release all the annunciators */ + oh_announcement_close(info->announs); + } + tmp_rdr = oh_get_rdr_next(state->rptcache, rid, rdrid); + } + tmp_entry = oh_get_resource_next(state->rptcache, rid); + } + + /* Release the RPT and RDR table */ + oh_flush_rpt(state->rptcache); + + g_free(state->rptcache); + g_free(state->elcache); g_free(state); return 0; } Modified: openhpi/trunk/src/event.c =================================================================== --- openhpi/trunk/src/event.c 2009-01-23 11:13:00 UTC (rev 6941) +++ openhpi/trunk/src/event.c 2009-01-25 08:26:47 UTC (rev 6942) @@ -30,12 +30,15 @@ #include <oh_utils.h> #include <oh_error.h> +#define OH_EVTPOP_THREAD_SLEEP_TIME 3 * G_USEC_PER_SEC + struct _oh_evt_queue { GAsyncQueue *q; }; oh_evt_queue oh_process_q = { .q = NULL }; extern GMutex *oh_event_thread_mutex; +extern SaHpiBoolT stop_oh_threads; /* * The following is required to set up the thread state for @@ -75,6 +78,30 @@ } } +/* This function will be called to free up the event queue */ +void oh_event_queue_free(void) +{ + gint len; + int i; + struct oh_event *e = NULL; + + /* Get the number of pending events in event queue */ + len = g_async_queue_length(oh_process_q.q); + if (len > 0) { + for(i = 0; i < len; i++) { + /* Extract the pending events in event queue */ + e = g_async_queue_try_pop(oh_process_q.q); + if (e == NULL) { + err("Error in releasing the events"); + break; + } + oh_event_free(e, 0); + } + } + /* Release the event queue */ + g_async_queue_unref(oh_process_q.q); +} + struct oh_event *oh_dup_event(struct oh_event *old_event) { GSList *node = NULL; @@ -380,14 +407,25 @@ SaErrorT oh_process_events() { - struct oh_event *e; + struct oh_event *e = NULL; // GArray *domain_results = NULL; SaHpiDomainIdT tmp_did; char *et; + GTimeVal time; // domain_results = oh_query_domains(); - while ((e = g_async_queue_pop(oh_process_q.q)) != NULL) { + /* Pop the events from the event queue. Come out of the loop on graceful + * shutdown request + */ + while (stop_oh_threads == SAHPI_FALSE) { + g_get_current_time(&time); + g_time_val_add(&time, OH_EVTPOP_THREAD_SLEEP_TIME); + e = g_async_queue_timed_pop(oh_process_q.q, &time); + /* On timeout, loop again */ + if (e == NULL) + continue; + et = oh_lookup_eventtype(e->event.EventType); dbg("Event Type = %s", (et) ? et : "<Unknown>"); @@ -409,9 +447,10 @@ free_event: oh_event_free(e, FALSE); + e = NULL; } - /* Should never get here */ + // g_array_free(domain_results, TRUE); - return SA_ERR_HPI_INTERNAL_ERROR; + return SA_OK; } Modified: openhpi/trunk/src/init.c =================================================================== --- openhpi/trunk/src/init.c 2009-01-23 11:13:00 UTC (rev 6941) +++ openhpi/trunk/src/init.c 2009-01-25 08:26:47 UTC (rev 6942) @@ -14,6 +14,9 @@ * */ +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> #include <config.h> #include <oh_init.h> #include <oh_ssl.h> @@ -25,7 +28,19 @@ #include <oh_error.h> #include <oh_lock.h> #include <oh_utils.h> +#include <oh_event.h> +extern SaHpiBoolT stop_oh_threads; +extern GThread *oh_evtpop_thread; +extern GThread *oh_discovery_thread; +extern GThread *oh_evtget_thread; +extern oh_evt_queue oh_process_q; +extern GStaticMutex oh_wake_discovery_mutex; +extern GMutex *oh_discovery_thread_mutex; +extern GCond *oh_discovery_thread_wait; +extern GMutex *oh_evtget_thread_mutex; +extern GStaticMutex oh_wake_evtget_mutex; +extern GCond *oh_evtget_thread_wait; /** * oh_init @@ -157,12 +172,90 @@ **/ int oh_finit(void) { +// unsigned int hid = 0, next_hid, i; + unsigned int hid = 0, next_hid; +/* GArray *domain_results = NULL; + oh_domain_result dr; */ + data_access_lock(); - oh_close_handlers(); + /* Set the stop_oh_threads to TRUE to stop the + * discovery and event threads + */ + stop_oh_threads = SAHPI_TRUE; + /* Wake up the discovery thread, if it is waiting */ + g_static_mutex_lock(&oh_wake_discovery_mutex); + if (g_mutex_trylock(oh_discovery_thread_mutex)) { + g_cond_broadcast(oh_discovery_thread_wait); + g_mutex_unlock(oh_discovery_thread_mutex); + } else { + g_mutex_lock(oh_discovery_thread_mutex); + g_cond_broadcast(oh_discovery_thread_wait); + g_mutex_unlock(oh_discovery_thread_mutex); + } + g_static_mutex_unlock(&oh_wake_discovery_mutex); + + /* Wait for the discovery thread to exit */ + g_thread_join(oh_discovery_thread); + dbg("discovery thread stopped"); + + /* Wake up the get event thread, if it is waiting */ + g_static_mutex_lock(&oh_wake_evtget_mutex); + if (g_mutex_trylock(oh_evtget_thread_mutex)) { + g_cond_broadcast(oh_evtget_thread_wait); + g_mutex_unlock(oh_evtget_thread_mutex); + } else { + g_mutex_lock(oh_evtget_thread_mutex); + g_cond_broadcast(oh_evtget_thread_wait); + g_mutex_unlock(oh_evtget_thread_mutex); + } + g_static_mutex_unlock(&oh_wake_evtget_mutex); + + /* Wait for the event get thread to exit */ + g_thread_join(oh_evtget_thread); + dbg("event get thread stopped"); + + /* Wait for the event pop thread to exit */ + g_thread_join(oh_evtpop_thread); + dbg("event pop thread stopped"); + + /* Cleanup the instantiated plugins */ + oh_getnext_handler_id(hid, &next_hid); + while (next_hid) { + hid = next_hid; + oh_destroy_handler(hid); + oh_getnext_handler_id(hid, &next_hid); + } + dbg("all the instantiated plugins closed"); + + /* Release the event queue */ + oh_event_queue_free(); + dbg("event queue released"); + + /* Cleanup the thread related variables */ + oh_threaded_final(); + dbg("global variables released"); + + /* Cleanup the SSL library */ + oh_ssl_finalize(); + dbg("ssl library cleaned"); + + /* close the ltdl structures */ + oh_exit_ltdl(); + dbg("ltdl library cleaned"); + + /* Destroy the sessions */ + oh_destroy_domain_sessions(OH_DEFAULT_DOMAIN_ID); + /* Destroy the domain */ + oh_destroy_domain(OH_DEFAULT_DOMAIN_ID); + dbg("default domain is destroyed"); + + g_hash_table_destroy(oh_domains.table); + dbg("domain table released"); + g_hash_table_destroy(oh_sessions.table); + dbg("sessions table released"); + data_access_unlock(); - return 0; } - Modified: openhpi/trunk/src/plugin.c =================================================================== --- openhpi/trunk/src/plugin.c 2009-01-23 11:13:00 UTC (rev 6941) +++ openhpi/trunk/src/plugin.c 2009-01-25 08:26:47 UTC (rev 6942) @@ -82,7 +82,7 @@ * * Returns: 0 on Success. **/ -static int oh_exit_ltdl(void) +int oh_exit_ltdl(void) { int rv; @@ -218,7 +218,7 @@ } __dec_plugin_refcount(plugin); - if (plugin->refcount < 0) + if (plugin->refcount < 1) __delete_plugin(plugin); else g_static_rec_mutex_unlock(&plugin->lock); @@ -306,7 +306,7 @@ plugin = oh_get_plugin(plugin_name); if (plugin) { - oh_release_plugin(plugin); + __dec_plugin_refcount(plugin); dbg("Plugin %s already loaded. Not loading twice.", plugin_name); return 0; @@ -389,7 +389,7 @@ } if (plugin->handler_count > 0) { - oh_release_plugin(plugin); + __dec_plugin_refcount(plugin); err("ERROR unloading plugin. Handlers are still referencing it."); return -3; } @@ -437,9 +437,9 @@ } /* Free the oh_handler members first, then the handler. */ - /* FIXME: Where/When should the handler config table be freed? */ g_static_rec_mutex_free(&h->lock); g_static_rec_mutex_free(&h->refcount_lock); + g_hash_table_destroy(h->config); g_free(h); } @@ -577,7 +577,7 @@ /* Initialize handler */ handler->abi = plugin->abi; plugin->handler_count++; /* Increment # of handlers using the plugin */ - oh_release_plugin(plugin); + __dec_plugin_refcount(plugin); g_static_rec_mutex_lock(&oh_handlers.lock); handler->id = handler_id++; g_static_rec_mutex_unlock(&oh_handlers.lock); Modified: openhpi/trunk/src/threaded.c =================================================================== --- openhpi/trunk/src/threaded.c 2009-01-23 11:13:00 UTC (rev 6941) +++ openhpi/trunk/src/threaded.c 2009-01-25 08:26:47 UTC (rev 6942) @@ -39,6 +39,8 @@ GCond *oh_discovery_thread_wait = NULL; GStaticMutex oh_wake_discovery_mutex = G_STATIC_MUTEX_INIT; +SaHpiBoolT stop_oh_threads = SAHPI_FALSE; + static int oh_discovery_init(void) { /* Nothing to do here...for now */ @@ -70,6 +72,10 @@ g_mutex_lock(oh_discovery_thread_mutex); while (1) { + /* Check for the signal to stop the thread */ + if (stop_oh_threads == SAHPI_TRUE) + break; + dbg("Doing threaded discovery on all handlers"); error = oh_discovery(); if (error) { @@ -99,11 +105,12 @@ SaErrorT error = SA_OK; g_mutex_lock(oh_evtpop_thread_mutex); - while(1) { - dbg("Thread processing events"); - error = oh_process_events(); - if (error != SA_OK) err("Error on processing of events."); - } + + dbg("Thread processing events"); + error = oh_process_events(); + if (error != SA_OK) + err("Error on processing of events."); + g_mutex_unlock(oh_evtpop_thread_mutex); g_thread_exit(0); @@ -118,6 +125,10 @@ g_mutex_lock(oh_evtget_thread_mutex); while (1) { + /* Check for the signal to stop the thread */ + if (stop_oh_threads == SAHPI_TRUE) + break; + /* Give the discovery time to start first -> FIXME */ if (first_loop) { struct timespec sleepytime = @@ -170,17 +181,18 @@ oh_discovery_thread_wait = g_cond_new(); oh_discovery_thread_mutex = g_mutex_new(); oh_discovery_thread = g_thread_create(oh_discovery_thread_loop, - NULL, FALSE, + NULL, TRUE, &oh_discovery_thread_error); dbg("Starting event threads"); oh_evtget_thread_wait = g_cond_new(); oh_evtget_thread_mutex = g_mutex_new(); oh_evtget_thread = g_thread_create(oh_evtget_thread_loop, - NULL, FALSE, &oh_evtget_thread_error); + NULL, TRUE, &oh_evtget_thread_error); oh_evtpop_thread_mutex = g_mutex_new(); + /* Make the event pop thread joinable */ oh_evtpop_thread = g_thread_create(oh_evtpop_thread_loop, - NULL, FALSE, &oh_evtpop_thread_error); + NULL, TRUE, &oh_evtpop_thread_error); return 0; } Modified: openhpi/trunk/ssl/oh_ssl.c =================================================================== --- openhpi/trunk/ssl/oh_ssl.c 2009-01-23 11:13:00 UTC (rev 6941) +++ openhpi/trunk/ssl/oh_ssl.c 2009-01-25 08:26:47 UTC (rev 6942) @@ -250,7 +250,6 @@ } -#if 0 /* Not used right now */ /** * thread_cleanup * @@ -287,7 +286,6 @@ return(0); /* No errors */ } -#endif /* Not used right now */ /** @@ -340,6 +338,38 @@ /** + * oh_ssl_finalize + * + * Finalizes the OpenSSL library. The calls used in this routine releases global + * data created/initialized by the OpenSSL library. + * + * Note that it is the responisbility of the caller of this function to make + * sure that no other threads are making the OpenSSL library calls. The openhpid + * should close all the threads and call this function from the main (single) + * thread. + * + * Return value: Noe + **/ +void oh_ssl_finalize(void) +{ + /* TODO: Check whether any other SSL library cleanup should be called */ + thread_cleanup(); + ENGINE_cleanup(); + CONF_modules_unload(0); + ERR_free_strings(); + EVP_cleanup(); + CRYPTO_cleanup_all_ex_data(); + /* The valgrind is showing possible memory leak by + * SSL_COMP_get_compression_methods() call. + * + * Call to SSL_free_comp_methods() may resolve the memory leak. + * But not able to find this call in the openssl 0.9.8e + * TODO: Find whether its a real problem or not + */ + +} + +/** * oh_ssl_ctx_init * * Create a new SSL_CTX object as a framework for TLS/SSL enabled functions. Modified: openhpi/trunk/ssl/oh_ssl.h =================================================================== --- openhpi/trunk/ssl/oh_ssl.h 2009-01-23 11:13:00 UTC (rev 6941) +++ openhpi/trunk/ssl/oh_ssl.h 2009-01-25 08:26:47 UTC (rev 6942) @@ -54,6 +54,7 @@ #include <openssl/err.h> #include <openssl/rand.h> #include <openssl/x509v3.h> +#include <openssl/engine.h> #endif @@ -71,6 +72,8 @@ * implemented in oh_ssl.c */ extern int oh_ssl_init(void); +extern void oh_ssl_finalize(void); + #ifdef HAVE_OPENSSL extern SSL_CTX *oh_ssl_ctx_init(void); extern int oh_ssl_ctx_free(SSL_CTX *ctx); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2009-01-30 20:16:47
|
Revision: 6944 http://openhpi.svn.sourceforge.net/openhpi/?rev=6944&view=rev Author: avpak Date: 2009-01-30 20:16:41 +0000 (Fri, 30 Jan 2009) Log Message: ----------- Initial SAF-HPI-B.03.01 support New API: saHpiInitialize saHpiFinalize saHpiMyEntityPathGet saHpiRdrUpdateCountGet saHpiFumiSpecInfoGet saHpiFumiServiceImpactGet saHpiFumiSourceComponentInfoGet saHpiFumiTargetComponentInfoGet saHpiFumiLogicalTargetInfoGet saHpiFumiLogicalTargetComponentInfoGet saHpiFumiTargetVerifyMainStart saHpiFumiAutoRollbackDisableGet saHpiFumiAutoRollbackDisableSet saHpiFumiActivateStart saHpiFumiCleanup New data structures: SaHpiFumiSpecInfoT SaHpiFumiServiceImpactDataT SaHpiFumiFirmwareInstanceInfoT SaHpiFumiLogicalBankInfoT SaHpiFumiComponentInfoT SaHpiFumiLogicalComponentInfoT Support for new resource events displaying in hpi_shell: SAHPI_RESE_RESOURCE_REMOVED SAHPI_RESE_RESOURCE_INACCESSIBLE SAHPI_RESE_RESOURCE_UPDATED Handler ABI extended for new API Modified Paths: -------------- openhpi/trunk/include/SaHpi.h openhpi/trunk/include/oh_handler.h openhpi/trunk/marshal/marshal_hpi.c openhpi/trunk/marshal/marshal_hpi.h openhpi/trunk/marshal/marshal_hpi_types.c openhpi/trunk/marshal/marshal_hpi_types.h openhpi/trunk/openhpid/oh_client.cpp openhpi/trunk/openhpid/openhpid.cpp openhpi/trunk/src/plugin.c openhpi/trunk/src/safhpi.c openhpi/trunk/utils/sahpi_enum_utils.c openhpi/trunk/utils/sahpi_enum_utils.h Modified: openhpi/trunk/include/SaHpi.h =================================================================== --- openhpi/trunk/include/SaHpi.h 2009-01-27 18:41:54 UTC (rev 6943) +++ openhpi/trunk/include/SaHpi.h 2009-01-30 20:16:41 UTC (rev 6944) @@ -10,10 +10,10 @@ ** generated from the Platform Interface specification document. ** ** SPECIFICATION VERSION: -** SAI-HPI-B.02.01 +** SAI-HPI-B.03.01 ** ** DATE: -** Wed Jan 17 2007 11:33 +** Wed Oct 08 2008 18:33 ** ** LEGAL: ** OWNERSHIP OF SPECIFICATION AND COPYRIGHTS. @@ -26,7 +26,7 @@ ** at any time without notice. Licensor is not obligated to support or ** update the Specification. ** -** Copyright(c) 2004, 2007, Service Availability(TM) Forum. All rights +** Copyright(c) 2004, 2008, Service Availability(TM) Forum. All rights ** reserved. ** ** Permission to use, copy, modify, and distribute this software for any @@ -45,6 +45,10 @@ #ifndef __SAHPI_H #define __SAHPI_H +#ifdef __cplusplus +extern "C" { +#endif + /******************************************************************************* ******************************************************************************** ********** ********** @@ -129,7 +133,7 @@ ** ** This is the IANA-assigned private enterprise number for the ** manufacturer of the resource or FRU, or of the manufacturer -** defining an OEM Control or event type. A list of current +** defining an OEM Control or event type. A list of current ** IANA-assigned private enterprise numbers may be obtained at ** ** http://www.iana.org/assignments/enterprise-numbers @@ -155,14 +159,14 @@ ** the next 8 bits represent the major version number; and ** the least significant 8 bits represent the minor version number. */ -#define SAHPI_INTERFACE_VERSION (SaHpiVersionT)0x020201 /* B.02.01 */ +#define SAHPI_INTERFACE_VERSION (SaHpiVersionT)0x020301 /* B.03.01 */ /* ** Return Codes ** ** SaErrorT is defined in the HPI specification. In the future a -** common SAF types definition may be created to contain this type. At -** that time, this typedef should be removed. Each of the return codes +** common SAF types definition may be created to contain this type. At +** that time, this typedef should be removed. Each of the return codes ** is defined in Section 4.1 of the specification. ** ** Future version of the specification may add new return codes. User @@ -387,7 +391,8 @@ SAHPI_LANG_TWI, SAHPI_LANG_UKRAINIAN, SAHPI_LANG_URDU, SAHPI_LANG_UZBEK, SAHPI_LANG_VIETNAMESE, SAHPI_LANG_VOLAPUK, SAHPI_LANG_WOLOF, SAHPI_LANG_XHOSA, SAHPI_LANG_YORUBA, - SAHPI_LANG_CHINESE, SAHPI_LANG_ZULU + SAHPI_LANG_CHINESE, SAHPI_LANG_ZULU, + SAHPI_LANG_MAX_VALID = SAHPI_LANG_ZULU } SaHpiLanguageT; /* @@ -459,7 +464,8 @@ SAHPI_TL_TYPE_ASCII6, /* Reduced ASCII character set: 0x20-0x5F ONLY */ SAHPI_TL_TYPE_TEXT, /* ASCII+Latin 1 */ - SAHPI_TL_TYPE_BINARY /* Binary data, any values legal */ + SAHPI_TL_TYPE_BINARY, /* Binary data, any values legal */ + SAHPI_TL_TYPE_MAX_VALID = SAHPI_TL_TYPE_BINARY } SaHpiTextTypeT; typedef struct { @@ -480,7 +486,6 @@ typedef SaHpiUint32T SaHpiInstrumentIdT; - /******************************************************************************* ******************************************************************************** ********** ********** @@ -491,12 +496,12 @@ /* ** Entity Types ** -** An Entity is a physical hardware component of the system. Entities are +** An Entity is a physical hardware component of the system. Entities are ** defined with an entity type enumeration, and an entity location number ** (to identify the physical location of a particular type of entity). ** ** Entities are uniquely identified in a system with an ordered series of -** Entity Type / Entity Location pairs called an "Entity Path". Each subsequent +** Entity Type / Entity Location pairs called an "Entity Path". Each subsequent ** Entity Type/Entity Location in the path is the next higher "containing" ** entity. The "root" of the Entity Path (the outermost level of containment) ** is designated with an Entity Type of SAHPI_ENT_ROOT if the entire Entity Path @@ -578,16 +583,16 @@ SAHPI_ENT_OPERATING_SYSTEM, SAHPI_ENT_SYSTEM_BUS, SAHPI_ENT_GROUP, /* This is a logical entity for use with - Entity Association records. It is - provided to allow a Sensor data - record to point to an entity- - association record when there is no - appropriate pre-defined logical - entity for the entity grouping. - This Entity should not be used as a - physical entity. */ + Entity Association records. It is + provided to allow a Sensor data + record to point to an entity- + association record when there is no + appropriate pre-defined logical + entity for the entity grouping. + This Entity should not be used as a + physical entity. */ SAHPI_ENT_REMOTE, /* Out of band management communication - device */ + device */ SAHPI_ENT_EXTERNAL_ENVIRONMENT, SAHPI_ENT_BATTERY, SAHPI_ENT_RESERVED_1, @@ -595,27 +600,27 @@ SAHPI_ENT_RESERVED_3, SAHPI_ENT_RESERVED_4, SAHPI_ENT_RESERVED_5, - SAHPI_ENT_MC_FIRMWARE, /* Management Controller Firmware, - represents firmware or software - running on a management controller */ - SAHPI_ENT_IPMI_CHANNEL, /* This Entity ID enables associating - Sensors with the IPMI communication - channels - for example a Redundancy - Sensor could be used to report - redundancy status for a channel that - is composed of multiple physical - links. By convention, the Entity - Instance corresponds to the channel - number. */ + SAHPI_ENT_MC_FIRMWARE , /* Management Controller Firmware, + represents firmware or software + running on a management controller */ + SAHPI_ENT_IPMI_CHANNEL, /* This Entity ID enables associating + Sensors with the IPMI communication + channels - for example a Redundancy + Sensor could be used to report + redundancy status for a channel that + is composed of multiple physical + links. By convention, the Entity + Instance corresponds to the channel + number. */ - SAHPI_ENT_PCI_BUS, - SAHPI_ENT_PCI_EXPRESS_BUS, - SAHPI_ENT_SCSI_BUS, - SAHPI_ENT_SATA_BUS, - SAHPI_ENT_PROC_FSB, /* Processor, front side bus */ - SAHPI_ENT_CLOCK, /* e.g. Real Time Clock (RTC) */ - SAHPI_ENT_SYSTEM_FIRMWARE, /* e.g. BIOS/ EFI */ - /* The range from + SAHPI_ENT_PCI_BUS, + SAHPI_ENT_PCI_EXPRESS_BUS, + SAHPI_ENT_SCSI_BUS, + SAHPI_ENT_SATA_BUS, + SAHPI_ENT_PROC_FSB, /* Processor, front side bus */ + SAHPI_ENT_CLOCK, /* e.g. Real Time Clock (RTC) */ + SAHPI_ENT_SYSTEM_FIRMWARE, /* e.g. BIOS/ EFI */ + /* The range from SAHPI_ENT_SYSTEM_FIRMWARE + 1 to SAHPI_ENT_CHASSIS_SPECIFIC - 1 is Reserved for future use by this @@ -649,29 +654,29 @@ SBC board */ SAHPI_ENT_ALARM_MANAGER, /* Chassis alarm manager board */ SAHPI_ENT_SHELF_MANAGER, /* Blade-based shelf manager */ - SAHPI_ENT_DISPLAY_PANEL, /* Display panel, such as an + SAHPI_ENT_DISPLAY_PANEL, /* Display panel, such as an alarm display panel. */ SAHPI_ENT_SUBBOARD_CARRIER_BLADE, /* Includes PMC Carrier Blade -- Use only if "carrier" is only - function of blade. Else use + function of blade. Else use primary function (SBC_BLADE, SPEC_PROC_BLADE, etc.). */ SAHPI_ENT_PHYSICAL_SLOT, /* Indicates the physical slot into which a FRU is inserted. */ SAHPI_ENT_PICMG_FRONT_BLADE, /* Any blade conforming to a PICMG - Standard. E.g. AdvancedTCA */ + Standard. E.g. AdvancedTCA */ SAHPI_ENT_SYSTEM_INVENTORY_DEVICE, /* Inventory storage device for - storing system definitions */ - SAHPI_ENT_FILTRATION_UNIT, /* E.g. a fan filter */ - SAHPI_ENT_AMC, /* Advanced Mezzannine Card */ - /* The range from - SAHPI_ENT_AMC + 0x01 to - SAHPI_ENT_SAFHPI_GROUP + 0x2F is - reserved for future use by this - specification */ + storing system definitions */ + SAHPI_ENT_FILTRATION_UNIT, /* E.g. a fan filter */ + SAHPI_ENT_AMC, /* Advanced Mezzannine Card */ + /* The range from + SAHPI_ENT_AMC + 0x01 to + SAHPI_ENT_SAFHPI_GROUP + 0x2F is + reserved for future use by this + specification */ SAHPI_ENT_BMC = SAHPI_ENT_SAFHPI_GROUP + 0x30, /* Baseboard Management - Controller */ + Controller */ SAHPI_ENT_IPMC, /* IPM controller */ SAHPI_ENT_MMC, /* Module Management controller */ SAHPI_ENT_SHMC, /* Shelf Mangement Controller */ @@ -684,8 +689,9 @@ SAHPI_ENT_DSP, /* Digital Signal Processor */ SAHPI_ENT_UCODE, /* Microcode */ SAHPI_ENT_NPU, /* Network Processor */ - SAHPI_ENT_OEM /* Proprietary device */ - /* The range from + SAHPI_ENT_OEM, /* Proprietary device */ + SAHPI_ENT_MAX_VALID = SAHPI_ENT_OEM + /* The range from SAHPI_ENT_OEM + 0x01 to SAHPI_ENT_SAFHPI_GROUP + 0xFF is reserved for future use by this @@ -716,7 +722,7 @@ /* ** Category ** -** Sensor events contain an event category and event state. Depending on the +** Sensor events contain an event category and event state. Depending on the ** event category, the event states take on different meanings for events ** generated by specific Sensors. ** @@ -766,7 +772,7 @@ ** Event States ** ** The following event states are specified relative to the categories listed -** above. The event types are only valid for their given category. Each set of +** above. The event types are only valid for their given category. Each set of ** events is labeled as to which category it belongs to. ** Each event has only one event state associated with it. When retrieving ** the event status or event enabled status a bit mask of all applicable event @@ -896,7 +902,7 @@ ** by the HPI specification. ** HPI Implementations shall not assign Sensor numbers within this ** number range, except for the specific Sensors identified in the -** specification. For example, currently, three aggregate Sensors are named in +** specification. For example, currently, three aggregate Sensors are named in ** this range. Other Sensors exposed by the HPI Implementation (e.g., a ** temperature Sensor) must be assigned a number outside of this range. **/ @@ -956,7 +962,8 @@ SAHPI_OPERATIONAL = 0xA0, SAHPI_OEM_SENSOR=0xC0, SAHPI_COMM_CHANNEL_LINK_STATE = SAHPI_SENSOR_TYPE_SAFHPI_GROUP + 0x1, - SAHPI_MANAGEMENT_BUS_STATE + SAHPI_MANAGEMENT_BUS_STATE, + SAHPI_SENSOR_TYPE_MAX_VALID = SAHPI_MANAGEMENT_BUS_STATE } SaHpiSensorTypeT; /* @@ -973,12 +980,13 @@ SAHPI_SENSOR_READING_TYPE_INT64, SAHPI_SENSOR_READING_TYPE_UINT64, SAHPI_SENSOR_READING_TYPE_FLOAT64, - SAHPI_SENSOR_READING_TYPE_BUFFER /* 32 byte array. The format of + SAHPI_SENSOR_READING_TYPE_BUFFER, /* 32 byte array. The format of the buffer is implementation- specific. Sensors that use this reading type may not have thresholds that are settable or readable. */ + SAHPI_SENSOR_READING_TYPE_MAX_VALID = SAHPI_SENSOR_READING_TYPE_BUFFER } SaHpiSensorReadingTypeT; typedef union { @@ -1004,7 +1012,7 @@ typedef struct { SaHpiBoolT IsSupported; SaHpiSensorReadingTypeT Type; - SaHpiSensorReadingUnionT Value; + SaHpiSensorReadingUnionT Value; } SaHpiSensorReadingT; @@ -1012,7 +1020,8 @@ typedef enum { SAHPI_SENS_ADD_EVENTS_TO_MASKS, - SAHPI_SENS_REMOVE_EVENTS_FROM_MASKS + SAHPI_SENS_REMOVE_EVENTS_FROM_MASKS, + SAHPI_SENS_EVENT_MASK_ACTION_MAX_VALID = SAHPI_SENS_REMOVE_EVENTS_FROM_MASKS } SaHpiSensorEventMaskActionT; /* Value to use for AssertEvents or DeassertEvents parameter @@ -1062,9 +1071,8 @@ SaHpiSensorReadingT UpMinor; /* Upper minor Threshold */ SaHpiSensorReadingT PosThdHysteresis; /* Positive Threshold Hysteresis */ SaHpiSensorReadingT NegThdHysteresis; /* Negative Threshold Hysteresis */ -}SaHpiSensorThresholdsT; +} SaHpiSensorThresholdsT; - /******************************************************************************* ******************************************************************************** ********** ********** @@ -1074,7 +1082,7 @@ *******************************************************************************/ /* -** Sensor Range +** Sensor Range ** Sensor range values can include minimum, maximum, normal minimum, normal ** maximum, and nominal values. ** @@ -1137,12 +1145,13 @@ SAHPI_SU_RESET, SAHPI_SU_OVERRUN, SAHPI_SU_UNDERRUN, SAHPI_SU_COLLISION, SAHPI_SU_PACKETS, SAHPI_SU_MESSAGES, SAHPI_SU_CHARACTERS, SAHPI_SU_ERRORS, SAHPI_SU_CORRECTABLE_ERRORS, - SAHPI_SU_UNCORRECTABLE_ERRORS + SAHPI_SU_UNCORRECTABLE_ERRORS, + SAHPI_SU_MAX_VALID = SAHPI_SU_UNCORRECTABLE_ERRORS } SaHpiSensorUnitsT; /* ** Modifier Unit Use -** This type defines how the modifier unit is used. For example: base unit == +** This type defines how the modifier unit is used. For example: base unit == ** meter, modifier unit == seconds, and modifier unit use == ** SAHPI_SMUU_BASIC_OVER_MODIFIER. The resulting unit would be meters per ** second. @@ -1150,7 +1159,8 @@ typedef enum { SAHPI_SMUU_NONE = 0, SAHPI_SMUU_BASIC_OVER_MODIFIER, /* Basic Unit / Modifier Unit */ - SAHPI_SMUU_BASIC_TIMES_MODIFIER /* Basic Unit * Modifier Unit */ + SAHPI_SMUU_BASIC_TIMES_MODIFIER, /* Basic Unit * Modifier Unit */ + SAHPI_SMUU_MAX_VALID = SAHPI_SMUU_BASIC_TIMES_MODIFIER } SaHpiSensorModUnitUseT; /* @@ -1160,7 +1170,7 @@ ** indicates that the rest of the structure is not meaningful. ** ** This structure encapsulates all of the various types that make up the -** definition of Sensor data. For reading type of +** definition of Sensor data. For reading type of ** SAHPI_SENSOR_READING_TYPE_BUFFER, the rest of the structure ** (beyond ReadingType) is not meaningful. ** @@ -1233,9 +1243,10 @@ SAHPI_SEC_READ_ONLY_MASKS, /* Control for entire Sensor only; Sensor event enable status can be changed, but assert/deassert masks cannot be changed */ - SAHPI_SEC_READ_ONLY /* Event control not supported; Sensor event + SAHPI_SEC_READ_ONLY, /* Event control not supported; Sensor event enable status cannot be changed and assert/deassert masks cannot be changed */ + SAHPI_SEC_MAX_VALID = SAHPI_SEC_READ_ONLY } SaHpiSensorEventCtrlT; /* @@ -1259,7 +1270,6 @@ SaHpiUint32T Oem; /* Reserved for OEM use */ } SaHpiSensorRecT; - /******************************************************************************* ******************************************************************************** ********** ********** @@ -1277,7 +1287,6 @@ #define SAHPI_DEFAGSENS_MIN (SaHpiSensorNumT)0x00000100 #define SAHPI_DEFAGSENS_MAX (SaHpiSensorNumT)0x0000010F - /******************************************************************************* ******************************************************************************** ********** ********** @@ -1304,7 +1313,8 @@ SAHPI_CTRL_TYPE_ANALOG, SAHPI_CTRL_TYPE_STREAM, SAHPI_CTRL_TYPE_TEXT, - SAHPI_CTRL_TYPE_OEM = 0xC0 + SAHPI_CTRL_TYPE_OEM = 0xC0, + SAHPI_CTRL_TYPE_MAX_VALID = SAHPI_CTRL_TYPE_OEM } SaHpiCtrlTypeT; /* @@ -1329,7 +1339,8 @@ SAHPI_CTRL_STATE_OFF = 0, SAHPI_CTRL_STATE_ON, SAHPI_CTRL_STATE_PULSE_OFF, - SAHPI_CTRL_STATE_PULSE_ON + SAHPI_CTRL_STATE_PULSE_ON, + SAHPI_CTRL_STATE_MAX_VALID = SAHPI_CTRL_STATE_PULSE_ON } SaHpiCtrlStateDigitalT; /* @@ -1397,10 +1408,10 @@ */ typedef enum { SAHPI_CTRL_MODE_AUTO, - SAHPI_CTRL_MODE_MANUAL + SAHPI_CTRL_MODE_MANUAL, + SAHPI_CTRL_MODE_MAX_VALID = SAHPI_CTRL_MODE_MANUAL } SaHpiCtrlModeT; - /******************************************************************************* ******************************************************************************** ********** ********** @@ -1428,7 +1439,8 @@ SAHPI_CTRL_POWER_INTERLOCK, SAHPI_CTRL_POWER_STATE, SAHPI_CTRL_LCD_DISPLAY, - SAHPI_CTRL_OEM + SAHPI_CTRL_OEM, + SAHPI_CTRL_OUTPUT_TYPE_MAX_VALID = SAHPI_CTRL_OEM } SaHpiCtrlOutputTypeT; /* @@ -1516,7 +1528,6 @@ } SaHpiCtrlRecT; - /******************************************************************************* ******************************************************************************** ********** ********** @@ -1546,7 +1557,8 @@ SAHPI_IDR_AREATYPE_BOARD_INFO, SAHPI_IDR_AREATYPE_PRODUCT_INFO, SAHPI_IDR_AREATYPE_OEM = 0xC0, - SAHPI_IDR_AREATYPE_UNSPECIFIED = 0xFF + SAHPI_IDR_AREATYPE_UNSPECIFIED = 0xFF, + SAHPI_IDR_AREATYPE_MAX_VALID = SAHPI_IDR_AREATYPE_UNSPECIFIED } SaHpiIdrAreaTypeT; /* Inventory Data Field type definitions @@ -1565,7 +1577,8 @@ SAHPI_IDR_FIELDTYPE_FILE_ID, SAHPI_IDR_FIELDTYPE_ASSET_TAG, SAHPI_IDR_FIELDTYPE_CUSTOM, - SAHPI_IDR_FIELDTYPE_UNSPECIFIED = 0xFF + SAHPI_IDR_FIELDTYPE_UNSPECIFIED = 0xFF, + SAHPI_IDR_FIELDTYPE_MAX_VALID = SAHPI_IDR_FIELDTYPE_UNSPECIFIED } SaHpiIdrFieldTypeT; /* Inventory Data Field structure definition */ @@ -1596,12 +1609,10 @@ SaHpiUint32T NumAreas; /* Number of Areas contained in IDR */ } SaHpiIdrInfoT; - - /******************************************************************************* ******************************************************************************** ********** ********** -********** Inventory Data Repository Resource Data Records ********** +********** Inventory Data Repository Resource Data Records ********** ********** ********** ******************************************************************************** *******************************************************************************/ @@ -1622,8 +1633,6 @@ SaHpiUint32T Oem; } SaHpiInventoryRecT; - - /******************************************************************************* ******************************************************************************** ********** ********** @@ -1650,7 +1659,8 @@ SAHPI_WA_NO_ACTION = 0, SAHPI_WA_RESET, SAHPI_WA_POWER_DOWN, - SAHPI_WA_POWER_CYCLE + SAHPI_WA_POWER_CYCLE, + SAHPI_WA_MAX_VALID = SAHPI_WA_POWER_CYCLE } SaHpiWatchdogActionT; typedef enum { @@ -1658,7 +1668,8 @@ SAHPI_WAE_RESET, SAHPI_WAE_POWER_DOWN, SAHPI_WAE_POWER_CYCLE, - SAHPI_WAE_TIMER_INT=0x08 /* Used if Timer Preinterrupt only */ + SAHPI_WAE_TIMER_INT=0x08, /* Used if Timer Preinterrupt only */ + SAHPI_WAE_MAX_VALID = SAHPI_WAE_TIMER_INT } SaHpiWatchdogActionEventT; /* @@ -1673,14 +1684,15 @@ SAHPI_WPI_SMI, SAHPI_WPI_NMI, SAHPI_WPI_MESSAGE_INTERRUPT, - SAHPI_WPI_OEM = 0x0F + SAHPI_WPI_OEM = 0x0F, + SAHPI_WPI_MAX_VALID = SAHPI_WPI_OEM } SaHpiWatchdogPretimerInterruptT; /* ** Watchdog Timer Use ** ** These enumerations represent the possible Watchdog users that may have caused -** the Watchdog to expire. For instance, if a Watchdog is used during power +** the Watchdog to expire. For instance, if a Watchdog is used during power ** on self test (POST), and it expires, the SAHPI_WTU_BIOS_POST expiration type ** is set. Most specific uses for Watchdog timer by users of HPI should ** indicate SAHPI_WTU_SMS_OS if the use is to provide an OS-healthy heartbeat, @@ -1694,7 +1706,8 @@ SAHPI_WTU_SMS_OS, /* System Management System providing heartbeat for OS */ SAHPI_WTU_OEM, - SAHPI_WTU_UNSPECIFIED = 0x0F + SAHPI_WTU_UNSPECIFIED = 0x0F, + SAHPI_WTU_MAX_VALID = SAHPI_WTU_UNSPECIFIED } SaHpiWatchdogTimerUseT; /* @@ -1718,9 +1731,9 @@ ** ** For saHpiWatchdogTimerGet() : ** -** Log - indicates whether or not the Watchdog is configured to +** Log - indicates whether the Watchdog is configured to ** issue events. True=events are generated. -** Running - indicates whether or not the Watchdog is currently +** Running - indicates whether the Watchdog is currently ** running or stopped. True=Watchdog is running. ** TimerUse - indicates the current use of the timer; one of the ** enumerated preset uses which was included on the last @@ -1755,7 +1768,7 @@ ** resolution could be supported. The HPI implementation ** returns this rounded value. ** PresentCount - The remaining time in milliseconds before the timer -** times out unless a saHpiWatchdogTimerReset() +** times out unless an saHpiWatchdogTimerReset() ** function call is made, or some other implementation- ** dependent strobe is sent to the Watchdog. ** HPI implementations may not be able to support @@ -1765,9 +1778,9 @@ ** ** For saHpiWatchdogTimerSet(): ** -** Log - indicates whether or not the Watchdog should issue +** Log - indicates whether the Watchdog should issue ** events. True=events are generated. -** Running - indicates whether or not the Watchdog should be +** Running - indicates whether the Watchdog should be ** stopped before updating. ** True = Watchdog is not stopped. If it is ** already stopped, it remains stopped, @@ -1777,12 +1790,12 @@ ** there is a race condition possible ** with this setting, so it should be used ** with care. -** False = Watchdog is stopped. After +** False = Watchdog is stopped. After ** saHpiWatchdogTimerSet() is called, a ** subsequent call to ** saHpiWatchdogTimerReset() is required ** to start the timer. -** TimerUse - indicates the current use of the timer. Controls +** TimerUse - indicates the current use of the timer. Controls ** which TimerUseExpFlag will be set if the timer ** expires. ** TimerAction - indicates what action will be taken when the Watchdog @@ -1799,16 +1812,16 @@ ** These restrictions should be documented by the ** provider of the HPI interface. ** TimerUseExpFlags - Set of five bit flags corresponding to the five -** TimerUse values. For each bit set to "1", the +** TimerUse values. For each bit set to "1", the ** corresponding Timer Use Expiration Flag is cleared, ** that is, set to "0". Generally, a program should only ** clear the Timer Use Expiration Flag corresponding to ** its own TimerUse, so that other software, which may ** have used the timer for another purpose in the past ** can still read its TimerUseExpFlag to determine -** whether or not the timer expired during that use. +** whether the timer expired during that use. ** InitialCount - The time, in milliseconds, before the timer will time -** out after a saHpiWatchdogTimerReset() function call is +** out after an saHpiWatchdogTimerReset() function call is ** made, or some other implementation-dependent strobe is ** sent to the Watchdog. HPI implementations may not be ** able to support millisecond resolution and may have a @@ -1830,7 +1843,6 @@ SaHpiUint32T PresentCount; } SaHpiWatchdogT; - /******************************************************************************* ******************************************************************************** ********** ********** @@ -1841,7 +1853,7 @@ /* ** When the "Watchdog" capability is set in a resource, a Watchdog with an -** identifier of SAHPI_DEFAULT_WATCHDOG_NUM is required. All Watchdogs must be +** identifier of SAHPI_DEFAULT_WATCHDOG_NUM is required. All Watchdogs must be ** represented in the RDR repository with an SaHpiWatchdogRecT, including the ** Watchdog with an identifier of SAHPI_DEFAULT_WATCHDOG_NUM. */ @@ -1850,12 +1862,10 @@ SaHpiUint32T Oem; } SaHpiWatchdogRecT; - - /******************************************************************************* ******************************************************************************** ********** ********** -********** DIMI ********** +********** DIMI ********** ********** ********** ******************************************************************************** *******************************************************************************/ @@ -1873,9 +1883,10 @@ typedef enum { SAHPI_DIMITEST_NONDEGRADING, SAHPI_DIMITEST_DEGRADING, - SAHPI_DIMITEST_VENDOR_DEFINED_LEVEL /* VENDOR_DEFINED_LEVEL can be used - to indicate severity of degrading - test */ + SAHPI_DIMITEST_VENDOR_DEFINED_LEVEL, /* VENDOR_DEFINED_LEVEL can be used + to indicate severity of degrading + test */ + SAHPI_DIMITEST_SERVICE_IMPACT_MAX_VALID = SAHPI_DIMITEST_VENDOR_DEFINED_LEVEL } SaHpiDimiTestServiceImpactT; @@ -1887,23 +1898,24 @@ typedef struct { SaHpiEntityPathT EntityImpacted; /* Entity path of impacted - entity */ - SaHpiDimiTestServiceImpactT ServiceImpact; /* Service Impact on - affected entity */ + entity */ + SaHpiDimiTestServiceImpactT ServiceImpact; /* Service Impact on affected + entity */ } SaHpiDimiTestAffectedEntityT; typedef enum { - SAHPI_DIMITEST_STATUS_NOT_RUN, /* Only returned if test has never - been executed on the DIMI */ + SAHPI_DIMITEST_STATUS_NOT_RUN, /* Only returned if test has never + been executed on the DIMI */ SAHPI_DIMITEST_STATUS_FINISHED_NO_ERRORS, /* Test is not running. Last run - finished without any errors */ - SAHPI_DIMITEST_STATUS_FINISHED_ERRORS, /* Test is not running. But the last - run finished with error */ - SAHPI_DIMITEST_STATUS_CANCELED, /* This is returned when a test has + finished without any errors */ + SAHPI_DIMITEST_STATUS_FINISHED_ERRORS, /* Test is not running. But the last + run finished with error */ + SAHPI_DIMITEST_STATUS_CANCELED, /* This is returned when a test has canceled using the saHpiDimiTestCancel function */ - SAHPI_DIMITEST_STATUS_RUNNING /* This is returned when a test is + SAHPI_DIMITEST_STATUS_RUNNING, /* This is returned when a test is in progress */ + SAHPI_DIMITEST_STATUS_MAX_VALID = SAHPI_DIMITEST_STATUS_RUNNING } SaHpiDimiTestRunStatusT; @@ -1913,41 +1925,42 @@ ** undefined errors. */ typedef enum { - SAHPI_DIMITEST_STATUSERR_NOERR = 0, /* No Error was generated */ - SAHPI_DIMITEST_STATUSERR_RUNERR, /* Run time error was generated */ - SAHPI_DIMITEST_STATUSERR_UNDEF /* Undefined Error*/ + SAHPI_DIMITEST_STATUSERR_NOERR = 0, /* No Error was generated */ + SAHPI_DIMITEST_STATUSERR_RUNERR, /* Run time error was generated */ + SAHPI_DIMITEST_STATUSERR_UNDEF, /* Undefined Error*/ + SAHPI_DIMITEST_STATUSERR_MAX_VALID = SAHPI_DIMITEST_STATUSERR_UNDEF } SaHpiDimiTestErrCodeT; /* Test results from last run of test */ typedef struct { - SaHpiTimeT ResultTimeStamp; /* TimeStamp when the results are - generated. When test ends, - ResultTimeStamp captures the time - test ended */ - SaHpiTimeoutT RunDuration; /* Implementation provides the - duration from the start of last run - until the time results were - generated */ - SaHpiDimiTestRunStatusT LastRunStatus; - SaHpiDimiTestErrCodeT TestErrorCode; - SaHpiTextBufferT TestResultString; /* String contains either in line - Test result or URI to the file name - containing results from last run */ - SaHpiBoolT TestResultStringIsURI; /* True = URI to file name, - False = in-line test result, - If True, the DataType of the - TestResultString text buffer - must be SAHPI_TL_TYPE_TEXT. */ +SaHpiTimeT ResultTimeStamp; /* TimeStamp when the results are + generated. When test ends, + ResultTimeStamp captures the time + test ended */ +SaHpiTimeoutT RunDuration; /* Implementation provides the + duration from the start of last run + until the time results were + generated */ +SaHpiDimiTestRunStatusT LastRunStatus; +SaHpiDimiTestErrCodeT TestErrorCode; +SaHpiTextBufferT TestResultString; /* String contains either in line + Test result or URI to the file name + containing results from last run */ +SaHpiBoolT TestResultStringIsURI; /* True = URI to file name, + False = in-line test result, + If True, the DataType of the + TestResultString text buffer + must be SAHPI_TL_TYPE_TEXT. */ } SaHpiDimiTestResultsT; /* SaHpiDimiTestParamsDefinitionT struct defines test parameters. The test ** parameter definition consists of Parameter Name, human readable text for ** parameters information, parameters type and value (min, max, default). -** HPI user can use APIs to obtain the parameters definition along with test -** information. Based on test parameters definition a proper parameter can +** HPI User can use APIs to obtain the parameters definition along with test +** information. Based on test parameters definition a proper parameter can ** be defined and passed together with the test invocation. */ @@ -1957,17 +1970,18 @@ SAHPI_DIMITEST_PARAM_TYPE_BOOLEAN, /* HPI type SaHpiBoolT */ SAHPI_DIMITEST_PARAM_TYPE_INT32, /* HPI type SaHpiUint32T */ SAHPI_DIMITEST_PARAM_TYPE_FLOAT64, /* HPI type SaHpiFloat64T */ - SAHPI_DIMITEST_PARAM_TYPE_TEXT /* HPI type SaHpiTextBufferT */ + SAHPI_DIMITEST_PARAM_TYPE_TEXT, /* HPI type SaHpiTextBufferT */ + SAHPI_DIMITEST_PARAM_TYPE_MAX_VALID = SAHPI_DIMITEST_PARAM_TYPE_TEXT } SaHpiDimiTestParamTypeT; /* This union is defining the values for the test parameter*/ typedef union { - SaHpiInt32T paramint; - SaHpiBoolT parambool; - SaHpiFloat64T paramfloat; - SaHpiTextBufferT paramtext; /* Must be DataType=SAHPI_TL_TYPE_TEXT */ + SaHpiInt32T paramint; + SaHpiBoolT parambool; + SaHpiFloat64T paramfloat; + SaHpiTextBufferT paramtext; /* Must be DataType = SAHPI_TL_TYPE_TEXT */ } SaHpiDimiTestParamValueT; @@ -1979,22 +1993,20 @@ typedef union { SaHpiInt32T IntValue; - SaHpiFloat64T FloatValue; + SaHpiFloat64T FloatValue; } SaHpiDimiTestParameterValueUnionT; typedef struct { - SaHpiUint8T ParamName[SAHPI_DIMITEST_PARAM_NAME_LEN]; /* Name of the - parameter, case - sensitive */ - SaHpiTextBufferT ParamInfo; /* This is a human readable - text */ - SaHpiDimiTestParamTypeT ParamType; - SaHpiDimiTestParameterValueUnionT MinValue; /* Only valid for integer and - float parameters */ - SaHpiDimiTestParameterValueUnionT MaxValue; /* Only valid for integer and - float parameters */ - SaHpiDimiTestParamValueT DefaultParam; /* Default value */ + SaHpiUint8T ParamName[SAHPI_DIMITEST_PARAM_NAME_LEN]; /* Name of the + parameter, case sensitive */ + SaHpiTextBufferT ParamInfo; /* This is a human readable text */ + SaHpiDimiTestParamTypeT ParamType; + SaHpiDimiTestParameterValueUnionT MinValue; /* Only valid for integer and float + parameters */ + SaHpiDimiTestParameterValueUnionT MaxValue; /* Only valid for integer and float + parameters */ + SaHpiDimiTestParamValueT DefaultParam; /* Default value */ } SaHpiDimiTestParamsDefinitionT; @@ -2003,7 +2015,7 @@ ** mask. If a test supports one of these capabilities then the corresponding ** bit is set in the bit mask. ** There is a close relationship between capabilities and parameters of a -** test. A test may support some standard parameters if specific capability +** test. A test may support some standard parameters if specific capability ** bits are set. Some capabilities might not have test parameters. ** ** Future versions of the HPI specification may define additional DIMI test @@ -2053,100 +2065,100 @@ typedef SaHpiUint32T SaHpiDimiTestCapabilityT; #define SAHPI_DIMITEST_CAPABILITY_NO_CAPABILITY \ - (SaHpiDimiTestCapabilityT)0x00000000 + (SaHpiDimiTestCapabilityT)0x00000000 #define SAHPI_DIMITEST_CAPABILITY_RESULTSOUTPUT \ - (SaHpiDimiTestCapabilityT)0x00000001 + (SaHpiDimiTestCapabilityT)0x00000001 #define SAHPI_DIMITEST_CAPABILITY_SERVICEMODE \ - (SaHpiDimiTestCapabilityT)0x00000002 -#define SAHPI_DIMITEST_CAPABILITY_LOOPCOUNT \ - (SaHpiDimiTestCapabilityT)0x00000004 -#define SAHPI_DIMITEST_CAPABILITY_LOOPTIME \ - (SaHpiDimiTestCapabilityT)0x00000008 -#define SAHPI_DIMITEST_CAPABILITY_LOGGING \ - (SaHpiDimiTestCapabilityT)0x00000010 + (SaHpiDimiTestCapabilityT)0x00000002 +#define SAHPI_DIMITEST_CAPABILITY_LOOPCOUNT \ + (SaHpiDimiTestCapabilityT)0x00000004 +#define SAHPI_DIMITEST_CAPABILITY_LOOPTIME \ + (SaHpiDimiTestCapabilityT)0x00000008 +#define SAHPI_DIMITEST_CAPABILITY_LOGGING \ + (SaHpiDimiTestCapabilityT)0x00000010 #define SAHPI_DIMITEST_CAPABILITY_TESTCANCEL \ - (SaHpiDimiTestCapabilityT)0x00000020 + (SaHpiDimiTestCapabilityT)0x00000020 /* The following are the standard test parameters available for use with DIMI ** tests. These parameters are applicable only if the corresponding test -** capability is supported by a DIMI test. HPI user can check the capabilities +** capability is supported by a DIMI test. HPI User can check the capabilities ** through the bit-stream defined through SaHpiDimiTestCapabilityT. If a test ** supports certain capability, corresponding test parameter is defined in -** standard format. The parameters are defined here as macros. For tests +** standard format. The parameters are defined here as macros. For tests ** supporting these parameters they are returned as type ** SaHpiDimiTestParamsDefinitionT with the SaHpiDimiTestT structure. */ #ifndef SAHPI_DIMITEST_LOOP_COUNT_PARAM #define SAHPI_DIMITEST_LOOP_COUNT_PARAM_NAME "Loop Count" -#define SAHPI_DIMITEST_LOOP_COUNT_PARAM \ - { \ +#define SAHPI_DIMITEST_LOOP_COUNT_PARAM \ + { \ SAHPI_DIMITEST_LOOP_COUNT_PARAM_NAME, \ - { \ - SAHPI_TL_TYPE_TEXT, \ - SAHPI_LANG_ENGLISH, \ - 15, \ - "Test Loop Count" \ - }, \ + { \ + SAHPI_TL_TYPE_TEXT, \ + SAHPI_LANG_ENGLISH, \ + 15, \ + "Test Loop Count" \ + }, \ SAHPI_DIMITEST_PARAM_TYPE_INT32, \ - 1, \ - 0xFFFFFFFF, \ - { 1 } \ + 1, \ + 0xFFFFFFFF, \ + { 1 } \ } #endif // SAHPI_DIMITEST_LOOP_COUNT_PARAM #ifndef SAHPI_DIMITEST_LOOP_TIME_PARAM -#define SAHPI_DIMITEST_LOOP_TIME_PARAM_NAME "Loop Time" -#define SAHPI_DIMITEST_LOOP_TIME_PARAM \ - { \ +#define SAHPI_DIMITEST_LOOP_TIME_PARAM_NAME "Loop Time" +#define SAHPI_DIMITEST_LOOP_TIME_PARAM \ + { \ SAHPI_DIMITEST_LOOP_TIME_PARAM_NAME, \ - { \ - SAHPI_TL_TYPE_TEXT, \ - SAHPI_LANG_ENGLISH, \ - 14, \ - "Test Loop Time" \ - }, \ - SAHPI_DIMITEST_PARAM_TYPE_INT32, \ - 0, \ - 0xFFFFFFFF, \ - { 1 } \ - } + { \ + SAHPI_TL_TYPE_TEXT, \ + SAHPI_LANG_ENGLISH, \ + 14, \ + "Test Loop Time" \ + }, \ + SAHPI_DIMITEST_PARAM_TYPE_INT32, \ + 0, \ + 0xFFFFFFFF, \ + { 1 } \ + } #endif // SAHPI_DIMITEST_LOOP_TIME_PARAM #ifndef SAHPI_DIMITEST_SERVICE_MODE_PARAM #define SAHPI_DIMITEST_SERVICE_MODE_PARAM_NAME "Service Mode" -#define SAHPI_DIMITEST_SERVICE_MODE_PARAM \ - { \ - SAHPI_DIMITEST_SERVICE_MODE_PARAM_NAME, \ - { \ - SAHPI_TL_TYPE_TEXT, \ - SAHPI_LANG_ENGLISH, \ - 14, \ - "Operating Mode" \ - }, \ - SAHPI_DIMITEST_PARAM_TYPE_INT32, \ - 0, /* basic mode */ \ - 1, /* extended mode */ \ - { 0 } /* default is basic mode */ \ - } +#define SAHPI_DIMITEST_SERVICE_MODE_PARAM { \ + { \ + SAHPI_DIMITEST_SERVICE_MODE_PARAM_NAME, \ + { \ + SAHPI_TL_TYPE_TEXT, \ + SAHPI_LANG_ENGLISH, \ + 14, \ + "Operating Mode" \ + }, \ + SAHPI_DIMITEST_PARAM_TYPE_INT32, \ + 0, /* basic mode */ \ + 1, /* extended mode */ \ + { 0 } /* default is basic mode */ \ + } #endif // SAHPI_DIMITEST_SERVICE_MODE_PARAM #ifndef SAHPI_DIMITEST_LOGGING_PARAM -#define SAHPI_DIMITEST_LOGGING_PARAM_NAME "Logging" -#define SAHPI_DIMITEST_LOGGING_PARAM \ - { \ - SAHPI_DIMITEST_LOGGING_PARAM_NAME, \ - { \ - SAHPI_TL_TYPE_TEXT, \ - SAHPI_LANG_ENGLISH, \ - 18, \ - "Logging Capability" \ - }, \ - SAHPI_DIMITEST_PARAM_TYPE_INT32, \ - 0, /* No Logging */ \ - 5, /* Verbose Logging*/ \ - { 0 } \ - } +#define SAHPI_DIMITEST_LOGGING_PARAM_NAME "Logging" +#define SAHPI_DIMITEST_LOGGING_PARAM \ + { \ + SAHPI_DIMITEST_LOGGING_PARAM_NAME, \ + { \ + SAHPI_TL_TYPE_TEXT, \ + SAHPI_LANG_ENGLISH, \ + 18, \ + "Logging Capability" \ + }, \ + SAHPI_DIMITEST_PARAM_TYPE_INT32, \ + 0, /* No Logging */ \ + 5, /* Verbose Logging*/ \ + { 0 } \ + } #endif // SAHPI_DIMITEST_LOGGING_PARAM /* ResultsOutputParam: Standard parameter describing the capability of a @@ -2157,26 +2169,26 @@ #ifndef SAHPI_DIMITEST_RESULTS_OUTPUT_PARAM -#define SAHPI_DIMITEST_CAPAB_RES_FINALONLY 0 -#define SAHPI_DIMITEST_CAPAB_RES_ONDEMAND 1 -#define SAHPI_DIMITEST_CAPAB_RES_ASYNC 2 +#define SAHPI_DIMITEST_CAPAB_RES_FINALONLY 0 +#define SAHPI_DIMITEST_CAPAB_RES_ONDEMAND 1 +#define SAHPI_DIMITEST_CAPAB_RES_ASYNC 2 #define SAHPI_DIMITEST_RESULTS_OUTPUT_PARAM_NAME "Results Output" -#define SAHPI_DIMITEST_RESULTS_OUTPUT_PARAM \ - { \ - SAHPI_DIMITEST_RESULTS_OUTPUT_PARAM_NAME, \ - { \ - SAHPI_TL_TYPE_TEXT, \ - SAHPI_LANG_ENGLISH, \ - 25, \ - "Results Output Capability" \ - }, \ - SAHPI_DIMITEST_PARAM_TYPE_INT32, \ - 0, \ - 2, \ - { 0 } \ - } +#define SAHPI_DIMITEST_RESULTS_OUTPUT_PARAM { \ + { \ + SAHPI_DIMITEST_RESULTS_OUTPUT_PARAM_NAME,\ + { \ + SAHPI_TL_TYPE_TEXT, \ + SAHPI_LANG_ENGLISH, \ + 25, \ + "Results Output Capability" \ + }, \ + SAHPI_DIMITEST_PARAM_TYPE_INT32, \ + 0, \ + 2, \ + { 0 } \ + } #endif // SAHPI_DIMITEST_RESULTS_OUTPUT_PARAM @@ -2187,95 +2199,91 @@ /* DIMI test number */ typedef SaHpiUint32T SaHpiDimiTestNumT; -/* Maximum number entities that can be impacted by a test */ +/* Maximum number entities that can be affected by a test */ #define SAHPI_DIMITEST_MAX_ENTITIESIMPACTED 5 typedef struct { - SaHpiTextBufferT TestName; - SaHpiDimiTestServiceImpactT ServiceImpact; /* Service Impact on DIMI - itself */ - SaHpiDimiTestAffectedEntityT - EntitiesImpacted[SAHPI_DIMITEST_MAX_ENTITIESIMPACTED]; - /* Entities impacted by the Test. If entity contains - other entities then contained entities are considered - impacted as well. If Entities impacted by Test are more - than Max number, its recommended to associate test with - higher level entity DIMI. */ - SaHpiBoolT NeedServiceOS; /* True if a special Service - OS is needed for this test */ - SaHpiTextBufferT ServiceOS; /* If a special Service OS - is needed to be run for the - test, the HPI user is required - to load the particular Service - OS before running the tests, - else DIMI returns an error code.*/ - SaHpiTimeT ExpectedRunDuration; /* Expected run duration - for a test with default - parameters */ - SaHpiDimiTestCapabilityT TestCapabilities; - - SaHpiDimiTestParamsDefinitionT - TestParameters[SAHPI_DIMITEST_MAX_PARAMETERS]; + SaHpiTextBufferT TestName; + SaHpiDimiTestServiceImpactT ServiceImpact; /* Service Impact + on DIMI itself */ + SaHpiDimiTestAffectedEntityT EntitiesImpacted[SAHPI_DIMITEST_MAX_ENTITIESIMPACTED]; + /* Entities affected by the Test. If entity contains + other entities then contained entities are considered + affected as well. If Entities affected by Test are more + than Max number, its recommended to associate test with + higher level entity DIMI. */ + SaHpiBoolT NeedServiceOS; /* True if a special Service + OS is needed for this test */ + SaHpiTextBufferT ServiceOS; /* If a special Service OS is + needed to be run for the test, + the HPI User is required to + load the particular Service + OS before running the tests, + else DIMI returns an error + code.*/ + SaHpiTimeT ExpectedRunDuration; /* Expected run duration + for a test with default + parameters */ + SaHpiDimiTestCapabilityT TestCapabilities; + SaHpiDimiTestParamsDefinitionT TestParameters[SAHPI_DIMITEST_MAX_PARAMETERS]; } SaHpiDimiTestT; /* This struct defines the format of parameter which is passed ** to the test on invocation */ typedef struct { - SaHpiUint8T ParamName[SAHPI_DIMITEST_PARAM_NAME_LEN]; - /* Must exactly match the one - returned by the ParamsDefinition */ - SaHpiDimiTestParamTypeT ParamType; /* Must exactly match the one - returned by the ParamsDefinition */ - SaHpiDimiTestParamValueT Value; + SaHpiUint8T ParamName[SAHPI_DIMITEST_PARAM_NAME_LEN]; + /* Must exactly match the one returned + by the ParamsDefinition */ + SaHpiDimiTestParamTypeT ParamType; /* Must exactly match the one + returned by the ParamsDefinition */ + SaHpiDimiTestParamValueT Value; } SaHpiDimiTestVariableParamsT; -/* Percentage of test completed. Based on DIMI test capability, +/* Percentage of test completed. Based on DIMI test capability, Value range is 0 - 100, 0xFF returned if capability not available. */ typedef SaHpiUint8T SaHpiDimiTestPercentCompletedT; typedef enum { - SAHPI_DIMI_READY, /* DIMI is in ready state to run a particular test */ + SAHPI_DIMI_READY, /* DIMI is in ready state to run a particular test */ SAHPI_DIMI_WRONG_STATE, /* DIMI is in the wrong state to run a particular test. For example, need to load a correct ServiceOS before this test can run */ - SAHPI_DIMI_BUSY /* DIMI cannot start a particular test at this - time. User can try again later. */ + SAHPI_DIMI_BUSY, /* DIMI cannot start a particular test at this + time. User can try again later. */ + SAHPI_DIMI_READY_MAX_VALID = SAHPI_DIMI_BUSY } SaHpiDimiReadyT; -typedef SaHpiUint32T SaHpiDimiTotalTestsT; +typedef struct { + SaHpiUint32T NumberOfTests; /* It is recommended that the DIMI + advertise all available tests + regardless of ServiceImpact or + Service OS */ +SaHpiUint32T TestNumUpdateCounter; /* If number of tests change for + DIMI this counter is incremented and + Event is generated*/ -typedef struct { - SaHpiDimiTotalTestsT NumberOfTests; /* It is recommended that the DIMI - advertise all available tests - regardless of ServiceImpact or - Service OS */ - SaHpiUint32T TestNumUpdateCounter; /* If number of tests change for - DIMI this counter is incremented - and Event is generated */ } SaHpiDimiInfoT; - /******************************************************************************* ******************************************************************************** ********** ********** -********** DIMI Resource Data Records ********** +********** DIMI Resource Data Records ********** ********** ********** ******************************************************************************** *******************************************************************************/ /* ** All DIMIs must be represented in the -** RDR repository with a SaHpiDimiRecT +** RDR repository with an SaHpiDimiRecT */ typedef struct { SaHpiDimiNumT DimiNum; SaHpiUint32T Oem; /* Reserved for OEM use */ } SaHpiDimiRecT; - /******************************************************************************* ******************************************************************************** ********** ********** @@ -2291,6 +2299,127 @@ typedef SaHpiUint8T SaHpiBankNumT; /* +** Spec framework underlying a FUMI implementation +** +** This information can be presented in two ways: +** +** 1) If SAF recognizes underlying spec framework: +** a well-known assigned Spec Identifier and Spec +** revision (SaHpiFumiSafDefinedSpecInfoT). +** +** 2) Otherwise, an OEM defined identifier (SaHpiFumiOemDefinedSpecInfoT) +*/ + +/* +** Underlying spec framework information type +*/ +typedef enum { + SAHPI_FUMI_SPEC_INFO_NONE, + SAHPI_FUMI_SPEC_INFO_SAF_DEFINED, + SAHPI_FUMI_SPEC_INFO_OEM_DEFINED, + SAHPI_FUMI_SPEC_INFO_MAX_VALID = SAHPI_FUMI_SPEC_INFO_OEM_DEFINED +} SaHpiFumiSpecInfoTypeT; + +/* +** SAF-recognized underlying spec framework information +*/ +typedef enum { + SAHPI_FUMI_SPEC_HPM1 = 0, + /* future revisions of HPI specification will define more constants */ + SAHPI_FUMI_SPEC_MAX_VALID = SAHPI_FUMI_SPEC_HPM1 +} SaHpiFumiSafDefinedSpecIdT; + +typedef struct { + SaHpiFumiSafDefinedSpecIdT SpecID; + SaHpiUint32T RevisionID; +} SaHpiFumiSafDefinedSpecInfoT; + +/* +** OEM-defined underlying spec framework information +*/ +#define SAHPI_FUMI_MAX_OEM_BODY_LENGTH 255 +typedef struct { + SaHpiManufacturerIdT Mid; + SaHpiUint8T BodyLength; + SaHpiUint8T Body[SAHPI_FUMI_MAX_OEM_BODY_LENGTH]; +} SaHpiFumiOemDefinedSpecInfoT; + +/* +** Underlying spec framework information +*/ +typedef union { + SaHpiFumiSafDefinedSpecInfoT SafDefined; + SaH... [truncated message content] |
From: <ric...@us...> - 2009-02-19 03:14:49
|
Revision: 6961 http://openhpi.svn.sourceforge.net/openhpi/?rev=6961&view=rev Author: ricwhite Date: 2009-02-19 03:14:45 +0000 (Thu, 19 Feb 2009) Log Message: ----------- Rolling back changes made in revision 6942 for the feature: 2220356 Supporting the graceful shutdown for openhpi daemon Temporarily removing this feature until the failures to the ohpi_008 and ohpi_010 tests are understood and fixed. Revision Links: -------------- http://openhpi.svn.sourceforge.net/openhpi/?rev=6942&view=rev Modified Paths: -------------- openhpi/trunk/include/oh_event.h openhpi/trunk/include/oh_plugin.h openhpi/trunk/marshal/strmsock.cpp openhpi/trunk/openhpid/openhpid.cpp openhpi/trunk/openhpid/openhpid.sh.in openhpi/trunk/plugins/simulator/sim_init.c openhpi/trunk/src/event.c openhpi/trunk/src/init.c openhpi/trunk/src/plugin.c openhpi/trunk/src/threaded.c openhpi/trunk/ssl/oh_ssl.c openhpi/trunk/ssl/oh_ssl.h Modified: openhpi/trunk/include/oh_event.h =================================================================== --- openhpi/trunk/include/oh_event.h 2009-02-15 03:17:02 UTC (rev 6960) +++ openhpi/trunk/include/oh_event.h 2009-02-19 03:14:45 UTC (rev 6961) @@ -112,7 +112,6 @@ SaErrorT oh_harvest_events(void); SaErrorT oh_process_events(void); void oh_event_free(struct oh_event *e, int only_rdrs); -void oh_event_queue_free(void); struct oh_event *oh_dup_event(struct oh_event *old_event); #ifdef __cplusplus Modified: openhpi/trunk/include/oh_plugin.h =================================================================== --- openhpi/trunk/include/oh_plugin.h 2009-02-15 03:17:02 UTC (rev 6960) +++ openhpi/trunk/include/oh_plugin.h 2009-02-19 03:14:45 UTC (rev 6961) @@ -74,7 +74,6 @@ /* Finalization of plugins and handlers. */ void oh_close_handlers(void); -int oh_exit_ltdl(void); /* Plugin interface functions */ struct oh_plugin *oh_get_plugin(char *plugin_name); Modified: openhpi/trunk/marshal/strmsock.cpp =================================================================== --- openhpi/trunk/marshal/strmsock.cpp 2009-02-15 03:17:02 UTC (rev 6960) +++ openhpi/trunk/marshal/strmsock.cpp 2009-02-19 03:14:45 UTC (rev 6961) @@ -36,8 +36,6 @@ #define INADDR_NONE 0xffffffff #endif -// server socket timeout -#define SERVER_SOCK_TIMEOUT 2 /*--------------------------------------------------------------------*/ /* Stream Sockets base class methods */ @@ -153,13 +151,7 @@ if (len < 0) { errcode = errno; - /* EWOULDBLOCK error code means there is no data to read - * and not an error condition - */ - if (errcode != EWOULDBLOCK) { - printf("Reading from socket returned and error: %d\n", - errcode); // Debug - } + printf("Reading from socket returned and error: %d\n", errcode); // Debug return true; } else if (len == 0) { //connection has been aborted by the peer Close(); @@ -354,7 +346,6 @@ { int Rc; // return code int so_reuseaddr = TRUE; // socket reuse flag - struct timeval tv; // get a server socket ss = socket(domain, type, protocol); @@ -365,11 +356,6 @@ // set the socket option to reuse the address setsockopt(ss, SOL_SOCKET, SO_REUSEADDR, &so_reuseaddr, sizeof(so_reuseaddr)); - tv.tv_sec = SERVER_SOCK_TIMEOUT; - tv.tv_usec = 0; - // set the socket option to timeout - setsockopt(ss, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); - // bind the server socket to a port memset(&addr, 0, sizeof (addr)); addr.sin_family = domain; Modified: openhpi/trunk/openhpid/openhpid.cpp =================================================================== --- openhpi/trunk/openhpid/openhpid.cpp 2009-02-15 03:17:02 UTC (rev 6960) +++ openhpi/trunk/openhpid/openhpid.cpp 2009-02-19 03:14:45 UTC (rev 6961) @@ -70,7 +70,7 @@ } -#define CLIENT_TIMEOUT 2 /* Set to 2 second timeout */ +#define CLIENT_TIMEOUT 0 // Unlimited #define PID_FILE "/var/run/openhpid.pid" static bool stop_server = FALSE; @@ -98,17 +98,6 @@ #define PVERBOSE3(msg, ...) if (verbose_flag) printf("CRITICAL: "msg, ## __VA_ARGS__) /*--------------------------------------------------------------------*/ -/* Function: shutdown_signal */ -/*--------------------------------------------------------------------*/ - -void shutdown_signal(int sig) -{ - dbg("Recieved the signal for shutdown"); - stop_server = TRUE; - return; -} - -/*--------------------------------------------------------------------*/ /* Function: display_help */ /*--------------------------------------------------------------------*/ @@ -151,9 +140,6 @@ char pid_buf[256]; int pfile, len, pid = 0; - /* Catch the termination signal */ - signal(SIGUSR1, shutdown_signal); - /* get the command line options */ while (1) { c = getopt_long(argc, argv, "nvc:p:f:s:t:", long_options, @@ -304,23 +290,21 @@ // wait for a connection and then service the connection while (TRUE) { + if (stop_server) { break; } if (servinst->Accept()) { - if (servinst->GetErrcode() == EWOULDBLOCK) { - PVERBOSE3("%p Timeout accepting server socket.\n", servinst); - continue; - } PVERBOSE1("Error accepting server socket."); - stop_server = TRUE; break; } PVERBOSE1("### Spawning thread to handle connection. ###"); psstrmsock thrdinst = new sstrmsock(*servinst); g_thread_pool_push(thrdpool, (gpointer)thrdinst, NULL); + + } servinst->CloseSrv(); @@ -328,15 +312,8 @@ // ensure all threads are complete g_thread_pool_free(thrdpool, FALSE, TRUE); - delete servinst; - /* Do a graceful shutdown */ - oh_finit(); - - /* Release the pid_file and configfile */ - if (pid_file) - g_free(pid_file); - g_free(configfile); + delete servinst; return 0; } @@ -428,8 +405,8 @@ PVERBOSE3("%p Timeout reading socket.\n", thrdid); } else { PVERBOSE3("%p Error reading socket.\n", thrdid); - stop = true; } + goto thrd_cleanup; } else { switch( thrdinst->header.m_type ) { @@ -451,11 +428,9 @@ break; } } - /* Check for the shutdown signal */ - if(stop_server) - stop = true; } + thrd_cleanup: // if necessary, clean up HPI lib data if (session_id != 0) { saHpiSessionClose( session_id ); Modified: openhpi/trunk/openhpid/openhpid.sh.in =================================================================== --- openhpi/trunk/openhpid/openhpid.sh.in 2009-02-15 03:17:02 UTC (rev 6960) +++ openhpi/trunk/openhpid/openhpid.sh.in 2009-02-19 03:14:45 UTC (rev 6961) @@ -166,44 +166,6 @@ } -shutdown() { - case "${lsbtype}" in - - rh | lsb | suse) - echo -n $"Shutting down $prog: " - killproc -s SIGUSR1 @prefix@/sbin/openhpid - RETVAL=$? - ;; - - gentoo) - ebegin "Shutting down $prog: " - start-stop-daemon --stop --signal SIGUSR1 --quiet --exec @prefix@/sbin/openhpid - RETVAL=$? - ;; - - nolsb) - echo -n $"Shutting down $prog: " - if test -f /var/run/openhpid.pid && test "`cat /var/run/openhpid.pid`" != "" - then - kill -s SIGUSR1 "`cat /var/run/openhpid.pid`" - RETVAL=$? - else - RETVAL=0 - fi - ;; - - esac - - print_outcome - - if test "$RETVAL" -eq 0 && test -f /var/run/openhpid.pid - then - rm -f /var/lock/openhpid - rm -f /var/run/openhpid.pid - fi - -} - dstatus() { echo $"Checking for $prog daemon: " @@ -263,9 +225,6 @@ stop) stop ;; - shutdown) - shutdown - ;; restart) restart ;; @@ -276,6 +235,6 @@ force_reload ;; *) - echo $"Usage: $0 {start|stop|shutdown|restart|status|force-reload}" + echo $"Usage: $0 {start|stop|restart|status|force-reload}" exit 1 esac Modified: openhpi/trunk/plugins/simulator/sim_init.c =================================================================== --- openhpi/trunk/plugins/simulator/sim_init.c 2009-02-15 03:17:02 UTC (rev 6960) +++ openhpi/trunk/plugins/simulator/sim_init.c 2009-02-19 03:14:45 UTC (rev 6961) @@ -203,39 +203,9 @@ SaErrorT sim_close(void *hnd) { struct oh_handler_state *state = hnd; - SaHpiRdrT *tmp_rdr; - SaHpiRptEntryT *tmp_entry; - struct simAnnunciatorInfo *info = NULL; - SaHpiResourceIdT rid = SAHPI_FIRST_ENTRY; - SaHpiEntryIdT rdrid = SAHPI_FIRST_ENTRY; - /* Release the Annuciators */ - tmp_entry = oh_get_resource_by_id(state->rptcache, rid); - while (tmp_entry != NULL) { - rid = tmp_entry->ResourceId; - /* Travers all RDRs for the ANNUNCIATOR RDR */ - rdrid = SAHPI_FIRST_ENTRY; - tmp_rdr = oh_get_rdr_by_id(state->rptcache, rid, rdrid); - while (tmp_rdr != NULL) { - rdrid = tmp_rdr->RecordId; - if (tmp_rdr->RdrType == SAHPI_ANNUNCIATOR_RDR) { - /* Get the annunciators */ - info = (struct simAnnunciatorInfo *) - oh_get_rdr_data(state->rptcache, - rid, rdrid); - /* Release all the annunciators */ - oh_announcement_close(info->announs); - } - tmp_rdr = oh_get_rdr_next(state->rptcache, rid, rdrid); - } - tmp_entry = oh_get_resource_next(state->rptcache, rid); - } - - /* Release the RPT and RDR table */ - oh_flush_rpt(state->rptcache); - - g_free(state->rptcache); - g_free(state->elcache); + /* TODO: we may need to do more here than just this! */ +// g_free(state->rptcache); g_free(state); return 0; } Modified: openhpi/trunk/src/event.c =================================================================== --- openhpi/trunk/src/event.c 2009-02-15 03:17:02 UTC (rev 6960) +++ openhpi/trunk/src/event.c 2009-02-19 03:14:45 UTC (rev 6961) @@ -30,15 +30,12 @@ #include <oh_utils.h> #include <oh_error.h> -#define OH_EVTPOP_THREAD_SLEEP_TIME 3 * G_USEC_PER_SEC - struct _oh_evt_queue { GAsyncQueue *q; }; oh_evt_queue oh_process_q = { .q = NULL }; extern GMutex *oh_event_thread_mutex; -extern SaHpiBoolT stop_oh_threads; /* * The following is required to set up the thread state for @@ -78,30 +75,6 @@ } } -/* This function will be called to free up the event queue */ -void oh_event_queue_free(void) -{ - gint len; - int i; - struct oh_event *e = NULL; - - /* Get the number of pending events in event queue */ - len = g_async_queue_length(oh_process_q.q); - if (len > 0) { - for(i = 0; i < len; i++) { - /* Extract the pending events in event queue */ - e = g_async_queue_try_pop(oh_process_q.q); - if (e == NULL) { - err("Error in releasing the events"); - break; - } - oh_event_free(e, 0); - } - } - /* Release the event queue */ - g_async_queue_unref(oh_process_q.q); -} - struct oh_event *oh_dup_event(struct oh_event *old_event) { GSList *node = NULL; @@ -407,25 +380,14 @@ SaErrorT oh_process_events() { - struct oh_event *e = NULL; + struct oh_event *e; // GArray *domain_results = NULL; SaHpiDomainIdT tmp_did; char *et; - GTimeVal time; // domain_results = oh_query_domains(); - /* Pop the events from the event queue. Come out of the loop on graceful - * shutdown request - */ - while (stop_oh_threads == SAHPI_FALSE) { - g_get_current_time(&time); - g_time_val_add(&time, OH_EVTPOP_THREAD_SLEEP_TIME); - e = g_async_queue_timed_pop(oh_process_q.q, &time); - /* On timeout, loop again */ - if (e == NULL) - continue; - + while ((e = g_async_queue_pop(oh_process_q.q)) != NULL) { et = oh_lookup_eventtype(e->event.EventType); dbg("Event Type = %s", (et) ? et : "<Unknown>"); @@ -447,10 +409,9 @@ free_event: oh_event_free(e, FALSE); - e = NULL; } - + /* Should never get here */ // g_array_free(domain_results, TRUE); - return SA_OK; + return SA_ERR_HPI_INTERNAL_ERROR; } Modified: openhpi/trunk/src/init.c =================================================================== --- openhpi/trunk/src/init.c 2009-02-15 03:17:02 UTC (rev 6960) +++ openhpi/trunk/src/init.c 2009-02-19 03:14:45 UTC (rev 6961) @@ -14,9 +14,6 @@ * */ -#include <stdlib.h> -#include <stdio.h> -#include <unistd.h> #include <config.h> #include <oh_init.h> #include <oh_ssl.h> @@ -28,19 +25,7 @@ #include <oh_error.h> #include <oh_lock.h> #include <oh_utils.h> -#include <oh_event.h> -extern SaHpiBoolT stop_oh_threads; -extern GThread *oh_evtpop_thread; -extern GThread *oh_discovery_thread; -extern GThread *oh_evtget_thread; -extern oh_evt_queue oh_process_q; -extern GStaticMutex oh_wake_discovery_mutex; -extern GMutex *oh_discovery_thread_mutex; -extern GCond *oh_discovery_thread_wait; -extern GMutex *oh_evtget_thread_mutex; -extern GStaticMutex oh_wake_evtget_mutex; -extern GCond *oh_evtget_thread_wait; /** * oh_init @@ -172,90 +157,12 @@ **/ int oh_finit(void) { -// unsigned int hid = 0, next_hid, i; - unsigned int hid = 0, next_hid; -/* GArray *domain_results = NULL; - oh_domain_result dr; */ - data_access_lock(); - /* Set the stop_oh_threads to TRUE to stop the - * discovery and event threads - */ - stop_oh_threads = SAHPI_TRUE; + oh_close_handlers(); - /* Wake up the discovery thread, if it is waiting */ - g_static_mutex_lock(&oh_wake_discovery_mutex); - if (g_mutex_trylock(oh_discovery_thread_mutex)) { - g_cond_broadcast(oh_discovery_thread_wait); - g_mutex_unlock(oh_discovery_thread_mutex); - } else { - g_mutex_lock(oh_discovery_thread_mutex); - g_cond_broadcast(oh_discovery_thread_wait); - g_mutex_unlock(oh_discovery_thread_mutex); - } - g_static_mutex_unlock(&oh_wake_discovery_mutex); - - /* Wait for the discovery thread to exit */ - g_thread_join(oh_discovery_thread); - dbg("discovery thread stopped"); - - /* Wake up the get event thread, if it is waiting */ - g_static_mutex_lock(&oh_wake_evtget_mutex); - if (g_mutex_trylock(oh_evtget_thread_mutex)) { - g_cond_broadcast(oh_evtget_thread_wait); - g_mutex_unlock(oh_evtget_thread_mutex); - } else { - g_mutex_lock(oh_evtget_thread_mutex); - g_cond_broadcast(oh_evtget_thread_wait); - g_mutex_unlock(oh_evtget_thread_mutex); - } - g_static_mutex_unlock(&oh_wake_evtget_mutex); - - /* Wait for the event get thread to exit */ - g_thread_join(oh_evtget_thread); - dbg("event get thread stopped"); - - /* Wait for the event pop thread to exit */ - g_thread_join(oh_evtpop_thread); - dbg("event pop thread stopped"); - - /* Cleanup the instantiated plugins */ - oh_getnext_handler_id(hid, &next_hid); - while (next_hid) { - hid = next_hid; - oh_destroy_handler(hid); - oh_getnext_handler_id(hid, &next_hid); - } - dbg("all the instantiated plugins closed"); - - /* Release the event queue */ - oh_event_queue_free(); - dbg("event queue released"); - - /* Cleanup the thread related variables */ - oh_threaded_final(); - dbg("global variables released"); - - /* Cleanup the SSL library */ - oh_ssl_finalize(); - dbg("ssl library cleaned"); - - /* close the ltdl structures */ - oh_exit_ltdl(); - dbg("ltdl library cleaned"); - - /* Destroy the sessions */ - oh_destroy_domain_sessions(OH_DEFAULT_DOMAIN_ID); - /* Destroy the domain */ - oh_destroy_domain(OH_DEFAULT_DOMAIN_ID); - dbg("default domain is destroyed"); - - g_hash_table_destroy(oh_domains.table); - dbg("domain table released"); - g_hash_table_destroy(oh_sessions.table); - dbg("sessions table released"); - data_access_unlock(); + return 0; } + Modified: openhpi/trunk/src/plugin.c =================================================================== --- openhpi/trunk/src/plugin.c 2009-02-15 03:17:02 UTC (rev 6960) +++ openhpi/trunk/src/plugin.c 2009-02-19 03:14:45 UTC (rev 6961) @@ -83,7 +83,7 @@ * * Returns: 0 on Success. **/ -int oh_exit_ltdl(void) +static int oh_exit_ltdl(void) { int rv; @@ -219,7 +219,7 @@ } __dec_plugin_refcount(plugin); - if (plugin->refcount < 1) + if (plugin->refcount < 0) __delete_plugin(plugin); else g_static_rec_mutex_unlock(&plugin->lock); @@ -307,7 +307,7 @@ plugin = oh_get_plugin(plugin_name); if (plugin) { - __dec_plugin_refcount(plugin); + oh_release_plugin(plugin); dbg("Plugin %s already loaded. Not loading twice.", plugin_name); return 0; @@ -390,7 +390,7 @@ } if (plugin->handler_count > 0) { - __dec_plugin_refcount(plugin); + oh_release_plugin(plugin); err("ERROR unloading plugin. Handlers are still referencing it."); return -3; } @@ -438,9 +438,9 @@ } /* Free the oh_handler members first, then the handler. */ + /* FIXME: Where/When should the handler config table be freed? */ g_static_rec_mutex_free(&h->lock); g_static_rec_mutex_free(&h->refcount_lock); - g_hash_table_destroy(h->config); g_free(h); } @@ -578,7 +578,7 @@ /* Initialize handler */ handler->abi = plugin->abi; plugin->handler_count++; /* Increment # of handlers using the plugin */ - __dec_plugin_refcount(plugin); + oh_release_plugin(plugin); g_static_rec_mutex_lock(&oh_handlers.lock); handler->id = handler_id++; g_static_rec_mutex_unlock(&oh_handlers.lock); Modified: openhpi/trunk/src/threaded.c =================================================================== --- openhpi/trunk/src/threaded.c 2009-02-15 03:17:02 UTC (rev 6960) +++ openhpi/trunk/src/threaded.c 2009-02-19 03:14:45 UTC (rev 6961) @@ -39,8 +39,6 @@ GCond *oh_discovery_thread_wait = NULL; GStaticMutex oh_wake_discovery_mutex = G_STATIC_MUTEX_INIT; -SaHpiBoolT stop_oh_threads = SAHPI_FALSE; - static int oh_discovery_init(void) { /* Nothing to do here...for now */ @@ -72,10 +70,6 @@ g_mutex_lock(oh_discovery_thread_mutex); while (1) { - /* Check for the signal to stop the thread */ - if (stop_oh_threads == SAHPI_TRUE) - break; - dbg("Doing threaded discovery on all handlers"); error = oh_discovery(); if (error) { @@ -105,12 +99,11 @@ SaErrorT error = SA_OK; g_mutex_lock(oh_evtpop_thread_mutex); - - dbg("Thread processing events"); - error = oh_process_events(); - if (error != SA_OK) - err("Error on processing of events."); - + while(1) { + dbg("Thread processing events"); + error = oh_process_events(); + if (error != SA_OK) err("Error on processing of events."); + } g_mutex_unlock(oh_evtpop_thread_mutex); g_thread_exit(0); @@ -125,10 +118,6 @@ g_mutex_lock(oh_evtget_thread_mutex); while (1) { - /* Check for the signal to stop the thread */ - if (stop_oh_threads == SAHPI_TRUE) - break; - /* Give the discovery time to start first -> FIXME */ if (first_loop) { struct timespec sleepytime = @@ -181,18 +170,17 @@ oh_discovery_thread_wait = g_cond_new(); oh_discovery_thread_mutex = g_mutex_new(); oh_discovery_thread = g_thread_create(oh_discovery_thread_loop, - NULL, TRUE, + NULL, FALSE, &oh_discovery_thread_error); dbg("Starting event threads"); oh_evtget_thread_wait = g_cond_new(); oh_evtget_thread_mutex = g_mutex_new(); oh_evtget_thread = g_thread_create(oh_evtget_thread_loop, - NULL, TRUE, &oh_evtget_thread_error); + NULL, FALSE, &oh_evtget_thread_error); oh_evtpop_thread_mutex = g_mutex_new(); - /* Make the event pop thread joinable */ oh_evtpop_thread = g_thread_create(oh_evtpop_thread_loop, - NULL, TRUE, &oh_evtpop_thread_error); + NULL, FALSE, &oh_evtpop_thread_error); return 0; } Modified: openhpi/trunk/ssl/oh_ssl.c =================================================================== --- openhpi/trunk/ssl/oh_ssl.c 2009-02-15 03:17:02 UTC (rev 6960) +++ openhpi/trunk/ssl/oh_ssl.c 2009-02-19 03:14:45 UTC (rev 6961) @@ -250,6 +250,7 @@ } +#if 0 /* Not used right now */ /** * thread_cleanup * @@ -286,6 +287,7 @@ return(0); /* No errors */ } +#endif /* Not used right now */ /** @@ -338,38 +340,6 @@ /** - * oh_ssl_finalize - * - * Finalizes the OpenSSL library. The calls used in this routine releases global - * data created/initialized by the OpenSSL library. - * - * Note that it is the responisbility of the caller of this function to make - * sure that no other threads are making the OpenSSL library calls. The openhpid - * should close all the threads and call this function from the main (single) - * thread. - * - * Return value: Noe - **/ -void oh_ssl_finalize(void) -{ - /* TODO: Check whether any other SSL library cleanup should be called */ - thread_cleanup(); - ENGINE_cleanup(); - CONF_modules_unload(0); - ERR_free_strings(); - EVP_cleanup(); - CRYPTO_cleanup_all_ex_data(); - /* The valgrind is showing possible memory leak by - * SSL_COMP_get_compression_methods() call. - * - * Call to SSL_free_comp_methods() may resolve the memory leak. - * But not able to find this call in the openssl 0.9.8e - * TODO: Find whether its a real problem or not - */ - -} - -/** * oh_ssl_ctx_init * * Create a new SSL_CTX object as a framework for TLS/SSL enabled functions. Modified: openhpi/trunk/ssl/oh_ssl.h =================================================================== --- openhpi/trunk/ssl/oh_ssl.h 2009-02-15 03:17:02 UTC (rev 6960) +++ openhpi/trunk/ssl/oh_ssl.h 2009-02-19 03:14:45 UTC (rev 6961) @@ -54,7 +54,6 @@ #include <openssl/err.h> #include <openssl/rand.h> #include <openssl/x509v3.h> -#include <openssl/engine.h> #endif @@ -72,8 +71,6 @@ * implemented in oh_ssl.c */ extern int oh_ssl_init(void); -extern void oh_ssl_finalize(void); - #ifdef HAVE_OPENSSL extern SSL_CTX *oh_ssl_ctx_init(void); extern int oh_ssl_ctx_free(SSL_CTX *ctx); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2009-05-28 20:10:13
|
Revision: 7002 http://openhpi.svn.sourceforge.net/openhpi/?rev=7002&view=rev Author: avpak Date: 2009-05-28 19:30:14 +0000 (Thu, 28 May 2009) Log Message: ----------- Fix for #2796891 Modified Paths: -------------- openhpi/trunk/hpi_shell/fumi.c openhpi/trunk/include/SaHpi.h openhpi/trunk/include/oh_handler.h openhpi/trunk/marshal/marshal_hpi.c openhpi/trunk/marshal/marshal_hpi.h openhpi/trunk/openhpid/oh_client.cpp openhpi/trunk/openhpid/openhpid.cpp openhpi/trunk/plugins/oa_soap/oa_soap_fumi.c openhpi/trunk/plugins/oa_soap/oa_soap_fumi.h openhpi/trunk/src/plugin.c openhpi/trunk/src/safhpi.c Modified: openhpi/trunk/hpi_shell/fumi.c =================================================================== --- openhpi/trunk/hpi_shell/fumi.c 2009-05-22 16:12:19 UTC (rev 7001) +++ openhpi/trunk/hpi_shell/fumi.c 2009-05-28 19:30:14 UTC (rev 7002) @@ -272,9 +272,9 @@ { SaErrorT rv; - rv = saHpiFumiRollback( sessionId, rptid, fuminum ); + rv = saHpiFumiRollbackStart( sessionId, rptid, fuminum ); if ( rv != SA_OK ) { - printf( "ERROR!!! saHpiFumiRollback: %s\n", oh_lookup_error( rv ) ); + printf( "ERROR!!! saHpiFumiRollbackStart: %s\n", oh_lookup_error( rv ) ); return HPI_SHELL_CMD_ERROR; } return HPI_SHELL_OK; Modified: openhpi/trunk/include/SaHpi.h =================================================================== --- openhpi/trunk/include/SaHpi.h 2009-05-22 16:12:19 UTC (rev 7001) +++ openhpi/trunk/include/SaHpi.h 2009-05-28 19:30:14 UTC (rev 7002) @@ -9606,7 +9606,7 @@ ** operation will be associated with that bank. ** *******************************************************************************/ -SaErrorT SAHPI_API saHpiFumiRollback ( +SaErrorT SAHPI_API saHpiFumiRollbackStart ( SAHPI_IN SaHpiSessionIdT SessionId, SAHPI_IN SaHpiResourceIdT ResourceId, SAHPI_IN SaHpiFumiNumT FumiNum Modified: openhpi/trunk/include/oh_handler.h =================================================================== --- openhpi/trunk/include/oh_handler.h 2009-05-22 16:12:19 UTC (rev 7001) +++ openhpi/trunk/include/oh_handler.h 2009-05-28 19:30:14 UTC (rev 7002) @@ -837,15 +837,15 @@ SaHpiBoolT disable); /*** - * saHpiFumiRollback + * saHpiFumiRollbackStart **/ - SaErrorT (*rollback_fumi)( + SaErrorT (*start_fumi_rollback)( void *hnd, SaHpiResourceIdT id, SaHpiFumiNumT num); /*** - * saHpiFumiRollback + * saHpiFumiActivate **/ SaErrorT (*activate_fumi)( void *hnd, Modified: openhpi/trunk/marshal/marshal_hpi.c =================================================================== --- openhpi/trunk/marshal/marshal_hpi.c 2009-05-22 16:12:19 UTC (rev 7001) +++ openhpi/trunk/marshal/marshal_hpi.c 2009-05-28 19:30:14 UTC (rev 7002) @@ -1552,14 +1552,14 @@ }; -static const cMarshalType *saHpiFumiRollbackIn[]= +static const cMarshalType *saHpiFumiRollbackStartIn[]= { &SaHpiSessionIdType, &SaHpiResourceIdType, &SaHpiFumiNumType, 0 }; -static const cMarshalType *saHpiFumiRollbackOut[] = +static const cMarshalType *saHpiFumiRollbackStartOut[] = { &SaErrorType, 0 @@ -2089,7 +2089,7 @@ dHpiMarshalEntry( saHpiFumiUpgradeStatusGet ), dHpiMarshalEntry( saHpiFumiTargetVerifyStart ), dHpiMarshalEntry( saHpiFumiUpgradeCancel ), - dHpiMarshalEntry( saHpiFumiRollback ), + dHpiMarshalEntry( saHpiFumiRollbackStart ), dHpiMarshalEntry( saHpiFumiActivate ), dHpiMarshalEntry( saHpiHotSwapPolicyCancel ), dHpiMarshalEntry( saHpiResourceActiveSet ), Modified: openhpi/trunk/marshal/marshal_hpi.h =================================================================== --- openhpi/trunk/marshal/marshal_hpi.h 2009-05-22 16:12:19 UTC (rev 7001) +++ openhpi/trunk/marshal/marshal_hpi.h 2009-05-28 19:30:14 UTC (rev 7002) @@ -122,7 +122,7 @@ eFsaHpiFumiUpgradeStatusGet, eFsaHpiFumiTargetVerifyStart, eFsaHpiFumiUpgradeCancel, - eFsaHpiFumiRollback, + eFsaHpiFumiRollbackStart, eFsaHpiFumiActivate, eFsaHpiHotSwapPolicyCancel, eFsaHpiResourceActiveSet, Modified: openhpi/trunk/openhpid/oh_client.cpp =================================================================== --- openhpi/trunk/openhpid/oh_client.cpp 2009-05-22 16:12:19 UTC (rev 7001) +++ openhpi/trunk/openhpid/oh_client.cpp 2009-05-28 19:30:14 UTC (rev 7002) @@ -4826,7 +4826,7 @@ return err; } -SaErrorT SAHPI_API saHpiFumiRollback ( +SaErrorT SAHPI_API saHpiFumiRollbackStart ( SAHPI_IN SaHpiSessionIdT SessionId, SAHPI_IN SaHpiResourceIdT ResourceId, SAHPI_IN SaHpiFumiNumT FumiNum) @@ -4834,7 +4834,7 @@ void *request; char reply[dMaxMessageLength]; SaErrorT err = SA_OK; - char cmd[] = "saHpiFumiRollback"; + char cmd[] = "saHpiFumiRollbackStart"; pcstrmsock pinst; SaHpiSessionIdT dsid = 0; SaHpiDomainIdT did = 0; @@ -4844,8 +4844,8 @@ err = oh_get_connx(SessionId, &dsid, &pinst, &did); if (err) return err; - cHpiMarshal *hm = HpiMarshalFind(eFsaHpiFumiRollback); - pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiFumiRollback, hm->m_request_len); + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiFumiRollbackStart); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiFumiRollbackStart, hm->m_request_len); request = malloc(hm->m_request_len); pinst->header.m_len = HpiMarshalRequest3(hm, request, Modified: openhpi/trunk/openhpid/openhpid.cpp =================================================================== --- openhpi/trunk/openhpid/openhpid.cpp 2009-05-22 16:12:19 UTC (rev 7001) +++ openhpi/trunk/openhpid/openhpid.cpp 2009-05-28 19:30:14 UTC (rev 7002) @@ -2449,19 +2449,19 @@ } break; - case eFsaHpiFumiRollback: { + case eFsaHpiFumiRollbackStart: { SaHpiSessionIdT session_id; SaHpiResourceIdT resource_id; SaHpiFumiNumT fumi_num; - PVERBOSE1("%p Processing saHpiFumiRollback.", thrdid); + PVERBOSE1("%p Processing saHpiFumiRollbackStart.", thrdid); if (HpiDemarshalRequest3(request_mFlags & dMhEndianBit, hm, pReq, &session_id, &resource_id, &fumi_num) < 0) return eResultError; - ret = saHpiFumiRollback(session_id, resource_id, + ret = saHpiFumiRollbackStart(session_id, resource_id, fumi_num); thrdinst->header.m_len = HpiMarshalReply0(hm, pReq, &ret); Modified: openhpi/trunk/plugins/oa_soap/oa_soap_fumi.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_fumi.c 2009-05-22 16:12:19 UTC (rev 7001) +++ openhpi/trunk/plugins/oa_soap/oa_soap_fumi.c 2009-05-28 19:30:14 UTC (rev 7002) @@ -323,7 +323,7 @@ } /** - * oa_soap_rollback_fumi + * oa_soap_start_fumi_rollback * @oh_handler: Handler data pointer * @resource_id: Resource ID * @num: FUMI number @@ -338,11 +338,11 @@ * SA_ERR_HPI_UNSUPPORTED_API - current oa_soap implementation does not * support this API **/ - SaErrorT oa_soap_rollback_fumi(void *oh_handler, + SaErrorT oa_soap_start_fumi_rollback(void *oh_handler, SaHpiResourceIdT resource_id, SaHpiFumiNumT num) { - err("oa_soap_rollback_fumi not implemented"); + err("oa_soap_start_fumi_rollback not implemented"); return SA_ERR_HPI_UNSUPPORTED_API; } @@ -442,10 +442,10 @@ SaHpiBankNumT) __attribute__ ((weak, alias("oa_soap_cancel_fumi_upgrade"))); -void * oh_rollback_fumi (void *, +void * oh_start_fumi_rollback (void *, SaHpiResourceIdT, SaHpiFumiNumT) - __attribute__ ((weak, alias("oa_soap_rollback_fumi"))); + __attribute__ ((weak, alias("oa_soap_start_fumi_rollback"))); void * oh_activate_fumi (void *, SaHpiResourceIdT, Modified: openhpi/trunk/plugins/oa_soap/oa_soap_fumi.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_fumi.h 2009-05-22 16:12:19 UTC (rev 7001) +++ openhpi/trunk/plugins/oa_soap/oa_soap_fumi.h 2009-05-28 19:30:14 UTC (rev 7002) @@ -99,7 +99,7 @@ SaHpiFumiNumT num, SaHpiBankNumT banknum); -SaErrorT oa_soap_rollback_fumi(void *oh_handler, +SaErrorT oa_soap_start_fumi_rollback(void *oh_handler, SaHpiResourceIdT resource_id, SaHpiFumiNumT num); Modified: openhpi/trunk/src/plugin.c =================================================================== --- openhpi/trunk/src/plugin.c 2009-05-22 16:12:19 UTC (rev 7001) +++ openhpi/trunk/src/plugin.c 2009-05-28 19:30:14 UTC (rev 7002) @@ -880,8 +880,8 @@ "oh_get_fumi_autorollback_disable"); (*abi)->set_fumi_autorollback_disable = lt_dlsym(plugin->dl_handle, "oh_set_fumi_autorollback_disable"); - (*abi)->rollback_fumi = lt_dlsym(plugin->dl_handle, - "oh_rollback_fumi"); + (*abi)->start_fumi_rollback = lt_dlsym(plugin->dl_handle, + "oh_start_fumi_rollback"); (*abi)->activate_fumi = lt_dlsym(plugin->dl_handle, "oh_activate_fumi"); (*abi)->start_fumi_activate = lt_dlsym(plugin->dl_handle, Modified: openhpi/trunk/src/safhpi.c =================================================================== --- openhpi/trunk/src/safhpi.c 2009-05-22 16:12:19 UTC (rev 7001) +++ openhpi/trunk/src/safhpi.c 2009-05-28 19:30:14 UTC (rev 7002) @@ -5563,7 +5563,7 @@ return error; } -SaErrorT SAHPI_API saHpiFumiRollback ( +SaErrorT SAHPI_API saHpiFumiRollbackStart ( SAHPI_IN SaHpiSessionIdT SessionId, SAHPI_IN SaHpiResourceIdT ResourceId, SAHPI_IN SaHpiFumiNumT FumiNum) @@ -5599,7 +5599,7 @@ oh_release_domain(d); return SA_ERR_HPI_NOT_PRESENT; } else if (!(rdr->RdrTypeUnion.FumiRec.Capability & SAHPI_FUMI_CAP_ROLLBACK)) { - err("FUMI %u does not support target verification for" + err("FUMI %u does not support rollback for" " Resource %u in Domain %u", FumiNum, ResourceId, did); oh_release_domain(d); @@ -5609,7 +5609,7 @@ OH_HANDLER_GET(d, ResourceId, h); oh_release_domain(d); - OH_CALL_ABI(h, rollback_fumi, SA_ERR_HPI_INVALID_CMD, error, + OH_CALL_ABI(h, start_fumi_rollback, SA_ERR_HPI_INVALID_CMD, error, ResourceId, FumiNum); oh_release_handler(h); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2010-02-16 21:32:07
|
Revision: 7043 http://openhpi.svn.sourceforge.net/openhpi/?rev=7043&view=rev Author: avpak Date: 2010-02-16 21:31:59 +0000 (Tue, 16 Feb 2010) Log Message: ----------- Feature request #2953031 Modified Paths: -------------- openhpi/trunk/Makefile.am openhpi/trunk/clients/Makefile.am openhpi/trunk/configure.ac openhpi/trunk/hpi_shell/Makefile.am openhpi/trunk/openhpid/Makefile.am openhpi/trunk/openhpid/t/ohpi/Makefile.am openhpi/trunk/plugins/ipmi/t/Makefile.am openhpi/trunk/plugins/simulator/t/Makefile.am openhpi/trunk/plugins/snmp_bc/t/Makefile.am openhpi/trunk/scripts/test/testconformance.pl Added Paths: ----------- openhpi/trunk/baselib/ openhpi/trunk/baselib/Makefile.am openhpi/trunk/baselib/oh_client.cpp openhpi/trunk/baselib/oh_client.h openhpi/trunk/baselib/oh_client_conf.c openhpi/trunk/baselib/oh_client_conf.h openhpi/trunk/baselib/oh_client_session.cpp openhpi/trunk/baselib/oh_client_session.h openhpi/trunk/openhpid/alarm.c openhpi/trunk/openhpid/config.c openhpi/trunk/openhpid/domain.c openhpi/trunk/openhpid/event.c openhpi/trunk/openhpid/hotswap.c openhpi/trunk/openhpid/init.c openhpi/trunk/openhpid/lock.c openhpi/trunk/openhpid/ohpi.c openhpi/trunk/openhpid/plugin.c openhpi/trunk/openhpid/plugin_static.c.in openhpi/trunk/openhpid/safhpi.c openhpi/trunk/openhpid/session.c openhpi/trunk/openhpid/t/ openhpi/trunk/openhpid/threaded.c Removed Paths: ------------- openhpi/trunk/openhpid/oh_client.cpp openhpi/trunk/openhpid/oh_client.h openhpi/trunk/openhpid/oh_client_conf.c openhpi/trunk/openhpid/oh_client_conf.h openhpi/trunk/openhpid/oh_client_session.cpp openhpi/trunk/openhpid/oh_client_session.h openhpi/trunk/src/Makefile.am openhpi/trunk/src/alarm.c openhpi/trunk/src/config.c openhpi/trunk/src/domain.c openhpi/trunk/src/event.c openhpi/trunk/src/hotswap.c openhpi/trunk/src/init.c openhpi/trunk/src/lock.c openhpi/trunk/src/ohpi.c openhpi/trunk/src/plugin.c openhpi/trunk/src/plugin_static.c.in openhpi/trunk/src/safhpi.c openhpi/trunk/src/session.c openhpi/trunk/src/t/ openhpi/trunk/src/threaded.c Modified: openhpi/trunk/Makefile.am =================================================================== --- openhpi/trunk/Makefile.am 2010-02-12 15:43:46 UTC (rev 7042) +++ openhpi/trunk/Makefile.am 2010-02-16 21:31:59 UTC (rev 7043) @@ -53,8 +53,8 @@ MOSTLYCLEANFILES = tags -SUBDIRS = utils scripts @SSLDIR@ src @SNMPDIR@ @MARSHALDIR@ plugins docs @ENABLED_DIRS@ hpi_shell -DIST_SUBDIRS = utils scripts src snmp ssl marshal plugins docs openhpid clients cpp hpi_shell +SUBDIRS = utils scripts @SSLDIR@ @SNMPDIR@ @MARSHALDIR@ baselib plugins docs @ENABLED_DIRS@ hpi_shell +DIST_SUBDIRS = utils scripts snmp ssl marshal baselib plugins docs openhpid clients cpp hpi_shell DISTCHECK_CONFIGURE_FLAGS = --with-initdir=prefix @@ -62,7 +62,7 @@ ALLSOURCES = \ $(shell find $(top_srcdir)/include -name .svn -o -name CVS -prune -o \ -name '*.[chS]' -print | grep -v '/t/') \ - $(shell find $(top_srcdir)/src -name .svn -o -name CVS -prune -o \ + $(shell find $(top_srcdir)/baselib -name .svn -o -name CVS -prune -o \ -name '*.[chS]' -print | grep -v '/t/') \ $(shell find $(top_srcdir)/utils -name .svn -o -name CVS -prune -o \ -name '*.[chS]' -print | grep -v '/t/') \ Added: openhpi/trunk/baselib/Makefile.am =================================================================== --- openhpi/trunk/baselib/Makefile.am (rev 0) +++ openhpi/trunk/baselib/Makefile.am 2010-02-16 21:31:59 UTC (rev 7043) @@ -0,0 +1,36 @@ +# +# Copyright (c) 2004-2006 by IBM Corporation. +# +# This program 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. This +# file and program are licensed under a BSD style license. See +# the Copying file included with the OpenHPI distribution for +# full licensing terms. +# +# Authors: +# W. David Ashley <da...@us...> +# Renier Morales <re...@op...> +# + +.NOTPARALLEL: + +MAINTAINERCLEANFILES = Makefile.in *~ + +INCLUDES = \ + @OPENHPI_INCLUDES@ -I$(top_srcdir)/marshal @OH_SSL_INCLUDES@ + +EXTRA_DIST = \ + oh_client.h oh_client_conf.h oh_client_session.h + +lib_LTLIBRARIES = libopenhpi.la + +libopenhpi_la_SOURCES = oh_client.cpp oh_client_session.cpp oh_client_conf.c + +libopenhpi_la_LDFLAGS = -version-info @HPI_LIB_VERSION@ +libopenhpi_la_LIBADD = $(top_builddir)/marshal/libohtcpconnx.la -lstdc++ \ + $(top_builddir)/marshal/libopenhpimarshal.la \ + $(top_builddir)/utils/libopenhpiutils.la + +clean-local: + rm -f *~ core core.* Copied: openhpi/trunk/baselib/oh_client.cpp (from rev 7038, openhpi/trunk/openhpid/oh_client.cpp) =================================================================== --- openhpi/trunk/baselib/oh_client.cpp (rev 0) +++ openhpi/trunk/baselib/oh_client.cpp 2010-02-16 21:31:59 UTC (rev 7043) @@ -0,0 +1,6172 @@ +/* -*- linux-c -*- + * + * (C) Copyright IBM Corp. 2004-2008 + * + * This program 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. This + * file and program are licensed under a BSD style license. See + * the Copying file included with the OpenHPI distribution for + * full licensing terms. + * + * Author(s): + * W. David Ashley <da...@us...> + * Renier Morales <re...@op...> + * Anton Pak <ant...@pi...> + * + */ + +extern "C" +{ +#include <string.h> +#include <glib.h> +#include <SaHpi.h> +#include <oHpi.h> +#include <oh_error.h> +#include <oh_domain.h> +#include <config.h> +} + +#include <marshal_hpi.h> + +#include "oh_client.h" +#include "oh_client_session.h" + +#define client_dbg(cmd, str) dbg("%s: %s\n", cmd, str) +#define client_err(cmd, str) err("%s: %s\n", cmd, str) + +/*----------------------------------------------------------------------------*/ +/* Utility functions */ +/*----------------------------------------------------------------------------*/ + +static SaErrorT clean_reading(SaHpiSensorReadingT *read_in, + SaHpiSensorReadingT *read_out) +{ + /* This is a workaround against unknown bugs in the marshal code */ + if (!read_in || !read_out) return SA_ERR_HPI_INVALID_PARAMS; + + memset(read_out, 0, sizeof(SaHpiSensorReadingT)); + + read_out->IsSupported = read_in->IsSupported; + + if (read_in->IsSupported == SAHPI_TRUE) { + if (!oh_lookup_sensorreadingtype(read_in->Type)) { + //printf("Invalid reading type: %d\n", read_in->Type); + return SA_ERR_HPI_INVALID_DATA; + } + read_out->Type = read_in->Type; + } + else { + /* Do we need to set dummy & reading type just to keep marshalling happy? */ + read_out->Type = SAHPI_SENSOR_READING_TYPE_INT64; + read_out->Value.SensorInt64 = 0; + return SA_OK; + } + + if (read_in->Type == SAHPI_SENSOR_READING_TYPE_INT64) { + read_out->Value.SensorInt64 = read_in->Value.SensorInt64; + } else if (read_in->Type == SAHPI_SENSOR_READING_TYPE_UINT64) { + read_out->Value.SensorUint64 = read_in->Value.SensorUint64; + } else if (read_in->Type == SAHPI_SENSOR_READING_TYPE_FLOAT64) { + read_out->Value.SensorFloat64 = read_in->Value.SensorFloat64; + } else if (read_in->Type == SAHPI_SENSOR_READING_TYPE_BUFFER) { + memcpy(read_out->Value.SensorBuffer, + read_in->Value.SensorBuffer, + SAHPI_SENSOR_BUFFER_LENGTH); + } + + return SA_OK; +} + +static SaErrorT clean_thresholds(SaHpiSensorThresholdsT *thrds_in, + SaHpiSensorThresholdsT *thrds_out) +{ + /* This is a workaround against unknown bugs in the marshal code */ + SaErrorT err = SA_OK; + if (!thrds_in || !thrds_out) return SA_ERR_HPI_INVALID_PARAMS; + + err = clean_reading(&thrds_in->LowCritical, &thrds_out->LowCritical); + if (err) return err; + err = clean_reading(&thrds_in->LowMajor, &thrds_out->LowMajor); + if (err) return err; + err = clean_reading(&thrds_in->LowMinor, &thrds_out->LowMinor); + if (err) return err; + err = clean_reading(&thrds_in->UpCritical, &thrds_out->UpCritical); + if (err) return err; + err = clean_reading(&thrds_in->UpMajor, &thrds_out->UpMajor); + if (err) return err; + err = clean_reading(&thrds_in->UpMinor, &thrds_out->UpMinor); + if (err) return err; + err = clean_reading(&thrds_in->PosThdHysteresis, + &thrds_out->PosThdHysteresis); + if (err) return err; + err = clean_reading(&thrds_in->NegThdHysteresis, + &thrds_out->NegThdHysteresis); + + return err; +} + +static void __dehash_config(gpointer key, gpointer value, gpointer data) +{ + oHpiHandlerConfigT *handler_config = (oHpiHandlerConfigT *)data; + + strncpy((char *)handler_config->Params[handler_config->NumberOfParams].Name, + (const char *)key, + SAHPI_MAX_TEXT_BUFFER_LENGTH); + strncpy((char *)handler_config->Params[handler_config->NumberOfParams].Value, + (const char *)value, + SAHPI_MAX_TEXT_BUFFER_LENGTH); + + handler_config->NumberOfParams = handler_config->NumberOfParams + 1; + + return; +} + +/******************************************************************************/ +/* HPI Client Layer */ +/******************************************************************************/ + +/*----------------------------------------------------------------------------*/ +/* saHpiVersionGet */ +/*----------------------------------------------------------------------------*/ + +SaHpiVersionT SAHPI_API saHpiVersionGet (void) +{ + return SAHPI_INTERFACE_VERSION; +} + +/*----------------------------------------------------------------------------*/ +/* saHpiInitialize */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiInitialize( + SAHPI_IN SaHpiVersionT RequestedVersion, + SAHPI_IN SaHpiUint32T NumOptions, + SAHPI_INOUT SaHpiInitOptionT *Options, + SAHPI_OUT SaHpiUint32T *FailedOption, + SAHPI_OUT SaErrorT *OptionError) +{ + if ( RequestedVersion != SAHPI_INTERFACE_VERSION ) { + return SA_ERR_HPI_UNSUPPORTED_API; + } + if ( ( NumOptions != 0 ) && ( Options == NULL ) ) { + return SA_ERR_HPI_INVALID_PARAMS; + } + + // TODO implement more checks from section 5.2.1 of B.03.01 spec + // Current implementation does not cover options check + + // TODO implement any library initialization code here + // Current implementation does not utilize this function + // + + return SA_OK; +} + +/*----------------------------------------------------------------------------*/ +/* saHpiFinalize */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiFinalize() +{ + // TODO implement + // TODO implement any library finalization code here + // Current implementation does not utilize this function + return SA_OK; +} + +/*----------------------------------------------------------------------------*/ +/* saHpiSessionOpen */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiSessionOpen( + SAHPI_IN SaHpiDomainIdT DomainId, + SAHPI_OUT SaHpiSessionIdT *SessionId, + SAHPI_IN void *SecurityParams) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + SaHpiSessionIdT domain_sid = 0; + char cmd[] = "saHpiSessionOpen"; + pcstrmsock pinst = NULL; + SaHpiDomainIdT default_did = SAHPI_UNSPECIFIED_DOMAIN_ID; + + + if (!SessionId || SecurityParams) + return SA_ERR_HPI_INVALID_PARAMS; + + if (DomainId == SAHPI_UNSPECIFIED_DOMAIN_ID) (DomainId = OH_DEFAULT_DOMAIN_ID); + + err = oh_create_connx(DomainId, &pinst); + if (err) { + client_err(cmd, "Could not create client connection"); + return err; + } + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiSessionOpen); + pinst->MessageHeaderInit( + eMhMsg, 0, eFsaHpiSessionOpen, hm->m_request_len); + request = malloc(hm->m_request_len); + /* TODO: Does daemon need domain id param in this call*/ + pinst->header.m_len = HpiMarshalRequest1(hm, request, &default_did); + SendRecv(0, cmd); + + int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, + hm, reply + sizeof(cMessageHeader), + &err, &domain_sid); + + if (request) + free(request); + if (err != SA_OK) { + oh_delete_connx(pinst); + return err; + } + if (mr < 0) { + oh_delete_connx(pinst); + return SA_ERR_HPI_INVALID_PARAMS; + } + + *SessionId = oh_open_session(DomainId, domain_sid, pinst); + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiSessionClose */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiSessionClose( + SAHPI_IN SaHpiSessionIdT SessionId) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiSessionClose"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiSessionClose); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiSessionClose, + hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest1(hm, request, &dsid); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, + hm, reply + sizeof(cMessageHeader), &err); + + if (request) + free(request); + + oh_close_session(SessionId); + + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiDiscover */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiDiscover( + SAHPI_IN SaHpiSessionIdT SessionId) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiDiscover"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiDiscover); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiDiscover, + hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest1(hm, request, &dsid); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, + hm, reply + sizeof(cMessageHeader), &err); + + if (request) + free(request); + + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiDomainInfoGet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiDomainInfoGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_OUT SaHpiDomainInfoT *DomainInfo) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiDomainInfoGet"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + + /* oh_get_connx() places the real Domain Id to dsid */ + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (DomainInfo == NULL) + return SA_ERR_HPI_INVALID_PARAMS; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiDomainInfoGet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiDomainInfoGet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest1(hm, request, &dsid); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, DomainInfo); + + /* Set Domain Id to real Domain Id */ + DomainInfo->DomainId = did; + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiDrtEntryGet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiDrtEntryGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiEntryIdT EntryId, + SAHPI_OUT SaHpiEntryIdT *NextEntryId, + SAHPI_OUT SaHpiDrtEntryT *DrtEntry) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiDrtEntryGet"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + + /* oh_get_connx() places the real Domain Id to dsid */ + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if((DrtEntry == NULL) || + (NextEntryId == NULL) || + (EntryId == SAHPI_LAST_ENTRY)) { + return SA_ERR_HPI_INVALID_PARAMS; + } + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiDrtEntryGet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiDrtEntryGet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest2(hm, request, &dsid, &EntryId); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, NextEntryId, DrtEntry); + + /* Set Domain Id to real Domain Id */ + DrtEntry->DomainId = did; + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiDomainTagSet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiDomainTagSet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiTextBufferT *DomainTag) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiDomainTagSet"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (!DomainTag) + return SA_ERR_HPI_INVALID_PARAMS; + if (!oh_lookup_texttype(DomainTag->DataType)) + return SA_ERR_HPI_INVALID_PARAMS; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiDomainTagSet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiDomainTagSet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest2(hm, request, &dsid, DomainTag); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiRptEntryGet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiRptEntryGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiEntryIdT EntryId, + SAHPI_OUT SaHpiEntryIdT *NextEntryId, + SAHPI_OUT SaHpiRptEntryT *RptEntry) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiRptEntryGet"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if ((NextEntryId == NULL) || (RptEntry == NULL)) { + return SA_ERR_HPI_INVALID_PARAMS; + } + if (EntryId == SAHPI_LAST_ENTRY) { + return SA_ERR_HPI_INVALID_PARAMS; + } + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiRptEntryGet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiRptEntryGet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest2(hm, request, &dsid, &EntryId); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, NextEntryId, RptEntry); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiRptEntryGetByResourceId */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiRptEntryGetByResourceId( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiRptEntryT *RptEntry) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiRptEntryGetByResourceId"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (ResourceId == SAHPI_UNSPECIFIED_RESOURCE_ID || + RptEntry == NULL) { + return SA_ERR_HPI_INVALID_PARAMS; + } + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiRptEntryGetByResourceId); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiRptEntryGetByResourceId, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest2(hm, request, &dsid, &ResourceId); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, RptEntry); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiResourceSeveritySet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiResourceSeveritySet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiSeverityT Severity) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiResourceSeveritySet"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (ResourceId == SAHPI_UNSPECIFIED_RESOURCE_ID) + return SA_ERR_HPI_INVALID_PARAMS; + if (!oh_lookup_severity(Severity)) + return SA_ERR_HPI_INVALID_PARAMS; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiResourceSeveritySet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiResourceSeveritySet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest3(hm, request, &dsid, &ResourceId, &Severity); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiResourceTagSet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiResourceTagSet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiTextBufferT *ResourceTag) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiResourceTagSet"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (ResourceTag == NULL) + return SA_ERR_HPI_INVALID_PARAMS; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiResourceTagSet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiResourceTagSet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest3(hm, request, &dsid, &ResourceId, ResourceTag); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiMyEntityPathGet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiMyEntityPathGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_OUT SaHpiEntityPathT *EntityPath) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiMyEntityPathGet"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (EntityPath == NULL) + return SA_ERR_HPI_INVALID_PARAMS; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiMyEntityPathGet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiMyEntityPathGet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest1(hm, request, &dsid); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, EntityPath); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiResourceIdGet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiResourceIdGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_OUT SaHpiResourceIdT *ResourceId) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiResourceIdGet"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (ResourceId == NULL) + return SA_ERR_HPI_INVALID_PARAMS; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiResourceIdGet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiResourceIdGet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest1(hm, request, &dsid); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, ResourceId); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiGetIdByEntityPath */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiGetIdByEntityPath( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiEntityPathT EntityPath, + SAHPI_IN SaHpiRdrTypeT InstrumentType, + SAHPI_INOUT SaHpiUint32T *InstanceId, + SAHPI_OUT SaHpiResourceIdT *ResourceId, + SAHPI_OUT SaHpiInstrumentIdT *InstrumentId, + SAHPI_OUT SaHpiUint32T *RptUpdateCount) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiGetIdByEntityPath"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + SaHpiInstrumentIdT instrument_id; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (ResourceId == NULL || InstanceId == NULL || + *InstanceId == SAHPI_LAST_ENTRY || RptUpdateCount == NULL || + (InstrumentId == NULL && InstrumentType != SAHPI_NO_RECORD)) + return SA_ERR_HPI_INVALID_PARAMS; + if (InstrumentId == NULL) + InstrumentId = &instrument_id; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiGetIdByEntityPath); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiGetIdByEntityPath, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest4(hm, request, &dsid, + &EntityPath, &InstrumentType, + InstanceId); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply4(pinst->header.m_flags & dMhEndianBit, hm, + reply + sizeof(cMessageHeader), &err, + InstanceId, ResourceId, InstrumentId, RptUpdateCount); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiGetChildEntityPath */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiGetChildEntityPath( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiEntityPathT ParentEntityPath, + SAHPI_INOUT SaHpiUint32T *InstanceId, + SAHPI_OUT SaHpiEntityPathT *ChildEntityPath, + SAHPI_OUT SaHpiUint32T *RptUpdateCount) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiGetChildEntityPath"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (InstanceId == NULL || *InstanceId == SAHPI_LAST_ENTRY || + RptUpdateCount == NULL) + return SA_ERR_HPI_INVALID_PARAMS; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiGetChildEntityPath); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiGetChildEntityPath, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest3(hm, request, &dsid, + &ParentEntityPath, + InstanceId); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply3(pinst->header.m_flags & dMhEndianBit, hm, + reply + sizeof(cMessageHeader), &err, + InstanceId, ChildEntityPath, RptUpdateCount); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiResourceFailedRemove */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiResourceFailedRemove( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiResourceFailedRemove"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiResourceFailedRemove); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiResourceFailedRemove, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest2(hm, request, &dsid, &ResourceId); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + +/*----------------------------------------------------------------------------*/ +/* saHpiEventLogInfoGet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiEventLogInfoGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiEventLogInfoT *Info) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiEventLogInfoGet"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (Info == NULL) + return SA_ERR_HPI_INVALID_PARAMS; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiEventLogInfoGet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiEventLogInfoGet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest2(hm, request, &dsid, &ResourceId); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Info); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + +/*----------------------------------------------------------------------------*/ +/* saHpiEventLogCapabilitiesGet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiEventLogCapabilitiesGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiEventLogCapabilitiesT *EventLogCapabilities) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiEventLogCapabilitiesGet"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (EventLogCapabilities == NULL) + return SA_ERR_HPI_INVALID_PARAMS; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiEventLogCapabilitiesGet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiEventLogCapabilitiesGet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest2(hm, request, &dsid, &ResourceId); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), + &err, EventLogCapabilities); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + +/*----------------------------------------------------------------------------*/ +/* saHpiEventLogEntryGet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiEventLogEntryGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiEntryIdT EntryId, + SAHPI_OUT SaHpiEventLogEntryIdT *PrevEntryId, + SAHPI_OUT SaHpiEventLogEntryIdT *NextEntryId, + SAHPI_OUT SaHpiEventLogEntryT *EventLogEntry, + SAHPI_INOUT SaHpiRdrT *Rdr, + SAHPI_INOUT SaHpiRptEntryT *RptEntry) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiEventLogEntryGet"; + SaHpiRdrT tmp_rdr; + SaHpiRptEntryT tmp_rpt; + pcstrmsock pinst; + SaHpiSessionIdT dsid =0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (!PrevEntryId || !EventLogEntry || !NextEntryId || + EntryId == SAHPI_NO_MORE_ENTRIES) { + return SA_ERR_HPI_INVALID_PARAMS; + } + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiEventLogEntryGet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiEventLogEntryGet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest3(hm, request, &dsid, &ResourceId, &EntryId); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply5(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, PrevEntryId, NextEntryId, EventLogEntry, &tmp_rdr, &tmp_rpt); + + if (Rdr != NULL) { + memcpy(Rdr, &tmp_rdr, sizeof(SaHpiRdrT)); + } + if (RptEntry != NULL) { + memcpy(RptEntry, &tmp_rpt, sizeof(SaHpiRptEntryT)); + } + + /* If this event is Domain Event, then adjust DomainId */ + if ((ResourceId == SAHPI_UNSPECIFIED_RESOURCE_ID) && + (EventLogEntry->Event.EventType == SAHPI_ET_DOMAIN)) { + EventLogEntry->Event.EventDataUnion.DomainEvent.DomainId = did; + } + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiEventLogEntryAdd */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiEventLogEntryAdd( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiEventT *EvtEntry) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiEventLogEntryAdd"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (EvtEntry == NULL) + return SA_ERR_HPI_INVALID_PARAMS; + if (EvtEntry->EventType != SAHPI_ET_USER || + EvtEntry->Source != SAHPI_UNSPECIFIED_RESOURCE_ID) + return SA_ERR_HPI_INVALID_PARAMS; + if (!oh_lookup_severity(EvtEntry->Severity)) + return SA_ERR_HPI_INVALID_PARAMS; + if (!oh_valid_textbuffer(&EvtEntry->EventDataUnion.UserEvent.UserEventData)) + return SA_ERR_HPI_INVALID_PARAMS; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiEventLogEntryAdd); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiEventLogEntryAdd, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest3(hm, request, &dsid, &ResourceId, EvtEntry); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiEventLogClear */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiEventLogClear( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiEventLogClear"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiEventLogClear); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiEventLogClear, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest2(hm, request, &dsid, &ResourceId); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiEventLogTimeGet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiEventLogTimeGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiTimeT *Time) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiEventLogTimeGet"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (Time == NULL) + return SA_ERR_HPI_INVALID_PARAMS; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiEventLogTimeGet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiEventLogTimeGet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest2(hm, request, &dsid, &ResourceId); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Time); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiEventLogTimeSet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiEventLogTimeSet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiTimeT Time) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiEventLogTimeSet"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiEventLogTimeSet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiEventLogTimeSet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest3(hm, request, &dsid, &ResourceId, &Time); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiEventLogStateGet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiEventLogStateGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_OUT SaHpiBoolT *EnableState) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiEventLogStateGet"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (EnableState == NULL) + return SA_ERR_HPI_INVALID_PARAMS; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiEventLogStateGet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiEventLogStateGet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest2(hm, request, &dsid, &ResourceId); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, EnableState); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiEventLogStateSet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiEventLogStateSet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId, + SAHPI_IN SaHpiBoolT EnableState) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiEventLogStateSet"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiEventLogStateSet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiEventLogStateSet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest3(hm, request, &dsid, &ResourceId, &EnableState); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiEventLogOverflowReset */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiEventLogOverflowReset( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiResourceIdT ResourceId) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiEventLogOverflowReset"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiEventLogOverflowReset); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiEventLogOverflowReset, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest2(hm, request, &dsid, &ResourceId); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiSubscribe */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiSubscribe( + SAHPI_IN SaHpiSessionIdT SessionId) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiSubscribe"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiSubscribe); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiSubscribe, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest1(hm, request, &dsid); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiUnsSubscribe */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiUnsubscribe( + SAHPI_IN SaHpiSessionIdT SessionId) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiUnsubscribe"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiUnsubscribe); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiUnsubscribe, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest1(hm, request, &dsid); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiEventGet */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiEventGet( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiTimeoutT Timeout, + SAHPI_OUT SaHpiEventT *Event, + SAHPI_INOUT SaHpiRdrT *Rdr, + SAHPI_INOUT SaHpiRptEntryT *RptEntry, + SAHPI_INOUT SaHpiEvtQueueStatusT *EventQueueStatus) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiEventGet"; + SaHpiRdrT tmp_rdr; + SaHpiRptEntryT tmp_rpt; + SaHpiEvtQueueStatusT tmp_status; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (Timeout < SAHPI_TIMEOUT_BLOCK || !Event) + return SA_ERR_HPI_INVALID_PARAMS; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiEventGet); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiEventGet, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest2(hm, request, &dsid, &Timeout); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply4(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Event, &tmp_rdr, &tmp_rpt, &tmp_status); + + if (Rdr != NULL) { + memcpy(Rdr, &tmp_rdr, sizeof(SaHpiRdrT)); + } + if (RptEntry != NULL) { + memcpy(RptEntry, &tmp_rpt, sizeof(SaHpiRptEntryT)); + } + if (EventQueueStatus != NULL) { + memcpy(EventQueueStatus, &tmp_status, sizeof(SaHpiEvtQueueStatusT)); + } + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiEventAdd */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiEventAdd( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiEventT *Event) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiEventAdd"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + + err = oh_valid_addevent(Event); + if (err != SA_OK) return err; + + cHpiMarshal *hm = HpiMarshalFind(eFsaHpiEventAdd); + pinst->MessageHeaderInit(eMhMsg, 0, eFsaHpiEventAdd, hm->m_request_len); + request = malloc(hm->m_request_len); + + pinst->header.m_len = HpiMarshalRequest2(hm, request, &dsid, Event); + + SendRecv(SessionId, cmd); + + int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + + if (request) + free(request); + if (pinst->header.m_type == eMhError) + return SA_ERR_HPI_INVALID_PARAMS; + if (mr < 0) + return SA_ERR_HPI_INVALID_PARAMS; + + return err; +} + + +/*----------------------------------------------------------------------------*/ +/* saHpiAlarmGetNext */ +/*----------------------------------------------------------------------------*/ + +SaErrorT SAHPI_API saHpiAlarmGetNext( + SAHPI_IN SaHpiSessionIdT SessionId, + SAHPI_IN SaHpiSeverityT Severity, + SAHPI_IN SaHpiBoolT Unack, + SAHPI_INOUT SaHpiAlarmT *Alarm) +{ + void *request; + char reply[dMaxMessageLength]; + SaErrorT err = SA_OK; + char cmd[] = "saHpiAlarmGetNext"; + pcstrmsock pinst; + SaHpiSessionIdT dsid = 0; + SaHpiDomainIdT did = 0; + + if (SessionId == 0) + return SA_ERR_HPI_INVALID_SESSION; + err = oh_get_connx(SessionId, &dsid, &pinst, &did); + if (err) return err; + if (!Alarm) + ... [truncated message content] |
From: <av...@us...> - 2010-03-05 15:39:02
|
Revision: 7046 http://openhpi.svn.sourceforge.net/openhpi/?rev=7046&view=rev Author: avpak Date: 2010-03-05 15:38:55 +0000 (Fri, 05 Mar 2010) Log Message: ----------- Feature request #2964252 Modified Paths: -------------- openhpi/trunk/Makefile.am openhpi/trunk/utils/Makefile.am openhpi/trunk/utils/oh_utils.h openhpi/trunk/utils/sahpi_enum_utils.c Added Paths: ----------- openhpi/trunk/utils/sahpixtca_enum_utils.c openhpi/trunk/utils/sahpixtca_enum_utils.h Modified: openhpi/trunk/Makefile.am =================================================================== --- openhpi/trunk/Makefile.am 2010-03-04 18:45:09 UTC (rev 7045) +++ openhpi/trunk/Makefile.am 2010-03-05 15:38:55 UTC (rev 7046) @@ -84,6 +84,7 @@ includedir=$(base_includedir)/openhpi # These are the only headers that users should have any access to include_HEADERS = $(top_srcdir)/include/SaHpi.h \ + $(top_srcdir)/include/SaHpiXtca.h \ $(top_srcdir)/include/SaHpiAtca.h \ $(top_srcdir)/include/SaHpiBladeCenter.h \ $(top_srcdir)/include/oHpi.h \ @@ -91,6 +92,7 @@ $(top_srcdir)/utils/announcement_utils.h \ $(top_srcdir)/utils/rpt_utils.h \ $(top_srcdir)/utils/sahpi_enum_utils.h \ + $(top_srcdir)/utils/sahpixtca_enum_utils.h \ $(top_srcdir)/utils/sahpiatca_enum_utils.h \ $(top_srcdir)/utils/sahpi_event_encode.h \ $(top_srcdir)/utils/sahpi_event_utils.h \ @@ -106,6 +108,9 @@ $(top_srcdir)/utils/sahpi_enum_utils.h: make -C $(top_builddir)/utils sahpi_enum_utils.h +$(top_srcdir)/utils/sahpixtca_enum_utils.h: + make -C $(top_builddir)/utils sahpixtca_enum_utils.h + $(top_srcdir)/utils/sahpiatca_enum_utils.h: make -C $(top_builddir)/utils sahpiatca_enum_utils.h Modified: openhpi/trunk/utils/Makefile.am =================================================================== --- openhpi/trunk/utils/Makefile.am 2010-03-04 18:45:09 UTC (rev 7045) +++ openhpi/trunk/utils/Makefile.am 2010-03-05 15:38:55 UTC (rev 7046) @@ -33,11 +33,13 @@ GENERATED_HEADER_FILES = \ sahpi_enum_utils.h \ + sahpixtca_enum_utils.h \ sahpiatca_enum_utils.h \ sahpi_event_encode.h GENERATED_SRC_FILES = \ sahpi_enum_utils.c \ + sahpixtca_enum_utils.c \ sahpiatca_enum_utils.c \ sahpi_event_encode.c Modified: openhpi/trunk/utils/oh_utils.h =================================================================== --- openhpi/trunk/utils/oh_utils.h 2010-03-04 18:45:09 UTC (rev 7045) +++ openhpi/trunk/utils/oh_utils.h 2010-03-05 15:38:55 UTC (rev 7046) @@ -18,6 +18,7 @@ #define __OH_UTILS_H /* Order is important */ +#include <SaHpiXtca.h> #include <SaHpiAtca.h> #include <announcement_utils.h> #include <el_utils.h> @@ -28,6 +29,7 @@ #include <sahpi_event_encode.h> #include <sahpi_event_utils.h> #include <sahpi_time_utils.h> +#include <sahpixtca_enum_utils.h> #include <sahpiatca_enum_utils.h> #include <uid_utils.h> Modified: openhpi/trunk/utils/sahpi_enum_utils.c =================================================================== --- openhpi/trunk/utils/sahpi_enum_utils.c 2010-03-04 18:45:09 UTC (rev 7045) +++ openhpi/trunk/utils/sahpi_enum_utils.c 2010-03-05 15:38:55 UTC (rev 7046) @@ -795,7 +795,7 @@ case SAHPI_ENT_INDICATOR: return "INDICATOR"; default: - return oh_lookup_atcahpientitytype(value); + return oh_lookup_xtcahpientitytype(value); } } @@ -939,7 +939,7 @@ *type = entitytype_strings[i].entity_type; } else { - return(oh_encode_atcahpientitytype(buffer, type)); + return(oh_encode_xtcahpientitytype(buffer, type)); } return(SA_OK); Added: openhpi/trunk/utils/sahpixtca_enum_utils.c =================================================================== --- openhpi/trunk/utils/sahpixtca_enum_utils.c (rev 0) +++ openhpi/trunk/utils/sahpixtca_enum_utils.c 2010-03-05 15:38:55 UTC (rev 7046) @@ -0,0 +1,347 @@ +/* -*- linux-c -*- + * + * (C) Copyright IBM Corp. 2004 + * (C) Copyright Pigeon Point Systems. 2010 + * + * This program 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. This + * file and program are licensed under a BSD style license. See + * the Copying file included with the OpenHPI distribution for + * full licensing terms. + * + * Author(s): + * Steve Sherman <st...@us...> + * Anton Pak <ant...@pi...> + */ + +#include <strings.h> + +#include <SaHpi.h> +#include <oh_utils.h> + +/** + * oh_lookup_xtcahpiledcolor: + * @value: enum value of type XtcaHpiLedColorT. + * + * Converts @value into a string based on @value's HPI enum definition. + * + * Returns: + * string - normal operation. + * NULL - if @value not a valid XtcaHpiLedColorT. + **/ + +char * oh_lookup_xtcahpiledcolor(XtcaHpiLedColorT value) +{ + switch (value) { + case XTCAHPI_LED_COLOR_RESERVED: + return "COLOR_RESERVED"; + case XTCAHPI_LED_COLOR_BLUE: + return "COLOR_BLUE"; + case XTCAHPI_LED_COLOR_RED: + return "COLOR_RED"; + case XTCAHPI_LED_COLOR_GREEN: + return "COLOR_GREEN"; + case XTCAHPI_LED_COLOR_AMBER: + return "COLOR_AMBER"; + case XTCAHPI_LED_COLOR_ORANGE: + return "COLOR_ORANGE"; + case XTCAHPI_LED_COLOR_WHITE: + return "COLOR_WHITE"; + case XTCAHPI_LED_COLOR_NO_CHANGE: + return "COLOR_NO_CHANGE"; + case XTCAHPI_LED_COLOR_USE_DEFAULT: + return "COLOR_USE_DEFAULT"; + default: + return NULL; + } +} + +struct oh_xtcahpiledcolor_map xtcahpiledcolor_strings[] = { + {XTCAHPI_LED_COLOR_RESERVED, "COLOR_RESERVED"}, + {XTCAHPI_LED_COLOR_BLUE, "COLOR_BLUE"}, + {XTCAHPI_LED_COLOR_RED, "COLOR_RED"}, + {XTCAHPI_LED_COLOR_GREEN, "COLOR_GREEN"}, + {XTCAHPI_LED_COLOR_AMBER, "COLOR_AMBER"}, + {XTCAHPI_LED_COLOR_ORANGE, "COLOR_ORANGE"}, + {XTCAHPI_LED_COLOR_WHITE, "COLOR_WHITE"}, + {XTCAHPI_LED_COLOR_NO_CHANGE, "COLOR_NO_CHANGE"}, + {XTCAHPI_LED_COLOR_USE_DEFAULT, "COLOR_USE_DEFAULT"}, +}; + +/** + * oh_encode_xtcahpiledcolor: + * @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. + * @type: Location (of XtcaHpiLedColorT) to place encoded result. + * + * Converts a @buffer->Data string, generated by oh_lookup_xtcahpiledcolor(), back + * into an XtcaHpiLedColorT type. + * + * Returns: + * XtcaHpiLedColorT value - normal operation. + * SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. + * SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. + **/ +SaErrorT oh_encode_xtcahpiledcolor(SaHpiTextBufferT *buffer, XtcaHpiLedColorT *type) +{ + int i, found; + + if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { + return(SA_ERR_HPI_INVALID_PARAMS); + } + + found = 0; + for (i=0; i<OH_MAX_XTCAHPILEDCOLOR; i++) { + if (strcasecmp((char *)buffer->Data, xtcahpiledcolor_strings[i].str) == 0) { + found++; + break; + } + } + + if (found) { + *type = xtcahpiledcolor_strings[i].entity_type; + } + else { + return(SA_ERR_HPI_INVALID_DATA); + } + + return(SA_OK); +} + +/** + * oh_lookup_xtcahpiresourceledmode: + * @value: enum value of type XtcaHpiResourceLedModeT. + * + * Converts @value into a string based on @value's HPI enum definition. + * + * Returns: + * string - normal operation. + * NULL - if @value not a valid XtcaHpiResourceLedModeT. + **/ + +char * oh_lookup_xtcahpiresourceledmode(XtcaHpiResourceLedModeT value) +{ + switch (value) { + case XTCAHPI_LED_AUTO: + return "AUTO"; + case XTCAHPI_LED_MANUAL: + return "MANUAL"; + case XTCAHPI_LED_LAMP_TEST: + return "LAMP_TEST"; + default: + return NULL; + } +} + +struct oh_xtcahpiresourceledmode_map xtcahpiresourceledmode_strings[] = { + {XTCAHPI_LED_AUTO, "AUTO"}, + {XTCAHPI_LED_MANUAL, "MANUAL"}, + {XTCAHPI_LED_LAMP_TEST, "LAMP_TEST"}, +}; + +/** + * oh_encode_xtcahpiresourceledmode: + * @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. + * @type: Location (of XtcaHpiResourceLedModeT) to place encoded result. + * + * Converts a @buffer->Data string, generated by oh_lookup_xtcahpiresourceledmode(), back + * into an XtcaHpiResourceLedModeT type. + * + * Returns: + * XtcaHpiResourceLedModeT value - normal operation. + * SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. + * SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. + **/ +SaErrorT oh_encode_xtcahpiresourceledmode(SaHpiTextBufferT *buffer, XtcaHpiResourceLedModeT *type) +{ + int i, found; + + if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { + return(SA_ERR_HPI_INVALID_PARAMS); + } + + found = 0; + for (i=0; i<OH_MAX_XTCAHPIRESOURCELEDMODE; i++) { + if (strcasecmp((char *)buffer->Data, xtcahpiresourceledmode_strings[i].str) == 0) { + found++; + break; + } + } + + if (found) { + *type = xtcahpiresourceledmode_strings[i].entity_type; + } + else { + return(SA_ERR_HPI_INVALID_DATA); + } + + return(SA_OK); +} + +/** + * oh_lookup_xtcahpiledbrsupport: + * @value: enum value of type XtcaHpiLedBrSupportT. + * + * Converts @value into a string based on @value's HPI enum definition. + * + * Returns: + * string - normal operation. + * NULL - if @value not a valid XtcaHpiLedBrSupportT. + **/ + +char * oh_lookup_xtcahpiledbrsupport(XtcaHpiLedBrSupportT value) +{ + switch (value) { + case XTCAHPI_LED_BR_SUPPORTED: + return "BR_SUPPORTED"; + case XTCAHPI_LED_BR_NOT_SUPPORTED: + return "BR_NOT_SUPPORTED"; + case XTCAHPI_LED_BR_UNKNOWN: + return "BR_UNKNOWN"; + default: + return NULL; + } +} + +struct oh_xtcahpiledbrsupport_map xtcahpiledbrsupport_strings[] = { + {XTCAHPI_LED_BR_SUPPORTED, "BR_SUPPORTED"}, + {XTCAHPI_LED_BR_NOT_SUPPORTED, "BR_NOT_SUPPORTED"}, + {XTCAHPI_LED_BR_UNKNOWN, "BR_UNKNOWN"}, +}; + +/** + * oh_encode_xtcahpiledbrsupport: + * @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. + * @type: Location (of XtcaHpiLedBrSupportT) to place encoded result. + * + * Converts a @buffer->Data string, generated by oh_lookup_xtcahpiledbrsupport(), back + * into an XtcaHpiLedBrSupportT type. + * + * Returns: + * XtcaHpiLedBrSupportT value - normal operation. + * SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. + * SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. + **/ +SaErrorT oh_encode_xtcahpiledbrsupport(SaHpiTextBufferT *buffer, XtcaHpiLedBrSupportT *type) +{ + int i, found; + + if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { + return(SA_ERR_HPI_INVALID_PARAMS); + } + + found = 0; + for (i=0; i<OH_MAX_XTCAHPILEDBRSUPPORT; i++) { + if (strcasecmp((char *)buffer->Data, xtcahpiledbrsupport_strings[i].str) == 0) { + found++; + break; + } + } + + if (found) { + *type = xtcahpiledbrsupport_strings[i].entity_type; + } + else { + return(SA_ERR_HPI_INVALID_DATA); + } + + return(SA_OK); +} + +/** + * oh_lookup_xtcahpientitytype: + * @value: enum value of type SaHpiEntityTypeT. + * + * Converts @value into a string based on @value's HPI enum definition. + * + * Returns: + * string - normal operation. + * NULL - if @value not a valid SaHpiEntityTypeT. + **/ + +char * oh_lookup_xtcahpientitytype(SaHpiEntityTypeT value) +{ + switch (value) { + case XTCAHPI_ENT_POWER_SLOT: + return "POWER_SLOT"; + case XTCAHPI_ENT_SHELF_FRU_DEVICE_SLOT: + return "SHELF_FRU_DEVICE_SLOT"; + case XTCAHPI_ENT_SHELF_MANAGER_SLOT: + return "SHELF_MANAGER_SLOT"; + case XTCAHPI_ENT_FAN_TRAY_SLOT: + return "FAN_TRAY_SLOT"; + case XTCAHPI_ENT_FAN_FILTER_TRAY_SLOT: + return "FAN_FILTER_TRAY_SLOT"; + case XTCAHPI_ENT_ALARM_SLOT: + return "ALARM_SLOT"; + case XTCAHPI_ENT_AMC_SLOT: + return "AMC_SLOT"; + case XTCAHPI_ENT_PMC_SLOT: + return "PMC_SLOT"; + case XTCAHPI_ENT_RTM_SLOT: + return "RTM_SLOT"; + case XTCAHPI_ENT_CARRIER_MANAGER_SLOT: + return "CARRIER_MANAGER_SLOT"; + case XTCAHPI_ENT_CARRIER_SLOT: + return "CARRIER_SLOT"; + case XTCAHPI_ENT_COM_E_SLOT: + return "COM_E_SLOT"; + default: + return NULL; + } +} + +struct oh_xtcahpientitytype_map xtcahpientitytype_strings[] = { + {XTCAHPI_ENT_POWER_SLOT, "POWER_SLOT"}, + {XTCAHPI_ENT_SHELF_FRU_DEVICE_SLOT, "SHELF_FRU_DEVICE_SLOT"}, + {XTCAHPI_ENT_SHELF_MANAGER_SLOT, "SHELF_MANAGER_SLOT"}, + {XTCAHPI_ENT_FAN_TRAY_SLOT, "FAN_TRAY_SLOT"}, + {XTCAHPI_ENT_FAN_FILTER_TRAY_SLOT, "FAN_FILTER_TRAY_SLOT"}, + {XTCAHPI_ENT_ALARM_SLOT, "ALARM_SLOT"}, + {XTCAHPI_ENT_AMC_SLOT, "AMC_SLOT"}, + {XTCAHPI_ENT_PMC_SLOT, "PMC_SLOT"}, + {XTCAHPI_ENT_RTM_SLOT, "RTM_SLOT"}, + {XTCAHPI_ENT_CARRIER_MANAGER_SLOT, "CARRIER_MANAGER_SLOT"}, + {XTCAHPI_ENT_CARRIER_SLOT, "CARRIER_SLOT"}, + {XTCAHPI_ENT_COM_E_SLOT, "COM_E_SLOT"}, +}; + +/** + * oh_encode_xtcahpientitytype: + * @buffer: Pointer to SaHpiTextBufferT that contains enum's string representation. + * @type: Location (of SaHpiEntityTypeT) to place encoded result. + * + * Converts a @buffer->Data string, generated by oh_lookup_xtcahpientitytype(), back + * into an SaHpiEntityTypeT type. + * + * Returns: + * SaHpiEntityTypeT value - normal operation. + * SA_ERR_HPI_INVALID_PARAMS - if @buffer or @type is NULL or @buffer->Data empty. + * SA_ERR_HPI_INVALID_DATA - if @buffer->Data is invalid. + **/ +SaErrorT oh_encode_xtcahpientitytype(SaHpiTextBufferT *buffer, SaHpiEntityTypeT *type) +{ + int i, found; + + if (!buffer || !type || buffer->Data == NULL || buffer->Data[0] == '\0') { + return(SA_ERR_HPI_INVALID_PARAMS); + } + + found = 0; + for (i=0; i<OH_MAX_XTCAHPIENTITYTYPE; i++) { + if (strcasecmp((char *)buffer->Data, xtcahpientitytype_strings[i].str) == 0) { + found++; + break; + } + } + + if (found) { + *type = xtcahpientitytype_strings[i].entity_type; + } + else { + return(SA_ERR_HPI_INVALID_DATA); + } + + return(SA_OK); +} + Added: openhpi/trunk/utils/sahpixtca_enum_utils.h =================================================================== --- openhpi/trunk/utils/sahpixtca_enum_utils.h (rev 0) +++ openhpi/trunk/utils/sahpixtca_enum_utils.h 2010-03-05 15:38:55 UTC (rev 7046) @@ -0,0 +1,70 @@ +/* -*- linux-c -*- + * + * (C) Copyright IBM Corp. 2004 + * (C) Copyright Pigeon Point Systems. 2010 + * + * This program 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. This + * file and program are licensed under a BSD style license. See + * the Copying file included with the OpenHPI distribution for + * full licensing terms. + * + * Author(s): + * Steve Sherman <st...@us...> + * Anton Pak <ant...@pi...> + */ + +#ifndef __SAHPIXTCA_ENUM_UTILS_H +#define __SAHPIXTCA_ENUM_UTILS_H + +#ifndef __OH_UTILS_H +#warning *** Include oh_utils.h instead of individual utility header files *** +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define OH_MAX_XTCAHPILEDCOLOR 9 +extern struct oh_xtcahpiledcolor_map { + XtcaHpiLedColorT entity_type; + char *str; +} xtcahpiledcolor_strings[OH_MAX_XTCAHPILEDCOLOR]; + +char * oh_lookup_xtcahpiledcolor(XtcaHpiLedColorT value); +SaErrorT oh_encode_xtcahpiledcolor(SaHpiTextBufferT *buffer, XtcaHpiLedColorT *type); + +#define OH_MAX_XTCAHPIRESOURCELEDMODE 3 +extern struct oh_xtcahpiresourceledmode_map { + XtcaHpiResourceLedModeT entity_type; + char *str; +} xtcahpiresourceledmode_strings[OH_MAX_XTCAHPIRESOURCELEDMODE]; + +char * oh_lookup_xtcahpiresourceledmode(XtcaHpiResourceLedModeT value); +SaErrorT oh_encode_xtcahpiresourceledmode(SaHpiTextBufferT *buffer, XtcaHpiResourceLedModeT *type); + +#define OH_MAX_XTCAHPILEDBRSUPPORT 3 +extern struct oh_xtcahpiledbrsupport_map { + XtcaHpiLedBrSupportT entity_type; + char *str; +} xtcahpiledbrsupport_strings[OH_MAX_XTCAHPILEDBRSUPPORT]; + +char * oh_lookup_xtcahpiledbrsupport(XtcaHpiLedBrSupportT value); +SaErrorT oh_encode_xtcahpiledbrsupport(SaHpiTextBufferT *buffer, XtcaHpiLedBrSupportT *type); + +#define OH_MAX_XTCAHPIENTITYTYPE 12 +extern struct oh_xtcahpientitytype_map { + SaHpiEntityTypeT entity_type; + char *str; +} xtcahpientitytype_strings[OH_MAX_XTCAHPIENTITYTYPE]; + +char * oh_lookup_xtcahpientitytype(SaHpiEntityTypeT value); +SaErrorT oh_encode_xtcahpientitytype(SaHpiTextBufferT *buffer, SaHpiEntityTypeT *type); + + +#ifdef __cplusplus +} +#endif + +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lar...@us...> - 2010-03-12 11:54:50
|
Revision: 7052 http://openhpi.svn.sourceforge.net/openhpi/?rev=7052&view=rev Author: larswetzel Date: 2010-03-12 11:54:43 +0000 (Fri, 12 Mar 2010) Log Message: ----------- Fix for Bug 2969326 and add some debug information inside the validation of thresholds values Inside function saHpiSensorThresholdsSet the validation of thresholds values from the caller are merged with values coming from a ThresholdsGet call. This leads to a wrong isSupport mask in the thresholds structure (reading mask instead of writing mask) and therefore wrong values are checked. Fix: Remove the ThresholdsGet call and work with the original data from the call. Modified Paths: -------------- openhpi/trunk/openhpid/safhpi.c openhpi/trunk/utils/sahpi_struct_utils.c Modified: openhpi/trunk/openhpid/safhpi.c =================================================================== --- openhpi/trunk/openhpid/safhpi.c 2010-03-09 15:44:31 UTC (rev 7051) +++ openhpi/trunk/openhpid/safhpi.c 2010-03-12 11:54:43 UTC (rev 7052) @@ -20,6 +20,7 @@ * Renier Morales <re...@op...> * Racing Guo <rac...@in...> * Anton Pak <ant...@pi...> + * Lars Wetzel <lar...@us...> */ #include <string.h> @@ -2009,7 +2010,7 @@ SAHPI_IN SaHpiSessionIdT SessionId, SAHPI_IN SaHpiResourceIdT ResourceId, SAHPI_IN SaHpiSensorNumT SensorNum, - SAHPI_OUT SaHpiSensorThresholdsT *SensorThresholds) + SAHPI_IN SaHpiSensorThresholdsT *SensorThresholds) { SaErrorT rv; SaErrorT (*set_func) (void *, SaHpiResourceIdT, SaHpiSensorNumT, @@ -2042,38 +2043,7 @@ return SA_ERR_HPI_NOT_PRESENT; } - - /* Merging thresholds*/ - SaHpiSensorThresholdsT tmp; - - rv = saHpiSensorThresholdsGet( SessionId, ResourceId, SensorNum, &tmp ); - - if (rv != SA_OK) { - err("Can't get sensor thresholds. Sensor %d, ResourceId %d, Domain %d", - SensorNum, ResourceId, did); - oh_release_domain(d); - return rv; - } - - SaHpiSensorThdMaskT wmask = rdr->RdrTypeUnion.SensorRec.ThresholdDefn.WriteThold; - -#define COPY_TH( TH, MASK ) \ -{ \ - if ( ( SensorThresholds->TH.IsSupported == SAHPI_TRUE ) && ( ( wmask & MASK ) != 0 ) ) { \ - tmp.TH = SensorThresholds->TH; \ - } \ -} - COPY_TH( UpCritical, SAHPI_STM_UP_CRIT ); - COPY_TH( UpMajor, SAHPI_STM_UP_MAJOR ); - COPY_TH( UpMinor, SAHPI_STM_UP_MINOR ); - COPY_TH( LowCritical, SAHPI_STM_LOW_CRIT ); - COPY_TH( LowMajor, SAHPI_STM_LOW_MAJOR ); - COPY_TH( LowMinor, SAHPI_STM_LOW_MINOR ); - COPY_TH( PosThdHysteresis, SAHPI_STM_UP_HYSTERESIS ); - COPY_TH( NegThdHysteresis, SAHPI_STM_LOW_HYSTERESIS ); -#undef COPY_TH - - rv = oh_valid_thresholds(&tmp, rdr); + rv = oh_valid_thresholds(SensorThresholds, rdr); if (rv != SA_OK) { /* Invalid sensor threshold */ err("Invalid sensor threshold."); oh_release_domain(d); Modified: openhpi/trunk/utils/sahpi_struct_utils.c =================================================================== --- openhpi/trunk/utils/sahpi_struct_utils.c 2010-03-09 15:44:31 UTC (rev 7051) +++ openhpi/trunk/utils/sahpi_struct_utils.c 2010-03-12 11:54:43 UTC (rev 7052) @@ -14,6 +14,7 @@ * Steve Sherman <st...@us...> * Racing Guo <rac...@in...> * Renier Morales <re...@op...> + * Lars Wetzel <lar...@us...> */ #include <glib.h> @@ -286,7 +287,7 @@ if (err) { return(err); } break; case 27768: - err = oh_append_textbuffer(&working, "Gesellschaft f\xFCr Netzwerk- und Automatisierungs-Technologie GmbH"); + err = oh_append_textbuffer(&working, "Gesellschaft f�r Netzwerk- und Automatisierungs-Technologie GmbH"); if (err) { return(err); } break; case 29333: @@ -4066,19 +4067,30 @@ rdr->RdrTypeUnion.SensorRec.ThresholdDefn.IsAccessible == SAHPI_FALSE || rdr->RdrTypeUnion.SensorRec.ThresholdDefn.WriteThold == 0) return(SA_ERR_HPI_INVALID_CMD); + dbg("Start of threshold validation:"); + dbg("Check SAHPI_STM_LOW_CRIT"); validate_threshold(LowCritical, SAHPI_STM_LOW_CRIT); + dbg("Check SAHPI_STM_LOW_MAJOR"); validate_threshold(LowMajor, SAHPI_STM_LOW_MAJOR); + dbg("Check SAHPI_STM_LOW_MINOR"); validate_threshold(LowMinor, SAHPI_STM_LOW_MINOR); + dbg("Check SAHPI_STM_UP_CRIT"); validate_threshold(UpCritical, SAHPI_STM_UP_CRIT); + dbg("Check SAHPI_STM_UP_MAJOR"); validate_threshold(UpMajor, SAHPI_STM_UP_MAJOR); + dbg("Check SAHPI_STM_UP_MINOR"); validate_threshold(UpMinor, SAHPI_STM_UP_MINOR); + dbg("Check SAHPI_STM_UP_HYSTERESIS"); validate_threshold(PosThdHysteresis, SAHPI_STM_UP_HYSTERESIS); + dbg("Check SAHPI_STM_LOW_HYSTERESIS"); validate_threshold(NegThdHysteresis, SAHPI_STM_LOW_HYSTERESIS); /* Validate defined thresholds are in order: * upper critical >= upper major >= upper minor >= * lower minor >= lower major >= lower critical */ + + dbg("Start of ordering validation."); switch (format.ReadingType) { case SAHPI_SENSOR_READING_TYPE_INT64: validate_threshold_order(SensorInt64); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lar...@us...> - 2010-03-19 15:15:15
|
Revision: 7054 http://openhpi.svn.sourceforge.net/openhpi/?rev=7054&view=rev Author: larswetzel Date: 2010-03-19 15:15:09 +0000 (Fri, 19 Mar 2010) Log Message: ----------- Re-insert the thresholds ordering check as described in the fix for Bug 2969326 Modified Paths: -------------- openhpi/trunk/openhpid/safhpi.c openhpi/trunk/utils/sahpi_struct_utils.c openhpi/trunk/utils/sahpi_struct_utils.h Modified: openhpi/trunk/openhpid/safhpi.c =================================================================== --- openhpi/trunk/openhpid/safhpi.c 2010-03-12 12:11:33 UTC (rev 7053) +++ openhpi/trunk/openhpid/safhpi.c 2010-03-19 15:15:09 UTC (rev 7054) @@ -2050,6 +2050,41 @@ return rv; } + /* Checking the ordering*/ + SaHpiSensorThresholdsT tmp; + + rv = saHpiSensorThresholdsGet( SessionId, ResourceId, SensorNum, &tmp ); + + if (rv != SA_OK) { + err("Can't get sensor thresholds. Sensor %d, ResourceId %d, Domain %d", + SensorNum, ResourceId, did); + oh_release_domain(d); + return rv; + } + +#define COPY_TH( TH, MASK ) \ +{ \ + if ( SensorThresholds->TH.IsSupported == SAHPI_TRUE ) { \ + tmp.TH = SensorThresholds->TH; \ + } \ +} + COPY_TH( UpCritical, SAHPI_STM_UP_CRIT ); + COPY_TH( UpMajor, SAHPI_STM_UP_MAJOR ); + COPY_TH( UpMinor, SAHPI_STM_UP_MINOR ); + COPY_TH( LowCritical, SAHPI_STM_LOW_CRIT ); + COPY_TH( LowMajor, SAHPI_STM_LOW_MAJOR ); + COPY_TH( LowMinor, SAHPI_STM_LOW_MINOR ); + COPY_TH( PosThdHysteresis, SAHPI_STM_UP_HYSTERESIS ); + COPY_TH( NegThdHysteresis, SAHPI_STM_LOW_HYSTERESIS ); +#undef COPY_TH + + rv = oh_valid_ordering(&tmp, rdr); + if (rv != SA_OK) { /* Invalid sensor threshold */ + err("Invalid sensor threshold ordering."); + oh_release_domain(d); + return rv; + } + OH_HANDLER_GET(d, ResourceId, h); oh_release_domain(d); /* Unlock domain */ Modified: openhpi/trunk/utils/sahpi_struct_utils.c =================================================================== --- openhpi/trunk/utils/sahpi_struct_utils.c 2010-03-12 12:11:33 UTC (rev 7053) +++ openhpi/trunk/utils/sahpi_struct_utils.c 2010-03-19 15:15:09 UTC (rev 7054) @@ -4030,7 +4030,60 @@ } \ } while(0) + /** + * oh_valid_ordering: + * @thds: Location of threshold definitions to verify. + * @rdr: Location of sensor's RDR. + * + * Validates the ordering of threshold values + * + * Return values: + * SA_OK - normal case. + * SA_ERR_HPI_INVALID_CMD - invalid data type. + * SA_ERR_HPI_INVALID_DATA - Threshold values out of order. + * SA_ERR_HPI_INVALID_PARAMS - Pointer parameter(s) are NULL. + **/ +SaErrorT oh_valid_ordering(SaHpiSensorThresholdsT *thds, SaHpiRdrT *rdr) +{ + SaHpiSensorDataFormatT format; + /* Validate defined thresholds are in order: + * upper critical >= upper major >= upper minor >= + * lower minor >= lower major >= lower critical + */ + if (!thds || !rdr) { + err("Invalid parameter."); + return(SA_ERR_HPI_INVALID_PARAMS); + } + if (rdr->RdrType != SAHPI_SENSOR_RDR) { + err("Invalid parameter"); + return(SA_ERR_HPI_INVALID_PARAMS); + } + + format = rdr->RdrTypeUnion.SensorRec.DataFormat; + + dbg("Start of ordering validation."); + switch (format.ReadingType) { + case SAHPI_SENSOR_READING_TYPE_INT64: + validate_threshold_order(SensorInt64); + break; + case SAHPI_SENSOR_READING_TYPE_FLOAT64: + validate_threshold_order(SensorFloat64); + break; + case SAHPI_SENSOR_READING_TYPE_UINT64: + validate_threshold_order(SensorUint64); + break; + case SAHPI_SENSOR_READING_TYPE_BUFFER: + break; + default: + err("Invalid threshold reading type."); + return(SA_ERR_HPI_INVALID_CMD); + } + + return(SA_OK); +} + +/** * oh_valid_thresholds: * @thds: Location of threshold definitions to verify. * @rdr: Location of sensor's RDR. @@ -4043,14 +4096,14 @@ * Return values: * SA_OK - normal case. * SA_ERR_HPI_INVALID_CMD - Non-writable thresholds, invalid thresholds values, or invalid data type. - * SA_ERR_HPI_INVALID_DATA - Threshold values out of order; negative hysteresis value. + * SA_ERR_HPI_INVALID_DATA - negative hysteresis value. * SA_ERR_HPI_INVALID_PARAMS - Pointer parameter(s) are NULL. **/ SaErrorT oh_valid_thresholds(SaHpiSensorThresholdsT *thds, SaHpiRdrT *rdr) { + SaHpiSensorThdMaskT writable_thds; SaHpiSensorDataFormatT format; - SaHpiSensorThdMaskT writable_thds; - + if (!thds || !rdr) { err("Invalid parameter."); return(SA_ERR_HPI_INVALID_PARAMS); @@ -4060,9 +4113,9 @@ return(SA_ERR_HPI_INVALID_PARAMS); } + writable_thds = rdr->RdrTypeUnion.SensorRec.ThresholdDefn.WriteThold; format = rdr->RdrTypeUnion.SensorRec.DataFormat; - writable_thds = rdr->RdrTypeUnion.SensorRec.ThresholdDefn.WriteThold; - + if (rdr->RdrTypeUnion.SensorRec.Category != SAHPI_EC_THRESHOLD || rdr->RdrTypeUnion.SensorRec.ThresholdDefn.IsAccessible == SAHPI_FALSE || rdr->RdrTypeUnion.SensorRec.ThresholdDefn.WriteThold == 0) return(SA_ERR_HPI_INVALID_CMD); @@ -4085,30 +4138,7 @@ dbg("Check SAHPI_STM_LOW_HYSTERESIS"); validate_threshold(NegThdHysteresis, SAHPI_STM_LOW_HYSTERESIS); - /* Validate defined thresholds are in order: - * upper critical >= upper major >= upper minor >= - * lower minor >= lower major >= lower critical - */ - - dbg("Start of ordering validation."); - switch (format.ReadingType) { - case SAHPI_SENSOR_READING_TYPE_INT64: - validate_threshold_order(SensorInt64); - break; - case SAHPI_SENSOR_READING_TYPE_FLOAT64: - validate_threshold_order(SensorFloat64); - break; - case SAHPI_SENSOR_READING_TYPE_UINT64: - validate_threshold_order(SensorUint64); - break; - case SAHPI_SENSOR_READING_TYPE_BUFFER: - break; - default: - err("Invalid threshold reading type."); - return(SA_ERR_HPI_INVALID_CMD); - } - - return(SA_OK); + return (SA_OK); } /** Modified: openhpi/trunk/utils/sahpi_struct_utils.h =================================================================== --- openhpi/trunk/utils/sahpi_struct_utils.h 2010-03-12 12:11:33 UTC (rev 7053) +++ openhpi/trunk/utils/sahpi_struct_utils.h 2010-03-19 15:15:09 UTC (rev 7054) @@ -94,6 +94,9 @@ *************************/ SaHpiBoolT oh_valid_textbuffer(SaHpiTextBufferT *buffer); +SaErrorT oh_valid_ordering(SaHpiSensorThresholdsT *thds, + SaHpiRdrT *rdr); + SaErrorT oh_valid_thresholds(SaHpiSensorThresholdsT *thds, SaHpiRdrT *rdr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mxb...@us...> - 2010-04-16 21:24:47
|
Revision: 7063 http://openhpi.svn.sourceforge.net/openhpi/?rev=7063&view=rev Author: mxbishop Date: 2010-04-16 21:24:41 +0000 (Fri, 16 Apr 2010) Log Message: ----------- Fix for enhancement #2982733 (Add power mgmt controls to oa_soap plugin) Modified Paths: -------------- openhpi/trunk/include/SaHpiOaSoap.h openhpi/trunk/plugins/oa_soap/oa_soap.h openhpi/trunk/plugins/oa_soap/oa_soap_calls.c openhpi/trunk/plugins/oa_soap/oa_soap_calls.h openhpi/trunk/plugins/oa_soap/oa_soap_control.c openhpi/trunk/plugins/oa_soap/oa_soap_control.h openhpi/trunk/plugins/oa_soap/oa_soap_discover.c openhpi/trunk/plugins/oa_soap/oa_soap_discover.h openhpi/trunk/plugins/oa_soap/oa_soap_event.c openhpi/trunk/plugins/oa_soap/oa_soap_ps_event.c openhpi/trunk/plugins/oa_soap/oa_soap_resources.c Modified: openhpi/trunk/include/SaHpiOaSoap.h =================================================================== --- openhpi/trunk/include/SaHpiOaSoap.h 2010-04-15 10:51:55 UTC (rev 7062) +++ openhpi/trunk/include/SaHpiOaSoap.h 2010-04-16 21:24:41 UTC (rev 7063) @@ -222,7 +222,27 @@ #define OA_SOAP_PWR_CNTRL (SaHpiCtrlNumT) 0x001 /* LCD Button Lock control */ #define OA_SOAP_LCD_BUTN_LCK_CNTRL (SaHpiCtrlNumT) 0x002 +/* Power Mode Control */ +#define OA_SOAP_PWR_MODE_CNTRL (SaHpiCtrlNumT) 0x003 +/* Dynamic Power Control */ +#define OA_SOAP_DYNAMIC_PWR_CNTRL (SaHpiCtrlNumT) 0x004 +/* Power Limit Mode Control */ +#define OA_SOAP_PWR_LIMIT_MODE_CNTRL (SaHpiCtrlNumT) 0x005 +/* Static Power Limit Control */ +#define OA_SOAP_STATIC_PWR_LIMIT_CNTRL (SaHpiCtrlNumT) 0x006 +/* Dynamic Power Cap Control */ +#define OA_SOAP_DYNAMIC_PWR_CAP_CNTRL (SaHpiCtrlNumT) 0x007 +/* HP c7000 Power Modes */ +#define C7000_PWR_NON_REDUNDANT 1 +#define C7000_PWR_AC_REDUNDANT 2 +#define C7000_PWR_SUPPLY_REDUNDANT 3 + +/* HP c7000 Power Limit Modes */ +#define C7000_PWR_LIMIT_NONE 0 +#define C7000_PWR_LIMIT_STATIC 1 +#define C7000_PWR_LIMIT_DYNAMIC_CAP 2 + /* Custom inventory Area and fields used in OA SOAP plugin * On adding new inventory area or field, fan zone mapping rray in in * plugin/oa_soap/oa_soap_resources.c may require updation. Modified: openhpi/trunk/plugins/oa_soap/oa_soap.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap.h 2010-04-15 10:51:55 UTC (rev 7062) +++ openhpi/trunk/plugins/oa_soap/oa_soap.h 2010-04-16 21:24:41 UTC (rev 7063) @@ -88,11 +88,6 @@ #define OA_SOAP_ENC_C7000 0 #define OA_SOAP_ENC_C3000 1 -/* Max Blade in HP BladeSystem c7000 c-Class enclosure*/ -#define OA_SOAP_C7000_MAX_BLADE 16 -/* Max Blade in HP BladeSystem c3000 c-Class enclosure*/ -#define OA_SOAP_C3000_MAX_BLADE 8 - /* Maximum Fan Zones present in different HP BladeSystem c-Class enclosures */ #define OA_SOAP_C7000_MAX_FZ 4 #define OA_SOAP_C3000_MAX_FZ 1 @@ -205,6 +200,13 @@ SaHpiBoolT shutdown_event_thread; SaHpiInt32T oa_switching; GMutex *mutex; + + /* This is local state for holding data for the */ + /* enclosure power management controls. */ + struct powerConfigInfo power_config_info; + struct powerCapConfig power_cap_config; + uint desired_static_pwr_limit; + uint desired_dynamic_pwr_cap; }; /* Structure for storing the current hotswap state of the resource */ Modified: openhpi/trunk/plugins/oa_soap/oa_soap_calls.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_calls.c 2010-04-15 10:51:55 UTC (rev 7062) +++ openhpi/trunk/plugins/oa_soap/oa_soap_calls.c 2010-04-16 21:24:41 UTC (rev 7063) @@ -288,6 +288,44 @@ response->extraData = soap_walk_tree(node, "extraData"); } +/* parse_powerConfigInfo - Parses a getPowerConfigInfo response structure */ +static void parse_powerConfigInfo(xmlNode *node, struct powerConfigInfo *response) +{ + response->powerCeiling = atoi(soap_tree_value(node, "powerCeiling")); + response->redundancyMode = + soap_enum(powerRedundancy_S, soap_tree_value(node, "redundancyMode")); + response->dynamicPowerSaverEnabled = + parse_xsdBoolean(soap_tree_value(node, "dynamicPowerSaverEnabled")); + response->extraData = soap_walk_tree(node, "extraData"); +} + +/* parse_powerCapConfig - Parses a getPowerCapConfig response structure */ +static void parse_powerCapConfig(xmlNode *node, struct powerCapConfig *response) +{ + xmlNode *bay_data; + int i; + + response->enclosureMinWattageMeasured = atoi(soap_tree_value(node, "enclosureMinWattageMeasured")); + response->enclosureMaxWattageMeasured = atoi(soap_tree_value(node, "enclosureMaxWattageMeasured")); + response->enclosurePowerCapLowerBound = atoi(soap_tree_value(node, "enclosurePowerCapLowerBound")); + response->enclosurePowerCapUpperBound = atoi(soap_tree_value(node, "enclosurePowerCapUpperBound")); + response->enclosureHighLine = parse_xsdBoolean(soap_tree_value(node, "enclosureHighLine")); + response->enclosureAcPhaseType = atoi(soap_tree_value(node, "enclosureAcPhaseType")); + response->enclosureEstimatedVoltage = atoi(soap_tree_value(node, "enclosureEstimatedVoltage")); + response->powerCap = atoi(soap_tree_value(node, "powerCap")); + response->extraData = soap_walk_tree(node, "extraData"); + + bay_data = soap_walk_tree(node, "optOutBayArray"); + bay_data = soap_walk_tree(bay_data, "bay"); + i = 0; + while (bay_data) { + /* Copy optOutBayArray data for later use: data is either "true" or "false" */ + strncpy(response->optOutBayArray[i], soap_value(bay_data), 6); + bay_data = soap_next_node(bay_data); + i++; + } +} + /* parse_oaStatus - Parses an oaStatus response structure */ static void parse_oaStatus(xmlNode *node, struct oaStatus *response) { @@ -1329,6 +1367,93 @@ return(ret); } +int soap_getPowerConfigInfo(SOAP_CON *con, + struct powerConfigInfo *response, + uint *desired_static_pwr_limit) +{ + SOAP_PARM_CHECK_NRQ + if (! (ret = soap_request(con, GET_POWER_CONFIG_INFO))) { + parse_powerConfigInfo(soap_walk_doc(con->doc, + "Body:" + "getPowerConfigInfoResponse:" + "powerConfigInfo"), + response); + } + + /* If user's desired static power limit is 0, then update it with the OA value, */ + /* otherwise preserve the user's intention for a static power limit. */ + if (*desired_static_pwr_limit == 0) { + *desired_static_pwr_limit = response->powerCeiling; + } + + return(ret); +} + +int soap_setPowerConfigInfo(SOAP_CON *con, + const struct powerConfigInfo *request) +{ + char hpoa_boolean[HPOA_BOOLEAN_LENGTH]; + char powerRedundancy[POWER_REDUNDANCY_LENGTH]; + + SOAP_PARM_CHECK_NRS + if (soap_inv_enum(hpoa_boolean, hpoa_boolean_S, request->dynamicPowerSaverEnabled)) { + err("invalid dynamic power parameter"); + return(-1); + } + if (soap_inv_enum(powerRedundancy, powerRedundancy_S, request->redundancyMode)) { + err("invalid power redundancy mode parameter"); + return(-1); + } + return(soap_request(con, SET_POWER_CONFIG_INFO, request->redundancyMode, + request->powerCeiling, request->dynamicPowerSaverEnabled)); +} + +int soap_getPowerCapConfig(SOAP_CON *con, + struct powerCapConfig *response, + uint *desired_dynamic_pwr_cap_limit) +{ + SOAP_PARM_CHECK_NRQ + if (! (ret = soap_request(con, GET_POWER_CAP_CONFIG))) { + parse_powerCapConfig(soap_walk_doc(con->doc, + "Body:" + "getPowerCapConfigResponse:" + "powerCapConfig"), + response); + } + + /* If user's desired dynamic power cap limit is 0, then update it with the OA value, */ + /* otherwise preserve the user's intention for a dynamic power cap limit. */ + if (*desired_dynamic_pwr_cap_limit == 0) { + *desired_dynamic_pwr_cap_limit = response->powerCap; + } + + return(ret); +} + +int soap_setPowerCapConfig(SOAP_CON *con, + const struct powerCapConfig *request) +{ + SOAP_PARM_CHECK_NRS + return(soap_request(con, SET_POWER_CAP_CONFIG, request->powerCap, + request->optOutBayArray[0], + request->optOutBayArray[1], + request->optOutBayArray[2], + request->optOutBayArray[3], + request->optOutBayArray[4], + request->optOutBayArray[5], + request->optOutBayArray[6], + request->optOutBayArray[7], + request->optOutBayArray[8], + request->optOutBayArray[9], + request->optOutBayArray[10], + request->optOutBayArray[11], + request->optOutBayArray[12], + request->optOutBayArray[13], + request->optOutBayArray[14], + request->optOutBayArray[15], + "")); +} + int soap_getOaStatus(SOAP_CON *con, const struct getOaStatus *request, struct oaStatus *response) Modified: openhpi/trunk/plugins/oa_soap/oa_soap_calls.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_calls.h 2010-04-15 10:51:55 UTC (rev 7062) +++ openhpi/trunk/plugins/oa_soap/oa_soap_calls.h 2010-04-16 21:24:41 UTC (rev 7063) @@ -47,6 +47,11 @@ #define MAX_PART_NUM_LENGTH 32 #define MAX_MODEL_NUM_LENGTH 32 +/* Moved these #defines from oa_soap.h - which includes this header file. */ +/* Max Blade in HP BladeSystem c7000 c-Class enclosure*/ +#define OA_SOAP_C7000_MAX_BLADE 16 +/* Max Blade in HP BladeSystem c3000 c-Class enclosure*/ +#define OA_SOAP_C3000_MAX_BLADE 8 /* Data types used to help us be more consistent with the WSDL description */ typedef unsigned char byte; @@ -114,6 +119,47 @@ "<hpoa:bayNumber>%d</hpoa:bayNumber>" \ "</hpoa:getOaInfo>\n" +#define GET_POWER_CONFIG_INFO \ + "<hpoa:getPowerConfigInfo>" \ + "</hpoa:getPowerConfigInfo>\n" + +#define SET_POWER_CONFIG_INFO \ + "<hpoa:setPowerConfigInfo>" \ + "<hpoa:redundancyMode>%d</hpoa:redundancyMode>" \ + "<hpoa:powerCeiling>%d</hpoa:powerCeiling>" \ + "<hpoa:dynamicPowerSaverEnabled>%d</hpoa:dynamicPowerSaverEnabled>" \ + "</hpoa:setPowerConfigInfo>\n" + +#define GET_POWER_CAP_CONFIG \ + "<hpoa:getPowerCapConfig>" \ + "</hpoa:getPowerCapConfig>\n" + +#define SET_POWER_CAP_CONFIG \ + "<hpoa:setPowerCapConfig>" \ + "<hpoa:config>" \ + "<hpoa:powerCap>%d</hpoa:powerCap>" \ + "<hpoa:optOutBayArray>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "</hpoa:optOutBayArray>" \ + "<hpoa:extraData hpoa:name=\"\">%s</hpoa:extraData>" \ + "</hpoa:config>" \ + "</hpoa:setPowerCapConfig>\n" + #define GET_INTERCONNECT_TRAY_STATUS \ "<hpoa:getInterconnectTrayStatus>" \ "<hpoa:bayNumber>%d</hpoa:bayNumber>" \ @@ -234,6 +280,7 @@ "</hpoa:setLcdButtonLock>\n" /* Enumerated types used for specific SOAP commands */ +#define HPOA_BOOLEAN_LENGTH 11 /* Max length of these enums + 1 */ OA_SOAP_ENUM(hpoa_boolean, HPOA_FALSE, HPOA_TRUE) @@ -457,6 +504,7 @@ NOT_REDUNDANT, REDUNDANT) +#define POWER_REDUNDANCY_LENGTH 42 /* Max length of these enums + 1 */ OA_SOAP_ENUM(powerRedundancy, REDUNDANT_UNKNOWN, NON_REDUNDANT, @@ -466,6 +514,12 @@ POWER_SUPPLY_REDUNDANT_WITH_POWER_CEILING, NON_REDUNDANT_WITH_POWER_CEILING) +#define POWER_LIMIT_MODE_LENGTH 19 /* Max length of these enums + 1 */ +OA_SOAP_ENUM(powerLimitMode, + POWER_LIMIT_NONE, + STATIC_POWER_LIMIT, + DYNAMIC_POWER_CAP) + #define SENSOR_TYPE_LENGTH 25 /* Max length of these enums + 1 */ OA_SOAP_ENUM(sensorType, SENSOR_TYPE_BLADE, @@ -745,7 +799,8 @@ EVENT_MEDIA_DRIVE_INSERTED2, EVENT_MEDIA_DRIVE_REMOVED2, EVENT_MEDIA_INSERTED2, - EVENT_MEDIA_REMOVED2) + EVENT_MEDIA_REMOVED2, + EVENT_ENC_GRP_CAP) /* This is not part of the SOAP response data from the OA, but is useful * for identifying the type of data that comes back from getAllEvents(). @@ -805,7 +860,8 @@ NUMVALUE, STRING, MESSAGE, - NOPAYLOAD) + NOPAYLOAD, + POWERCAPCONFIG) OA_SOAP_ENUM(enum_usbMode, USB_KVM_ENABLED, @@ -1304,8 +1360,26 @@ enum powerRedundancy redundancyMode; enum hpoa_boolean dynamicPowerSaverEnabled; xmlNode *extraData; /* Items are struct extraDataInfo */ + /* These are needed as high/low limits of the analog control RDRs */ + /* static power limit. */ + int ACLimitLow; + int ACLimitHigh; }; +struct powerCapConfig +{ + int enclosureMinWattageMeasured; + int enclosureMaxWattageMeasured; + int enclosurePowerCapLowerBound; + int enclosurePowerCapUpperBound; + enum hpoa_boolean enclosureHighLine; + int enclosureAcPhaseType; + int enclosureEstimatedVoltage; + int powerCap; + char optOutBayArray[OA_SOAP_C7000_MAX_BLADE][8]; /* holds true or false for each bay */ + xmlNode *extraData; /* Items are struct extraDataInfo */ +}; + struct thermalInfo { enum sensorType sensorType; @@ -1820,6 +1894,7 @@ struct powerSupplyStatus powerSupplyStatus; struct powerSubsystemInfo powerSubsystemInfo; struct powerConfigInfo powerConfigInfo; + struct powerCapConfig powerCapConfig; struct thermalInfo thermalInfo; xmlNode *userInfoArray; /* Items are struct userInfo */ struct userInfo userInfo; @@ -1965,6 +2040,20 @@ int soap_getEnclosureInfo(SOAP_CON *connection, struct enclosureInfo *response); +int soap_getPowerConfigInfo(SOAP_CON *connection, + struct powerConfigInfo *response, + uint *desired_static_pwr_limit); + +int soap_setPowerConfigInfo(SOAP_CON *connection, + const struct powerConfigInfo *request); + +int soap_getPowerCapConfig(SOAP_CON *connection, + struct powerCapConfig *response, + uint *desired_dynamic_pwr_cap_limit); + +int soap_setPowerCapConfig(SOAP_CON *connection, + const struct powerCapConfig *request); + int soap_getOaStatus(SOAP_CON *connection, const struct getOaStatus *request, struct oaStatus *response); Modified: openhpi/trunk/plugins/oa_soap/oa_soap_control.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_control.c 2010-04-15 10:51:55 UTC (rev 7062) +++ openhpi/trunk/plugins/oa_soap/oa_soap_control.c 2010-04-16 21:24:41 UTC (rev 7063) @@ -55,6 +55,26 @@ * * oa_soap_get_uid_cntrl() - Gets the UID control * + * oa_soap_set_dynamic_pwr_cntrl() - Sets the dynamic power control + * + * oa_soap_get_dynamic_pwr_cntrl() - Gets the dynamic power control + * + * oa_soap_set_pwr_mode_cntrl() - Sets the power mode control + * + * oa_soap_get_pwr_mode_cntrl() - Gets the power mode control + * + * oa_soap_set_pwr_limit_mode_cntrl() - Sets the power limit mode control + * + * oa_soap_get_pwr_limit_mode_cntrl() - Gets the power limit mode control + * + * oa_soap_set_static_pwr_limit_cntrl() - Sets the static power limit control + * + * oa_soap_get_static_pwr_limit_cntrl() - Gets the static power limit control + * + * oa_soap_set_dynamic_pwr_cap_cntrl() - Sets the dynamic power cap control + * + * oa_soap_get_dynamic_pwr_cap_cntrl() - Gets the dynamic power cap control + * */ #include "oa_soap_control.h" @@ -82,6 +102,36 @@ static SaErrorT oa_soap_get_uid_cntrl(struct oh_handler_state *oh_handler, SaHpiRptEntryT *rpt, SaHpiCtrlStateDigitalT *control_state); +static SaErrorT oa_soap_set_dynamic_pwr_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDigitalT control_state); +static SaErrorT oa_soap_get_dynamic_pwr_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDigitalT *control_state); +static SaErrorT oa_soap_set_pwr_mode_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT control_state); +static SaErrorT oa_soap_get_pwr_mode_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT *control_state); +static SaErrorT oa_soap_set_pwr_limit_mode_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT control_state); +static SaErrorT oa_soap_get_pwr_limit_mode_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT *control_state); +static SaErrorT oa_soap_set_static_pwr_limit_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT control_state); +static SaErrorT oa_soap_get_static_pwr_limit_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT *control_state); +static SaErrorT oa_soap_set_dynamic_pwr_cap_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT control_state); +static SaErrorT oa_soap_get_dynamic_pwr_cap_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT *control_state); /** * oa_soap_get_control_state @@ -125,6 +175,8 @@ SaHpiCtrlRecDigitalT *digital = NULL; SaHpiCtrlRecT *ctrl = NULL; SaHpiCtrlStateDigitalT control_digital_state; + SaHpiCtrlStateDiscreteT control_discrete_state; + SaHpiCtrlStateAnalogT control_analog_state; if (oh_handler == NULL || mode == NULL || state == NULL) { err("Invalid parameter."); @@ -186,11 +238,67 @@ return rv; } break; + case OA_SOAP_DYNAMIC_PWR_CNTRL: + rv = oa_soap_get_dynamic_pwr_cntrl(handler, resource_id, + &control_digital_state); + if (rv != SA_OK) { + err("Failed to get the dynamic power state RDR"); + return rv; + } + break; + case OA_SOAP_PWR_MODE_CNTRL: + rv = oa_soap_get_pwr_mode_cntrl(handler, resource_id, + &control_discrete_state); + if (rv != SA_OK) { + err("Failed to get the power mode state RDR"); + return rv; + } + break; + case OA_SOAP_PWR_LIMIT_MODE_CNTRL: + rv = oa_soap_get_pwr_limit_mode_cntrl(handler, resource_id, + &control_discrete_state); + if (rv != SA_OK) { + err("Failed to get the power limit mode state RDR"); + return rv; + } + break; + case OA_SOAP_STATIC_PWR_LIMIT_CNTRL: + rv = oa_soap_get_static_pwr_limit_cntrl(handler, resource_id, + &control_analog_state); + if (rv != SA_OK) { + err("Failed to get the static power limit state RDR"); + return rv; + } + break; + case OA_SOAP_DYNAMIC_PWR_CAP_CNTRL: + rv = oa_soap_get_dynamic_pwr_cap_cntrl(handler, resource_id, + &control_analog_state); + if (rv != SA_OK) { + err("Failed to get the dynamic power cap state RDR"); + return rv; + } + break; default: err("Invalid control rdr num"); return SA_ERR_HPI_INTERNAL_ERROR; } - ctrl_state.StateUnion.Digital = control_digital_state; + switch (rdr_num){ + case OA_SOAP_PWR_CNTRL: + case OA_SOAP_UID_CNTRL: + case OA_SOAP_LCD_BUTN_LCK_CNTRL: + case OA_SOAP_DYNAMIC_PWR_CNTRL: + ctrl_state.StateUnion.Digital = control_digital_state; + break; + case OA_SOAP_PWR_MODE_CNTRL: + case OA_SOAP_PWR_LIMIT_MODE_CNTRL: + ctrl_state.StateUnion.Discrete = control_discrete_state; + break; + case OA_SOAP_STATIC_PWR_LIMIT_CNTRL: + case OA_SOAP_DYNAMIC_PWR_CAP_CNTRL: + ctrl_state.StateUnion.Analog = control_analog_state; + break; + } + /* Return the appropriately mapped control state */ *state = ctrl_state; return rv; @@ -281,15 +389,27 @@ } /* Return error for Non digital type control request */ - if (state->Type != SAHPI_CTRL_TYPE_DIGITAL) { + if ((state->Type != SAHPI_CTRL_TYPE_DIGITAL) && + (state->Type != SAHPI_CTRL_TYPE_DISCRETE) && + (state->Type != SAHPI_CTRL_TYPE_ANALOG)) { err("Control type not supported"); return SA_ERR_HPI_INTERNAL_ERROR; } - /* If control mode is MANUAL and specified state is of digital type, - * then the control state is updated with specified state value + /* If control mode is MANUAL and specified state could be digital, discrete, or + * analog type, then the control state is updated with specified state value */ - ctrl->TypeUnion.Digital.Default = state->StateUnion.Digital; + if (state->Type == SAHPI_CTRL_TYPE_DIGITAL) { + ctrl->TypeUnion.Digital.Default = state->StateUnion.Digital; + } + else { + if (state->Type == SAHPI_CTRL_TYPE_DISCRETE) { + ctrl->TypeUnion.Discrete.Default = state->StateUnion.Discrete; + } + else { + ctrl->TypeUnion.Analog.Default = state->StateUnion.Analog; + } + } switch (rdr_num) { case OA_SOAP_PWR_CNTRL: rv = oa_soap_set_pwr_cntrl(handler, resource_id, @@ -315,6 +435,46 @@ return rv; } break; + case OA_SOAP_DYNAMIC_PWR_CNTRL: + rv = oa_soap_set_dynamic_pwr_cntrl(handler, resource_id, + state->StateUnion.Digital); + if (rv != SA_OK) { + err("Failed to set the dynamic power state"); + return rv; + } + break; + case OA_SOAP_PWR_MODE_CNTRL: + rv = oa_soap_set_pwr_mode_cntrl(handler, resource_id, + state->StateUnion.Discrete); + if (rv != SA_OK) { + err("Failed to set the power mode state"); + return rv; + } + break; + case OA_SOAP_PWR_LIMIT_MODE_CNTRL: + rv = oa_soap_set_pwr_limit_mode_cntrl(handler, resource_id, + state->StateUnion.Discrete); + if (rv != SA_OK) { + err("Failed to set the power limit mode state"); + return rv; + } + break; + case OA_SOAP_STATIC_PWR_LIMIT_CNTRL: + rv = oa_soap_set_static_pwr_limit_cntrl(handler, resource_id, + state->StateUnion.Analog); + if (rv != SA_OK) { + err("Failed to set the static power limit state"); + return rv; + } + break; + case OA_SOAP_DYNAMIC_PWR_CAP_CNTRL: + rv = oa_soap_set_dynamic_pwr_cap_cntrl(handler, resource_id, + state->StateUnion.Analog); + if (rv != SA_OK) { + err("Failed to set the dynamic power cap state"); + return rv; + } + break; default: err("Invalid control rdr num"); return SA_ERR_HPI_INTERNAL_ERROR; @@ -328,6 +488,8 @@ * @rdr: Pointer to the rdr structure * @resource_id: Resource ID * @control_num: Control rdr number + * @analogLimitLow: RDR lower limit for analog control + * @analogLimitHigh: RDR upper limit for analog control * * Purpose: * Builds the control rdr. @@ -344,7 +506,9 @@ SaErrorT oa_soap_build_control_rdr(struct oh_handler_state *oh_handler, SaHpiRdrT *rdr, SaHpiResourceIdT resource_id, - SaHpiCtrlNumT control_num) + SaHpiCtrlNumT control_num, + int analogLimitLow, + int analogLimitHigh) { SaHpiRptEntryT *rpt = NULL; @@ -364,9 +528,15 @@ rdr->RdrType = SAHPI_CTRL_RDR; rdr->RdrTypeUnion.CtrlRec = oa_soap_cntrl_arr[control_num].control; + oh_init_textbuffer(&(rdr->IdString)); oh_append_textbuffer(&(rdr->IdString), oa_soap_cntrl_arr[control_num].comment); + + if (rdr->RdrTypeUnion.CtrlRec.Type == SAHPI_CTRL_TYPE_ANALOG) { + rdr->RdrTypeUnion.CtrlRec.TypeUnion.Analog.Min = analogLimitLow; + rdr->RdrTypeUnion.CtrlRec.TypeUnion.Analog.Max = analogLimitHigh; + } return SA_OK; } @@ -860,6 +1030,623 @@ return SA_OK; } +/** + * oa_soap_get_dynamic_pwr_cntrl: + * @oh_handler: Handler data pointer + * @resource_id: Resource id + * @control state: Pointer to digital control state + * + * Purpose: + * Gets the control state of the dynamic power control on resource + * + * Detailed Description: + * - Gets the dynamic power state of resource and maps it to control state + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_get_dynamic_pwr_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDigitalT *control_state) +{ + SaErrorT rv = SA_OK; + struct powerConfigInfo *power_config_info; + struct oa_soap_handler *oa_handler = NULL; + + if (oh_handler == NULL || control_state == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + power_config_info = &(oa_handler->power_config_info); + + /* Make a soap call to get the enclosure power config info */ + g_mutex_lock(oa_handler->mutex); + rv = soap_getPowerConfigInfo(oa_handler->active_con, + power_config_info, + &(oa_handler->desired_static_pwr_limit)); + g_mutex_unlock(oa_handler->mutex); + if (rv != SOAP_OK) { + err("Get enclosure power config info failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + switch (power_config_info->dynamicPowerSaverEnabled) { + case HPOA_FALSE: + *control_state = SAHPI_CTRL_STATE_OFF; + break; + case HPOA_TRUE: + *control_state = SAHPI_CTRL_STATE_ON; + break; + default: + err("Invalid dynamic power state"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + return SA_OK; +} + +/** + * oa_soap_set_dynamic_pwr_cntrl: + * @oh_handler: Handler data pointer + * @resource_id: Resource id + * @control state: Digital control state + * + * Purpose: + * Sets the control state of the dynamic power control on resource + * + * Detailed Description: + * - Sets the dynamic power state of resource after mapping the control state + * appropriate dynamic power state + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_set_dynamic_pwr_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDigitalT control_state) +{ + SaErrorT rv = SA_OK; + struct powerConfigInfo *power_config_info; + struct oa_soap_handler *oa_handler = NULL; + + if (oh_handler == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + /* Return error if the control state is PULSE_ON or PULSE_OFF */ + if ((control_state == SAHPI_CTRL_STATE_PULSE_ON) || + (control_state == SAHPI_CTRL_STATE_PULSE_OFF)) { + err("Setting the control state to PULSE ON/OFF not supported"); + return SA_ERR_HPI_INVALID_DATA; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + power_config_info = &(oa_handler->power_config_info); + + if (control_state == SAHPI_CTRL_STATE_ON) { + power_config_info->dynamicPowerSaverEnabled = HPOA_TRUE; + } else { + power_config_info->dynamicPowerSaverEnabled = HPOA_FALSE; + } + + /* Make a soap call to set the enclosure power config info */ + rv = soap_setPowerConfigInfo(oa_handler->active_con, + power_config_info); + if (rv != SOAP_OK) { + err("Set enclosure power config info failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + return SA_OK; +} + +/** + * oa_soap_get_pwr_mode_cntrl: + * @oh_handler: Handler data pointer + * @resource_id: Resource id + * @control state: Pointer to discrete control state + * + * Purpose: + * Gets the control state of the power mode control on resource + * + * Detailed Description: + * - Gets the power mode state of resource and maps it to control state + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_get_pwr_mode_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT *control_state) +{ + SaErrorT rv = SA_OK; + struct powerConfigInfo *power_config_info; + struct oa_soap_handler *oa_handler = NULL; + + if (oh_handler == NULL || control_state == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + power_config_info = &(oa_handler->power_config_info); + + /* Make a soap call to get the enclosure power config info */ + g_mutex_lock(oa_handler->mutex); + rv = soap_getPowerConfigInfo(oa_handler->active_con, + power_config_info, + &(oa_handler->desired_static_pwr_limit)); + g_mutex_unlock(oa_handler->mutex); + if (rv != SOAP_OK) { + err("Get enclosure power config info failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + if ((power_config_info->redundancyMode < NON_REDUNDANT) || + (power_config_info->redundancyMode > POWER_SUPPLY_REDUNDANT)) { + err("Invalid power mode state"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + else { + *control_state = power_config_info->redundancyMode; + } + + return SA_OK; +} + +/** + * oa_soap_set_pwr_mode_cntrl: + * @oh_handler: Handler data pointer + * @resource_id: Resource id + * @control state: Discrete control state + * + * Purpose: + * Sets the control state of the power mode control on resource + * + * Detailed Description: + * - Sets the power mode state of resource after mapping the control state + * appropriate power mode state + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_set_pwr_mode_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT control_state) +{ + SaErrorT rv = SA_OK; + struct powerConfigInfo *power_config_info; + struct oa_soap_handler *oa_handler = NULL; + + if (oh_handler == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + /* Return error if the control state is PULSE_ON or PULSE_OFF */ + if ((control_state < NON_REDUNDANT) || + (control_state > POWER_SUPPLY_REDUNDANT)) { + err("Cannot set the control state to %d - value out of range", control_state); + return SA_ERR_HPI_INVALID_DATA; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + power_config_info = &(oa_handler->power_config_info); + + power_config_info->redundancyMode = control_state; + + /* Make a soap call to set the enclosure power config info */ + rv = soap_setPowerConfigInfo(oa_handler->active_con, + power_config_info); + if (rv != SOAP_OK) { + err("Set enclosure power config info failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + return SA_OK; +} + +/** + * oa_soap_get_pwr_limit_mode_cntrl: + * @oh_handler: Handler data pointer + * @resource_id: Resource id + * @control state: Pointer to discrete control state + * + * Purpose: + * Gets the control state of the power limit mode control on resource + * + * Detailed Description: + * - Gets the power limit mode state of resource and maps it to control state + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_get_pwr_limit_mode_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT *control_state) +{ + SaErrorT rv = SA_OK; + struct powerConfigInfo *power_config_info; + struct powerCapConfig *power_cap_config; + struct oa_soap_handler *oa_handler = NULL; + + if (oh_handler == NULL || control_state == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + power_config_info = &(oa_handler->power_config_info); + power_cap_config = &(oa_handler->power_cap_config); + + /* Make a soap call to get the enclosure power config info */ + g_mutex_lock(oa_handler->mutex); + rv = soap_getPowerConfigInfo(oa_handler->active_con, + power_config_info, + &(oa_handler->desired_static_pwr_limit)); + g_mutex_unlock(oa_handler->mutex); + if (rv != SOAP_OK) { + err("Get enclosure power config info failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + /* Make a soap call to get the enclosure power dynamic power cap config */ + g_mutex_lock(oa_handler->mutex); + rv = soap_getPowerCapConfig(oa_handler->active_con, + power_cap_config, + &(oa_handler->desired_dynamic_pwr_cap)); + g_mutex_unlock(oa_handler->mutex); + if (rv != SOAP_OK) { + err("Get enclosure dynamic power cap config failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + if (power_config_info->powerCeiling > 0) { + *control_state = STATIC_POWER_LIMIT; + } + else { + if (power_cap_config->powerCap > 0) { + *control_state = DYNAMIC_POWER_CAP; + } else { + *control_state = POWER_LIMIT_NONE; + } + } + + return SA_OK; +} + +/** + * oa_soap_set_pwr_limit_mode_cntrl: + * @oh_handler: Handler data pointer + * @resource_id: Resource id + * @control state: Discrete control state + * + * Purpose: + * Sets the control state of the power limit mode control on resource + * + * Detailed Description: + * - Sets the power limit mode state of resource after mapping the control state + * appropriate power limit mode state + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_set_pwr_limit_mode_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT control_state) +{ + SaErrorT rv = SA_OK; + struct powerConfigInfo *power_config_info; + struct powerCapConfig *power_cap_config; + struct oa_soap_handler *oa_handler = NULL; + + if (oh_handler == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + /* Return error if the control state is out of range */ + if ((control_state < POWER_LIMIT_NONE) || + (control_state > DYNAMIC_POWER_CAP)) { + err("Cannot set the control state to %d - value out of range", control_state); + return SA_ERR_HPI_INVALID_DATA; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + power_config_info = &(oa_handler->power_config_info); + power_cap_config = &(oa_handler->power_cap_config); + + if (control_state == POWER_LIMIT_NONE) { + power_config_info->powerCeiling = 0; + power_cap_config->powerCap = 0; + } else { + if (control_state == STATIC_POWER_LIMIT) { + /* Checked desired setting, if non-zero - then send it - else user error */ + if (oa_handler->desired_static_pwr_limit > 0) { + power_config_info->powerCeiling = oa_handler->desired_static_pwr_limit; + power_cap_config->powerCap = 0; + } + else { + err("Cannot set the control state to %d - no static pwr limit value has been set", + control_state); + return SA_ERR_HPI_INVALID_DATA; + } + } else { + /* DYNAMIC_POWER_CAP */ + /* Checked desired setting, if non-zero - then send it - else user error */ + if (oa_handler->desired_dynamic_pwr_cap > 0) { + power_cap_config->powerCap = oa_handler->desired_dynamic_pwr_cap; + power_config_info->powerCeiling = 0; + } + else { + err("Cannot set the control state to %d - no dynamic pwr cap value has been set", + control_state); + return SA_ERR_HPI_INVALID_DATA; + } + } + } + + /* Make soaps calls to set the enclosure power config info, and dynamic power cap config */ + if (control_state == POWER_LIMIT_NONE) { + /* Must turn off dynamic power cap config, and reset power config info */ + rv = soap_setPowerCapConfig(oa_handler->active_con, + power_cap_config); + if (rv != SOAP_OK) { + err("Set enclosure power cap config failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + rv = soap_setPowerConfigInfo(oa_handler->active_con, + power_config_info); + if (rv != SOAP_OK) { + err("Set enclosure power config info failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + } else { + if (control_state == STATIC_POWER_LIMIT) { + /* Make a soap call to set the enclosure power config info */ + rv = soap_setPowerConfigInfo(oa_handler->active_con, + power_config_info); + if (rv != SOAP_OK) { + err("Set enclosure power config info failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + } + else { + /* DYNAMIC_POWER_CAP */ + /* Make a soap call to set the enclosure power cap config */ + rv = soap_setPowerCapConfig(oa_handler->active_con, + power_cap_config); + if (rv != SOAP_OK) { + err("Set enclosure power cap config failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + } + } + + return SA_OK; +} + +/** + * oa_soap_get_static_pwr_limit_cntrl: + * @oh_handler: Handler data pointer + * @resource_id: Resource id + * @control state: Pointer to analog control state + * + * Purpose: + * Gets the control state of the static power limit control on resource + * + * Detailed Description: + * - Gets the static power limit state of resource and maps it to control state + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_get_static_pwr_limit_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT *control_state) +{ + SaErrorT rv = SA_OK; + struct powerConfigInfo *power_config_info; + struct oa_soap_handler *oa_handler = NULL; + + if (oh_handler == NULL || control_state == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + power_config_info = &(oa_handler->power_config_info); + + /* Make a soap call to get the enclosure power config info */ + g_mutex_lock(oa_handler->mutex); + rv = soap_getPowerConfigInfo(oa_handler->active_con, + power_config_info, + &(oa_handler->desired_static_pwr_limit)); + g_mutex_unlock(oa_handler->mutex); + if (rv != SOAP_OK) { + err("Get enclosure power config info failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + /* Always report the OA view of the static power limit - regardless of the user's desired setting */ + *control_state = power_config_info->powerCeiling; + + return SA_OK; +} + +/** + * oa_soap_set_static_pwr_limit_cntrl: + * @oh_handler: Handler data pointer + * @resource_id: Resource id + * @control state: Analog control state + * + * Purpose: + * Sets the control state of the static power limit control on resource + * + * Detailed Description: + * - Sets the static power limit state of resource after mapping the control state + * appropriate static power limit state + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_set_static_pwr_limit_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT control_state) +{ + SaErrorT rv = SA_OK; + struct powerConfigInfo *power_config_info; + struct oa_soap_handler *oa_handler = NULL; + + if (oh_handler == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + power_config_info = &(oa_handler->power_config_info); + + oa_handler->desired_static_pwr_limit = control_state; + + /* If user already has the static power limit turned on, then let this new value go thru */ + if (power_config_info->powerCeiling != 0) { + power_config_info->powerCeiling = control_state; + + /* Make a soap call to set the enclosure power config info */ + rv = soap_setPowerConfigInfo(oa_handler->active_con, + power_config_info); + if (rv != SOAP_OK) { + err("Set enclosure power config info failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + } + + return SA_OK; +} + +/** + * oa_soap_get_dyanmic_pwr_cap_cntrl: + * @oh_handler: Handler data pointer + * @resource_id: Resource id + * @control state: Pointer to analog control state + * + * Purpose: + * Gets the control state of the dynamic power cap control on resource + * + * Detailed Description: + * - Gets the dynamic power cap state of resource and maps it to control state + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_get_dynamic_pwr_cap_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT *control_state) +{ + SaErrorT rv = SA_OK; + struct powerCapConfig *power_cap_config; + struct oa_soap_handler *oa_handler = NULL; + + if (oh_handler == NULL || control_state == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + power_cap_config = &(oa_handler->power_cap_config); + + /* Make a soap call to get the enclosure power cap config */ + g_mutex_lock(oa_handler->mutex); + rv = soap_getPowerCapConfig(oa_handler->active_con, + power_cap_config, + &(oa_handler->desired_dynamic_pwr_cap)); + g_mutex_unlock(oa_handler->mutex); + if (rv != SOAP_OK) { + err("Get enclosure power cap config failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + /* Always report the OA view of the dynamic power cap - regardless of the user's desired setting */ + *control_state = power_cap_config->powerCap; + + return SA_OK; +} + +/** + * oa_soap_set_dynamic_pwr_cap_cntrl: + * @oh_handler: Handler data pointer + * @resource_id: Resource id + * @control state: Analog control state + * + * Purpose: + * Sets the control state of the dynamic power cap control on resource + * + * Detailed Description: + * - Sets the dynamic power cap state of resource after mapping the control state + * appropriate dynamic power cap state + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_set_dynamic_pwr_cap_cntrl(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT control_state) +{ + SaErrorT rv = SA_OK; + struct powerConfigInfo *power_config_info; + struct powerCapConfig *power_cap_config; + struct oa_soap_handler *oa_handler = NULL; + + if (oh_handler == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + power_config_info = &(oa_handler->power_config_info); + power_cap_config = &(oa_handler->power_cap_config); + + oa_handler->desired_dynamic_pwr_cap = control_state; + + /* If user already has the dynamic power cap turned on, then let this new value go thru */ + if (power_cap_config->powerCap != 0) { + power_cap_config->powerCap = control_state; + + /* Make a soap call to set the enclosure power cap config */ + rv = soap_setPowerCapConfig(oa_handler->active_con, + power_cap_config); + if (rv != SOAP_OK) { + err("Set enclosure power cap config failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + } + + return SA_OK; +} + void *oh_get_control_state (void *, SaHpiResourceIdT, SaHpiCtrlNumT, Modified: openhpi/trunk/plugins/oa_soap/oa_soap_control.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_control.h 2010-04-15 10:51:55 UTC (rev 7062) +++ openhpi/trunk/plugins/oa_soap/oa_soap_control.h 2010-04-16 21:24:41 UTC (rev 7063) @@ -59,9 +59,12 @@ SaHpiCtrlModeT mode, SaHpiCtrlStateT *state); +/* Set analog limits to 0 if building a non-analog control. */ SaErrorT oa_soap_build_control_rdr(struct oh_handler_state *oh_handler, SaHpiRdrT *rdr, SaHpiResourceIdT resource_id, - SaHpiCtrlNumT control_num); + SaHpiCtrlNumT control_num, + int analogLimitLow, + int analogLimitHigh); #endif Modified: openhpi/trunk/plugins/oa_soap/oa_soap_discover.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_discover.c 2010-04-15 10:51:55 UTC (rev 7062) +++ openhpi/trunk/plugins/oa_soap/oa_soap_discover.c 2010-04-16 21:24:41 UTC (rev 7063) @@ -983,7 +983,7 @@ diag_ex_status[DIAG_EX_DEV_NOT_SUPPORT]) /* Build UID control rdr for Enclosure */ - OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_UID_CNTRL) + OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_UID_CNTRL, 0, 0) return SA_OK; } @@ -1216,7 +1216,7 @@ thermal_response) /* Build UID control rdr for OA */ - OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_UID_CNTRL) + OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_UID_CNTRL, 0, 0) status_request.bayNumber = response->bayNumber; rv = soap_getOaStatus(con, &status_request, &status_response); @@ -1735,10 +1735,10 @@ if (rpt->ResourceEntity.Entry[0].EntityType == SAHPI_ENT_SYSTEM_BLADE) { /* Build power control rdr for server */ - OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_PWR_CNTRL) + OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_PWR_CNTRL, 0, 0) } /* Build UID control rdr for server */ - OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_UID_CNTRL) + OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_UID_CNTRL, 0, 0) status_request.bayNumber = bay_number; rv = soap_getBladeStatus(con, &status_request, &status_response); @@ -2202,10 +2202,10 @@ thermal_response) /* Build power control rdr for server */ - OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_PWR_CNTRL) + OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_PWR_CNTRL, 0, 0) /* Build UID control rdr for server */ - OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_UID_CNTRL) + OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_UID_CNTRL, 0, 0) status_request.bayNumber = bay_number; rv = soap_getInterconnectTrayStatus(con, &status_request, @@ -2438,7 +2438,8 @@ memset(&rpt, 0, sizeof(SaHpiRptEntryT)); rpt.ResourceCapabilities = SAHPI_CAPABILITY_RDR | SAHPI_CAPABILITY_RESOURCE | - SAHPI_CAPABILITY_SENSOR; + SAHPI_CAPABILITY_SENSOR | + SAHPI_CAPABILITY_CONTROL; rpt.ResourceEntity.Entry[1].EntityType = SAHPI_ENT_ROOT; rpt.ResourceEntity.Entry[1].EntityLocation = 0; rpt.ResourceEntity.Entry[0].EntityType = SAHPI_ENT_POWER_MGMNT; @@ -2500,12 +2501,22 @@ struct powerSubsystemInfo response; SaHpiInt32T sensor_status; + struct powerConfigInfo *power_config_info; + struct powerCapConfig *power_cap_config; + xmlNode *extra_data; + struct extraDataInfo extra_data_info; + if (oh_handler == NULL) { err("Invalid parameter"); return SA_ERR_HPI_INVALID_PARAMS; } oa_handler = (struct oa_soap_handler *) oh_handler->data; + power_config_info = &(oa_handler->power_config_info); + power_cap_config = &(oa_handler->power_cap_config); + /* Initialize user's desired static power limit - and dynamic power cap to zero to start with */ + oa_handler->desired_static_pwr_limit = 0; + oa_handler->desired_dynamic_pwr_cap = 0; /* Build the input power sensor RDR */ OA_SOAP_BUILD_SENSOR_RDR(OA_SOAP_SEN_IN_PWR) @@ -2519,12 +2530,51 @@ /* Build the power capacity sensor RDR */ OA_SOAP_BUILD_SENSOR_RDR(OA_SOAP_SEN_PWR_CAPACITY) + /* Make a soap call to get the enclosure power config info */ + rv = soap_getPowerConfigInfo(oa_handler->active_con, + power_config_info, + &(oa_handler->desired_static_pwr_limit)); + if (rv != SOAP_OK) { + err("build_power_subsystem get power config info failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + /* Make a soap call to get the enclosure power cap config */ + rv = soap_getPowerCapConfig(oa_handler->active_con, + power_cap_config, + &(oa_handler->desired_dynamic_pwr_cap)); + if (rv != SOAP_OK) { + err("build_power_subsystem get power cap config failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + /* Build power mode control rdr for Enclosure */ + OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_PWR_MODE_CNTRL, 0, 0) + + /* Build dynamic power control rdr for Enclosure */ + OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_DYNAMIC_PWR_CNTRL, 0, 0); + + /* Build power limit mode control rdr for Enclosure */ + OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_PWR_LIMIT_MODE_CNTRL, 0, 0) + rv = soap_getPowerSubsystemInfo(oa_handler->active_con, &response); if (rv != SOAP_OK) { err("Get power subsystem info SOAP call failed"); return SA_ERR_HPI_INTERNAL_ERROR; } + extra_data = response.extraData; + while (extra_data) { + soap_getExtraData(extra_data, &extra_data_info); + if (!(strcmp(extra_data_info.name, "ACLimitLow"))) { + power_config_info->ACLimitLow = atoi(extra_data_info.value); + } + if (!(strcmp(extra_data_info.name, "ACLimitHigh"))) { + power_config_info->ACLimitHigh = atoi(extra_data_info.value); + } + extra_data = soap_next_node(extra_data); + } + /* Build operational status sensor rdr */ OA_SOAP_BUILD_ENABLE_SENSOR_RDR(OA_SOAP_SEN_OPER_STATUS, response.operationalStatus) @@ -2537,6 +2587,16 @@ OA_SOAP_BUILD_ENABLE_SENSOR_RDR(OA_SOAP_SEN_REDUND, response.redundancy) + /* Build static power limit control for Enclosure */ + OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_STATIC_PWR_LIMIT_CNTRL, + power_config_info->ACLimitLow, + power_config_info->ACLimitHigh) + + /* Build dynamic power cap config control rdr for Enclosure */ + OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_DYNAMIC_PWR_CAP_CNTRL, + power_cap_config->enclosurePowerCapLowerBound, + power_cap_config->enclosurePowerCapUpperBound); + return SA_OK; } @@ -3608,7 +3668,7 @@ } /* Build LCD button lock control rdr */ - OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_LCD_BUTN_LCK_CNTRL) + OA_SOAP_BUILD_CONTROL_RDR(OA_SOAP_LCD_BUTN_LCK_CNTRL, 0, 0) /* Build operational status sensor rdr */ rv = soap_getLcdStatus(oa_handler->active_con, &status); Modified: openhpi/trunk/plugins/oa_soap/oa_soap_discover.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_discover.h 2010-04-15 10:51:55 UTC (rev 7062) +++ openhpi/trunk/plugins/oa_soap/oa_soap_discover.h 2010-04-16 21:24:41 UTC (rev 7063) @@ -131,12 +131,13 @@ } \ } -/* Builds the control rdr */ -#define OA_SOAP_BUILD_CONTROL_RDR(control_num) \ +/* Builds the control rdr. */ +/* Set analog limits to 0 if building a non-analog control. */ +#define OA_SOAP_BUILD_CONTROL_RDR(control_num, analogLimitLow, analogLimitHigh) \ { \ memset(&rdr, 0, sizeof(SaHpiRdrT)); \ rv = oa_soap_build_control_rdr(oh_handler, &rdr, resource_id, \ - control_num); \ + control_num, analogLimitLow, analogLimitHigh); \ if (rv != SA_OK) { \ err("Failed to create rdr for control %x", control_num);\ return rv; \ Modified: openhpi/trunk/plugins/oa_soap/oa_soap_event.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_event.c 2010-04-15 10:51:55 UTC (rev 7062) +++ openhpi/trunk/plugins/oa_soap/oa_soap_event.c 2010-04-16 21:24:41 UTC (rev 7063) @@ -1120,6 +1120,9 @@ case EVENT_ENC_WIZARD_STATUS: dbg("EVENT_ENC_WIZARD_STATUS -- Not processed"); break; + ... [truncated message content] |
From: <mxb...@us...> - 2010-04-21 17:54:33
|
Revision: 7064 http://openhpi.svn.sourceforge.net/openhpi/?rev=7064&view=rev Author: mxbishop Date: 2010-04-21 17:54:26 +0000 (Wed, 21 Apr 2010) Log Message: ----------- Fix for enhancement #2984110 - Add dynamic power cap control support for OA firmare 3.0 Modified Paths: -------------- openhpi/trunk/include/SaHpiOaSoap.h openhpi/trunk/plugins/oa_soap/oa_soap.h openhpi/trunk/plugins/oa_soap/oa_soap_calls.c openhpi/trunk/plugins/oa_soap/oa_soap_calls.h openhpi/trunk/plugins/oa_soap/oa_soap_control.c openhpi/trunk/plugins/oa_soap/oa_soap_discover.c openhpi/trunk/plugins/oa_soap/oa_soap_discover.h openhpi/trunk/plugins/oa_soap/oa_soap_event.c openhpi/trunk/plugins/oa_soap/oa_soap_ps_event.c openhpi/trunk/plugins/oa_soap/oa_soap_resources.c openhpi/trunk/plugins/oa_soap/oa_soap_utils.c Modified: openhpi/trunk/include/SaHpiOaSoap.h =================================================================== --- openhpi/trunk/include/SaHpiOaSoap.h 2010-04-16 21:24:41 UTC (rev 7063) +++ openhpi/trunk/include/SaHpiOaSoap.h 2010-04-21 17:54:26 UTC (rev 7064) @@ -233,6 +233,14 @@ /* Dynamic Power Cap Control */ #define OA_SOAP_DYNAMIC_PWR_CAP_CNTRL (SaHpiCtrlNumT) 0x007 +/* The following 2 controls are only available in OA Firmware */ +/* version 3.00 and higher. */ + +/* Derated Circuit Cap Control */ +#define OA_SOAP_DERATED_CIRCUIT_CAP_CNTRL (SaHpiCtrlNumT) 0x008 +/* Rated Circuit Cap Control */ +#define OA_SOAP_RATED_CIRCUIT_CAP_CNTRL (SaHpiCtrlNumT) 0x009 + /* HP c7000 Power Modes */ #define C7000_PWR_NON_REDUNDANT 1 #define C7000_PWR_AC_REDUNDANT 2 Modified: openhpi/trunk/plugins/oa_soap/oa_soap.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap.h 2010-04-16 21:24:41 UTC (rev 7063) +++ openhpi/trunk/plugins/oa_soap/oa_soap.h 2010-04-21 17:54:26 UTC (rev 7064) @@ -105,7 +105,7 @@ #define OA_SOAP_RES_CNTRL_NUM (SaHpiCtrlNumT) 0x001 /* SOAP XML calls timeout values for event thread and hpi calls */ -#define HPI_CALL_TIMEOUT 10 +#define HPI_CALL_TIMEOUT 20 #define EVENT_CALL_TIMEOUT 40 /* Error code for SOAP XML calls */ @@ -203,10 +203,13 @@ /* This is local state for holding data for the */ /* enclosure power management controls. */ + double active_fm_ver; struct powerConfigInfo power_config_info; struct powerCapConfig power_cap_config; uint desired_static_pwr_limit; uint desired_dynamic_pwr_cap; + uint desired_derated_circuit_cap; + uint desired_rated_circuit_cap; }; /* Structure for storing the current hotswap state of the resource */ Modified: openhpi/trunk/plugins/oa_soap/oa_soap_calls.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_calls.c 2010-04-16 21:24:41 UTC (rev 7063) +++ openhpi/trunk/plugins/oa_soap/oa_soap_calls.c 2010-04-21 17:54:26 UTC (rev 7064) @@ -289,13 +289,14 @@ } /* parse_powerConfigInfo - Parses a getPowerConfigInfo response structure */ -static void parse_powerConfigInfo(xmlNode *node, struct powerConfigInfo *response) +static void parse_powerConfigInfo(xmlNode *node, \ + struct powerConfigInfo *response) { response->powerCeiling = atoi(soap_tree_value(node, "powerCeiling")); response->redundancyMode = - soap_enum(powerRedundancy_S, soap_tree_value(node, "redundancyMode")); + soap_enum(powerRedundancy_S, soap_tree_value(node, "redundancyMode")); response->dynamicPowerSaverEnabled = - parse_xsdBoolean(soap_tree_value(node, "dynamicPowerSaverEnabled")); + parse_xsdBoolean(soap_tree_value(node, "dynamicPowerSaverEnabled")); response->extraData = soap_walk_tree(node, "extraData"); } @@ -304,14 +305,37 @@ { xmlNode *bay_data; int i; + xmlNode *extra_data; + struct extraDataInfo extra_data_info; - response->enclosureMinWattageMeasured = atoi(soap_tree_value(node, "enclosureMinWattageMeasured")); - response->enclosureMaxWattageMeasured = atoi(soap_tree_value(node, "enclosureMaxWattageMeasured")); - response->enclosurePowerCapLowerBound = atoi(soap_tree_value(node, "enclosurePowerCapLowerBound")); - response->enclosurePowerCapUpperBound = atoi(soap_tree_value(node, "enclosurePowerCapUpperBound")); - response->enclosureHighLine = parse_xsdBoolean(soap_tree_value(node, "enclosureHighLine")); - response->enclosureAcPhaseType = atoi(soap_tree_value(node, "enclosureAcPhaseType")); - response->enclosureEstimatedVoltage = atoi(soap_tree_value(node, "enclosureEstimatedVoltage")); + response->enclosureMinWattageMeasured = atoi(soap_tree_value(node, + "enclosureMinWattageMeasured")); + response->enclosureMaxWattageMeasured = atoi(soap_tree_value(node, + "enclosureMaxWattageMeasured")); + response->enclosurePowerCapLowerBound = atoi(soap_tree_value(node, + "enclosurePowerCapLowerBound")); + + /* These limits default to above limit, unless there is extraData */ + response->deratedCircuitCapLowerBound = + response->enclosurePowerCapLowerBound; + response->ratedCircuitCapLowerBound = + response->enclosurePowerCapLowerBound; + + response->enclosurePowerCapUpperBound = atoi(soap_tree_value(node, + "enclosurePowerCapUpperBound")); + + /* These limits default to above limit, unless there is extraData */ + response->deratedCircuitCapUpperBound = + response->enclosurePowerCapUpperBound; + response->ratedCircuitCapUpperBound = + response->enclosurePowerCapUpperBound; + + response->enclosureHighLine = + parse_xsdBoolean(soap_tree_value(node, "enclosureHighLine")); + response->enclosureAcPhaseType = + atoi(soap_tree_value(node, "enclosureAcPhaseType")); + response->enclosureEstimatedVoltage = + atoi(soap_tree_value(node, "enclosureEstimatedVoltage")); response->powerCap = atoi(soap_tree_value(node, "powerCap")); response->extraData = soap_walk_tree(node, "extraData"); @@ -319,11 +343,42 @@ bay_data = soap_walk_tree(bay_data, "bay"); i = 0; while (bay_data) { - /* Copy optOutBayArray data for later use: data is either "true" or "false" */ + /* Copy optOutBayArray data for later use: */ + /* data is either "true" or "false" */ strncpy(response->optOutBayArray[i], soap_value(bay_data), 6); bay_data = soap_next_node(bay_data); i++; } + + response->deratedCircuitCap = 0; + response->ratedCircuitCap = 0; + extra_data = response->extraData; + while (extra_data) { + soap_getExtraData(extra_data, &extra_data_info); + if (!(strcmp(extra_data_info.name, "deratedCircuit"))) { + response->deratedCircuitCap = atoi(extra_data_info.value); + } else if (!(strcmp(extra_data_info.name, "ratedCircuit"))) { + response->ratedCircuitCap = atoi(extra_data_info.value); + } else if (!(strcmp(extra_data_info.name, + "deratedCircuitLowerBound"))) { + response->deratedCircuitCapLowerBound + = atoi(extra_data_info.value); + } else if (!(strcmp(extra_data_info.name, + "deratedCircuitUpperBound"))) { + response->deratedCircuitCapUpperBound + = atoi(extra_data_info.value); + } else if (!(strcmp(extra_data_info.name, + "ratedCircuitLowerBound"))) { + response->ratedCircuitCapLowerBound + = atoi(extra_data_info.value); + } else if (!(strcmp(extra_data_info.name, + "ratedCircuitUpperBound"))) { + response->ratedCircuitCapUpperBound + = atoi(extra_data_info.value); + } + extra_data = soap_next_node(extra_data); + } + } /* parse_oaStatus - Parses an oaStatus response structure */ @@ -465,29 +520,35 @@ soap_enum(presence_S, soap_tree_value(node, "presence")); temp_val=soap_tree_value(node, "modelNumber"); - if ( temp_val != NULL && (len = strlen(temp_val) < MAX_MODEL_NUM_LENGTH)) { + if (temp_val != NULL && (len = strlen(temp_val) < + MAX_MODEL_NUM_LENGTH)) { strcpy(response->modelNumber, temp_val); } else { - dbg("Internal Error: Power Supply modelNumber does not exist or too long"); + dbg("Internal Error: Power Supply modelNumber does not exist \ +or too long"); response->modelNumber[0] = '\0'; } temp_val=soap_tree_value(node, "sparePartNumber"); - if ( temp_val != NULL && (len = strlen(temp_val) < MAX_PART_NUM_LENGTH)) { + if (temp_val != NULL && (len = strlen(temp_val) + < MAX_PART_NUM_LENGTH)) { strcpy(response->sparePartNumber, temp_val); } else { - dbg("Internal Error: Power Supply modelNumber does not exist or too long"); + dbg("Internal Error: Power Supply modelNumber does not exist \ +or too long"); response->sparePartNumber[0] = '\0'; } temp_val=soap_tree_value(node, "serialNumber"); - if ( temp_val != NULL && (len = strlen(temp_val) < MAX_SERIAL_NUM_LENGTH)) { + if (temp_val != NULL && (len = strlen(temp_val) + < MAX_SERIAL_NUM_LENGTH)) { strcpy(response->serialNumber, temp_val); } else { - dbg("Internal Error: Power Supply modelNumber does not exist or too long"); + dbg("Internal Error: Power Supply modelNumber does not exist \ +or too long"); response->serialNumber[0] = '\0'; } @@ -1023,7 +1084,7 @@ result->entityId = atoi(soap_tree_value(node, "entityId")); result->entityInstance = atoi(soap_tree_value(node, "entityInstance")); result->criticalThreshold = - atoi(soap_tree_value(node, "criticalThreshold")); + atoi(soap_tree_value(node, "criticalThreshold")); result->cautionThreshold = atoi(soap_tree_value(node, "cautionThreshold")); result->temperatureC = atoi(soap_tree_value(node, "temperatureC")); @@ -1380,8 +1441,9 @@ response); } - /* If user's desired static power limit is 0, then update it with the OA value, */ - /* otherwise preserve the user's intention for a static power limit. */ + /* If user's desired static power limit is 0, then update it with */ + /* the OA value, otherwise preserve the user's intention for a */ + /* static power limit. */ if (*desired_static_pwr_limit == 0) { *desired_static_pwr_limit = response->powerCeiling; } @@ -1396,11 +1458,13 @@ char powerRedundancy[POWER_REDUNDANCY_LENGTH]; SOAP_PARM_CHECK_NRS - if (soap_inv_enum(hpoa_boolean, hpoa_boolean_S, request->dynamicPowerSaverEnabled)) { + if (soap_inv_enum(hpoa_boolean, hpoa_boolean_S, + request->dynamicPowerSaverEnabled)) { err("invalid dynamic power parameter"); return(-1); } - if (soap_inv_enum(powerRedundancy, powerRedundancy_S, request->redundancyMode)) { + if (soap_inv_enum(powerRedundancy, powerRedundancy_S, + request->redundancyMode)) { err("invalid power redundancy mode parameter"); return(-1); } @@ -1410,7 +1474,9 @@ int soap_getPowerCapConfig(SOAP_CON *con, struct powerCapConfig *response, - uint *desired_dynamic_pwr_cap_limit) + uint *desired_dynamic_pwr_cap_limit, + uint *desired_derated_circuit_cap_limit, + uint *desired_rated_circuit_cap_limit) { SOAP_PARM_CHECK_NRQ if (! (ret = soap_request(con, GET_POWER_CAP_CONFIG))) { @@ -1421,11 +1487,20 @@ response); } - /* If user's desired dynamic power cap limit is 0, then update it with the OA value, */ - /* otherwise preserve the user's intention for a dynamic power cap limit. */ + /* If user's desired dynamic power cap limit is 0, then update it */ + /* with the OA value, otherwise preserve the user's intention for */ + /* a dynamic power cap limit. */ + /* Do the same for the derated and rated circuit caps. */ if (*desired_dynamic_pwr_cap_limit == 0) { *desired_dynamic_pwr_cap_limit = response->powerCap; } + if (*desired_derated_circuit_cap_limit == 0) { + *desired_derated_circuit_cap_limit = + response->deratedCircuitCap; + } + if (*desired_rated_circuit_cap_limit == 0) { + *desired_rated_circuit_cap_limit = response->ratedCircuitCap; + } return(ret); } @@ -1451,7 +1526,8 @@ request->optOutBayArray[13], request->optOutBayArray[14], request->optOutBayArray[15], - "")); + request->deratedCircuitCap, + request->ratedCircuitCap)); } int soap_getOaStatus(SOAP_CON *con, @@ -1856,10 +1932,10 @@ SOAP_PARM_CHECK if (! (ret = soap_request(con, GET_BLADE_THERMAL_INFO_ARRAY, request->bayNumber))) { - parse_getBladeThermalInfoArray(soap_walk_doc(con->doc, - "Body:" - "getBladeThermalInfoArrayResponse"), - response); + parse_getBladeThermalInfoArray(soap_walk_doc(con->doc, + "Body:" + "getBladeThermalInfoArrayResponse"), + response); } return(ret); } Modified: openhpi/trunk/plugins/oa_soap/oa_soap_calls.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_calls.h 2010-04-16 21:24:41 UTC (rev 7063) +++ openhpi/trunk/plugins/oa_soap/oa_soap_calls.h 2010-04-21 17:54:26 UTC (rev 7064) @@ -124,41 +124,42 @@ "</hpoa:getPowerConfigInfo>\n" #define SET_POWER_CONFIG_INFO \ - "<hpoa:setPowerConfigInfo>" \ - "<hpoa:redundancyMode>%d</hpoa:redundancyMode>" \ - "<hpoa:powerCeiling>%d</hpoa:powerCeiling>" \ - "<hpoa:dynamicPowerSaverEnabled>%d</hpoa:dynamicPowerSaverEnabled>" \ - "</hpoa:setPowerConfigInfo>\n" + "<hpoa:setPowerConfigInfo>" \ + "<hpoa:redundancyMode>%d</hpoa:redundancyMode>" \ + "<hpoa:powerCeiling>%d</hpoa:powerCeiling>" \ + "<hpoa:dynamicPowerSaverEnabled>%d</hpoa:dynamicPowerSaverEnabled>" \ + "</hpoa:setPowerConfigInfo>\n" #define GET_POWER_CAP_CONFIG \ "<hpoa:getPowerCapConfig>" \ "</hpoa:getPowerCapConfig>\n" #define SET_POWER_CAP_CONFIG \ - "<hpoa:setPowerCapConfig>" \ - "<hpoa:config>" \ - "<hpoa:powerCap>%d</hpoa:powerCap>" \ - "<hpoa:optOutBayArray>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "<hpoa:bay>%s</hpoa:bay>" \ - "</hpoa:optOutBayArray>" \ - "<hpoa:extraData hpoa:name=\"\">%s</hpoa:extraData>" \ - "</hpoa:config>" \ - "</hpoa:setPowerCapConfig>\n" + "<hpoa:setPowerCapConfig>" \ + "<hpoa:config>" \ + "<hpoa:powerCap>%d</hpoa:powerCap>" \ + "<hpoa:optOutBayArray>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "<hpoa:bay>%s</hpoa:bay>" \ + "</hpoa:optOutBayArray>" \ + "<hpoa:extraData hpoa:name=\"deratedCircuit\">%d</hpoa:extraData>" \ + "<hpoa:extraData hpoa:name=\"ratedCircuit\">%d</hpoa:extraData>" \ + "</hpoa:config>" \ + "</hpoa:setPowerCapConfig>\n" #define GET_INTERCONNECT_TRAY_STATUS \ "<hpoa:getInterconnectTrayStatus>" \ @@ -1376,8 +1377,18 @@ int enclosureAcPhaseType; int enclosureEstimatedVoltage; int powerCap; - char optOutBayArray[OA_SOAP_C7000_MAX_BLADE][8]; /* holds true or false for each bay */ - xmlNode *extraData; /* Items are struct extraDataInfo */ + /* optOutBayArray holds true or false for each bay */ + char optOutBayArray[OA_SOAP_C7000_MAX_BLADE][8]; + /* Items are struct extraDataInfo */ + xmlNode *extraData; + /* The following are needed to hold values associated with */ + /* the derated and rated circuit caps. */ + int deratedCircuitCap; + int ratedCircuitCap; + int deratedCircuitCapLowerBound; + int deratedCircuitCapUpperBound; + int ratedCircuitCapLowerBound; + int ratedCircuitCapUpperBound; }; struct thermalInfo @@ -2049,7 +2060,9 @@ int soap_getPowerCapConfig(SOAP_CON *connection, struct powerCapConfig *response, - uint *desired_dynamic_pwr_cap_limit); + uint *desired_dynamic_pwr_cap_limit, + uint *desired_derated_circuit_cap, + uint *desired_rated_circuit_cap); int soap_setPowerCapConfig(SOAP_CON *connection, const struct powerCapConfig *request); Modified: openhpi/trunk/plugins/oa_soap/oa_soap_control.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_control.c 2010-04-16 21:24:41 UTC (rev 7063) +++ openhpi/trunk/plugins/oa_soap/oa_soap_control.c 2010-04-21 17:54:26 UTC (rev 7064) @@ -55,28 +55,41 @@ * * oa_soap_get_uid_cntrl() - Gets the UID control * - * oa_soap_set_dynamic_pwr_cntrl() - Sets the dynamic power control + * oa_soap_set_dynamic_pwr_cntrl() - Sets the dynamic pwr control * - * oa_soap_get_dynamic_pwr_cntrl() - Gets the dynamic power control + * oa_soap_get_dynamic_pwr_cntrl() - Gets the dynamic pwr control * - * oa_soap_set_pwr_mode_cntrl() - Sets the power mode control + * oa_soap_set_pwr_mode_cntrl() - Sets the pwr mode control * - * oa_soap_get_pwr_mode_cntrl() - Gets the power mode control + * oa_soap_get_pwr_mode_cntrl() - Gets the pwr mode control * - * oa_soap_set_pwr_limit_mode_cntrl() - Sets the power limit mode control + * oa_soap_set_pwr_limit_mode_cntrl() - Sets pwr limit mode control * - * oa_soap_get_pwr_limit_mode_cntrl() - Gets the power limit mode control + * oa_soap_get_pwr_limit_mode_cntrl() - Gets pwr limit mode control * - * oa_soap_set_static_pwr_limit_cntrl() - Sets the static power limit control + * oa_soap_set_static_pwr_limit_cntrl() - Sets static pwr limit control * - * oa_soap_get_static_pwr_limit_cntrl() - Gets the static power limit control + * oa_soap_get_static_pwr_limit_cntrl() - Gets static pwr limit control * - * oa_soap_set_dynamic_pwr_cap_cntrl() - Sets the dynamic power cap control + * oa_soap_set_dynamic_pwr_cap_cntrl() - Sets dynamic pwr cap control * - * oa_soap_get_dynamic_pwr_cap_cntrl() - Gets the dynamic power cap control + * oa_soap_get_dynamic_pwr_cap_cntrl() - Gets dynamic pwr cap control * + * oa_soap_set_derated_circuit_cap_cntrl() - Sets derated circuit cap + * control + * + * oa_soap_get_derated_circuit_cap_cntrl() - Gets derated circuit cap + * control + * + * oa_soap_set_rated_circuit_cap_cntrl() - Sets rated circuit cap + * control + * + * oa_soap_get_rated_circuit_cap_cntrl() - Gets the rated circuit cap + * control + * */ +#include <stdio.h> #include "oa_soap_control.h" /* Forward declaraction for static functions */ @@ -102,36 +115,62 @@ static SaErrorT oa_soap_get_uid_cntrl(struct oh_handler_state *oh_handler, SaHpiRptEntryT *rpt, SaHpiCtrlStateDigitalT *control_state); -static SaErrorT oa_soap_set_dynamic_pwr_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateDigitalT control_state); -static SaErrorT oa_soap_get_dynamic_pwr_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateDigitalT *control_state); -static SaErrorT oa_soap_set_pwr_mode_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateDiscreteT control_state); -static SaErrorT oa_soap_get_pwr_mode_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateDiscreteT *control_state); -static SaErrorT oa_soap_set_pwr_limit_mode_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateDiscreteT control_state); -static SaErrorT oa_soap_get_pwr_limit_mode_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateDiscreteT *control_state); -static SaErrorT oa_soap_set_static_pwr_limit_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateAnalogT control_state); -static SaErrorT oa_soap_get_static_pwr_limit_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateAnalogT *control_state); -static SaErrorT oa_soap_set_dynamic_pwr_cap_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateAnalogT control_state); -static SaErrorT oa_soap_get_dynamic_pwr_cap_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateAnalogT *control_state); +static SaErrorT oa_soap_set_dynamic_pwr_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDigitalT control_state); +static SaErrorT oa_soap_get_dynamic_pwr_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDigitalT *control_state); +static SaErrorT oa_soap_set_pwr_mode_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT control_state); +static SaErrorT oa_soap_get_pwr_mode_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT *control_state); +static SaErrorT oa_soap_set_pwr_limit_mode_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT control_state); +static SaErrorT oa_soap_get_pwr_limit_mode_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT *control_state); +static SaErrorT oa_soap_set_static_pwr_limit_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT control_state); +static SaErrorT oa_soap_get_static_pwr_limit_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT *control_state); +static SaErrorT oa_soap_set_dynamic_pwr_cap_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT control_state); +static SaErrorT oa_soap_get_dynamic_pwr_cap_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT *control_state); +static SaErrorT oa_soap_set_derated_circuit_cap_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT control_state); +static SaErrorT oa_soap_get_derated_circuit_cap_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT *control_state); +static SaErrorT oa_soap_set_rated_circuit_cap_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT control_state); +static SaErrorT oa_soap_get_rated_circuit_cap_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT *control_state); /** * oa_soap_get_control_state @@ -218,66 +257,95 @@ rv = oa_soap_get_pwr_cntrl(handler, resource_id, &control_digital_state); if (rv != SA_OK) { - err("Failed to get the power state RDR"); - return rv; + err("Failed to get the power state RDR"); + return rv; } break; case OA_SOAP_UID_CNTRL: rv = oa_soap_get_uid_cntrl(handler, rpt, &control_digital_state); if (rv != SA_OK) { - err("Failed to get the uid status"); - return rv; + err("Failed to get the uid status"); + return rv; } break; case OA_SOAP_LCD_BUTN_LCK_CNTRL: rv = oa_soap_get_lcd_butn_lck_cntrl(handler, rpt, &control_digital_state); if (rv != SA_OK) { - err("Failed to get the LCD button lock status"); - return rv; + err("Failed to get the LCD button lock status"); + return rv; } break; case OA_SOAP_DYNAMIC_PWR_CNTRL: - rv = oa_soap_get_dynamic_pwr_cntrl(handler, resource_id, - &control_digital_state); + rv = + oa_soap_get_dynamic_pwr_cntrl(handler, + resource_id, + &control_digital_state); if (rv != SA_OK) { - err("Failed to get the dynamic power state RDR"); - return rv; + err("Failed to get the dynamic power state RDR"); + return rv; } break; case OA_SOAP_PWR_MODE_CNTRL: - rv = oa_soap_get_pwr_mode_cntrl(handler, resource_id, - &control_discrete_state); + rv = + oa_soap_get_pwr_mode_cntrl(handler, resource_id, + &control_discrete_state); if (rv != SA_OK) { - err("Failed to get the power mode state RDR"); - return rv; + err("Failed to get the power mode state RDR"); + return rv; } break; case OA_SOAP_PWR_LIMIT_MODE_CNTRL: - rv = oa_soap_get_pwr_limit_mode_cntrl(handler, resource_id, - &control_discrete_state); + rv = + oa_soap_get_pwr_limit_mode_cntrl(handler, resource_id, + &control_discrete_state); if (rv != SA_OK) { - err("Failed to get the power limit mode state RDR"); - return rv; + err("Failed to get the power limit mode state RDR"); + return rv; } break; case OA_SOAP_STATIC_PWR_LIMIT_CNTRL: - rv = oa_soap_get_static_pwr_limit_cntrl(handler, resource_id, - &control_analog_state); + rv = + oa_soap_get_static_pwr_limit_cntrl(handler, + resource_id, + &control_analog_state); if (rv != SA_OK) { - err("Failed to get the static power limit state RDR"); - return rv; + err("Failed to get the static power limit state RDR"); + return rv; } break; case OA_SOAP_DYNAMIC_PWR_CAP_CNTRL: - rv = oa_soap_get_dynamic_pwr_cap_cntrl(handler, resource_id, - &control_analog_state); + rv = + oa_soap_get_dynamic_pwr_cap_cntrl(handler, + resource_id, + &control_analog_state); if (rv != SA_OK) { - err("Failed to get the dynamic power cap state RDR"); - return rv; + err("Failed to get the dynamic power cap state RDR"); + return rv; } break; + case OA_SOAP_DERATED_CIRCUIT_CAP_CNTRL: + rv = + oa_soap_get_derated_circuit_cap_cntrl(handler, + resource_id, + &control_analog_state); + if (rv != SA_OK) { + err("Failed to get the derated circuit cap state \ +RDR"); + return rv; + } + break; + case OA_SOAP_RATED_CIRCUIT_CAP_CNTRL: + rv = + oa_soap_get_rated_circuit_cap_cntrl(handler, + resource_id, + &control_analog_state); + if (rv != SA_OK) { + err("Failed to get the rated circuit cap state RDR"); + return rv; + } + break; default: err("Invalid control rdr num"); return SA_ERR_HPI_INTERNAL_ERROR; @@ -295,6 +363,8 @@ break; case OA_SOAP_STATIC_PWR_LIMIT_CNTRL: case OA_SOAP_DYNAMIC_PWR_CAP_CNTRL: + case OA_SOAP_DERATED_CIRCUIT_CAP_CNTRL: + case OA_SOAP_RATED_CIRCUIT_CAP_CNTRL: ctrl_state.StateUnion.Analog = control_analog_state; break; } @@ -396,18 +466,22 @@ return SA_ERR_HPI_INTERNAL_ERROR; } - /* If control mode is MANUAL and specified state could be digital, discrete, or - * analog type, then the control state is updated with specified state value + /* + * If control mode is MANUAL and specified state could be digital, + * discrete, or analog type, then the control state is updated + * with specified state value */ if (state->Type == SAHPI_CTRL_TYPE_DIGITAL) { ctrl->TypeUnion.Digital.Default = state->StateUnion.Digital; } else { if (state->Type == SAHPI_CTRL_TYPE_DISCRETE) { - ctrl->TypeUnion.Discrete.Default = state->StateUnion.Discrete; + ctrl->TypeUnion.Discrete.Default = + state->StateUnion.Discrete; } else { - ctrl->TypeUnion.Analog.Default = state->StateUnion.Analog; + ctrl->TypeUnion.Analog.Default = + state->StateUnion.Analog; } } switch (rdr_num) { @@ -415,66 +489,96 @@ rv = oa_soap_set_pwr_cntrl(handler, resource_id, state->StateUnion.Digital); if (rv != SA_OK) { - err("Set power state failed"); - return rv; + err("Set power state failed"); + return rv; } break; case OA_SOAP_UID_CNTRL: rv = oa_soap_set_uid_cntrl(handler, rpt, state->StateUnion.Digital); if (rv != SA_OK) { - err("Set uid state failed"); - return rv; + err("Set uid state failed"); + return rv; } break; case OA_SOAP_LCD_BUTN_LCK_CNTRL: rv = oa_soap_set_lcd_butn_lck_cntrl(handler, rpt, state->StateUnion.Digital); if (rv != SA_OK) { - err("Failed to set the LCD button lock status"); - return rv; + err("Failed to set the LCD button lock status"); + return rv; } break; case OA_SOAP_DYNAMIC_PWR_CNTRL: - rv = oa_soap_set_dynamic_pwr_cntrl(handler, resource_id, - state->StateUnion.Digital); + rv = + oa_soap_set_dynamic_pwr_cntrl(handler, + resource_id, + state->StateUnion.Digital); if (rv != SA_OK) { - err("Failed to set the dynamic power state"); - return rv; + err("Failed to set the dynamic power state"); + return rv; } break; case OA_SOAP_PWR_MODE_CNTRL: - rv = oa_soap_set_pwr_mode_cntrl(handler, resource_id, - state->StateUnion.Discrete); + rv = + oa_soap_set_pwr_mode_cntrl(handler, + resource_id, + state->StateUnion.Discrete); if (rv != SA_OK) { - err("Failed to set the power mode state"); - return rv; + err("Failed to set the power mode state"); + return rv; } break; case OA_SOAP_PWR_LIMIT_MODE_CNTRL: - rv = oa_soap_set_pwr_limit_mode_cntrl(handler, resource_id, - state->StateUnion.Discrete); + rv = + oa_soap_set_pwr_limit_mode_cntrl(handler, + resource_id, + state->StateUnion.Discrete); if (rv != SA_OK) { - err("Failed to set the power limit mode state"); - return rv; + err("Failed to set the power limit mode state"); + return rv; } break; case OA_SOAP_STATIC_PWR_LIMIT_CNTRL: - rv = oa_soap_set_static_pwr_limit_cntrl(handler, resource_id, - state->StateUnion.Analog); + rv = + oa_soap_set_static_pwr_limit_cntrl(handler, + resource_id, + state->StateUnion.Analog); if (rv != SA_OK) { - err("Failed to set the static power limit state"); - return rv; + err("Failed to set the static power limit state"); + return rv; } break; case OA_SOAP_DYNAMIC_PWR_CAP_CNTRL: - rv = oa_soap_set_dynamic_pwr_cap_cntrl(handler, resource_id, - state->StateUnion.Analog); + rv = + oa_soap_set_dynamic_pwr_cap_cntrl(handler, + resource_id, + state->StateUnion.Analog); if (rv != SA_OK) { - err("Failed to set the dynamic power cap state"); - return rv; + err("Failed to set the dynamic power cap state"); + return rv; } break; + case OA_SOAP_DERATED_CIRCUIT_CAP_CNTRL: + rv = + oa_soap_set_derated_circuit_cap_cntrl(handler, + resource_id, + state->StateUnion.Analog); + if (rv != SA_OK) { + err("Failed to set the derated circuit cap state"); + return rv; + } + break; + case OA_SOAP_RATED_CIRCUIT_CAP_CNTRL: + rv = + oa_soap_set_rated_circuit_cap_cntrl(handler, + resource_id, + state->StateUnion.Analog); + if (rv != SA_OK) { + err("Failed to set the rated circuit cap state"); + return rv; + } + break; default: err("Invalid control rdr num"); return SA_ERR_HPI_INTERNAL_ERROR; @@ -534,8 +638,10 @@ oa_soap_cntrl_arr[control_num].comment); if (rdr->RdrTypeUnion.CtrlRec.Type == SAHPI_CTRL_TYPE_ANALOG) { - rdr->RdrTypeUnion.CtrlRec.TypeUnion.Analog.Min = analogLimitLow; - rdr->RdrTypeUnion.CtrlRec.TypeUnion.Analog.Max = analogLimitHigh; + rdr->RdrTypeUnion.CtrlRec.TypeUnion.Analog.Min = + analogLimitLow; + rdr->RdrTypeUnion.CtrlRec.TypeUnion.Analog.Max = + analogLimitHigh; } return SA_OK; } @@ -1047,9 +1153,10 @@ * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered **/ -static SaErrorT oa_soap_get_dynamic_pwr_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateDigitalT *control_state) +static SaErrorT oa_soap_get_dynamic_pwr_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDigitalT *control_state) { SaErrorT rv = SA_OK; struct powerConfigInfo *power_config_info; @@ -1099,17 +1206,18 @@ * Sets the control state of the dynamic power control on resource * * Detailed Description: - * - Sets the dynamic power state of resource after mapping the control state - * appropriate dynamic power state + * - Sets the dynamic power state of resource after mapping the control + * state appropriate dynamic power state * * Return values: * SA_OK - Normal case. * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered **/ -static SaErrorT oa_soap_set_dynamic_pwr_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateDigitalT control_state) +static SaErrorT oa_soap_set_dynamic_pwr_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDigitalT control_state) { SaErrorT rv = SA_OK; struct powerConfigInfo *power_config_info; @@ -1164,9 +1272,10 @@ * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered **/ -static SaErrorT oa_soap_get_pwr_mode_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateDiscreteT *control_state) +static SaErrorT oa_soap_get_pwr_mode_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT *control_state) { SaErrorT rv = SA_OK; struct powerConfigInfo *power_config_info; @@ -1221,9 +1330,10 @@ * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered **/ -static SaErrorT oa_soap_set_pwr_mode_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateDiscreteT control_state) +static SaErrorT oa_soap_set_pwr_mode_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT control_state) { SaErrorT rv = SA_OK; struct powerConfigInfo *power_config_info; @@ -1237,7 +1347,8 @@ /* Return error if the control state is PULSE_ON or PULSE_OFF */ if ((control_state < NON_REDUNDANT) || (control_state > POWER_SUPPLY_REDUNDANT)) { - err("Cannot set the control state to %d - value out of range", control_state); + err("Cannot set the control state to %d - value out of range", + control_state); return SA_ERR_HPI_INVALID_DATA; } @@ -1267,16 +1378,18 @@ * Gets the control state of the power limit mode control on resource * * Detailed Description: - * - Gets the power limit mode state of resource and maps it to control state + * - Gets the power limit mode state of resource and maps it to + * control state * * Return values: * SA_OK - Normal case. * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered **/ -static SaErrorT oa_soap_get_pwr_limit_mode_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateDiscreteT *control_state) +static SaErrorT oa_soap_get_pwr_limit_mode_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT *control_state) { SaErrorT rv = SA_OK; struct powerConfigInfo *power_config_info; @@ -1303,11 +1416,14 @@ return SA_ERR_HPI_INTERNAL_ERROR; } - /* Make a soap call to get the enclosure power dynamic power cap config */ + /* Make a soap call to get the enclosure power dynamic power */ + /* cap config */ g_mutex_lock(oa_handler->mutex); rv = soap_getPowerCapConfig(oa_handler->active_con, power_cap_config, - &(oa_handler->desired_dynamic_pwr_cap)); + &(oa_handler->desired_dynamic_pwr_cap), + &(oa_handler->desired_derated_circuit_cap), + &(oa_handler->desired_rated_circuit_cap)); g_mutex_unlock(oa_handler->mutex); if (rv != SOAP_OK) { err("Get enclosure dynamic power cap config failed"); @@ -1338,17 +1454,18 @@ * Sets the control state of the power limit mode control on resource * * Detailed Description: - * - Sets the power limit mode state of resource after mapping the control state - * appropriate power limit mode state + * - Sets the power limit mode state of resource after mapping the + * control state appropriate power limit mode state * * Return values: * SA_OK - Normal case. * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered **/ -static SaErrorT oa_soap_set_pwr_limit_mode_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateDiscreteT control_state) +static SaErrorT oa_soap_set_pwr_limit_mode_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateDiscreteT control_state) { SaErrorT rv = SA_OK; struct powerConfigInfo *power_config_info; @@ -1363,7 +1480,8 @@ /* Return error if the control state is out of range */ if ((control_state < POWER_LIMIT_NONE) || (control_state > DYNAMIC_POWER_CAP)) { - err("Cannot set the control state to %d - value out of range", control_state); + err("Cannot set the control state to %d - value out of range", + control_state); return SA_ERR_HPI_INVALID_DATA; } @@ -1374,36 +1492,70 @@ if (control_state == POWER_LIMIT_NONE) { power_config_info->powerCeiling = 0; power_cap_config->powerCap = 0; + power_cap_config->deratedCircuitCap = 0; + power_cap_config->ratedCircuitCap = 0; } else { if (control_state == STATIC_POWER_LIMIT) { - /* Checked desired setting, if non-zero - then send it - else user error */ + /* Checked desired setting, if non-zero - then */ + /* send it - else user error */ if (oa_handler->desired_static_pwr_limit > 0) { - power_config_info->powerCeiling = oa_handler->desired_static_pwr_limit; + power_config_info->powerCeiling = + oa_handler->desired_static_pwr_limit; power_cap_config->powerCap = 0; + power_cap_config->deratedCircuitCap = 0; + power_cap_config->ratedCircuitCap = 0; } else { - err("Cannot set the control state to %d - no static pwr limit value has been set", + err("Cannot set the control state to %d - no \ +static pwr limit value has been set", control_state); return SA_ERR_HPI_INVALID_DATA; } } else { /* DYNAMIC_POWER_CAP */ - /* Checked desired setting, if non-zero - then send it - else user error */ + /* Checked power cap, if non-zero - then send it */ + /* - else user error */ if (oa_handler->desired_dynamic_pwr_cap > 0) { - power_cap_config->powerCap = oa_handler->desired_dynamic_pwr_cap; + power_cap_config->powerCap = + oa_handler->desired_dynamic_pwr_cap; power_config_info->powerCeiling = 0; } else { - err("Cannot set the control state to %d - no dynamic pwr cap value has been set", + err("Cannot set the control state to %d - no \ +dynamic pwr cap value has been set", control_state); return SA_ERR_HPI_INVALID_DATA; } + if (oa_handler->active_fm_ver >= 3.0) { + if (oa_handler->desired_derated_circuit_cap > 0) { + power_cap_config->deratedCircuitCap = + oa_handler->desired_derated_circuit_cap; + } + else { + err("Cannot set the control state to %d - no \ +derated circuit cap value has been set", + control_state); + return SA_ERR_HPI_INVALID_DATA; + } + if (oa_handler->desired_rated_circuit_cap > 0) { + power_cap_config->ratedCircuitCap = + oa_handler->desired_rated_circuit_cap; + } + else { + err("Cannot set the control state to %d - no \ +rated circuit cap value has been set", + control_state); + return SA_ERR_HPI_INVALID_DATA; + } + } } } - /* Make soaps calls to set the enclosure power config info, and dynamic power cap config */ + /* Make soaps calls to set the enclosure power config info, and */ + /* dynamic power cap config */ if (control_state == POWER_LIMIT_NONE) { - /* Must turn off dynamic power cap config, and reset power config info */ + /* Must turn off dynamic power cap config, and reset */ + /* power config info */ rv = soap_setPowerCapConfig(oa_handler->active_con, power_cap_config); if (rv != SOAP_OK) { @@ -1418,7 +1570,8 @@ } } else { if (control_state == STATIC_POWER_LIMIT) { - /* Make a soap call to set the enclosure power config info */ + /* Make a soap call to set the enclosure power */ + /* config info */ rv = soap_setPowerConfigInfo(oa_handler->active_con, power_config_info); if (rv != SOAP_OK) { @@ -1428,7 +1581,8 @@ } else { /* DYNAMIC_POWER_CAP */ - /* Make a soap call to set the enclosure power cap config */ + /* Make a soap call to set the enclosure power */ + /* cap config */ rv = soap_setPowerCapConfig(oa_handler->active_con, power_cap_config); if (rv != SOAP_OK) { @@ -1451,16 +1605,18 @@ * Gets the control state of the static power limit control on resource * * Detailed Description: - * - Gets the static power limit state of resource and maps it to control state + * - Gets the static power limit state of resource and maps it to + * control state * * Return values: * SA_OK - Normal case. * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered **/ -static SaErrorT oa_soap_get_static_pwr_limit_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateAnalogT *control_state) +static SaErrorT oa_soap_get_static_pwr_limit_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT *control_state) { SaErrorT rv = SA_OK; struct powerConfigInfo *power_config_info; @@ -1485,7 +1641,8 @@ return SA_ERR_HPI_INTERNAL_ERROR; } - /* Always report the OA view of the static power limit - regardless of the user's desired setting */ + /* Always report the OA view of the static power limit - regardless */ + /* of the user's desired setting */ *control_state = power_config_info->powerCeiling; return SA_OK; @@ -1501,17 +1658,18 @@ * Sets the control state of the static power limit control on resource * * Detailed Description: - * - Sets the static power limit state of resource after mapping the control state - * appropriate static power limit state + * - Sets the static power limit state of resource after mapping + * the control state appropriate static power limit state * * Return values: * SA_OK - Normal case. * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered **/ -static SaErrorT oa_soap_set_static_pwr_limit_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateAnalogT control_state) +static SaErrorT oa_soap_set_static_pwr_limit_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT control_state) { SaErrorT rv = SA_OK; struct powerConfigInfo *power_config_info; @@ -1527,7 +1685,8 @@ oa_handler->desired_static_pwr_limit = control_state; - /* If user already has the static power limit turned on, then let this new value go thru */ + /* If user already has the static power limit turned on, */ + /* then let this new value go thru */ if (power_config_info->powerCeiling != 0) { power_config_info->powerCeiling = control_state; @@ -1553,16 +1712,18 @@ * Gets the control state of the dynamic power cap control on resource * * Detailed Description: - * - Gets the dynamic power cap state of resource and maps it to control state + * - Gets the dynamic power cap state of resource and maps it to + * control state * * Return values: * SA_OK - Normal case. * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered **/ -static SaErrorT oa_soap_get_dynamic_pwr_cap_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateAnalogT *control_state) +static SaErrorT oa_soap_get_dynamic_pwr_cap_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT *control_state) { SaErrorT rv = SA_OK; struct powerCapConfig *power_cap_config; @@ -1580,14 +1741,17 @@ g_mutex_lock(oa_handler->mutex); rv = soap_getPowerCapConfig(oa_handler->active_con, power_cap_config, - &(oa_handler->desired_dynamic_pwr_cap)); + &(oa_handler->desired_dynamic_pwr_cap), + &(oa_handler->desired_derated_circuit_cap), + &(oa_handler->desired_rated_circuit_cap)); g_mutex_unlock(oa_handler->mutex); if (rv != SOAP_OK) { err("Get enclosure power cap config failed"); return SA_ERR_HPI_INTERNAL_ERROR; } - /* Always report the OA view of the dynamic power cap - regardless of the user's desired setting */ + /* Always report the OA view of the dynamic power cap - regardless of */ + /* the user's desired setting */ *control_state = power_cap_config->powerCap; return SA_OK; @@ -1603,17 +1767,18 @@ * Sets the control state of the dynamic power cap control on resource * * Detailed Description: - * - Sets the dynamic power cap state of resource after mapping the control state - * appropriate dynamic power cap state + * - Sets the dynamic power cap state of resource after mapping the + * control state appropriate dynamic power cap state * * Return values: * SA_OK - Normal case. * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered **/ -static SaErrorT oa_soap_set_dynamic_pwr_cap_cntrl(struct oh_handler_state *oh_handler, - SaHpiResourceIdT resource_id, - SaHpiCtrlStateAnalogT control_state) +static SaErrorT oa_soap_set_dynamic_pwr_cap_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT control_state) { SaErrorT rv = SA_OK; struct powerConfigInfo *power_config_info; @@ -1631,7 +1796,8 @@ oa_handler->desired_dynamic_pwr_cap = control_state; - /* If user already has the dynamic power cap turned on, then let this new value go thru */ + /* If user already has the dynamic power cap turned on, then let */ + /* this new value go thru */ if (power_cap_config->powerCap != 0) { power_cap_config->powerCap = control_state; @@ -1647,6 +1813,230 @@ return SA_OK; } +/** + * oa_soap_get_derated_circuit_cap_cntrl: + * @oh_handler: Handler data pointer + * @resource_id: Resource id + * @control state: Pointer to analog control state + * + * Purpose: + * Gets the control state of the derated circuit cap control on resource + * + * Detailed Description: + * - Gets the derated circuit cap state of resource and maps it to + * control state + * + * Return values: + * SA_OK - Normal case. + * SA_ERR_HPI_INVALID_PARAMS - On wrong parameter + * SA_ERR_HPI_INTERNAL_ERROR - Internal error encountered + **/ +static SaErrorT oa_soap_get_derated_circuit_cap_cntrl( + struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiCtrlStateAnalogT *control_state) +{ + SaErrorT rv = SA_OK; + struct powerCapConfig *power_cap_config; + struct oa_soap_handler *oa_handler = NULL; + + if (oh_handler == NULL || control_state == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + power_cap_config = &(oa_handler->power_cap_config); + + /* Make a soap call to get the enclosure power cap config */ + g_mutex_lock(oa_handler->mutex); + rv = soap_getPowerCapConfig(oa_handler->active_con, + power_cap_config, + &(oa_handler->desired_dynamic_pwr_cap), + &(oa_handler->desired_derated_circuit_cap), + &(oa_handler->desired_rated_circuit_cap)); + g_mutex_unlock(oa_handler->mutex); + if (rv != SOAP_OK) { + err("Get enclosure derated circuit cap config failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + /* Always report the OA view of the derated circuit cap - regardless */ + /* of the user's desired setting */ + *control_state = power_cap_config->deratedCircuitCap; + + return SA_OK; +} + +/** + * oa_soap_set_derated_circuit_cap_cntrl: + * @oh_handler: Handler data pointer + * @resource_id: Resource id + * @control state: Analog control state + * + * Pu... [truncated message content] |
From: <av...@us...> - 2010-05-21 11:03:02
|
Revision: 7078 http://openhpi.svn.sourceforge.net/openhpi/?rev=7078&view=rev Author: avpak Date: 2010-05-21 11:02:54 +0000 (Fri, 21 May 2010) Log Message: ----------- Feature request #3004865 Modified Paths: -------------- openhpi/trunk/baselib/oh_client.cpp openhpi/trunk/marshal/Makefile.am openhpi/trunk/marshal/marshal.c openhpi/trunk/marshal/marshal.h openhpi/trunk/marshal/strmsock.cpp openhpi/trunk/marshal/strmsock.h openhpi/trunk/openhpid/openhpid.cpp Modified: openhpi/trunk/baselib/oh_client.cpp =================================================================== --- openhpi/trunk/baselib/oh_client.cpp 2010-05-17 18:55:40 UTC (rev 7077) +++ openhpi/trunk/baselib/oh_client.cpp 2010-05-21 11:02:54 UTC (rev 7078) @@ -212,7 +212,7 @@ pinst->header.m_len = HpiMarshalRequest1(hm, request, &default_did); SendRecv(0, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, &domain_sid); @@ -262,7 +262,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) @@ -308,7 +308,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) @@ -357,7 +357,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, DomainInfo); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, DomainInfo); /* Set Domain Id to real Domain Id */ DomainInfo->DomainId = did; @@ -410,7 +410,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, NextEntryId, DrtEntry); + int mr = HpiDemarshalReply2(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, NextEntryId, DrtEntry); /* Set Domain Id to real Domain Id */ DrtEntry->DomainId = did; @@ -459,7 +459,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -509,7 +509,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, NextEntryId, RptEntry); + int mr = HpiDemarshalReply2(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, NextEntryId, RptEntry); if (request) free(request); @@ -556,7 +556,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, RptEntry); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, RptEntry); if (request) free(request); @@ -603,7 +603,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -648,7 +648,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -692,7 +692,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, EntityPath); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, EntityPath); if (request) free(request); @@ -736,7 +736,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, ResourceId); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, ResourceId); if (request) free(request); @@ -792,7 +792,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply4(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply4(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, InstanceId, ResourceId, InstrumentId, RptUpdateCount); @@ -844,7 +844,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply3(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply3(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, InstanceId, ChildEntityPath, RptUpdateCount); @@ -888,7 +888,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -932,7 +932,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Info); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Info); if (request) free(request); @@ -976,7 +976,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, EventLogCapabilities); if (request) @@ -1030,7 +1030,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply5(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, PrevEntryId, NextEntryId, EventLogEntry, &tmp_rdr, &tmp_rpt); + int mr = HpiDemarshalReply5(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, PrevEntryId, NextEntryId, EventLogEntry, &tmp_rdr, &tmp_rpt); if (Rdr != NULL) { memcpy(Rdr, &tmp_rdr, sizeof(SaHpiRdrT)); @@ -1095,7 +1095,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -1137,7 +1137,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -1182,7 +1182,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Time); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Time); if (request) free(request); @@ -1225,7 +1225,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -1270,7 +1270,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, EnableState); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, EnableState); if (request) free(request); @@ -1313,7 +1313,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -1355,7 +1355,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -1396,7 +1396,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -1437,7 +1437,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -1488,7 +1488,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply4(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Event, &tmp_rdr, &tmp_rpt, &tmp_status); + int mr = HpiDemarshalReply4(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Event, &tmp_rdr, &tmp_rpt, &tmp_status); if (Rdr != NULL) { memcpy(Rdr, &tmp_rdr, sizeof(SaHpiRdrT)); @@ -1543,7 +1543,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -1593,7 +1593,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Alarm); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Alarm); /* Set Alarm DomainId to actual DomainID since openhpi core lib has DEFAULT_DOMAIN_ID */ Alarm->AlarmCond.DomainId = did; @@ -1640,7 +1640,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Alarm); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Alarm); /* Set Alarm DomainId to actual DomainID since openhpi core lib has DEFAULT_DOMAIN_ID */ Alarm->AlarmCond.DomainId = did; @@ -1688,7 +1688,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -1734,7 +1734,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Alarm); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Alarm); /* Set Alarm DomainId to actual DomainID since openhpi core lib has DEFAULT_DOMAIN_ID */ Alarm->AlarmCond.DomainId = did; @@ -1782,7 +1782,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -1829,7 +1829,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, NextEntryId, Rdr); + int mr = HpiDemarshalReply2(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, NextEntryId, Rdr); if (request) free(request); @@ -1877,7 +1877,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Rdr); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Rdr); if (request) free(request); @@ -1922,7 +1922,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, UpdateCount); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, UpdateCount); if (request) free(request); @@ -1969,7 +1969,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, &tmp_reading, &tmp_state); + int mr = HpiDemarshalReply2(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, &tmp_reading, &tmp_state); if (Reading != NULL) { memcpy(Reading, &tmp_reading, sizeof(SaHpiSensorReadingT)); @@ -2022,7 +2022,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Thresholds); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Thresholds); if (request) free(request); @@ -2072,7 +2072,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -2119,7 +2119,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Type, Category); + int mr = HpiDemarshalReply2(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Type, Category); if (request) free(request); @@ -2165,7 +2165,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Enabled); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Enabled); if (request) free(request); @@ -2209,7 +2209,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -2255,7 +2255,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Enabled); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Enabled); if (request) free(request); @@ -2299,7 +2299,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -2349,7 +2349,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Assert, Deassert); + int mr = HpiDemarshalReply2(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Assert, Deassert); if (request) free(request); @@ -2396,7 +2396,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -2444,7 +2444,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Type); if (request) @@ -2506,7 +2506,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply2(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, &tmp_mode, &tmp_state); @@ -2577,7 +2577,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -2623,7 +2623,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Info); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Info); if (request) free(request); @@ -2678,7 +2678,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, NextAreaId, Header); + int mr = HpiDemarshalReply2(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, NextAreaId, Header); if (request) free(request); @@ -2730,7 +2730,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, AreaId); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, AreaId); if (request) free(request); @@ -2781,7 +2781,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -2827,7 +2827,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -2884,7 +2884,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, NextId, Field); + int mr = HpiDemarshalReply2(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, NextId, Field); if (request) free(request); @@ -2942,7 +2942,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Field); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Field); if (request) free(request); @@ -3000,7 +3000,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Field); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Field); if (request) free(request); @@ -3048,7 +3048,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -3095,7 +3095,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -3141,7 +3141,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Watchdog); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Watchdog); if (request) free(request); @@ -3196,7 +3196,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -3239,7 +3239,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -3289,7 +3289,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Announcement); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Announcement); if (request) free(request); @@ -3338,7 +3338,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Announcement); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Announcement); if (request) free(request); @@ -3393,7 +3393,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -3447,7 +3447,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Announcement); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Announcement); if (request) free(request); @@ -3503,7 +3503,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -3549,7 +3549,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Mode); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Mode); if (request) free(request); @@ -3595,7 +3595,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -3641,7 +3641,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, DimiInfo); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, DimiInfo); if (request) free(request); @@ -3684,7 +3684,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, DimiTest); @@ -3729,7 +3729,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, DimiReady); @@ -3780,7 +3780,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -3822,7 +3822,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -3872,7 +3872,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply2(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, ppercent, RunStatus); @@ -3917,7 +3917,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, TestResults); @@ -3967,7 +3967,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, SpecInfo); @@ -4011,7 +4011,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, ServiceImpact); @@ -4059,7 +4059,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -4101,7 +4101,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -4146,7 +4146,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, SourceInfo); @@ -4195,7 +4195,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply2(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, NextComponentEntryId, ComponentInfo); @@ -4240,7 +4240,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, BankInfo); @@ -4289,7 +4289,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply2(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, NextComponentEntryId, ComponentInfo); @@ -4333,7 +4333,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, BankInfo); @@ -4381,7 +4381,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply2(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply2(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, NextComponentEntryId, ComponentInfo); @@ -4422,7 +4422,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -4466,7 +4466,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -4510,7 +4510,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -4553,7 +4553,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -4599,7 +4599,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, UpgradeStatus); @@ -4642,7 +4642,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -4683,7 +4683,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -4726,7 +4726,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -4770,7 +4770,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Disable); @@ -4812,7 +4812,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -4853,7 +4853,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -4894,7 +4894,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -4936,7 +4936,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -4979,7 +4979,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -5023,7 +5023,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -5064,7 +5064,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -5106,7 +5106,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -5150,7 +5150,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Timeout); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Timeout); if (request) free(request); @@ -5196,7 +5196,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -5241,7 +5241,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Timeout); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Timeout); if (request) free(request); @@ -5288,7 +5288,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -5333,7 +5333,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, State); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, State); if (request) free(request); @@ -5378,7 +5378,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -5423,7 +5423,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, State); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, State); if (request) free(request); @@ -5468,7 +5468,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -5513,7 +5513,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -5556,7 +5556,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, LoadId); @@ -5603,7 +5603,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -5650,7 +5650,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, Action); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, Action); if (request) free(request); @@ -5695,7 +5695,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -5740,7 +5740,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, State); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, State); if (request) free(request); @@ -5785,7 +5785,7 @@ SendRecv(SessionId, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); if (request) free(request); @@ -5845,7 +5845,7 @@ SendRecv(0, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, id); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, id); oh_delete_connx(pinst); if (request) @@ -5881,7 +5881,7 @@ SendRecv(0, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err); + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); oh_delete_connx(pinst); if (request) @@ -5917,7 +5917,7 @@ SendRecv(0, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, info); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, info); oh_delete_connx(pinst); if (request) @@ -5953,7 +5953,7 @@ SendRecv(0, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, next_id); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, next_id); oh_delete_connx(pinst); if (request) @@ -5993,7 +5993,7 @@ SendRecv(0, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, @@ -6036,7 +6036,7 @@ SendRecv(0, cmd); - int mr = HpiDemarshalReply0(pinst->header.m_flags & dMhEndianBit, + int mr = HpiDemarshalReply0(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err); @@ -6076,7 +6076,7 @@ SendRecv(0, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, param); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, param); oh_delete_connx(pinst); if (request) @@ -6112,7 +6112,7 @@ SendRecv(0, cmd); - int mr = HpiDemarshalReply1(pinst->header.m_flags & dMhEndianBit, hm, reply + sizeof(cMessageHeader), &err, param); + int mr = HpiDemarshalReply1(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, param); oh_delete_connx(pinst); if (request) @@ -6156,7 +6156,7 @@ SendRecv(0, cmd); - int mr = HpiDemarshalReply4(pinst->header.m_flags & dMhEndianBit, + int mr = HpiDemarshalReply4(pinst->remote_byte_order, hm, reply + sizeof(cMessageHeader), &err, &id, event, rpte, rdr); Modified: openhpi/trunk/marshal/Makefile.am =================================================================== --- openhpi/trunk/marshal/Makefile.am 2010-05-17 18:55:40 UTC (rev 7077) +++ openhpi/trunk/marshal/Makefile.am 2010-05-21 11:02:54 UTC (rev 7078) @@ -48,7 +48,6 @@ strmsock.cpp libohtcpconnx_la_LDFLAGS= -version-info @HPI_LIB_VERSION@ -libohtcpconnx_la_LIBADD = $(top_builddir)/marshal/libopenhpimarshal.la clean-local: rm -f *~ core core.* Modified: openhpi/trunk/marshal/marshal.c =================================================================== --- openhpi/trunk/marshal/marshal.c 2010-05-17 18:55:40 UTC (rev 7077) +++ openhpi/trunk/marshal/marshal.c 2010-05-21 11:02:54 UTC (rev 7078) @@ -79,16 +79,7 @@ }; -int -MarshalByteOrder() -{ - if ( G_BYTE_ORDER == G_LITTLE_ENDIAN ) - return 1; - return 0; -} - - int IsSimpleType( tMarshalType type ) { @@ -610,7 +601,7 @@ tUint16 v; memcpy( &v, buffer, sizeof( tUint16 ) ); - if ( MarshalByteOrder() != byte_order ) + if ( G_BYTE_ORDER != byte_order ) v = GUINT16_SWAP_LE_BE( v ); *(tUint16 *)data = v; @@ -624,7 +615,7 @@ tUint32 v; memcpy( &v, buffer, sizeof( tUint32 ) ); - if ( MarshalByteOrder() != byte_order ) + if ( G_BYTE_ORDER != byte_order ) v = GUINT32_SWAP_LE_BE( v ); *(tUint32 *)data = v; @@ -638,7 +629,7 @@ tUint64 v; memcpy( &v, buffer, sizeof( tUint64 ) ); - if ( MarshalByteOrder() != byte_order ) + if ( G_BYTE_ORDER != byte_order ) v = GUINT64_SWAP_LE_BE( v ); *(tUint64 *)data = v; @@ -652,7 +643,7 @@ tFloat32Uint32 v; memcpy( &(v.m_f32), buffer, sizeof( tFloat32 ) ); - if ( MarshalByteOrder() != byte_order ) + if ( G_BYTE_ORDER != byte_order ) v.m_u32 = GUINT32_SWAP_LE_BE( v.m_u32 ); *(tFloat32 *)data = v.m_f32; @@ -666,7 +657,7 @@ tFloat64Uint64 v; memcpy( &(v.m_f64), buffer, sizeof( tFloat64 ) ); - if ( MarshalByteOrder() != byte_order ) + if ( G_BYTE_ORDER != byte_order ) v.m_u64 = GUINT64_SWAP_LE_BE( v.m_u64 ); *(tFloat64 *)data = v.m_f64; Modified: openhpi/trunk/marshal/marshal.h =================================================================== --- openhpi/trunk/marshal/marshal.h 2010-05-17 18:55:40 UTC (rev 7077) +++ openhpi/trunk/marshal/marshal.h 2010-05-21 11:02:54 UTC (rev 7078) @@ -224,9 +224,6 @@ extern cMarshalType Marshal_Float64Type; -// marshal order used -int MarshalByteOrder( void ); - // size in bytes int MarshalSize( const cMarshalType *type ); int MarshalSizeArray( const cMarshalType **types ); Modified: openhpi/trunk/marshal/strmsock.cpp =================================================================== --- openhpi/trunk/marshal/strmsock.cpp 2010-05-17 18:55:40 UTC (rev 7077) +++ openhpi/trunk/marshal/strmsock.cpp 2010-05-21 11:02:54 UTC (rev 7078) @@ -11,6 +11,7 @@ * * Author(s): * W. David Ashley <da...@us...> + * Anton Pak <ant...@pi...> * */ @@ -28,7 +29,6 @@ #include <glib.h> #include "strmsock.h" -#include "marshal.h" // Local definitions @@ -162,8 +162,9 @@ return true; } memcpy(&header, data, sizeof(cMessageHeader)); + remote_byte_order = ( ( header.m_flags & dMhEndianBit ) != 0 ) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN; // swap id and len if nessesary in the reply header - if ((header.m_flags & dMhEndianBit) != MarshalByteOrder()) { + if (remote_byte_order != G_BYTE_ORDER) { header.m_id = GUINT32_SWAP_LE_BE(header.m_id); header.m_len = GUINT32_SWAP_LE_BE(header.m_len); } @@ -192,9 +193,11 @@ header.m_flags &= 0x0f; header.m_flags |= dMhVersion << 4; - // set endian - header.m_flags &= ~dMhEndianBit; - header.m_flags |= MarshalByteOrder(); + // set byte order + header.m_flags &= ~dMhEndianBit; + if ( G_BYTE_ORDER == G_LITTLE_ENDIAN ) { + header.m_flags |= dMhEndianBit; + } header.m_id = id; header.m_len = len; Modified: openhpi/trunk/marshal/strmsock.h =================================================================== --- openhpi/trunk/marshal/strmsock.h 2010-05-17 18:55:40 UTC (rev 7077) +++ openhpi/trunk/marshal/strmsock.h 2010-05-21 11:02:54 UTC (rev 7078) @@ -11,6 +11,7 @@ * * Author(s): * W. David Ashley <da...@us...> + * Anton Pak <ant...@pi...> * */ @@ -23,16 +24,7 @@ #include <sys/socket.h> #include <netinet/in.h> -#ifdef __cplusplus -extern "C" { -#endif - #include <SaHpi.h> - -#ifdef __cplusplus -} -#endif - #ifndef TRUE @@ -48,6 +40,7 @@ #define dMhGetVersion(flags) (((flags)>>4) & 0x7) // message flags +// if bit is set the byte order is Little Endian #define dMhEndianBit 1 #define dMhRequest 0 @@ -104,6 +97,7 @@ virtual bool ReadMsg (char *); cMessageHeader header; // message header int errcode; // errno contents + int remote_byte_order; }; typedef strmsock *pstrmsock; Modified: openhpi/trunk/openhpid/openhpid.cpp =================================================================== --- openhpi/trunk/openhpid/openhpid.cpp 2010-05-17 18:55:40 UTC (rev 7077) +++ openhpi/trunk/openhpid/openhpid.cpp 2010-05-21 11:02:54 UTC (rev 7078) @@ -471,14 +471,9 @@ tResult result = eResultReply; char *pReq = data + sizeof(cMessageHeader); gpointer thrdid = g_thread_self(); - unsigned char request_mFlags; hm = HpiMarshalFind(thrdinst->header.m_id); - // keep a local copy of the requests flags - // before it is overwritten in the MessageHeaderInit below. - request_mFlags = thrdinst->header.m_flags; - // init reply header thrdinst->MessageHeaderInit((tMessageType) thrdinst->header.m_type, 0, thrdinst->header.m_id, hm->m_reply_len ); @@ -492,7 +487,7 @@ PVERBOSE1("%p Processing saHpiSessionOpen.", thrdid); - if ( HpiDemarshalRequest1( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest1( thrdinst->remote_byte_order, hm, pReq, &domain_id ) < 0 ) return eResultError; @@ -510,7 +505,7 @@ PVERBOSE1("%p Processing saHpiSessionClose.", thrdid); - if ( HpiDemarshalRequest1( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest1( thrdinst->remote_byte_order, hm, pReq, &session_id ) < 0 ) return eResultError; @@ -527,7 +522,7 @@ PVERBOSE1("%p Processing saHpiDiscover.", thrdid); - if ( HpiDemarshalRequest1( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest1( thrdinst->remote_byte_order, hm, pReq, &session_id ) < 0 ) return eResultError; @@ -543,7 +538,7 @@ PVERBOSE1("%p Processing saHpiDomainInfoGet.", thrdid); - if ( HpiDemarshalRequest1( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest1( thrdinst->remote_byte_order, hm, pReq, &session_id ) < 0 ) return eResultError; @@ -561,7 +556,7 @@ PVERBOSE1("%p Processing saHpiDrtEntryGet.", thrdid); - if ( HpiDemarshalRequest2( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest2( thrdinst->remote_byte_order, hm, pReq, &session_id, &entry_id ) < 0 ) return eResultError; @@ -578,7 +573,7 @@ PVERBOSE1("%p Processing saHpiDomainTagSet.", thrdid); - if ( HpiDemarshalRequest2( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest2( thrdinst->remote_byte_order, hm, pReq, &session_id, &domain_tag ) < 0 ) return eResultError; @@ -596,7 +591,7 @@ PVERBOSE1("%p Processing saHpiRptEntryGet.", thrdid); - if ( HpiDemarshalRequest2( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest2( thrdinst->remote_byte_order, hm, pReq, &session_id, &entry_id ) < 0 ) return eResultError; @@ -613,7 +608,7 @@ PVERBOSE1("%p Processing saHpiRptEntryGetByResourceId.", thrdid); - if ( HpiDemarshalRequest2( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest2( thrdinst->remote_byte_order, hm, pReq, &session_id, &resource_id ) < 0 ) return eResultError; @@ -630,7 +625,7 @@ PVERBOSE1("%p Processing saHpiResourceSeveritySet.", thrdid); - if ( HpiDemarshalRequest3( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest3( thrdinst->remote_byte_order, hm, pReq, &session_id, &resource_id, &severity ) < 0 ) return eResultError; @@ -650,7 +645,7 @@ PVERBOSE1("%p Processing saHpiResourceTagSet.", thrdid); - if ( HpiDemarshalRequest3( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest3( thrdinst->remote_byte_order, hm, pReq, &session_id, &resource_id, &resource_tag ) < 0 ) return eResultError; @@ -667,7 +662,7 @@ PVERBOSE1("%p Processing saHpiMyEntityPathGet.", thrdid); - if ( HpiDemarshalRequest1( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest1( thrdinst->remote_byte_order, hm, pReq, &session_id ) < 0 ) return eResultError; @@ -683,7 +678,7 @@ PVERBOSE1("%p Processing saHpiResourceIdGet.", thrdid); - if ( HpiDemarshalRequest1( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest1( thrdinst->remote_byte_order, hm, pReq, &session_id ) < 0 ) return eResultError; @@ -707,7 +702,7 @@ PVERBOSE1("%p Processing saHpiGetIdByEntityPath.", thrdid); - if ( HpiDemarshalRequest4( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest4( thrdinst->remote_byte_order, hm, pReq, &session_id, &entity_path, &instrument_type, &instance_id ) < 0 ) @@ -738,7 +733,7 @@ PVERBOSE1("%p Processing saHpiGetChildEntityPath.", thrdid); - if ( HpiDemarshalRequest3( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest3( thrdinst->remote_byte_order, hm, pReq, &session_id, &parent_ep, &instance_id ) < 0 ) @@ -761,7 +756,7 @@ PVERBOSE1("%p Processing saHpiResourceFailedRemove.", thrdid); - if ( HpiDemarshalRequest2( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest2( thrdinst->remote_byte_order, hm, pReq, &session_id, &resource_id ) < 0 ) return eResultError; @@ -779,7 +774,7 @@ PVERBOSE1("%p Processing saHpiEventLogInfoGet.", thrdid); - if ( HpiDemarshalRequest2( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest2( thrdinst->remote_byte_order, hm, pReq, &session_id, &resource_id ) < 0 ) return eResultError; @@ -796,7 +791,7 @@ PVERBOSE1("%p Processing saHpiEventLogCapabilitiesGet.", thrdid); - if ( HpiDemarshalRequest2( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest2( thrdinst->remote_byte_order, hm, pReq, &session_id, &resource_id ) < 0 ) return eResultError; @@ -822,7 +817,7 @@ memset( &rpt_entry, 0, sizeof( SaHpiRptEntryT ) ); memset( &event_log_entry, 0, sizeof( SaHpiEventLogEntryT ) ); - if ( HpiDemarshalRequest3( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest3( thrdinst->remote_byte_order, hm, pReq, &session_id, &resource_id, &entry_id ) < 0 ) return eResultError; @@ -843,7 +838,7 @@ PVERBOSE1("%p Processing saHpiEventLogEntryAdd.", thrdid); - if ( HpiDemarshalRequest3( request_mFlags & dMhEndianBit, + if ( HpiDemarshalRequest3( thrdinst->remote_byte_order, hm, pReq, &session_id, &resource_id, &evt_entry ) < 0 ) return eR... [truncated message content] |
From: <av...@us...> - 2010-05-21 21:52:59
|
Revision: 7080 http://openhpi.svn.sourceforge.net/openhpi/?rev=7080&view=rev Author: avpak Date: 2010-05-21 21:52:52 +0000 (Fri, 21 May 2010) Log Message: ----------- Feature requests #3005255 and #3005257 Modified Paths: -------------- openhpi/trunk/Makefile.am openhpi/trunk/baselib/Makefile.am openhpi/trunk/baselib/oh_client_session.h openhpi/trunk/configure.ac openhpi/trunk/hpi_shell/Makefile.am openhpi/trunk/marshal/Makefile.am openhpi/trunk/openhpi.spec.in openhpi/trunk/openhpid/Makefile.am Added Paths: ----------- openhpi/trunk/transport/ openhpi/trunk/transport/Makefile.am openhpi/trunk/transport/strmsock.cpp openhpi/trunk/transport/strmsock.h Removed Paths: ------------- openhpi/trunk/marshal/connection.c openhpi/trunk/marshal/connection.h openhpi/trunk/marshal/strmsock.cpp openhpi/trunk/marshal/strmsock.h Modified: openhpi/trunk/Makefile.am =================================================================== --- openhpi/trunk/Makefile.am 2010-05-21 13:33:28 UTC (rev 7079) +++ openhpi/trunk/Makefile.am 2010-05-21 21:52:52 UTC (rev 7080) @@ -53,8 +53,8 @@ MOSTLYCLEANFILES = tags -SUBDIRS = utils scripts @SSLDIR@ @SNMPDIR@ @MARSHALDIR@ baselib plugins docs @ENABLED_DIRS@ hpi_shell -DIST_SUBDIRS = utils scripts snmp ssl marshal baselib plugins docs openhpid clients cpp hpi_shell +SUBDIRS = utils scripts @SSLDIR@ @SNMPDIR@ transport marshal baselib plugins docs @ENABLED_DIRS@ hpi_shell +DIST_SUBDIRS = utils scripts snmp ssl transport marshal baselib plugins docs openhpid clients cpp hpi_shell DISTCHECK_CONFIGURE_FLAGS = --with-initdir=prefix @@ -74,6 +74,8 @@ -name '*.[chS]' -print | grep -v '/t/') \ $(shell find $(top_srcdir)/ssl -name .svn -o -name CVS -prune -o \ -name '*.[chS]' -print | grep -v '/t/') \ + $(shell find $(top_srcdir)/transport -name .svn -o -name CVS -prune -o \ + -name '*.[chS]' -print | grep -v '/t/') \ $(shell find $(top_srcdir)/marshal -name .svn -o -name CVS -prune -o \ -name '*.[chS]' -print | grep -v '/t/') \ $(shell find $(top_srcdir)/clients -name .svn -o -name CVS -prune -o \ Modified: openhpi/trunk/baselib/Makefile.am =================================================================== --- openhpi/trunk/baselib/Makefile.am 2010-05-21 13:33:28 UTC (rev 7079) +++ openhpi/trunk/baselib/Makefile.am 2010-05-21 21:52:52 UTC (rev 7080) @@ -18,7 +18,7 @@ MAINTAINERCLEANFILES = Makefile.in *~ INCLUDES = \ - @OPENHPI_INCLUDES@ -I$(top_srcdir)/marshal @OH_SSL_INCLUDES@ + @OPENHPI_INCLUDES@ -I$(top_srcdir)/transport -I$(top_srcdir)/marshal @OH_SSL_INCLUDES@ EXTRA_DIST = \ oh_client.h oh_client_conf.h oh_client_session.h @@ -28,7 +28,7 @@ libopenhpi_la_SOURCES = oh_client.cpp oh_client_session.cpp oh_client_conf.c libopenhpi_la_LDFLAGS = -version-info @HPI_LIB_VERSION@ -libopenhpi_la_LIBADD = $(top_builddir)/marshal/libohtcpconnx.la -lstdc++ \ +libopenhpi_la_LIBADD = $(top_builddir)/transport/libopenhpitransport.la -lstdc++ \ $(top_builddir)/marshal/libopenhpimarshal.la \ $(top_builddir)/utils/libopenhpiutils.la Modified: openhpi/trunk/baselib/oh_client_session.h =================================================================== --- openhpi/trunk/baselib/oh_client_session.h 2010-05-21 13:33:28 UTC (rev 7079) +++ openhpi/trunk/baselib/oh_client_session.h 2010-05-21 21:52:52 UTC (rev 7080) @@ -18,7 +18,7 @@ #ifndef __OH_CLIENT_SESSION_H #define __OH_CLIENT_SESSION_H -#include "strmsock.h" +#include <strmsock.h> extern "C" { Modified: openhpi/trunk/configure.ac =================================================================== --- openhpi/trunk/configure.ac 2010-05-21 13:33:28 UTC (rev 7079) +++ openhpi/trunk/configure.ac 2010-05-21 21:52:52 UTC (rev 7080) @@ -410,9 +410,6 @@ fi ]) -dnl enable marshal library -AC_SUBST(MARSHALDIR,marshal) - dnl dnl create static plugin config dnl @@ -697,6 +694,7 @@ utils/t/el/Makefile utils/t/uid/Makefile utils/t/ann/Makefile + transport/Makefile marshal/Makefile marshal/t/Makefile plugins/Makefile Modified: openhpi/trunk/hpi_shell/Makefile.am =================================================================== --- openhpi/trunk/hpi_shell/Makefile.am 2010-05-21 13:33:28 UTC (rev 7079) +++ openhpi/trunk/hpi_shell/Makefile.am 2010-05-21 21:52:52 UTC (rev 7080) @@ -11,7 +11,7 @@ INCLUDES += -I$(top_srcdir)/openhpid \ -I$(top_srcdir)/marshal \ -DCLIENT -COMMONLIBS = $(top_builddir)/marshal/libohtcpconnx.la \ +COMMONLIBS = $(top_builddir)/transport/libopenhpitransport.la \ $(top_builddir)/utils/libopenhpiutils.la \ $(top_builddir)/baselib/libopenhpi.la Modified: openhpi/trunk/marshal/Makefile.am =================================================================== --- openhpi/trunk/marshal/Makefile.am 2010-05-21 13:33:28 UTC (rev 7079) +++ openhpi/trunk/marshal/Makefile.am 2010-05-21 21:52:52 UTC (rev 7080) @@ -24,7 +24,7 @@ LIBS = # marshal and connection used by the daemon and client library -lib_LTLIBRARIES = libopenhpimarshal.la libohudpconnx.la libohtcpconnx.la +lib_LTLIBRARIES = libopenhpimarshal.la libopenhpimarshal_la_SOURCES = \ marshal_hpi.h \ @@ -36,18 +36,5 @@ libopenhpimarshal_la_LDFLAGS= -version-info @HPI_LIB_VERSION@ -libohudpconnx_la_SOURCES = \ - connection.h \ - connection.c - -libohudpconnx_la_LDFLAGS= -version-info @HPI_LIB_VERSION@ -libohudpconnx_la_LIBADD = $(top_builddir)/marshal/libopenhpimarshal.la - -libohtcpconnx_la_SOURCES = \ - strmsock.h \ - strmsock.cpp - -libohtcpconnx_la_LDFLAGS= -version-info @HPI_LIB_VERSION@ - clean-local: rm -f *~ core core.* Deleted: openhpi/trunk/marshal/connection.c =================================================================== --- openhpi/trunk/marshal/connection.c 2010-05-21 13:33:28 UTC (rev 7079) +++ openhpi/trunk/marshal/connection.c 2010-05-21 21:52:52 UTC (rev 7080) @@ -1,697 +0,0 @@ -/* - * socket and message handling - * - * Copyright (c) 2004 by FORCE Computers. - * - * This program 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. This - * file and program are licensed under a BSD style license. See - * the Copying file included with the OpenHPI distribution for - * full licensing terms. - * - * Authors: - * Thomas Kanngieser <tho...@fc...> - */ - -#include <stdio.h> -#include <assert.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <unistd.h> -#include <netinet/in.h> -#include <string.h> -#include <stdlib.h> -#include <glib.h> - -#include "connection.h" -#include "marshal.h" - - -//#define dUdpTest 1 - - -//////////////////////////////////////////////////////////// -// message functions -//////////////////////////////////////////////////////////// - -int -IsMessageType( tMessageType type ) -{ - if ( type >= eMhPing && type < eMhLast ) - return 1; - - return 0; -} - - -void -MessageHeaderInit( cMessageHeader *header, tMessageType type, unsigned char flags, - unsigned char seq_in, unsigned int id, - unsigned int len ) -{ - memset( header, 0, sizeof( cMessageHeader ) ); - - header->m_type = type; - header->m_flags = flags; - header->m_seq_in = seq_in; - header->m_id = id; - header->m_len = len; -} - - -//////////////////////////////////////////////////////////// -// sequence number handling -//////////////////////////////////////////////////////////// - -void -ConnectionSeqInit( cConnectionSeq *cs ) -{ - cs->m_inbound_seq_num = 1; - cs->m_outbound_seq_num = 0; - cs->m_recv_msg_map = 0; -} - - -unsigned char -ConnectionSeqGet( cConnectionSeq *cs ) -{ - cs->m_outbound_seq_num = (cs->m_outbound_seq_num + 1) % 256; - - if ( cs->m_outbound_seq_num == 0 ) - cs->m_outbound_seq_num = 1; - - return cs->m_outbound_seq_num; -} - - -tConnectionError -ConnectionSeqCheck( cConnectionSeq *cs, unsigned char seq ) -{ - unsigned char d = seq - cs->m_inbound_seq_num; - - if ( d < 16 ) - { - // It's after the current sequence number, but within 15. - unsigned int bit = 1 << (d + 16); - - if ( cs->m_recv_msg_map & bit ) - return eConnectionDuplicate; - - // move the sequence number forward. - cs->m_recv_msg_map >>= d; - - cs->m_inbound_seq_num = seq; - cs->m_recv_msg_map |= 1 << 16; - - return eConnectionOk; - } - - d = cs->m_inbound_seq_num - seq; - - if ( d <= 16 ) - { - // It's before the current sequence number, but within 16. - unsigned int bit = 1 << d; - - if ( cs->m_recv_msg_map & bit ) - return eConnectionDuplicate; - - // move the sequence number backward. - cs->m_recv_msg_map <<= d; - - cs->m_inbound_seq_num = seq; - cs->m_recv_msg_map |= 1 << 16; - - return eConnectionOk; - } - - // It's outside the current sequence number range, discard - // the msg. - return eConnectionError; -} - - -//////////////////////////////////////////////////////////// -// read and write messages -//////////////////////////////////////////////////////////// - -int -ConnectionWriteMsg( int fd, struct sockaddr_in *addr, cMessageHeader *header, - const void *msg ) -{ - assert( IsMessageType( header->m_type ) ); - - assert( (header->m_type == eMhPing && header->m_seq == 0) - || (header->m_type != eMhPing && header->m_seq ) ); - - // set version - header->m_flags &= 0x0f; - header->m_flags |= dMhVersion << 4; - - // set endian - header->m_flags &= ~dMhEndianBit; - header->m_flags |= MarshalByteOrder(); - - int l = sizeof( cMessageHeader ) + header->m_len; - - if ( l > dMaxMessageLength ) - { - fprintf( stderr, "message too big: %d !\n", l ); - - assert( 0 ); - return -1; - } - - unsigned char data[dMaxMessageLength]; - - memcpy( data, header, sizeof( cMessageHeader ) ); - - if ( header->m_len ) - { - assert( msg ); - memcpy( data + sizeof( cMessageHeader ), msg, header->m_len ); - } - -#ifdef dUdpTest - // simple test for lost upd messages: - // remove 50% of all messages - if ( rand() < RAND_MAX / 2 ) - return 0; -#endif - - int rv = sendto( fd, data, l, 0, - (struct sockaddr *)addr, - sizeof( struct sockaddr_in ) ); - - if ( rv != l ) - { - fprintf( stderr, "write error: %s !\n", strerror( errno ) ); - return -1; - } - - return 0; -} - - -int -ConnectionReadMsg( int fd, struct sockaddr_in *rd_addr, cMessageHeader *header, - void *response ) -{ - socklen_t from_len = sizeof( struct sockaddr_in ); - unsigned char data[dMaxMessageLength]; - - int len = recvfrom( fd, data, dMaxMessageLength, 0, (struct sockaddr *)rd_addr, &from_len ); - - if ( len < sizeof( cMessageHeader ) ) - { - fprintf( stderr, "drop message because header too small !\n" ); - return -1; - } - - memcpy( header, data, sizeof( cMessageHeader ) ); - - if ( (header->m_flags >> 4) != dMhVersion ) - { - fprintf( stderr, "drop message because of wrong header version: %d, expect %d !\n", - (header->m_flags>>4), dMhVersion ); - return -1; - } - - if ( !IsMessageType( header->m_type ) ) - { - fprintf( stderr, "drop message because of wrong message type: %d !\n", - header->m_type ); - return -1; - } - - // swap id and len if nessesary - if ( (header->m_flags & dMhEndianBit) != MarshalByteOrder() ) - { - header->m_id = GUINT32_SWAP_LE_BE( header->m_id ); - header->m_len = GUINT32_SWAP_LE_BE( header->m_len ); - } - - if ( header->m_len > dMaxMessageLength - sizeof( cMessageHeader ) ) - { - fprintf( stderr, "drop message because too big message: %d !\n", - header->m_len ); - return -1; - } - - if ( header->m_len ) - { - assert( response ); - memcpy( response, data + sizeof( cMessageHeader ), header->m_len ); - } - - return 0; -} - - -//////////////////////////////////////////////////////////// -// resend messages -//////////////////////////////////////////////////////////// - -void -ConnectionResendInit( cConnectionResend *rs, const struct sockaddr_in ip_addr ) -{ - assert( rs ); - - memset( rs, 0, sizeof( cConnectionResend ) ); - - ConnectionSeqInit( &rs->m_seq ); - - rs->m_ip_addr = ip_addr; - rs->m_send_count = 0; - rs->m_received_count = 0; -} - - -void -ConnectionResendCleanup( cConnectionResend *rs ) -{ - int i; - - for( i = 0; i < 256; i++ ) - if ( rs->m_msg[i].m_data ) - { - free( rs->m_msg[i].m_data ); - rs->m_msg[i].m_data = 0; - } - - ConnectionResendInit( rs, rs->m_ip_addr ); -} - - -int -ConnectionResendWriteMsg( cConnectionResend *rs, int fd, - cMessageHeader *header, const void *msg ) -{ - if ( header->m_type != eMhPing ) - { - assert( header->m_len <= dMaxMessageLength ); - header->m_seq = ConnectionSeqGet( &rs->m_seq ); - - assert( header->m_seq ); - - if ( rs->m_send_count < 255 ) - assert( header->m_seq == rs->m_send_count + 1 ); - - if ( IsReplyMsg( header ) ) - { - unsigned char seq = header->m_seq_in; - assert( seq ); - - cConnectionResendMsg *m = &rs->m_msg[seq]; - - if ( m->m_data ) - free( m->m_data ); - - memcpy( &m->m_msg, header, sizeof( cMessageHeader ) ); - - if ( header->m_len ) - { - assert( msg ); - m->m_data = malloc( header->m_len ); - memcpy( m->m_data, msg, header->m_len ); - } - else - { - assert( msg == 0 ); - m->m_data = 0; - } - - assert( rs->m_msg[seq].m_msg.m_seq == header->m_seq ); - - //fprintf( stderr, "write msg: %d, %d.\n", seq, header->m_seq ); - } - - rs->m_send_count += 1; - - if ( IsReplyMsg( header ) && header->m_type == eMhReset ) - ConnectionResendCleanup( rs ); - } - else - { - header->m_seq = 0; - header->m_seq_in = 0; - - assert( header->m_len == 0 ); - assert( msg == 0 ); - } - - return ConnectionWriteMsg( fd, &rs->m_ip_addr, header, msg ); -} - - -tConnectionError -ConnectionResendHandleMsg( cConnectionResend *rs, int fd, - cMessageHeader *header, const void *response ) -{ - if ( header->m_type == eMhPing ) - { - assert( header->m_len == 0 ); - assert( header->m_seq == 0 ); - assert( header->m_seq_in == 0 ); - - return eConnectionOk; - } - else - rs->m_received_count += 1; - - //fprintf( stderr, "read msg: %d.\n", header->m_seq ); - - if ( header->m_seq == 0 ) - { - fprintf( stderr, "read invalid message with seq 0 !\n" ); - return eConnectionError; - } - - tConnectionError rv = ConnectionSeqCheck( &rs->m_seq, header->m_seq ); - - switch( header->m_type ) - { - case eMhReset: - if ( IsReplyMsg(header) ) - ConnectionResendCleanup( rs ); - - return eConnectionOk; - - case eMhMsg: - if ( IsRequestMsg( header ) ) - { - if ( rv == eConnectionDuplicate ) - { - cConnectionResendMsg *m = &rs->m_msg[header->m_seq]; - - //fprintf( stderr, "re-send reply %d %d.\n", - // m->m_msg.m_seq_in, m->m_msg.m_seq ); - - // check for reply - if ( m->m_msg.m_seq ) - // resend reply - ConnectionWriteMsg( fd, &rs->m_ip_addr, &m->m_msg, m->m_data ); - } - } - - break; - - default: - fprintf( stderr, "drop message because of unknown type %d !\n", header->m_type ); - return eConnectionError; - } - - if ( IsRequestMsg( header ) && rv == eConnectionOk ) - { - //fprintf( stderr, "remove old msg: %d %d.\n", header->m_seq, - // rs->m_msg[header->m_seq].m_msg.m_seq_in ); - - cConnectionResendMsg *m = &rs->m_msg[header->m_seq]; - - if ( m->m_data ) - { - free( m->m_data ); - m->m_data = 0; - } - - m->m_msg.m_seq = 0; - } - - return rv; -} - - -//////////////////////////////////////////////////////////// -// client functions -//////////////////////////////////////////////////////////// - -cClientConnection * -ClientOpen( const char *host, int host_port ) -{ - // host addr - struct hostent *ent = gethostbyname( host ); - - if ( !ent ) - { - fprintf( stderr, "cannot resolve %s !\n", host ); - return 0; - } - - struct in_addr host_addr; - memcpy( &host_addr, ent->h_addr_list[0], ent->h_length ); - - // create socket - int fd = socket( PF_INET, SOCK_DGRAM, IPPROTO_UDP ); - - if ( fd == -1 ) - { - fprintf( stderr, "cannot create socket: %s\n", strerror( errno ) ); - return 0; - } - - int curr_port = 8000; - int rv; - - do - { - curr_port++; - - struct sockaddr_in addr; - - addr.sin_family = AF_INET; - addr.sin_port = htons( curr_port ); - addr.sin_addr.s_addr = INADDR_ANY; - - rv = bind( fd, (struct sockaddr *)&addr, sizeof( addr ) ); - } - while( curr_port < 8100 && rv == -1 ); - - if ( rv == -1 ) - { - fprintf( stderr, "cannot bind: %s\n", strerror( errno ) ); - - close( fd ); - - return 0; - } - - cClientConnection *c = malloc( sizeof( cClientConnection ) ); - - struct sockaddr_in addr; - addr.sin_addr = host_addr; - addr.sin_family = AF_INET; - addr.sin_port = htons( host_port ); - - ConnectionResendInit( &c->m_resend, addr ); - c->m_fd = fd; - - return c; -} - - -void -ClientClose( cClientConnection *c ) -{ - if ( c->m_fd ) - close( c->m_fd ); - - ConnectionResendCleanup( &c->m_resend ); - free( c ); -} - - -int -ClientWriteMsg( cClientConnection *c, - cMessageHeader *header, const void *request ) -{ - return ConnectionResendWriteMsg( &c->m_resend, c->m_fd, header, request ); -} - - -tConnectionError -ClientReadMsg( cClientConnection *c, - cMessageHeader *header, void *request ) -{ - struct sockaddr_in addr; - - int rv = ConnectionReadMsg( c->m_fd, &addr, header, request ); - - if ( rv ) - return eConnectionError; - - // check addr - struct sockaddr_in *ipaddr = (struct sockaddr_in *)(void *)&addr; - - if ( (ipaddr->sin_port != c->m_resend.m_ip_addr.sin_port) - || (ipaddr->sin_addr.s_addr != c->m_resend.m_ip_addr.sin_addr.s_addr) ) - { - fprintf( stderr, "dropped message due to invalid ip !\n" ); - return eConnectionError; - } - - return ConnectionResendHandleMsg( &c->m_resend, c->m_fd, header, request ); -} - - -//////////////////////////////////////////////////////////// -// server functions -//////////////////////////////////////////////////////////// - -cServerSocket * -ServerOpen( int port ) -{ - int fd = socket( PF_INET, SOCK_DGRAM, IPPROTO_UDP ); - - if ( fd == -1 ) - { - fprintf( stderr, "cannot open udp server socket: %s !\n", - strerror( errno ) ); - return 0; - } - - struct sockaddr_in addr; - addr.sin_family = AF_INET; - addr.sin_port = htons( port ); - addr.sin_addr.s_addr = INADDR_ANY; - - int rv = bind( fd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in) ); - - if ( rv == -1 ) - { - fprintf( stderr, "cannot bind socket to port: %s !\n", - strerror( errno ) ); - - close( fd ); - - return 0; - } - - cServerSocket *s = malloc( sizeof( cServerSocket ) ); - s->m_fd = fd; - s->m_first = 0; - - return s; -} - - -void -ServerClose( cServerSocket *s ) -{ - while( s->m_first ) - ServerConnectionRem( s->m_first ); - - if ( s->m_fd ) - close( s->m_fd ); - - free( s ); -} - - -static void -ServerConnectionAdd( cServerSocket *s, - cServerConnection *c ) -{ - c->m_next = s->m_first; - c->m_socket = s; - s->m_first = c; -} - - -void -ServerConnectionRem( cServerConnection *c ) - -{ - cServerSocket *s = c->m_socket; - cServerConnection *prev = 0; - cServerConnection *current = s->m_first; - - while( current ) - { - if ( current == c ) - { - // found - if ( prev == 0 ) - s->m_first = c->m_next; - else - prev->m_next = c->m_next; - - ConnectionResendCleanup( &c->m_resend ); - free( c ); - - return; - } - - prev = current; - current = current->m_next; - } - - // connection not found - assert( 0 ); -} - - -int -ServerWriteMsg( cServerConnection *c, - cMessageHeader *header, - const void *request ) -{ - return ConnectionResendWriteMsg( &c->m_resend, c->m_socket->m_fd, header, request ); -} - - -tConnectionError -ServerReadMsg( cServerSocket *s, cServerConnection **con, - cMessageHeader *header, - void *response ) -{ - struct sockaddr_in addr; - - int r = ConnectionReadMsg( s->m_fd, &addr, header, - response ); - - if ( r ) - return eConnectionError; - - // find connection - cServerConnection *c = s->m_first; - *con = 0; - - while( c ) - { - if ( (addr.sin_port == c->m_resend.m_ip_addr.sin_port) - && (addr.sin_addr.s_addr == c->m_resend.m_ip_addr.sin_addr.s_addr) ) - { - *con = c; - break; - } - - c = c->m_next; - } - - if ( *con == 0 ) - { - c = malloc( sizeof( cServerConnection ) ); - c->m_next = 0; - c->m_socket = s; - ConnectionResendInit( &c->m_resend, addr ); - c->m_user_data = 0; - - ServerConnectionAdd( s, c ); - - *con = c; - - tConnectionError r = ConnectionResendHandleMsg( &c->m_resend, s->m_fd, header, response ); - - if ( r != eConnectionOk ) - { - assert( 0 ); - return r; - } - - return eConnectionNew; - } - - return ConnectionResendHandleMsg( &c->m_resend, s->m_fd, header, response ); -} Deleted: openhpi/trunk/marshal/connection.h =================================================================== --- openhpi/trunk/marshal/connection.h 2010-05-21 13:33:28 UTC (rev 7079) +++ openhpi/trunk/marshal/connection.h 2010-05-21 21:52:52 UTC (rev 7080) @@ -1,198 +0,0 @@ -/* - * socket and message handling - * - * Copyright (c) 2004 by FORCE Computers. - * - * This program 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. This - * file and program are licensed under a BSD style license. See - * the Copying file included with the OpenHPI distribution for - * full licensing terms. - * - * Authors: - * Thomas Kanngieser <tho...@fc...> - */ - -#ifndef dConnection_h -#define dConnection_h - - -#ifdef __cplusplus -extern "C" { -#endif - - -#include <netdb.h> - -// common errors codes -typedef enum -{ - eConnectionOk, - eConnectionNew, - eConnectionDuplicate, - eConnectionError, -} tConnectionError; - -// current version -#define dMhVersion 1 - -#define dMhGetVersion(flags) (((flags)>>4) & 0x7) - -// message flags -#define dMhEndianBit 1 - -#define dMhRequest 0 -#define dMhReply 2 - -#define dMhSingle 0 -#define dMhFirst 1 -#define dMhMiddle 2 -#define dMhLast 3 - -#define dMhGetPackageType(flags) (((flags) >> 2) & 3) - -// cMessageHeader::m_type -typedef enum -{ - eMhPing = 1, - eMhReset = 2, // reset seq - eMhMsg = 3, - eMhLast = 4 -} tMessageType; - -int IsMessageType( tMessageType type ); - - -// max message length including header -#define dMaxMessageLength 0xffff - -typedef struct -{ - unsigned char m_type; - unsigned char m_flags; // bit 0-3 flags, bit 4-7 version - unsigned char m_seq; - unsigned char m_seq_in; // != 0 for eMhReply to assign the request - unsigned int m_id; - int m_len; -} cMessageHeader; - - -#define IsReplyMsg(header) ((header)->m_flags & dMhReply) -#define IsRequestMsg(header) (!((header)->m_flags & dMhReply)) - - -void MessageHeaderInit( cMessageHeader *header, tMessageType type, - unsigned char flags, unsigned char seq_in, - unsigned int id, unsigned int len ); - -// sequence number handling -typedef struct -{ - unsigned char m_inbound_seq_num; - unsigned char m_outbound_seq_num; - unsigned int m_recv_msg_map; -} cConnectionSeq; - - -void ConnectionSeqInit ( cConnectionSeq *cs ); -unsigned char ConnectionSeqGet ( cConnectionSeq *cs ); // get next seq -tConnectionError ConnectionSeqCheck( cConnectionSeq *cs, unsigned char seq ); - - -// write message -int ConnectionWriteMsg( int fd, struct sockaddr_in *addr, cMessageHeader *header, - const void *msg ); - -// read message -int ConnectionReadMsg( int fd, struct sockaddr_in *rd_addr, cMessageHeader *header, - void *response ); - - -// re-send of messages -struct sConnectionResendMsg; -typedef struct sConnectionResendMsg cConnectionResendMsg; - -struct sConnectionResendMsg -{ - cMessageHeader m_msg; - unsigned char *m_data; -}; - - -typedef struct -{ - cConnectionSeq m_seq; - cConnectionResendMsg m_msg[256]; - struct sockaddr_in m_ip_addr; - unsigned int m_send_count; // number of messages send - unsigned int m_received_count; // number of messages received -} cConnectionResend; - - -void ConnectionResendInit ( cConnectionResend *rs, - const struct sockaddr_in ip_addr ); -void ConnectionResendCleanup ( cConnectionResend *rs ); -int ConnectionResendWriteMsg ( cConnectionResend *rs, int fd, - cMessageHeader *header, const void *msg ); -tConnectionError ConnectionResendHandleMsg( cConnectionResend *rs, int fd, - cMessageHeader *header, const void *response ); - - -// client - -typedef struct -{ - cConnectionResend m_resend; - int m_fd; -} cClientConnection; - - -cClientConnection *ClientOpen ( const char *host, int host_port ); -void ClientClose ( cClientConnection *c ); -int ClientWriteMsg( cClientConnection *c, - cMessageHeader *header, - const void *request ); -tConnectionError ClientReadMsg ( cClientConnection *c, - cMessageHeader *header, - void *response ); - - -// server -struct sServerConnection; -typedef struct sServerConnection cServerConnection; - -typedef struct -{ - int m_fd; - cServerConnection *m_first; -} cServerSocket; - - -struct sServerConnection -{ - cServerConnection *m_next; - cServerSocket *m_socket; - cConnectionResend m_resend; - void *m_user_data; -}; - - -cServerSocket *ServerOpen ( int port ); -void ServerClose ( cServerSocket *s ); -void ServerConnectionRem( cServerConnection *c ); -int ServerWriteMsg ( cServerConnection *c, - cMessageHeader *header, - const void *request ); -tConnectionError ServerReadMsg ( cServerSocket *c, - cServerConnection **con, - cMessageHeader *header, - void *response ); - - -#ifdef __cplusplus -} -#endif - - -#endif Deleted: openhpi/trunk/marshal/strmsock.cpp =================================================================== --- openhpi/trunk/marshal/strmsock.cpp 2010-05-21 13:33:28 UTC (rev 7079) +++ openhpi/trunk/marshal/strmsock.cpp 2010-05-21 21:52:52 UTC (rev 7080) @@ -1,382 +0,0 @@ -/* -*- linux-c -*- - * - * (C) Copyright IBM Corp. 2004 - * - * This program 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. This - * file and program are licensed under a BSD style license. See - * the Copying file included with the OpenHPI distribution for - * full licensing terms. - * - * Author(s): - * W. David Ashley <da...@us...> - * Anton Pak <ant...@pi...> - * - */ - -#include <stdlib.h> -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <sys/ioctl.h> -#include <netdb.h> -#include <errno.h> -#include <glib.h> - -#include "strmsock.h" - - -// Local definitions -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - - -/*--------------------------------------------------------------------*/ -/* Stream Sockets base class methods */ -/*--------------------------------------------------------------------*/ - -void strmsock::Close(void) -{ - if (fOpen) { - close(s); - fOpen = FALSE; - } - errcode = 0; - return; -} - - -int strmsock::GetErrcode(void) -{ - return(errcode); -} - - -void strmsock::SetDomain( - int lNewDomain) // the new domain -{ - domain = lNewDomain; - errcode = 0; - return; -} - - -void strmsock::SetProtocol( - int lNewProtocol) // the new protocol -{ - protocol = lNewProtocol; - errcode = 0; - return; -} - - -void strmsock::SetType( - int lNewType) // the new type -{ - type = lNewType; - errcode = 0; - return; -} - - -void strmsock::SetReadTimeout( - int seconds) // the timeout -{ - struct timeval tv; - - tv.tv_sec = seconds; - tv.tv_usec = 0; - setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); - return; -} - -bool strmsock::WriteMsg(const void *request) -{ - unsigned char data[dMaxMessageLength]; - unsigned int l = sizeof(cMessageHeader) + header.m_len; - -// printf("Message body length = %d.\n", header.m_len); - errcode = 0; - if (!fOpen) { - printf("Socket not open.\n"); - return true; - } - - if (l > dMaxMessageLength) { - printf("Message too large.\n"); - return true; - } - - memcpy(&data[0], &header, sizeof(cMessageHeader)); - if (request != NULL) { - memcpy(&data[sizeof(cMessageHeader)], request, header.m_len); - } -// printf("Size of message header is %d\n", sizeof(cMessageHeader)); -// printf("Buffer header address is %p\n", &data[0]); -// printf("Buffer request address is %p\n", &data[sizeof(cMessageHeader)]); -// printf("Write request buffer (%d bytes) is\n", header.m_len); -// for (unsigned int i = 0; i < header.m_len; i++) { -// printf("%02x ", *((unsigned char *)request + i)); -// } -// printf("\n"); -// printf("Write buffer (%d bytes) is\n", l); -// for (int i = 0; i < l; i++) { -// printf("%02x ", (unsigned char)data[i]); -// } -// printf("\n"); - - int rv = write(s, data, l); - - if ( (unsigned int)rv != l ) { - return true; - } - - return false; -} - -bool strmsock::ReadMsg(char *data) -{ - errcode = 0; - if (!fOpen) { - return true; - } - - int len = read( s, data, dMaxMessageLength); - - if (len < 0) { - errcode = errno; - printf("Reading from socket returned and error: %d\n", errcode); // Debug - return true; - } else if (len == 0) { //connection has been aborted by the peer - Close(); - printf("Connection has been aborted\n"); // Debug - return true; - } else if (len < (int)sizeof(cMessageHeader)) { - printf("Got corrupted header?\n"); // Debug - return true; - } - memcpy(&header, data, sizeof(cMessageHeader)); - remote_byte_order = ( ( header.m_flags & dMhEndianBit ) != 0 ) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN; - // swap id and len if nessesary in the reply header - if (remote_byte_order != G_BYTE_ORDER) { - header.m_id = GUINT32_SWAP_LE_BE(header.m_id); - header.m_len = GUINT32_SWAP_LE_BE(header.m_len); - } - //printf("header.m_flags: 0x%x\n", header.m_flags); - - if ( (header.m_flags >> 4) != dMhVersion ) { - printf("Wrong version? 0x%x != 0x%x\n", header.m_flags, dMhVersion); // Debug - return true; - } -// printf("Read buffer (%d bytes) is\n", len); -// for (int i = 0; i < len; i++) { -// printf("%02x ", (unsigned char)data[i]); -// } -// printf("\n"); - - return false; -} - -void strmsock::MessageHeaderInit(tMessageType mtype, unsigned char flags, - unsigned int id, unsigned int len ) -{ - header.m_type = mtype; - header.m_flags = flags; - - // set version - header.m_flags &= 0x0f; - header.m_flags |= dMhVersion << 4; - - // set byte order - header.m_flags &= ~dMhEndianBit; - if ( G_BYTE_ORDER == G_LITTLE_ENDIAN ) { - header.m_flags |= dMhEndianBit; - } - - header.m_id = id; - header.m_len = len; -} - -/*--------------------------------------------------------------------*/ -/* Stream Sockets client class methods */ -/*--------------------------------------------------------------------*/ - - -cstrmsock::cstrmsock() -{ - fOpen = FALSE; - ulBufSize = 4096; - domain = AF_INET; - type = SOCK_STREAM; - protocol = 0; - s = -1; - next = NULL; -} - - -cstrmsock::~cstrmsock() -{ - if (fOpen) - Close(); -} - - -bool cstrmsock::Open( - const char * pszHost, // the remote host - const int lPort) // the remote port -{ - struct sockaddr_in addr; // address structure - struct hostent *phe; // pointer to a host entry - - // get a socket - s = socket(domain, type, protocol); - if (s == -1) { - errcode = errno; - return(TRUE); - } - // convert the host entry/name to an address - phe = gethostbyname(pszHost); - if (phe) - memcpy((char *) &addr.sin_addr, phe -> h_addr, phe -> h_length); - else - addr.sin_addr.s_addr = inet_addr(pszHost); - if (addr.sin_addr.s_addr == INADDR_NONE) { - errcode = 67; // bad network name - close(s); - return(TRUE); - } - // connect to the remote host - addr.sin_family = domain; - addr.sin_port = htons(lPort); - errcode = connect(s, (struct sockaddr *) &addr, sizeof(addr)); - if (errcode == -1) { - errcode = errno; - close(s); - return(TRUE); - } - - errcode = 0; - fOpen = TRUE; - return(FALSE); -} - - -/*--------------------------------------------------------------------*/ -/* Stream Sockets server class methods */ -/*--------------------------------------------------------------------*/ - - -sstrmsock::sstrmsock() -{ - fOpen = FALSE; - fOpenS = FALSE; - ulBufSize = 4096; - domain = AF_INET; - type = SOCK_STREAM; - protocol = 0; - backlog = 20; - s = -1; - ss = -1; -} - - -sstrmsock::sstrmsock(const sstrmsock ©) -{ - if (this == ©) { - return; - } - fOpen = copy.fOpen; - fOpenS = copy.fOpenS; - ulBufSize = copy.ulBufSize; - domain = copy.domain; - type = copy.type; - protocol = copy.protocol; - backlog = copy.backlog; - s = copy.s; - ss = copy.ss; - errcode = 0; -} - - -sstrmsock::~sstrmsock() -{ -// Note: do NOT close the server socket by default! This will cause -// an error in a multi-threaded environment. - if (fOpen) - Close(); -} - - -bool sstrmsock::Accept(void) -{ - socklen_t sz = sizeof(addr); - - if (!fOpenS) { - return(TRUE); - } -// accept the connection and obtain the connection socket - sz = sizeof (struct sockaddr); - s = accept(ss, (struct sockaddr *) &addr, &sz); - if (s == -1) { - errcode = errno; - fOpen = FALSE; - return(TRUE); - } - - fOpen = TRUE; - return(FALSE); -} - -void sstrmsock::CloseSrv(void) -{ - if (fOpenS) { - close(ss); - fOpenS = FALSE; - } - errcode = 0; - return; -} - - -bool sstrmsock::Create( - int Port) // the local port -{ - int Rc; // return code - int so_reuseaddr = TRUE; // socket reuse flag - - // get a server socket - ss = socket(domain, type, protocol); - if (ss == -1) { - errcode = errno; - return(TRUE); - } - // set the socket option to reuse the address - setsockopt(ss, SOL_SOCKET, SO_REUSEADDR, &so_reuseaddr, - sizeof(so_reuseaddr)); - // bind the server socket to a port - memset(&addr, 0, sizeof (addr)); - addr.sin_family = domain; - addr.sin_port = htons(Port); - addr.sin_addr.s_addr = INADDR_ANY; - Rc = bind(ss, (struct sockaddr *) &addr, sizeof(addr)); - if (Rc == -1) { - errcode = errno; - return (TRUE); - } - // listen for a client at the port - Rc = listen(ss, backlog); - if (Rc == -1) { - errcode = errno; - return(TRUE); - } - - errcode = 0; - fOpenS = TRUE; - return(FALSE); -} Deleted: openhpi/trunk/marshal/strmsock.h =================================================================== --- openhpi/trunk/marshal/strmsock.h 2010-05-21 13:33:28 UTC (rev 7079) +++ openhpi/trunk/marshal/strmsock.h 2010-05-21 21:52:52 UTC (rev 7080) @@ -1,137 +0,0 @@ -/* -*- linux-c -*- - * - * (C) Copyright IBM Corp. 2004 - * - * This program 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. This - * file and program are licensed under a BSD style license. See - * the Copying file included with the OpenHPI distribution for - * full licensing terms. - * - * Author(s): - * W. David Ashley <da...@us...> - * Anton Pak <ant...@pi...> - * - */ - - -#ifndef STRMSOCK_H_INCLUDED - -#define STRMSOCK_H_INCLUDED - -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> - -#include <SaHpi.h> - - -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - - // current version -#define dMhVersion 1 - -#define dMhGetVersion(flags) (((flags)>>4) & 0x7) - -// message flags -// if bit is set the byte order is Little Endian -#define dMhEndianBit 1 - -#define dMhRequest 0 -#define dMhReply 1 -#define dMhError 2 // only valid on server replies - -// max message length including header -#define dMaxMessageLength 0xffff - -// cMessageHeader::m_type -typedef enum -{ - eMhMsg = 1, - eMhError, // for reply message header only! -} tMessageType; - -// NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!! -// -// The following structure definition will need to be changed if all clients -// and deamons do not have a homogenious word size (all 32-bit or all 64-bit). -// The fix is to probably define them using GLIB types to force all the -// structure member values to use a fixed bit size no matter what the -// architecture word size is. -typedef struct -{ - unsigned char m_type; - unsigned char m_flags; // bit 0-3 flags, bit 4-7 version - unsigned int m_id; - unsigned int m_len; -} cMessageHeader; - -// The Stream Sockets class -class strmsock -{ - protected: - int s; // the client socket handle - unsigned long ulBufSize; // the read buffer size - int domain; // the socket domain - int type; // the socket type - int protocol; // the socket protocol - bool fOpen; // open connection indicator - - public: - virtual ~strmsock () { }; - virtual void Close (void); - virtual int GetErrcode (void); - virtual void SetDomain (int); - virtual void SetProtocol (int); - virtual void SetType (int); - virtual void SetReadTimeout (int); - virtual void MessageHeaderInit (tMessageType, unsigned char, - unsigned int, unsigned int); - virtual bool WriteMsg (const void *request); - virtual bool ReadMsg (char *); - cMessageHeader header; // message header - int errcode; // errno contents - int remote_byte_order; -}; -typedef strmsock *pstrmsock; - -// the Client Stream Sockets class -class cstrmsock : public strmsock -{ - public: - SaHpiSessionIdT sid; - cstrmsock *next; - cstrmsock (); - ~cstrmsock (); - bool Open (const char *, int); -}; -typedef cstrmsock *pcstrmsock; - -// the Server Stream Sockets class -class sstrmsock : public strmsock -{ - protected: - char acHostName[256]; // host name - int ss; // the server socket handle - int backlog; // listen queue size - struct sockaddr_in addr; // address structure - bool fOpenS; // TRUE = valid server socket - - public: - sstrmsock (); - sstrmsock (const sstrmsock&); - ~sstrmsock (); - void CloseSrv (void); - bool Create (int); - bool Accept (void); -}; -typedef sstrmsock *psstrmsock; - - -#endif // STRMSOCK_H_INCLUDED__ Modified: openhpi/trunk/openhpi.spec.in =================================================================== --- openhpi/trunk/openhpi.spec.in 2010-05-21 13:33:28 UTC (rev 7079) +++ openhpi/trunk/openhpi.spec.in 2010-05-21 21:52:52 UTC (rev 7080) @@ -249,7 +249,6 @@ %dir %{_libdir}/%{name} %dir /var/lib/%{name} %{_libdir}/libopenhpi*.so.* -%{_libdir}/liboh*connx*.so.* %{_mandir}/man7/%{name}.7* %{_mandir}/man8/%{name}d.8* %{_sbindir}/openhpid @@ -265,8 +264,6 @@ %{_libdir}/libopenhpi*.so %{_libdir}/libopenhpi*.la %{_libdir}/*.a -%{_libdir}/liboh*connx*.so -%{_libdir}/liboh*connx*.la ################################################### %files clients Modified: openhpi/trunk/openhpid/Makefile.am =================================================================== --- openhpi/trunk/openhpid/Makefile.am 2010-05-21 13:33:28 UTC (rev 7079) +++ openhpi/trunk/openhpid/Makefile.am 2010-05-21 21:52:52 UTC (rev 7080) @@ -18,7 +18,7 @@ MAINTAINERCLEANFILES = Makefile.in *~ INCLUDES = \ - @OPENHPI_INCLUDES@ -I$(top_srcdir)/marshal @OH_SSL_INCLUDES@ + @OPENHPI_INCLUDES@ -I$(top_srcdir)/transport -I$(top_srcdir)/marshal @OH_SSL_INCLUDES@ SUBDIRS = t DIST_SUBDIRS = t @@ -49,7 +49,7 @@ openhpid_LDADD = $(top_builddir)/baselib/libopenhpi.la \ $(top_builddir)/utils/libopenhpiutils.la \ $(top_builddir)/marshal/libopenhpimarshal.la \ - $(top_builddir)/marshal/libohtcpconnx.la + $(top_builddir)/transport/libopenhpitransport.la if HAVE_OPENSSL openhpid_LDADD += $(top_builddir)/$(SSLDIR)/libopenhpi_ssl.la endif Added: openhpi/trunk/transport/Makefile.am =================================================================== --- openhpi/trunk/transport/Makefile.am (rev 0) +++ openhpi/trunk/transport/Makefile.am 2010-05-21 21:52:52 UTC (rev 7080) @@ -0,0 +1,33 @@ +# +# Copyright (c) 2004 by FORCE Computers. +# +# This program 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. This +# file and program are licensed under a BSD style license. See +# the Copying file included with the OpenHPI distribution for +# full licensing terms. +# +# Authors: +# Thomas Kanngieser <tho...@fc...> +# + +.NOTPARALLEL: + +MAINTAINERCLEANFILES = Makefile.in *~ + +INCLUDES = @OPENHPI_INCLUDES@ +# just to clear LIBS +LIBS = + +# marshal and connection used by the daemon and client library +lib_LTLIBRARIES = libopenhpitransport.la + +libopenhpitransport_la_SOURCES = \ + strmsock.h \ + strmsock.cpp + +libopenhpitransport_la_LDFLAGS= -version-info @HPI_LIB_VERSION@ + +clean-local: + rm -f *~ core core.* Copied: openhpi/trunk/transport/strmsock.cpp (from rev 7078, openhpi/trunk/marshal/strmsock.cpp) =================================================================== --- openhpi/trunk/transport/strmsock.cpp (rev 0) +++ openhpi/trunk/transport/strmsock.cpp 2010-05-21 21:52:52 UTC (rev 7080) @@ -0,0 +1,382 @@ +/* -*- linux-c -*- + * + * (C) Copyright IBM Corp. 2004 + * + * This program 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. This + * file and program are licensed under a BSD style license. See + * the Copying file included with the OpenHPI distribution for + * full licensing terms. + * + * Author(s): + * W. David Ashley <da...@us...> + * Anton Pak <ant...@pi...> + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <sys/ioctl.h> +#include <netdb.h> +#include <errno.h> +#include <glib.h> + +#include "strmsock.h" + + +// Local definitions +#ifndef INADDR_NONE +#define INADDR_NONE 0xffffffff +#endif + + +/*--------------------------------------------------------------------*/ +/* Stream Sockets base class methods */ +/*--------------------------------------------------------------------*/ + +void strmsock::Close(void) +{ + if (fOpen) { + close(s); + fOpen = FALSE; + } + errcode = 0; + return; +} + + +int strmsock::GetErrcode(void) +{ + return(errcode); +} + + +void strmsock::SetDomain( + int lNewDomain) // the new domain +{ + domain = lNewDomain; + errcode = 0; + return; +} + + +void strmsock::SetProtocol( + int lNewProtocol) // the new protocol +{ + protocol = lNewProtocol; + errcode = 0; + return; +} + + +void strmsock::SetType( + int lNewType) // the new type +{ + type = lNewType; + errcode = 0; + return; +} + + +void strmsock::SetReadTimeout( + int seconds) // the timeout +{ + struct timeval tv; + + tv.tv_sec = seconds; + tv.tv_usec = 0; + setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + return; +} + +bool strmsock::WriteMsg(const void *request) +{ + unsigned char data[dMaxMessageLength]; + unsigned int l = sizeof(cMessageHeader) + header.m_len; + +// printf("Message body length = %d.\n", header.m_len); + errcode = 0; + if (!fOpen) { + printf("Socket not open.\n"); + return true; + } + + if (l > dMaxMessageLength) { + printf("Message too large.\n"); + return true; + } + + memcpy(&data[0], &header, sizeof(cMessageHeader)); + if (request != NULL) { + memcpy(&data[sizeof(cMessageHeader)], request, header.m_len); + } +// printf("Size of message header is %d\n", sizeof(cMessageHeader)); +// printf("Buffer header address is %p\n", &data[0]); +// printf("Buffer request address is %p\n", &data[sizeof(cMessageHeader)]); +// printf("Write request buffer (%d bytes) is\n", header.m_len); +// for (unsigned int i = 0; i < header.m_len; i++) { +// printf("%02x ", *((unsigned char *)request + i)); +// } +// printf("\n"); +// printf("Write buffer (%d bytes) is\n", l); +// for (int i = 0; i < l; i++) { +// printf("%02x ", (unsigned char)data[i]); +// } +// printf("\n"); + + int rv = write(s, data, l); + + if ( (unsigned int)rv != l ) { + return true; + } + + return false; +} + +bool strmsock::ReadMsg(char *data) +{ + errcode = 0; + if (!fOpen) { + return true; + } + + int len = read( s, data, dMaxMessageLength); + + if (len < 0) { + errcode = errno; + printf("Reading from socket returned and error: %d\n", errcode); // Debug + return true; + } else if (len == 0) { //connection has been aborted by the peer + Close(); + printf("Connection has been aborted\n"); // Debug + return true; + } else if (len < (int)sizeof(cMessageHeader)) { + printf("Got corrupted header?\n"); // Debug + return true; + } + memcpy(&header, data, sizeof(cMessageHeader)); + remote_byte_order = ( ( header.m_flags & dMhEndianBit ) != 0 ) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN; + // swap id and len if nessesary in the reply header + if (remote_byte_order != G_BYTE_ORDER) { + header.m_id = GUINT32_SWAP_LE_BE(header.m_id); + header.m_len = GUINT32_SWAP_LE_BE(header.m_len); + } + //printf("header.m_flags: 0x%x\n", header.m_flags); + + if ( (header.m_flags >> 4) != dMhVersion ) { + printf("Wrong version? 0x%x != 0x%x\n", header.m_flags, dMhVersion); // Debug + return true; + } +// printf("Read buffer (%d bytes) is\n", len); +// for (int i = 0; i < len; i++) { +// printf("%02x ", (unsigned char)data[i]); +// } +// printf("\n"); + + return false; +} + +void strmsock::MessageHeaderInit(tMessageType mtype, unsigned char flags, + unsigned int id, unsigned int len ) +{ + header.m_type = mtype; + header.m_flags = flags; + + // set version + header.m_flags &= 0x0f; + header.m_flags |= dMhVersion << 4; + + // set byte order + header.m_flags &= ~dMhEndianBit; + if ( G_BYTE_ORDER == G_LITTLE_ENDIAN ) { + header.m_flags |= dMhEndianBit; + } + + header.m_id = id; + header.m_len = len; +} + +/*--------------------------------------------------------------------*/ +/* Stream Sockets client class methods */ +/*--------------------------------------------------------------------*/ + + +cstrmsock::cstrmsock() +{ + fOpen = FALSE; + ulBufSize = 4096; + domain = AF_INET; + type = SOCK_STREAM; + protocol = 0; + s = -1; + next = NULL; +} + + +cstrmsock::~cstrmsock() +{ + if (fOpen) + Close(); +} + + +bool cstrmsock::Open( + const char * pszHost, // the remote host + const int lPort) // the remote port +{ + struct sockaddr_in addr; // address structure + struct hostent *phe; // pointer to a host entry + + // get a socket + s = socket(domain, type, protocol); + if (s == -1) { + errcode = errno; + return(TRUE); + } + // convert the host entry/name to an address + phe = gethostbyname(pszHost); + if (phe) + memcpy((char *) &addr.sin_addr, phe -> h_addr, phe -> h_length); + else + addr.sin_addr.s_addr = inet_addr(pszHost); + if (addr.sin_addr.s_addr == INADDR_NONE) { + errcode = 67; // bad network name + close(s); + return(TRUE); + } + // connect to the remote host + addr.sin_family = domain; + addr.sin_port = htons(lPort); + errcode = connect(s, (struct sockaddr *) &addr, sizeof(addr)); + if (errcode == -1) { + errcode = errno; + close(s); + return(TRUE); + } + + errcode = 0; + fOpen = TRUE; + return(FALSE); +} + + +/*--------------------------------------------------------------------*/ +/* Stream Sockets server class methods */ +/*--------------------------------------------------------------------*/ + + +sstrmsock::sstrmsock() +{ + fOpen = FALSE; + fOpenS = FALSE; + ulBufSize = 4096; + domain = AF_INET; + type = SOCK_STREAM; + protocol = 0; + backlog = 20; + s = -1; + ss = -1; +} + + +sstrmsock::sstrmsock(const sstrmsock ©) +{ + if (this == ©) { + return; + } + fOpen = copy.fOpen; + fOpenS = copy.fOpenS; + ulBufSize = copy.ulBufSize; + domain = copy.domain; + type = copy.type; + protocol = copy.protocol; + backlog = copy.backlog; + s = copy.s; + ss = copy.ss; + errcode = 0; +} + + +sstrmsock::~sstrmsock() +{ +// Note: do NOT close the server socket by default! This will cause +// an error in a multi-threaded environment. + if (fOpen) + Close(); +} + + +bool sstrmsock::Accept(void) +{ + socklen_t sz = sizeof(addr); + + if (!fOpenS) { + return(TRUE); + } +// accept the connection and obtain the connection socket + sz = sizeof (struct sockaddr); + s = accept(ss, (struct sockaddr *) &addr, &sz); + if (s == -1) { + errcode = errno; + fOpen = FALSE; + return(TRUE); + } + + fOpen = TRUE; + return(FALSE); +} + +void sstrmsock::CloseSrv(void) +{ + if (fOpenS) { + close(ss); + fOpenS = FALSE; + } + errcode = 0; + return; +} + + +bool sstrmsock::Create( + int Port) // the local port +{ + int Rc; // return code + int so_reuseaddr = TRUE; // socket reuse flag + + // get a server socket + ss = socket(domain, type, protocol); + if (ss == -1) { + errcode = errno; + return(TRUE); + } + // set the socket option to reuse the address + setsockopt(ss, SOL_SOCKET, SO_REUSEADDR, &so_reuseaddr, + sizeof(so_reuseaddr)); + // bind the server socket to a port + memset(&addr, 0, sizeof (addr)); + addr.sin_family = domain; + addr.sin_port = htons(Port); + addr.sin_addr.s_addr = INADDR_ANY; + Rc = bind(ss, (struct sockaddr *) &addr, sizeof(addr)); + if (Rc == -1) { + errcode = errno; + return (TRUE); + } + // listen for a client at the port + Rc = listen(ss, backlog); + if (Rc == -1) { + errcode = errno; + return(TRUE); + } + + errcode = 0; + fOpenS = TRUE; + return(FALSE); +} Copied: openhpi/trunk/transport/strmsock.h (from rev 7078, openhpi/trunk/marshal/strmsock.h) =================================================================== --- openhpi/trunk/transport/strmsock.h (rev 0) +++ openhpi/trunk/transport/strmsock.h 2010-05-21 21:52:52 UTC (rev 7080) @@ -0,0 +1,137 @@ +/* -*- linux-c -*- + * + * (C) Copyright IBM Corp. 2004 + * + * This program 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. This + * file and program are licensed under a BSD style license. See + * the Copying file included with the OpenHPI distribution for + * full licensing terms. + * + * Author(s): + * W. David Ashley <da...@us...> + * Anton Pak <ant...@pi...> + * + */ + + +#ifndef STRMSOCK_H_INCLUDED + +#define STRMSOCK_H_INCLUDED + +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> + +#include <SaHpi.h> + + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + + // current version +#define dMhVersion 1 + +#define dMhGetVersion(flags) (((flags)>>4) & 0x7) + +// message flags +// if bit is set the byte order is Little Endian +#define dMhEndianBit 1 + +#define dMhRequest 0 +#define dMhReply 1 +#define dMhError 2 // only valid on server replies + +// max message length including header +#define dMaxMessageLength 0xffff + +// cMessageHeader::m_type +typedef enum +{ + eMhMsg = 1, + eMhError, // for reply message header only! +} tMessageType; + +// NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// The following structure definition will need to be changed if all clients +// and deamons do not have a homogenious word size (all 32-bit or all 64-bit). +// The fix is to probably define them using GLIB types to force all the +// structure member values to use a fixed bit size no matter what the +// architecture word size is. +typedef struct +{ + unsigned char m_type; + unsigned char m_flags; // bit 0-3 flags, bit 4-7 version + unsigned int m_id; + unsigned int m_len; +} cMessageHeader; + +// The Stream Sockets class +class strmsock +{ + protected: + int s; // the client socket handle + unsigned long ulBufSize; // the read buffer size + int domain; // the socket domain + int type; // the socket type + int protocol; // the socket protocol + bool fOpen; // open connection indicator + + public: + virtual ~strmsock () { }; + virtual void Close (void); + virtual int GetErrcode (void); + virtual void SetDomain (int); + virtual void SetProtocol (int); + virtual void SetType (int); + virtual void SetReadTimeout (int); + virtual void MessageHeaderInit (tMessageType, unsigned char, + unsigned int, unsigned int); + virtual bool WriteMsg (const void *request); + virtual bool ReadMsg (char *); + cMessageHeader header; // message header + int errcode; // errno contents + int remote_byte_order; +}; +typedef strmsock *pstrmsock; + +// the Client Stream Sockets class +class cstrmsock : public strmsock +{ + public: + SaHpiSessionIdT sid; + cstrmsock *next; + cstrmsock (); + ~cstrmsock (); + bool Open (const char *, int); +}; +typedef cstrmsock *pcstrmsock; + +// the Server Stream Sockets class +class sstrmsock : public strmsock +{ + protected: + char acHostName[256]; // host name + int ss; // the server socket handle + int backlog; // listen queue size + struct sockaddr_in addr; // address structure + bool fOpenS; // TRUE = valid server socket + + public: + sstrmsock (); + sstrmsock (const sstrmsock&); + ~sstrmsock (); + void CloseSrv (void); + bool Create (int); + bool Accept (void); +}; +typedef sstrmsock *psstrmsock; + + +#endif // STRMSOCK_H_INCLUDED__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2010-06-08 15:05:25
|
Revision: 7094 http://openhpi.svn.sourceforge.net/openhpi/?rev=7094&view=rev Author: avpak Date: 2010-06-08 15:05:15 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Feature request #3013282 Modified Paths: -------------- openhpi/trunk/openhpid/safhpi.c openhpi/trunk/utils/rpt_utils.c openhpi/trunk/utils/rpt_utils.h Modified: openhpi/trunk/openhpid/safhpi.c =================================================================== --- openhpi/trunk/openhpid/safhpi.c 2010-06-06 17:46:12 UTC (rev 7093) +++ openhpi/trunk/openhpid/safhpi.c 2010-06-08 15:05:15 UTC (rev 7094) @@ -1851,8 +1851,9 @@ SaHpiRptEntryT *res; /* Test pointer parameters for invalid pointers */ - if (UpdateCount == NULL) + if (UpdateCount == NULL) { return SA_ERR_HPI_INVALID_PARAMS; + } OH_CHECK_INIT_STATE(SessionId); OH_GET_DID(SessionId, did); @@ -1865,15 +1866,11 @@ return SA_ERR_HPI_CAPABILITY; } - // TODO implement - // Current implementation always return 0 - // Shall we introduce new call in handler ABI or - // implement update counter in OpenHPI core? - *UpdateCount = 0; + SaErrorT rv = oh_get_rdr_update_count(&(d->rpt), ResourceId, UpdateCount); oh_release_domain(d); /* Unlock domain */ - return SA_OK; + return rv; } Modified: openhpi/trunk/utils/rpt_utils.c =================================================================== --- openhpi/trunk/utils/rpt_utils.c 2010-06-06 17:46:12 UTC (rev 7093) +++ openhpi/trunk/utils/rpt_utils.c 2010-06-08 15:05:15 UTC (rev 7094) @@ -23,6 +23,7 @@ SaHpiRptEntryT rpt_entry; int owndata; void *data; /* private data for the owner of the RPTable */ + SaHpiUint32T update_count; /* RDR Update counter */ GSList *rdrlist; /* Contains RDRecords for sequence lookups */ GHashTable *rdrtable; /* Contains RDRecords for fast RecordId lookups */ } RPTEntry; @@ -636,6 +637,37 @@ } /** + * oh_get_rdr_update_count + * @table: Pointer to the RPT for looking up the RPT entry. + * @rid: Resource id of the RPT entry to be looked up. + * @update_count: pointer of where to place the rdr update count + * + * Get a RDR Repository Update Counter for the resource using the resource id. + * + * Returns: + * Returns: SA_OK on success. + * Will return SA_ERR_HPI_INVALID_PARAMS if update_count is NULL. + * Will return SA_ERR_HPI_NOT_PRESENT if there is no resource + * with specified rid in RPT. + **/ +SaErrorT oh_get_rdr_update_count(RPTable *table, + SaHpiResourceIdT rid, + SaHpiUint32T *update_count) +{ + RPTEntry *rptentry = get_rptentry_by_rid(table, rid); + if ( !rptentry ) { + err("Failed to get RPT entry. No Resource found by that id."); + return SA_ERR_HPI_NOT_PRESENT; + } + if ( !update_count ) { + err("Failed to get rdr update counter. Output data pointer is NULL."); + return SA_ERR_HPI_INVALID_PARAMS; + } + *update_count = rptentry->update_count; + return SA_OK; +} + +/** * RDR interface functions */ @@ -715,6 +747,8 @@ rdrecord->owndata = owndata; rdrecord->rdr = *rdr; + ++rptentry->update_count; + return SA_OK; } @@ -760,6 +794,7 @@ g_hash_table_destroy(rptentry->rdrtable); rptentry->rdrtable = NULL; } + ++rptentry->update_count; } return SA_OK; Modified: openhpi/trunk/utils/rpt_utils.h =================================================================== --- openhpi/trunk/utils/rpt_utils.h 2010-06-06 17:46:12 UTC (rev 7093) +++ openhpi/trunk/utils/rpt_utils.h 2010-06-08 15:05:15 UTC (rev 7094) @@ -62,6 +62,10 @@ SaHpiRptEntryT *oh_get_resource_by_ep(RPTable *table, SaHpiEntityPathT *ep); SaHpiRptEntryT *oh_get_resource_next(RPTable *table, SaHpiResourceIdT rid_prev); +SaErrorT oh_get_rdr_update_count(RPTable *table, + SaHpiResourceIdT rid, + SaHpiUint32T *update_count); + /* RDR calls */ SaErrorT oh_add_rdr(RPTable *table, SaHpiResourceIdT rid, SaHpiRdrT *rdr, void *data, int owndata); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lar...@us...> - 2010-06-11 18:39:08
|
Revision: 7096 http://openhpi.svn.sourceforge.net/openhpi/?rev=7096&view=rev Author: larswetzel Date: 2010-06-11 18:38:59 +0000 (Fri, 11 Jun 2010) Log Message: ----------- Merge of dynamic simulator Modified Paths: -------------- openhpi/trunk/Makefile.am openhpi/trunk/clients/Makefile.am openhpi/trunk/configure.ac openhpi/trunk/openhpi.conf.example openhpi/trunk/openhpi.spec.in openhpi/trunk/plugins/Makefile.am openhpi/trunk/rt-env.sh.in Added Paths: ----------- openhpi/trunk/clients/hpigensimdata.c openhpi/trunk/plugins/dynamic_simulator/ openhpi/trunk/plugins/dynamic_simulator/Doxyfile openhpi/trunk/plugins/dynamic_simulator/Makefile.am openhpi/trunk/plugins/dynamic_simulator/README openhpi/trunk/plugins/dynamic_simulator/array.h openhpi/trunk/plugins/dynamic_simulator/doc.html.tgz openhpi/trunk/plugins/dynamic_simulator/new_sim.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim.h openhpi/trunk/plugins/dynamic_simulator/new_sim_announcement.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_announcement.h openhpi/trunk/plugins/dynamic_simulator/new_sim_annunciator.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_annunciator.h openhpi/trunk/plugins/dynamic_simulator/new_sim_control.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_control.h openhpi/trunk/plugins/dynamic_simulator/new_sim_control_analog.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_control_analog.h openhpi/trunk/plugins/dynamic_simulator/new_sim_control_digital.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_control_digital.h openhpi/trunk/plugins/dynamic_simulator/new_sim_control_discrete.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_control_discrete.h openhpi/trunk/plugins/dynamic_simulator/new_sim_control_oem.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_control_oem.h openhpi/trunk/plugins/dynamic_simulator/new_sim_control_stream.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_control_stream.h openhpi/trunk/plugins/dynamic_simulator/new_sim_control_text.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_control_text.h openhpi/trunk/plugins/dynamic_simulator/new_sim_dimi.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_dimi.h openhpi/trunk/plugins/dynamic_simulator/new_sim_dimi_data.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_dimi_data.h openhpi/trunk/plugins/dynamic_simulator/new_sim_domain.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_domain.h openhpi/trunk/plugins/dynamic_simulator/new_sim_entity.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_entity.h openhpi/trunk/plugins/dynamic_simulator/new_sim_event_log.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_event_log.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_annunciator.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_annunciator.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_control.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_control.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_dimi.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_dimi.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_fumi.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_fumi.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_inventory.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_inventory.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_rdr.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_rdr.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_sensor.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_sensor.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_util.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_util.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_watchdog.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_watchdog.h openhpi/trunk/plugins/dynamic_simulator/new_sim_fumi.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_fumi.h openhpi/trunk/plugins/dynamic_simulator/new_sim_fumi_data.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_fumi_data.h openhpi/trunk/plugins/dynamic_simulator/new_sim_hotswap.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_hotswap.h openhpi/trunk/plugins/dynamic_simulator/new_sim_inventory.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_inventory.h openhpi/trunk/plugins/dynamic_simulator/new_sim_inventory_data.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_inventory_data.h openhpi/trunk/plugins/dynamic_simulator/new_sim_log.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_log.h openhpi/trunk/plugins/dynamic_simulator/new_sim_rdr.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_rdr.h openhpi/trunk/plugins/dynamic_simulator/new_sim_resource.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_resource.h openhpi/trunk/plugins/dynamic_simulator/new_sim_sensor.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_sensor.h openhpi/trunk/plugins/dynamic_simulator/new_sim_sensor_common.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_sensor_common.h openhpi/trunk/plugins/dynamic_simulator/new_sim_sensor_threshold.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_sensor_threshold.h openhpi/trunk/plugins/dynamic_simulator/new_sim_text_buffer.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_text_buffer.h openhpi/trunk/plugins/dynamic_simulator/new_sim_timer_thread.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_timer_thread.h openhpi/trunk/plugins/dynamic_simulator/new_sim_utils.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_utils.h openhpi/trunk/plugins/dynamic_simulator/new_sim_watchdog.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_watchdog.h openhpi/trunk/plugins/dynamic_simulator/t/ openhpi/trunk/plugins/dynamic_simulator/thread.cpp openhpi/trunk/plugins/dynamic_simulator/thread.h openhpi/trunk/simulation.data.example Removed Paths: ------------- openhpi/trunk/plugins/dynamic_simulator/Doxyfile openhpi/trunk/plugins/dynamic_simulator/Makefile.am openhpi/trunk/plugins/dynamic_simulator/README openhpi/trunk/plugins/dynamic_simulator/array.h openhpi/trunk/plugins/dynamic_simulator/doc.html.tgz openhpi/trunk/plugins/dynamic_simulator/new_sim.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim.h openhpi/trunk/plugins/dynamic_simulator/new_sim_announcement.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_announcement.h openhpi/trunk/plugins/dynamic_simulator/new_sim_annunciator.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_annunciator.h openhpi/trunk/plugins/dynamic_simulator/new_sim_control.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_control.h openhpi/trunk/plugins/dynamic_simulator/new_sim_control_analog.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_control_analog.h openhpi/trunk/plugins/dynamic_simulator/new_sim_control_digital.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_control_digital.h openhpi/trunk/plugins/dynamic_simulator/new_sim_control_discrete.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_control_discrete.h openhpi/trunk/plugins/dynamic_simulator/new_sim_control_oem.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_control_oem.h openhpi/trunk/plugins/dynamic_simulator/new_sim_control_stream.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_control_stream.h openhpi/trunk/plugins/dynamic_simulator/new_sim_control_text.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_control_text.h openhpi/trunk/plugins/dynamic_simulator/new_sim_dimi.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_dimi.h openhpi/trunk/plugins/dynamic_simulator/new_sim_dimi_data.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_dimi_data.h openhpi/trunk/plugins/dynamic_simulator/new_sim_domain.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_domain.h openhpi/trunk/plugins/dynamic_simulator/new_sim_entity.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_entity.h openhpi/trunk/plugins/dynamic_simulator/new_sim_event_log.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_event_log.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_annunciator.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_annunciator.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_control.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_control.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_dimi.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_dimi.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_fumi.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_fumi.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_inventory.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_inventory.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_rdr.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_rdr.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_sensor.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_sensor.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_util.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_util.h openhpi/trunk/plugins/dynamic_simulator/new_sim_file_watchdog.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_watchdog.h openhpi/trunk/plugins/dynamic_simulator/new_sim_fumi.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_fumi.h openhpi/trunk/plugins/dynamic_simulator/new_sim_fumi_data.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_fumi_data.h openhpi/trunk/plugins/dynamic_simulator/new_sim_hotswap.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_hotswap.h openhpi/trunk/plugins/dynamic_simulator/new_sim_inventory.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_inventory.h openhpi/trunk/plugins/dynamic_simulator/new_sim_inventory_data.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_inventory_data.h openhpi/trunk/plugins/dynamic_simulator/new_sim_log.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_log.h openhpi/trunk/plugins/dynamic_simulator/new_sim_rdr.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_rdr.h openhpi/trunk/plugins/dynamic_simulator/new_sim_resource.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_resource.h openhpi/trunk/plugins/dynamic_simulator/new_sim_sensor.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_sensor.h openhpi/trunk/plugins/dynamic_simulator/new_sim_sensor_common.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_sensor_common.h openhpi/trunk/plugins/dynamic_simulator/new_sim_sensor_threshold.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_sensor_threshold.h openhpi/trunk/plugins/dynamic_simulator/new_sim_text_buffer.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_text_buffer.h openhpi/trunk/plugins/dynamic_simulator/new_sim_timer_thread.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_timer_thread.h openhpi/trunk/plugins/dynamic_simulator/new_sim_utils.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_utils.h openhpi/trunk/plugins/dynamic_simulator/new_sim_watchdog.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_watchdog.h openhpi/trunk/plugins/dynamic_simulator/t/ openhpi/trunk/plugins/dynamic_simulator/thread.cpp openhpi/trunk/plugins/dynamic_simulator/thread.h Property Changed: ---------------- openhpi/trunk/ Property changes on: openhpi/trunk ___________________________________________________________________ Added: svn:ignore + rpm autom4te.cache .project Modified: openhpi/trunk/Makefile.am =================================================================== --- openhpi/trunk/Makefile.am 2010-06-10 18:34:51 UTC (rev 7095) +++ openhpi/trunk/Makefile.am 2010-06-11 18:38:59 UTC (rev 7096) @@ -41,6 +41,7 @@ EXTRA_DIST = openhpi.spec.in \ openhpi.conf.example \ + simulation.data.example \ openhpiclient.conf.example \ README.daemon \ $(shell find $(srcdir)/include -name '*.h') @@ -116,7 +117,7 @@ $(top_srcdir)/utils/sahpiatca_enum_utils.h: make -C $(top_builddir)/utils sahpiatca_enum_utils.h -install-data-local: openhpi.pc openhpi.conf.example openhpiclient.conf.example +install-data-local: openhpi.pc openhpi.conf.example simulation.data.example openhpiclient.conf.example $(mkinstalldirs) $(DESTDIR)$(libdir)/pkgconfig $(INSTALL_DATA) openhpi.pc $(DESTDIR)$(libdir)/pkgconfig $(mkinstalldirs) $(DESTDIR)$(VARPATH) @@ -125,6 +126,9 @@ if test ! -e $(DESTDIR)$(sysconfdir)/openhpi/openhpi.conf; then \ $(INSTALL_DATA) $(top_srcdir)/openhpi.conf.example $(DESTDIR)$(sysconfdir)/openhpi/openhpi.conf; \ fi + if test ! -e $(DESTDIR)$(sysconfdir)/openhpi/simulation.data; then \ + $(INSTALL_DATA) $(top_srcdir)/simulation.data.example $(DESTDIR)$(sysconfdir)/openhpi/simulation.data; \ + fi if test ! -e $(DESTDIR)$(sysconfdir)/openhpi/openhpiclient.conf; then \ $(INSTALL_DATA) $(top_srcdir)/openhpiclient.conf.example $(DESTDIR)$(sysconfdir)/openhpi/openhpiclient.conf; \ fi @@ -134,6 +138,9 @@ if cmp $(top_srcdir)/openhpi.conf.example $(DESTDIR)$(sysconfdir)/openhpi/openhpi.conf; then \ rm -f $(DESTDIR)$(sysconfdir)/openhpi/openhpi.conf; \ fi + if cmp $(top_srcdir)/simulation.data.example $(DESTDIR)$(sysconfdir)/openhpi/simulation.data; then \ + rm -f $(DESTDIR)$(sysconfdir)/openhpi/simulation.data; \ + fi if cmp $(top_srcdir)/openhpiclient.conf.example $(DESTDIR)$(sysconfdir)/openhpi/openhpiclient.conf; then \ rm -f $(DESTDIR)$(sysconfdir)/openhpi/openhpiclient.conf; \ fi Modified: openhpi/trunk/clients/Makefile.am =================================================================== --- openhpi/trunk/clients/Makefile.am 2010-06-10 18:34:51 UTC (rev 7095) +++ openhpi/trunk/clients/Makefile.am 2010-06-11 18:38:59 UTC (rev 7096) @@ -16,6 +16,7 @@ hpifan \ hpiinv \ hpiel \ + hpigensimdata \ hpisensor \ hpipower \ hpitree \ @@ -47,6 +48,9 @@ hpiel_SOURCES = hpiel.c $(CLIENTS_SRC) hpiel_LDADD = $(COMMONLIBS) +hpigensimdata_SOURCES = hpigensimdata.c $(CLIENTS_SRC) +hpigensimdata_LDADD = $(COMMONLIBS) + hpisensor_SOURCES = hpisensor.c $(CLIENTS_SRC) hpisensor_LDADD = $(COMMONLIBS) Copied: openhpi/trunk/clients/hpigensimdata.c (from rev 7095, openhpi/branches/newsimulator/clients/hpigensimdata.c) =================================================================== --- openhpi/trunk/clients/hpigensimdata.c (rev 0) +++ openhpi/trunk/clients/hpigensimdata.c 2010-06-11 18:38:59 UTC (rev 7096) @@ -0,0 +1,1812 @@ +/* + * hpigensimdata.c + * + * Copyright (c) 2010 by Lars Wetzel + * + * This program 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. This + * file and program are licensed under a BSD style license. See + * the Copying file included with the OpenHPI distribution for + * full licensing terms. + * + * Authors: + * Lars Wetzel (klw) <lar...@us...> + * + * Changes: + * 10/02/09 (klw) Release 0.9 + * 20/04/10 (klw) Fix in fumi data structure FumiNum -> Num + * (klw) Fix in fumi data structure spaces are printed correctly + * + * Open: + * - print all events of a system (not clear if necessary) + * - check update mode (depends on NewSimulator Fumi implementation) + * - maybe more selection criteria at the command line (eg. only sensor) + * depends on user which needs this client for some other reasons + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <getopt.h> +#include <ctype.h> +#include <SaHpi.h> +#include <oh_utils.h> +#include <oh_clients.h> + +#define OH_SVN_REV "$Revision: 6571 $" +#define GEN_SIM_DATA_VERSION 0.901 + +#define OFFSET_STEP 3 +#define OFFSET_FILLER ' ' +#define MAX_OFFSETS 10 +#define MAX_CHAR 256 +#define MAX_SHORT_CHAR 10 + +#define MODE_INIT 0 +#define MODE_UPD 1 + +#define CONF_SECTION "CONFIGURATION" +#define SENS_SECTION "SENSOR" +#define CONT_SECTION "CONTROL" +#define INV_SECTION "INVENTORY" +#define WDT_SECTION "WATCHDOG" +#define ANN_SECTION "ANNUNCIATOR" +#define DIMI_SECTION "DIMI" +#define FUMI_SECTION "FUMI" +#define RPT_SECTION "RPT" +#define RDR_SECTION "RDR" +#define RDR_DETAIL "RDR_DETAIL" + +#define CONTROL_GET "CONTROL_GET" +#define SENSOR_DATA "SENSOR_DATA" +#define INVENTORY_DATA "INVENTORY_DATA" +#define INV_AREA_DATA "INV_AREA" +#define INV_FIELD_DATA "INV_FIELD" +#define WTD_GET "WTD_GET" +#define ANN_DATA "ANNUNCIATOR_DATA" +#define ANNOUNCEMENT "ANNOUNCEMENT" +#define DIMI_DATA "DIMI_DATA" +#define DIMI_TEST "DIMI_TESTCASE" +#define DIMI_TEST_DATA "DIMI_TEST_DATA" +#define FUMI_DATA "FUMI_DATA" +#define FUMI_SOURCE "FUMI_SOURCE_DATA" +#define FUMI_TARGET "FUMI_TARGET_DATA" +#define FUMI_LOG_TARGET "FUMI_LOG_TARGET_DATA" + +typedef struct { + int mode; +} ConfigurationDataT; + +/* + * Globals + */ +int g_resource = FALSE; +int g_file = FALSE; + +char offSet[MAX_OFFSETS][MAX_CHAR]; + + + +/* + * Function prototypes + */ +static void print_header(FILE *out, + int offset, + ConfigurationDataT data); + +static SaErrorT print_resources(FILE *out, + int offset, + SaHpiSessionIdT sessionid, + SaHpiResourceIdT res_id); + +static SaErrorT print_rpt(FILE *out, + int offset, + SaHpiRptEntryT *rptptr); + +static void print_resourceInfo(FILE *out, + int offset, + SaHpiResourceInfoT resinfo); + +static SaErrorT print_rdr(FILE *out, + int offset, + SaHpiSessionIdT sessionid, + SaHpiResourceIdT resId, + SaHpiRdrT *rdrptr); + +static void print_common_rdr(FILE *out, + int offset, + SaHpiRdrT *rdrptr); + +static SaErrorT print_control_rdr(FILE *out, + int offset, + SaHpiSessionIdT sessionid, + SaHpiResourceIdT resId, + SaHpiCtrlRecT *ctrl); + +static void print_control_state_stream(FILE *out, + int offset, + SaHpiCtrlStateStreamT data); + +static void print_control_state_text(FILE *out, + int offset, + SaHpiCtrlStateTextT data); + +static void print_control_state_oem(FILE *out, + int offset, + SaHpiCtrlStateOemT data); + +static void print_sensor_rdr(FILE *out, + int offset, + SaHpiSensorRecT *sens); + +static SaErrorT print_sensor_data(FILE *out, + int offset, + SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, + SaHpiSensorRecT *sens); + +static int print_sensor_thresholds(FILE *out, + int myoffset, + SaHpiSensorThresholdsT thres, + SaHpiSensorDataFormatT format); + +static int check_sensor_reading(SaHpiSensorReadingT *read, + SaHpiSensorDataFormatT format); + +static void print_sensor_data_format(FILE *out, + int offset, + SaHpiSensorDataFormatT data); + +static void print_sensor_threshold_definition(FILE *out, + int offset, + SaHpiSensorThdDefnT def); + +static void print_sensor_reading(FILE *out, + int offset, + SaHpiSensorReadingT val); + +static void print_inventory_rdr(FILE *out, + int offset, + SaHpiInventoryRecT *inv); + +static SaErrorT print_inventory_data(FILE *out, + int offset, + SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, + SaHpiInventoryRecT *inv); + +static SaErrorT print_inventory_area_data(FILE *out, + int offset, + SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, + SaHpiInventoryRecT *inv, + SaHpiIdrAreaHeaderT *area); + +static void print_inventory_field(FILE *out, + int offset, + SaHpiIdrFieldT field); + +static SaErrorT print_watchdog_rdr(FILE *out, + int offset, + SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, + SaHpiWatchdogRecT *wtd); + +static void print_annunciator_rdr(FILE *out, + int offset, + SaHpiAnnunciatorRecT *ann); + +static SaErrorT print_annunciator_data(FILE *out, + int offset, + SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, + SaHpiAnnunciatorRecT *ann); + +static void print_annunciator_cond(FILE *out, + int offset, + SaHpiConditionT cond); + +static void print_dimi_rdr(FILE *out, + int offset, + SaHpiDimiRecT *dimi); + +static SaErrorT print_dimi_data(FILE *out, + int offset, + SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, + SaHpiDimiRecT *dimi); + +static void print_dimi_testparameter(FILE *out, + int offset, + SaHpiDimiTestParamsDefinitionT param); + +static void print_dimi_test_data(FILE *out, + int offset, + SaHpiDimiTestResultsT test); + +static void print_fumi_rdr(FILE *out, + int offset, + SaHpiFumiRecT *fumi); + +static SaErrorT print_fumi_data(FILE *out, + int offset, + SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, + SaHpiFumiRecT *fumi); + +static void print_fumi_source_info(FILE *out, + int offset, + SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, + SaHpiFumiRecT *fumi, + SaHpiBankNumT bnum); + +static void print_fumi_target_info(FILE *out, + int offset, + SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, + SaHpiFumiRecT *fumi, + SaHpiBankNumT bnum); + +static void print_fumi_logical_target_info(FILE *out, + int offset, + SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, + SaHpiFumiRecT *fumi); + +static void print_fumi_logical_component_info(FILE *out, + int offset, + SaHpiFumiLogicalComponentInfoT cinfo); + +static void print_fumi_component_info(FILE *out, + int offset, + SaHpiFumiComponentInfoT cinfo); + +static void print_fumi_fw_info(FILE *out, + int offset, + SaHpiFumiFirmwareInstanceInfoT data); + +static void print_textbuffer(FILE *out, + int offset, + SaHpiTextBufferT data); + +static SaErrorT print_ep(FILE *out, + int offset, + const SaHpiEntityPathT *ep); + +/* + * Main + */ +int main(int argc, char **argv) { + SaErrorT rv = SA_OK; + SaHpiDomainIdT domainid = SAHPI_UNSPECIFIED_DOMAIN_ID; + SaHpiSessionIdT sessionid; + SaHpiResourceIdT resourceid = 0; + char filename[MAX_CHAR+1]; + FILE *outfile = stdout; + int c; + ConfigurationDataT confdata; + SaHpiBoolT printusage = FALSE; + + confdata.mode = MODE_INIT; + oh_prog_version(argv[0], OH_SVN_REV); + + while ( (c = getopt( argc, argv,"xD:r:f:m:?")) != EOF ) { + switch(c) { + case 'D': + if (optarg) domainid = atoi(optarg); + else printusage = TRUE; + break; + case 'r': + if (optarg) { + resourceid = atoi(optarg); + g_resource = TRUE; + } else { + fprintf(stderr, "\nResourceid is missing\n"); + printusage = TRUE; + } + break; + case 'm': + if (optarg) { + char tmpmode[MAX_SHORT_CHAR+1]; + int i = 0; + while (i < MAX_SHORT_CHAR || optarg[i] != '\0') { + tmpmode[i] = toupper((char) optarg[i]); + i++; + } + tmpmode[i] = '\0'; + if (!strcmp(tmpmode, "UPD")) { + confdata.mode = MODE_UPD; + } else if (!strcmp(tmpmode, "INIT")) { + confdata.mode = MODE_INIT; + } else { + fprintf(stderr, "\nUnknown mode %s.\n", tmpmode); + printusage = TRUE; + } + } + break; + case 'f': + g_file = 1; + if (optarg) { + strncpy(filename, optarg, MAX_CHAR); + filename[MAX_CHAR] = '\0'; + outfile = fopen(filename, "w"); + if (outfile == NULL) { + fprintf(stderr, "\n%s couldn't be opened for writing.\n", filename); + exit(1); + } + break; + } + default: printusage = TRUE; + } + } + if (printusage == TRUE) + { + printf("\n %s - Version %.3f\n", argv[0], GEN_SIM_DATA_VERSION); + printf("\nThe client will print all HPI information. This information can be parsed by NewSimulator plugin."); + printf("\nTo spare some encoding/decoding function, values of enums are printed as int values instead of" + "encode them to ASCII values and decode them afterwards."); + printf("\nSince this client is primarily for the NewSimulator, the output functions don't depend on the" + "oh_.. - output function. Therefore they can be easily changed without influence on other clients."); + printf("\n\tUsage: %s [-option]\n\n", argv[0]); + printf("\t -D domain_id Select particular Domain\n"); + printf("\t -r res_id Select particular resource id for an update file\n"); + printf("\t -f filename Name of the file to be generated\n"); + printf("\t -m (UPD|INIT) Write update or initial file\n"); + printf("\n\n\n\n"); + exit(1); + } + + /** + * Initialize the offset strings + **/ + int i, j; + for(j=0; j < MAX_OFFSETS; j++) { + for (i=0; i < MAX_OFFSETS*OFFSET_STEP; i++) { + offSet[j][i] = OFFSET_FILLER; + } + offSet[j][OFFSET_STEP*j] = '\0'; + } + + print_header(outfile, 0, confdata); + + rv = saHpiSessionOpen(domainid,&sessionid,NULL); + if (rv != SA_OK) { + printf("saHpiSessionOpen returns %s\n",oh_lookup_error(rv)); + exit(-1); + } + + /* + * Resource discovery + */ + rv = saHpiDiscover(sessionid); + if (rv != SA_OK) { + printf("saHpiDiscover returns %s\n",oh_lookup_error(rv)); + exit(-1); + } + print_resources(outfile, 0, sessionid, resourceid); + + rv = saHpiSessionClose(sessionid); + if (g_file) fclose(outfile); + + exit(0); +} + + +/* + * + */ +static void print_header(FILE *out, int offset, ConfigurationDataT data) { + int myoffset = offset; + char strMode[MAX_CHAR]; + + if (data.mode == MODE_INIT) { + strcpy(strMode, "INIT"); + } else { + strcpy(strMode, "UPD"); + } + + fprintf(out, "%s%s {\n", offSet[myoffset++], CONF_SECTION); + fprintf(out, "%sMODE=%s\n", offSet[myoffset], strMode); + fprintf(out, "%sVERSION=%f\n", offSet[myoffset], GEN_SIM_DATA_VERSION); + fprintf(out, "%s}\n", offSet[--myoffset]); +} + +static SaErrorT print_resources(FILE *out, int offset, SaHpiSessionIdT sessionid, SaHpiResourceIdT resourceid) { + SaErrorT rv = SA_OK, + rvRptGet = SA_OK; + + SaHpiRptEntryT rptentry; + SaHpiEntryIdT rptentryid; + SaHpiEntryIdT nextrptentryid; + SaHpiEntryIdT entryid; + SaHpiEntryIdT nextentryid; + SaHpiRdrT rdr; + SaHpiTextBufferT working; + int myoffset = offset; + + oh_init_textbuffer(&working); + + /* walk the RPT list */ + rptentryid = SAHPI_FIRST_ENTRY; + do { + + rvRptGet = saHpiRptEntryGet(sessionid,rptentryid,&nextrptentryid,&rptentry); + if (rvRptGet != SA_OK) { + fprintf(stderr, "RptEntryGet returns %s\n",oh_lookup_error(rvRptGet)); + return rvRptGet; + } + + if ((g_resource == FALSE) || (resourceid == rptentry.ResourceId)) { + + fprintf(out, "%s%s {\n", offSet[myoffset], RPT_SECTION); + myoffset++; + rv = print_rpt(out, myoffset, &rptentry); + + if (rptentry.ResourceCapabilities & SAHPI_CAPABILITY_RDR) { + /* walk the RDR list for this RPT entry */ + entryid = SAHPI_FIRST_ENTRY; + + fprintf(out, "%s%s {\n", offSet[myoffset], RDR_SECTION); + myoffset++; + do { + rv = saHpiRdrGet(sessionid,rptentry.ResourceId, entryid, &nextentryid, &rdr); + if (rv != SA_OK) { + fprintf(stderr, "saHpiRdrGet[%d, %d] rv = %s\n", rptentry.ResourceId, entryid, + oh_lookup_error(rv)); + } + + rv = print_rdr(out, myoffset, sessionid, rptentry.ResourceId, &rdr); + entryid = nextentryid; + + } while ((rv == SA_OK) && (entryid != SAHPI_LAST_ENTRY)) ; + + fprintf(out, "%s}\n", offSet[--myoffset]); + } + } + + rptentryid = nextrptentryid; + fprintf(out, "%s}\n", offSet[--myoffset]); + } while (rptentryid != SAHPI_LAST_ENTRY); + + return(rv); +} + +/** + * print the rpt entries + **/ + +static SaErrorT print_rpt(FILE *out, int offset, SaHpiRptEntryT *rptptr) { + SaErrorT rv = SA_OK; + int myoffset = offset; + + fprintf(out, "%sEntryId=%d\n",offSet[myoffset],rptptr->EntryId); + fprintf(out, "%sResourceId=%d\n",offSet[myoffset],rptptr->ResourceId); + print_resourceInfo(out, myoffset, rptptr->ResourceInfo); + + fprintf(out, "%sResourceEntity={\n",offSet[myoffset]); + myoffset++; + rv = print_ep(out, myoffset, &rptptr->ResourceEntity); + myoffset--; + fprintf(out, "%s}\n", offSet[myoffset]); + + fprintf(out, "%sResourceCapabilities=0x%08X\n",offSet[myoffset],rptptr->ResourceCapabilities); + fprintf(out, "%sHotSwapCapabilities=0x%08X\n",offSet[myoffset],rptptr->HotSwapCapabilities); + fprintf(out, "%sResourceSeverity=%d\n",offSet[myoffset],rptptr->ResourceSeverity); + fprintf(out, "%sResourceFailed=%d\n",offSet[myoffset],rptptr->ResourceFailed); + + fprintf(out, "%sResourceTag={\n",offSet[myoffset]); + myoffset++; + print_textbuffer(out, myoffset, rptptr->ResourceTag); + myoffset--; + fprintf(out, "%s}\n", offSet[myoffset]); + + return(rv); +} + +static void print_resourceInfo(FILE *out, int offset, SaHpiResourceInfoT resinfo) { + int myoffset = offset; + int i; + fprintf(out,"%sResourceInfo={\n", offSet[offset]); + myoffset++; + fprintf(out,"%sResourceRev=0x%02X\n", offSet[myoffset],resinfo.ResourceRev); + fprintf(out,"%sSpecificVer=0x%02X\n", offSet[myoffset],resinfo.SpecificVer); + fprintf(out,"%sDeviceSupport=0x%02X\n", offSet[myoffset],resinfo.DeviceSupport); + fprintf(out,"%sManufacturerId=0x%08X\n", offSet[myoffset],resinfo.ManufacturerId); + fprintf(out,"%sProductId=0x%04X\n", offSet[myoffset],resinfo.ProductId); + fprintf(out,"%sFirmwareMajorRev=0x%02X\n", offSet[myoffset],resinfo.FirmwareMajorRev); + fprintf(out,"%sFirmwareMinorRev=0x%02X\n", offSet[myoffset],resinfo.FirmwareMinorRev); + fprintf(out,"%sAuxFirmwareRev=0x%02X\n", offSet[myoffset],resinfo.AuxFirmwareRev); + fprintf(out,"%sGuid=\"", offSet[myoffset]); + for (i=0; i<16 ; i++) fprintf(out,"%02X", resinfo.Guid[i]); + fprintf(out,"\"\n"); + fprintf(out,"%s}\n",offSet[offset]); +} + +static SaErrorT print_rdr(FILE *out, int offset, SaHpiSessionIdT sessionid, + SaHpiResourceIdT resId, SaHpiRdrT *rdrptr) { + int myoffset = offset; + SaErrorT rv = SA_OK; + + switch (rdrptr->RdrType) { + case SAHPI_CTRL_RDR: + fprintf(out, "%s%s {\n",offSet[myoffset++], CONT_SECTION); + print_common_rdr(out, myoffset, rdrptr); + fprintf(out, "%s%s {\n",offSet[myoffset++], RDR_DETAIL); + rv = print_control_rdr(out, myoffset, sessionid, resId, &rdrptr->RdrTypeUnion.CtrlRec); + fprintf(out, "%s}\n", offSet[--myoffset]); + break; + case SAHPI_SENSOR_RDR: + fprintf(out, "%s%s {\n",offSet[myoffset++], SENS_SECTION); + print_common_rdr(out, myoffset, rdrptr); + fprintf(out, "%s%s {\n",offSet[myoffset++], RDR_DETAIL); + print_sensor_rdr(out, myoffset, &rdrptr->RdrTypeUnion.SensorRec); + rv = print_sensor_data(out, myoffset, sessionid, resId, &rdrptr->RdrTypeUnion.SensorRec); + fprintf(out, "%s}\n", offSet[--myoffset]); + break; + case SAHPI_INVENTORY_RDR: + fprintf(out, "%s%s {\n",offSet[myoffset++], INV_SECTION); + print_common_rdr(out, myoffset, rdrptr); + fprintf(out, "%s%s {\n",offSet[myoffset++], RDR_DETAIL); + print_inventory_rdr(out, myoffset, &rdrptr->RdrTypeUnion.InventoryRec); + rv = print_inventory_data(out, myoffset, sessionid, resId, &rdrptr->RdrTypeUnion.InventoryRec); + fprintf(out, "%s}\n", offSet[--myoffset]); + break; + case SAHPI_WATCHDOG_RDR: + fprintf(out, "%s%s {\n",offSet[myoffset++], WDT_SECTION); + print_common_rdr(out, myoffset, rdrptr); + fprintf(out, "%s%s {\n",offSet[myoffset++], RDR_DETAIL); + rv = print_watchdog_rdr(out, myoffset, sessionid, resId, &rdrptr->RdrTypeUnion.WatchdogRec); + fprintf(out, "%s}\n", offSet[--myoffset]); + break; + case SAHPI_ANNUNCIATOR_RDR: + fprintf(out, "%s%s {\n",offSet[myoffset++], ANN_SECTION); + print_common_rdr(out, myoffset, rdrptr); + fprintf(out, "%s%s {\n",offSet[myoffset++], RDR_DETAIL); + print_annunciator_rdr(out, myoffset, &rdrptr->RdrTypeUnion.AnnunciatorRec); + rv = print_annunciator_data(out, myoffset, sessionid, resId, &rdrptr->RdrTypeUnion.AnnunciatorRec); + fprintf(out, "%s}\n", offSet[--myoffset]); + break; + case SAHPI_DIMI_RDR: + fprintf(out, "%s%s {\n",offSet[myoffset++], DIMI_SECTION); + print_common_rdr(out, myoffset, rdrptr); + fprintf(out, "%s%s {\n",offSet[myoffset++], RDR_DETAIL); + print_dimi_rdr(out, myoffset, &rdrptr->RdrTypeUnion.DimiRec); + rv = print_dimi_data(out, myoffset, sessionid, resId, &rdrptr->RdrTypeUnion.DimiRec); + fprintf(out, "%s}\n", offSet[--myoffset]); + break; + case SAHPI_FUMI_RDR: + fprintf(out, "%s%s {\n",offSet[myoffset++], FUMI_SECTION); + print_common_rdr(out, myoffset, rdrptr); + fprintf(out, "%s%s {\n",offSet[myoffset++], RDR_DETAIL); + print_fumi_rdr(out, myoffset, &rdrptr->RdrTypeUnion.FumiRec); + rv = print_fumi_data(out, myoffset, sessionid, resId, &rdrptr->RdrTypeUnion.FumiRec); + fprintf(out, "%s}\n", offSet[--myoffset]); + break; + default: + fprintf(out, "%sUNKNOWN_RDR={\n",offSet[myoffset++]); + } + + fprintf(out, "%s}\n", offSet[--myoffset]); + return rv; +} + +static void print_common_rdr(FILE *out, int offset, SaHpiRdrT *rdrptr) { + int myoffset = offset; + + fprintf(out,"%sRecordId=%d\n",offSet[myoffset], rdrptr->RecordId); + fprintf(out,"%sRdrType=%d\n",offSet[myoffset], rdrptr->RdrType); + fprintf(out,"%sEntity={\n",offSet[myoffset++]); + print_ep(out, myoffset, &rdrptr->Entity); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out,"%sIsFru=%d\n",offSet[myoffset], rdrptr->IsFru); + fprintf(out,"%sIdString={\n",offSet[myoffset]); + myoffset++; + print_textbuffer(out, myoffset, rdrptr->IdString); + myoffset--; + fprintf(out, "%s}\n", offSet[myoffset]); +} + +/** + * Fumi functions + **/ +static void print_fumi_rdr(FILE *out, int offset, SaHpiFumiRecT *fumi) { + int myoffset = offset; + + fprintf(out,"%sNum=%d\n",offSet[myoffset], fumi->Num); + fprintf(out,"%sAccessProt=%d\n",offSet[myoffset], fumi->AccessProt); + fprintf(out,"%sCapability=%d\n",offSet[myoffset], fumi->Capability); + fprintf(out,"%sNumBanks=%d\n",offSet[myoffset], fumi->NumBanks); + fprintf(out,"%sOem=%u\n", offSet[myoffset], fumi->Oem); +} + +static SaErrorT print_fumi_data(FILE *out, int offset, SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, SaHpiFumiRecT *fumi) { + int myoffset = offset; + SaErrorT rv = SA_OK; + int printData = TRUE; + int i; + + // Get the fumi specification + SaHpiFumiSpecInfoT fumispec; + rv = saHpiFumiSpecInfoGet(sessionId, resId, fumi->Num, &fumispec); + if (rv != SA_OK) { + fprintf(stderr, "saHpiFumiSpecInfoGet returns %s for ResId %d Num %d -" + " no fumi data will be printed\n", + oh_lookup_error(rv), resId, fumi->Num); + printData = FALSE; + } + + SaHpiFumiServiceImpactDataT fumiimpact; + rv = saHpiFumiServiceImpactGet(sessionId, resId, fumi->Num, &fumiimpact); + if (rv != SA_OK) { + fprintf(stderr, "saHpiFumiServiceImpactGet returns %s for ResId %d Num %d -" + " no fumi data will be printed\n", + oh_lookup_error(rv), resId, fumi->Num); + printData = FALSE; + rv = SA_OK; // Should not lead to an interruption + } + + if (printData) { + fprintf(out,"%s%s={\n", offSet[myoffset++], FUMI_DATA); + + // Fumi Spec Info + fprintf(out,"%sSpecInfoType=%u\n", offSet[myoffset], fumispec.SpecInfoType); + if (fumispec.SpecInfoType == SAHPI_FUMI_SPEC_INFO_SAF_DEFINED) { + fprintf(out,"%sSafDefined={\n",offSet[myoffset++]); + fprintf(out,"%sSpecID=%u\n",offSet[myoffset], fumispec.SpecInfoTypeUnion.SafDefined.SpecID); + fprintf(out,"%sRevisionID=%u\n",offSet[myoffset], fumispec.SpecInfoTypeUnion.SafDefined.RevisionID); + fprintf(out, "%s}\n",offSet[--myoffset]); + } else if (fumispec.SpecInfoType == SAHPI_FUMI_SPEC_INFO_OEM_DEFINED) { + fprintf(out,"%sOemDefined={\n",offSet[myoffset++]); + fprintf(out,"%sMid=0x%08X\n", offSet[myoffset], fumispec.SpecInfoTypeUnion.OemDefined.Mid); + fprintf(out,"%sBodyLength=%u\n",offSet[myoffset], fumispec.SpecInfoTypeUnion.OemDefined.BodyLength); + fprintf(out,"%sBody=\"",offSet[myoffset]); + for (i = 0; i < fumispec.SpecInfoTypeUnion.OemDefined.BodyLength; i++) + fprintf(out,"%02X", fumispec.SpecInfoTypeUnion.OemDefined.Body[i]); + fprintf(out,"\"\n"); + fprintf(out, "%s}\n", offSet[--myoffset]); + } + + // Fumi AutoRollback + if (fumi->Capability & SAHPI_FUMI_CAP_AUTOROLLBACK) { + SaHpiBoolT disabled; + rv = saHpiFumiAutoRollbackDisableGet(sessionId, resId, fumi->Num, &disabled); + if (rv != SA_OK) { + fprintf(stderr, " saHpiFumiAutoRollbackDisableGet returns %s for ResId %d Num %d -" + " no data is printed\n", + oh_lookup_error(rv), resId, fumi->Num); + } else { + fprintf(out,"%sAutoRollbackDisable=%d\n", offSet[myoffset], disabled); + } + } + + // Fumi Service Impact + fprintf(out,"%sNumEntities=%u\n", offSet[myoffset], fumiimpact.NumEntities); + for ( i = 0; i < fumiimpact.NumEntities; i++) { + fprintf(out,"%sImpactedEntities={\n", offSet[myoffset++]); + fprintf(out,"%sImpactedEntity={\n", offSet[myoffset++]); + print_ep(out, myoffset, &fumiimpact.ImpactedEntities[i].ImpactedEntity); + fprintf(out, "%s}\n", offSet[--myoffset]); //ImpactedEntity + fprintf(out,"%sServiceImpact=%u\n",offSet[myoffset],fumiimpact.ImpactedEntities[i].ServiceImpact); + fprintf(out, "%s}\n", offSet[--myoffset]); // ImpactedEntities + } + + // Fumi Source and Target Information + for (i = 0; i <= fumi->NumBanks; i++) { + print_fumi_target_info(out, myoffset, sessionId, resId, fumi, i); + print_fumi_source_info(out, myoffset, sessionId, resId, fumi, i); + } + + // Fumi logical Target Information + print_fumi_logical_target_info(out, myoffset, sessionId, resId, fumi); + + fprintf(out, "%s}\n", offSet[--myoffset]); // FUMI_DATA + } + return rv; +} + +static void print_fumi_logical_target_info(FILE *out, int offset, SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, SaHpiFumiRecT *fumi) { + int myoffset = offset; + SaErrorT rv = SA_OK; + SaHpiFumiLogicalBankInfoT logbank; + int printHeader = FALSE; + + rv = saHpiFumiLogicalTargetInfoGet(sessionId, resId, fumi->Num, &logbank); + if (rv == SA_OK) { + printHeader = TRUE; + fprintf(out,"%s%s={\n",offSet[myoffset++], FUMI_LOG_TARGET); + + fprintf(out,"%sFirmwarePersistentLocationCount=%u\n",offSet[myoffset], logbank.FirmwarePersistentLocationCount); + fprintf(out,"%sBankStateFlags=0x%08X\n",offSet[myoffset], logbank.BankStateFlags); + fprintf(out,"%sPendingFwInstance={\n",offSet[myoffset++]); + print_fumi_fw_info(out, myoffset, logbank.PendingFwInstance); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out,"%sRollbackFwInstance={\n",offSet[myoffset++]); + print_fumi_fw_info(out, myoffset, logbank.RollbackFwInstance); + fprintf(out, "%s}\n", offSet[--myoffset]); + } + + if (fumi->Capability & SAHPI_FUMI_CAP_COMPONENTS) { + SaHpiEntryIdT entry = SAHPI_FIRST_ENTRY; + SaHpiEntryIdT next; + SaHpiFumiLogicalComponentInfoT cinfo; + rv = SA_OK; + while ((entry != SAHPI_LAST_ENTRY) && (rv == SA_OK)) { + rv = saHpiFumiLogicalTargetComponentInfoGet(sessionId, resId, fumi->Num, + entry, &next, &cinfo); + if (rv == SA_OK) { + if (!printHeader) + fprintf(out,"%s%s={\n",offSet[myoffset++], FUMI_LOG_TARGET); + printHeader = TRUE; + print_fumi_logical_component_info(out, myoffset, cinfo); + } + entry = next; + } + } + + if (printHeader) + fprintf(out, "%s}\n", offSet[--myoffset]); // FUMI_TARGET +} + +static void print_fumi_target_info(FILE *out, int offset, SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, SaHpiFumiRecT *fumi, SaHpiBankNumT bnum) { + int myoffset = offset; + SaErrorT rv = SA_OK; + SaHpiFumiBankInfoT bank; + int printHeader = FALSE; + + rv = saHpiFumiTargetInfoGet(sessionId, resId, fumi->Num, bnum, &bank); + if (rv == SA_OK) { + printHeader = TRUE; + fprintf(out,"%s%s={\n",offSet[myoffset++], FUMI_TARGET); + + fprintf(out,"%sBankId=%u\n", offSet[myoffset], bank.BankId); + fprintf(out,"%sBankSize=%u\n", offSet[myoffset], bank.BankSize); + fprintf(out,"%sPosition=%u\n", offSet[myoffset], bank.Position); + fprintf(out,"%sBankState=%u\n", offSet[myoffset], bank.BankState); + fprintf(out,"%sIdentifier={\n",offSet[myoffset++]); + print_textbuffer(out, myoffset, bank.Identifier); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out,"%sDescription={\n",offSet[myoffset++]); + print_textbuffer(out, myoffset, bank.Description); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out,"%sDateTime={\n",offSet[myoffset++]); + print_textbuffer(out, myoffset, bank.DateTime); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out, "%sMajorVersion=%u\n", offSet[myoffset], bank.MajorVersion); + fprintf(out, "%sMinorVersion=%u\n", offSet[myoffset], bank.MinorVersion); + fprintf(out, "%sAuxVersion=%u\n", offSet[myoffset], bank.AuxVersion); + } + + if (fumi->Capability & SAHPI_FUMI_CAP_COMPONENTS) { + SaHpiEntryIdT entry = SAHPI_FIRST_ENTRY; + SaHpiEntryIdT next; + SaHpiFumiComponentInfoT cinfo; + rv = SA_OK; + while ((entry != SAHPI_LAST_ENTRY) && (rv == SA_OK)) { + rv = saHpiFumiTargetComponentInfoGet(sessionId, resId, fumi->Num, bnum, + entry, &next, &cinfo); + if (rv == SA_OK) { + if (!printHeader) + fprintf(out,"%s%s={\n",offSet[myoffset++], FUMI_TARGET); + printHeader = TRUE; + print_fumi_component_info(out, myoffset, cinfo); + } + entry = next; + } + } + + if (printHeader) + fprintf(out, "%s}\n", offSet[--myoffset]); // FUMI_TARGET + +} + + +static void print_fumi_source_info(FILE *out, int offset, SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, SaHpiFumiRecT *fumi, SaHpiBankNumT bnum) { + int myoffset = offset; + SaErrorT rv = SA_OK; + SaHpiFumiSourceInfoT source; + int printHeader = FALSE; + + rv = saHpiFumiSourceInfoGet(sessionId, resId, fumi->Num, bnum, &source); + if (rv == SA_OK) { + printHeader = TRUE; + fprintf(out,"%s%s={\n",offSet[myoffset++], FUMI_SOURCE); + fprintf(out,"%sForBank=%u\n", offSet[myoffset], bnum); + fprintf(out,"%sSourceUri={\n",offSet[myoffset++]); + print_textbuffer(out, myoffset, source.SourceUri); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out,"%sSourceStatus=%u\n", offSet[myoffset], source.SourceStatus); + fprintf(out,"%sIdentifier={\n",offSet[myoffset++]); + print_textbuffer(out, myoffset, source.Identifier); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out,"%sDescription={\n",offSet[myoffset++]); + print_textbuffer(out, myoffset, source.Description); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out,"%sDateTime={\n",offSet[myoffset++]); + print_textbuffer(out, myoffset, source.DateTime); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out, "%sMajorVersion=%u\n", offSet[myoffset], source.MajorVersion); + fprintf(out, "%sMinorVersion=%u\n", offSet[myoffset], source.MinorVersion); + fprintf(out, "%sAuxVersion=%u\n", offSet[myoffset], source.AuxVersion); + } + + if (fumi->Capability & SAHPI_FUMI_CAP_COMPONENTS) { + SaHpiEntryIdT entry = SAHPI_FIRST_ENTRY; + SaHpiEntryIdT next; + SaHpiFumiComponentInfoT cinfo; + rv = SA_OK; + while ((entry != SAHPI_LAST_ENTRY) && (rv == SA_OK)) { + rv = saHpiFumiSourceComponentInfoGet(sessionId, resId, fumi->Num, bnum, + entry, &next, &cinfo); + if (rv == SA_OK) { + if (!printHeader) + fprintf(out,"%s%s={\n",offSet[myoffset++], FUMI_SOURCE); + printHeader = TRUE; + print_fumi_component_info(out, myoffset, cinfo); + } + entry = next; + } + } + + if (printHeader) + fprintf(out, "%s}\n", offSet[--myoffset]); // FUMI_SOURCE + +} + +static void print_fumi_logical_component_info(FILE *out, int offset, SaHpiFumiLogicalComponentInfoT cinfo) { + int myoffset = offset; + + fprintf(out, "%sEntryId=%u\n", offSet[myoffset], cinfo.EntryId); + fprintf(out, "%sComponentId=%u\n", offSet[myoffset], cinfo.ComponentId); + fprintf(out, "%sPendingFwInstance={\n",offSet[myoffset++]); + print_fumi_fw_info(out, myoffset, cinfo.PendingFwInstance); + fprintf(out, "%s}\n", offSet[--myoffset]); // PendingFwInstance + fprintf(out, "%sRollbackFwInstance={\n",offSet[myoffset++]); + print_fumi_fw_info(out, myoffset, cinfo.RollbackFwInstance); + fprintf(out, "%s}\n", offSet[--myoffset]); // RollbackFwInstance + fprintf(out, "%sComponentFlags=%u\n",offSet[myoffset], cinfo.ComponentFlags); +} + +static void print_fumi_component_info(FILE *out, int offset, SaHpiFumiComponentInfoT cinfo) { + int myoffset = offset; + + fprintf(out, "%sEntryId=%u\n", offSet[myoffset], cinfo.EntryId); + fprintf(out, "%sComponentId=%u\n", offSet[myoffset], cinfo.ComponentId); + fprintf(out, "%sMainFwInstance={\n",offSet[myoffset++]); + print_fumi_fw_info(out, myoffset, cinfo.MainFwInstance); + fprintf(out, "%s}\n", offSet[--myoffset]); // MainFwInstance + fprintf(out, "%sComponentFlags=%u\n",offSet[myoffset], cinfo.ComponentFlags); +} + +static void print_fumi_fw_info(FILE *out, int offset, SaHpiFumiFirmwareInstanceInfoT data) { + int myoffset = offset; + + fprintf(out,"%sInstancePresent=%d\n",offSet[myoffset], data.InstancePresent); + fprintf(out,"%sIdentifier={\n",offSet[myoffset++]); + print_textbuffer(out, myoffset, data.Identifier); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out,"%sDescription={\n",offSet[myoffset++]); + print_textbuffer(out, myoffset, data.Description); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out,"%sDateTime={\n",offSet[myoffset++]); + print_textbuffer(out, myoffset, data.DateTime); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out, "%sMajorVersion=%u\n", offSet[myoffset], data.MajorVersion); + fprintf(out, "%sMinorVersion=%u\n", offSet[myoffset], data.MinorVersion); + fprintf(out, "%sAuxVersion=%u\n", offSet[myoffset], data.AuxVersion); +} + +/** + * Dimi functions + **/ + +static void print_dimi_rdr(FILE *out, int offset, SaHpiDimiRecT *dimi) { + int myoffset = offset; + + fprintf(out,"%sDimiNum=%d\n",offSet[myoffset], dimi->DimiNum); + fprintf(out,"%sOem=%u\n", offSet[myoffset], dimi->Oem); +} + +static SaErrorT print_dimi_data(FILE *out, int offset, SaHpiSessionIdT sessionId, + SaHpiResourceIdT resId, SaHpiDimiRecT *dimi) { + int myoffset = offset; + int i,j; + SaErrorT rv = SA_OK; + SaHpiDimiInfoT testinfo; + + rv = saHpiDimiInfoGet(sessionId, resId, dimi->DimiNum, &testinfo); + if (rv != SA_OK) { + fprintf(stderr, "saHpiDimiInfoGet returns %s for ResId %d Num %d - will be Ignored, all is set to 0\n", + oh_lookup_error(rv), resId, dimi->DimiNum); + testinfo.NumberOfTests = 0; + testinfo.TestNumUpdateCounter = 0; + rv = SA_OK; + } + fprintf(out,"%s%s={\n", offSet[myoffset++], DIMI_DATA); + fprintf(out,"%sNumberOfTests=%u\n", offSet[myoffset], testinfo.NumberOfTests); + fprintf(out,"%sTestNumUpdateCounter=%u\n", offSet[myoffset], testinfo.TestNumUpdateCounter); + + for (i = 0; i < testinfo.NumberOfTests; i++) { + SaHpiDimiTestT testcase; + rv = saHpiDimiTestInfoGet(sessionId, resId, dimi->DimiNum, i, &testcase); + if (rv != SA_OK) { + fprintf(stderr, "saHpiDimiTestInfoGet returns %s for ResId %d DimiNum %d Test %d-" + "will be Ignored, no data is printed\n", + oh_lookup_error(rv), resId, dimi->DimiNum, i); + rv = SA_OK; + + } else { + + // Testcase + fprintf(out,"%s%s={\n", offSet[myoffset++], DIMI_TEST); + fprintf(out,"%sTestName={\n", offSet[myoffset++]); + print_textbuffer(out, myoffset, testcase.TestName); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out,"%sServiceImpact=%u\n",offSet[myoffset], testcase.ServiceImpact); + for (j = 0; j < SAHPI_DIMITEST_MAX_ENTITIESIMPACTED; j++) { + fprintf(out,"%sEntitiesImpacted={\n", offSet[myoffset++]); + fprintf(out,"%sEntityImpacted={\n", offSet[myoffset++]); + print_ep(out, myoffset, &testcase.EntitiesImpacted[j].EntityImpacted); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out,"%sServiceImpact=%u\n",offSet[myoffset],testcase.EntitiesImpacted[j].ServiceImpact); + fprintf(out, "%s}\n", offSet[--myoffset]); + } + + fprintf(out,"%sNeedServiceOS=%d\n",offSet[myoffset], testcase.NeedServiceOS); + fprintf(out,"%sServiceOS={\n", offSet[myoffset++]); + print_textbuffer(out, myoffset, testcase.ServiceOS); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out,"%sExpectedRunDuration=%ld\n",offSet[myoffset], (long int) testcase.ExpectedRunDuration); + fprintf(out,"%sTestCapabilities=%u\n",offSet[myoffset], testcase.TestCapabilities); + for (j = 0; j < SAHPI_DIMITEST_MAX_PARAMETERS; j++) { + fprintf(out,"%sTestParameters={\n", offSet[myoffset++]); + print_dimi_testparameter(out, myoffset, testcase.TestParameters[j]); + fprintf(out, "%s}\n", offSet[--myoffset]); // TestParameters + } + + // Testcase readiness + SaErrorT rv_testdata = SA_OK; + SaHpiDimiReadyT testready; + rv_testdata = saHpiDimiTestReadinessGet(sessionId, resId, dimi->DimiNum, i, &testready); + if (rv_testdata != SA_OK) { + fprintf(stderr, "saHpiDimiTestReadinessGet returns %s for ResId %d DimiNum %d Test %d-" + "SAHPI_DIMI_WRONG_STATE is used instead\n", + oh_lookup_error(rv), resId, dimi->DimiNum, i); + testready = SAHPI_DIMI_WRONG_STATE; + } + fprintf(out,"%sTestReadiness=%u\n", offSet[myoffset], testready); + + // Testcase data + SaHpiDimiTestResultsT testresult; + rv_testdata = saHpiDimiTestResultsGet(sessionId, resId, dimi->DimiNum, i, &testresult); + if (rv_testdata != SA_OK) { + fprintf(stderr, "saHpiDimiTestResultsGet returns %s for ResId %d DimiNum %d Test %d -" + "will be Ignored, no data is printed\n", + oh_lookup_error(rv), resId, dimi->DimiNum, i); + } else { + fprintf(out,"%s%s={\n", offSet[myoffset++], DIMI_TEST_DATA); + print_dimi_test_data(out, myoffset, testresult); + fprintf(out, "%s}\n", offSet[--myoffset]); // DIMI_TEST_DATA + } + fprintf(out, "%s}\n", offSet[--myoffset]); // DIMI_TEST + } + } + + fprintf(out, "%s}\n", offSet[--myoffset]); // DIMI_DATA + return rv; +} + +static void print_dimi_testparameter(FILE *out, int offset, SaHpiDimiTestParamsDefinitionT param) { + int myoffset = offset; + + fprintf(out,"%sParamName=\"%s\"\n", offSet[myoffset], (char *) param.ParamName); + fprintf(out,"%sParamInfo={\n", offSet[myoffset++]); + print_textbuffer(out, myoffset, param.ParamInfo); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out,"%sParamType=%u\n", offSet[myoffset],param.ParamType); + switch (param.ParamType) { + case SAHPI_DIMITEST_PARAM_TYPE_BOOLEAN: + fprintf(out,"%sDefaultParam=%d\n", offSet[myoffset], param.DefaultParam.parambool); + break; + case SAHPI_DIMITEST_PARAM_TYPE_INT32: + fprintf(out,"%sMinValue=%d\n", offSet[myoffset], param.MinValue.IntValue); + fprintf(out,"%sMaxValue=%d\n", offSet[myoffset], param.MaxValue.IntValue); + fprintf(out,"%sDefaultParam=%d\n", offSet[myoffset], param.DefaultParam.paramint); + break; + case SAHPI_DIMITEST_PARAM_TYPE_FLOAT64: + fprintf(out,"%sMinValue=%lf\n", offSet[myoffset], param.MinValue.FloatValue); + fprintf(out,"%sMaxValue=%lf\n", offSet[myoffset], param.MaxValue.FloatValue); + fprintf(out,"%sDefaultParam=%lf\n", offSet[myoffset], param.DefaultParam.paramfloat); + break; + case SAHPI_DIMITEST_PARAM_TYPE_TEXT: + fprintf(out,"%sDefaultParam={\n", offSet[myoffset++]); + print_textbuffer(out, myoffset, param.DefaultParam.paramtext); + fprintf(out, "%s}\n", offSet[--myoffset]); + default: + fprintf(out,"%sUNKNOWN_PARAM_TYPE\n", offSet[myoffset]); + } +} +static void print_dimi_test_data(FILE *out, int offset, SaHpiDimiTestResultsT test) { + int myoffset = offset; + + fprintf(out,"%sResultTimeStamp=%ld\n", offSet[myoffset], (long int) test.ResultTimeStamp); + fprintf(out,"%sRunDuration=%ld\n", offSet[myoffset], (long int) test.RunDuration); + fprintf(out,"%sLastRunStatus=%u\n", offSet[myoffset], test.LastRunStatus); + fprintf(out,"%sTestErrorCode=%u\n", offSet[myoffset], test.TestErrorCode); + fprintf(out,"%sTestResultString={\n", offSet[myoffset++]); + print_textbuffer(out, myoffset, test.TestResultString); + fprintf(out, "%s}\n", offSet[--myoffset]); + fprintf(out,"%sTestResultStringIsURI=%d\n", offSet[myoffset], test.TestResultStringIsURI); +} + + +/** + * Annunciator functions + **/ +static void print_annunciator_rdr(FILE *out, int offset, SaHpiAnnunciatorRecT *ann) { + int myoffset = offset; + + fprintf(out,"%sAnnunciatorNum=%d\n",offSet[myoffset], ann->AnnunciatorNum); + fprintf(out,"%... [truncated message content] |
From: <su...@us...> - 2010-06-12 21:08:20
|
Revision: 7100 http://openhpi.svn.sourceforge.net/openhpi/?rev=7100&view=rev Author: sutula Date: 2010-06-12 21:08:14 +0000 (Sat, 12 Jun 2010) Log Message: ----------- Don't run daemon until openhpi.conf has been configured, fixes tracker ID: 3014655 Modified Paths: -------------- openhpi/trunk/include/oh_config.h openhpi/trunk/openhpi.conf.example openhpi/trunk/openhpid/config.c openhpi/trunk/openhpid/init.c Modified: openhpi/trunk/include/oh_config.h =================================================================== --- openhpi/trunk/include/oh_config.h 2010-06-11 21:53:25 UTC (rev 7099) +++ openhpi/trunk/include/oh_config.h 2010-06-12 21:08:14 UTC (rev 7100) @@ -12,6 +12,7 @@ * Authors: * Sean Dague <http://dague.net/sean> * Renier Morales <re...@op...> + * Bryan Sutula <su...@us...> */ #ifndef __OH_CONFIG_H @@ -43,7 +44,8 @@ OPENHPI_PATH, OPENHPI_VARPATH, OPENHPI_CONF, - OPENHPICLIENT_CONF + OPENHPICLIENT_CONF, + OPENHPI_UNCONFIGURED } oh_global_param_type; typedef union { @@ -58,6 +60,7 @@ char path[OH_MAX_TEXT_BUFFER_LENGTH]; char varpath[OH_MAX_TEXT_BUFFER_LENGTH]; char conf[OH_MAX_TEXT_BUFFER_LENGTH]; + SaHpiBoolT unconfigured; } oh_global_param_union; struct oh_global_param { Modified: openhpi/trunk/openhpi.conf.example =================================================================== --- openhpi/trunk/openhpi.conf.example 2010-06-11 21:53:25 UTC (rev 7099) +++ openhpi/trunk/openhpi.conf.example 2010-06-12 21:08:14 UTC (rev 7100) @@ -1,6 +1,12 @@ ### OpenHPI configuration example file ### ####### +## OpenHPI will not be useful unless it is configured for your system. Once +## you have modified this file, remove or comment the following line to allow +## the OpenHPI daemon to run. This line causes the daemon to exit immediately. +OPENHPI_UNCONFIGURED = "YES" + +####### ## FIRST section: declaration of global parameters like the following. #OPENHPI_LOG_ON_SEV = "MINOR" Modified: openhpi/trunk/openhpid/config.c =================================================================== --- openhpi/trunk/openhpid/config.c 2010-06-11 21:53:25 UTC (rev 7099) +++ openhpi/trunk/openhpid/config.c 2010-06-12 21:08:14 UTC (rev 7100) @@ -16,6 +16,7 @@ * David Judkovics <dju...@us...> * Thomas Kangieser <Tho...@fc...> * Renier Morales <re...@op...> + * Bryan Sutula <su...@us...> */ #include <string.h> @@ -43,6 +44,7 @@ "OPENHPI_VARPATH", "OPENHPI_CONF", "OPENHPICLIENT_CONF", + "OPENHPI_UNCONFIGURED", NULL }; @@ -59,6 +61,7 @@ char varpath[OH_MAX_TEXT_BUFFER_LENGTH]; char conf[OH_MAX_TEXT_BUFFER_LENGTH]; char client_conf[OH_MAX_TEXT_BUFFER_LENGTH]; + SaHpiBoolT unconfigured; unsigned char read_env; GStaticRecMutex lock; } global_params = { /* Defaults for global params are set here */ @@ -74,6 +77,7 @@ .varpath = VARPATH, .conf = OH_DEFAULT_CONF, .client_conf = OH_CLIENT_DEFAULT_CONF, + .unconfigured = SAHPI_FALSE, .read_env = 0, .lock = G_STATIC_REC_MUTEX_INIT }; @@ -209,6 +213,12 @@ memset(global_params.client_conf, 0, OH_MAX_TEXT_BUFFER_LENGTH); strncpy(global_params.client_conf, value, OH_MAX_TEXT_BUFFER_LENGTH-1); g_static_rec_mutex_unlock(&global_params.lock); + } else if (!strcmp("OPENHPI_UNCONFIGURED", name)) { + if (!strcmp("YES", value)) { + global_params.unconfigured = SAHPI_TRUE; + } else { + global_params.unconfigured = SAHPI_FALSE; + } } else { err("ERROR. Invalid global parameter %s in config file", name); } @@ -668,6 +678,9 @@ OH_MAX_TEXT_BUFFER_LENGTH); g_static_rec_mutex_unlock(&global_params.lock); break; + case OPENHPI_UNCONFIGURED: + param->u.unconfigured = global_params.unconfigured; + break; default: err("ERROR. Invalid global parameter %d!", param->type); return -2; @@ -750,6 +763,9 @@ OH_MAX_TEXT_BUFFER_LENGTH-1); g_static_rec_mutex_unlock(&global_params.lock); break; + case OPENHPI_UNCONFIGURED: + global_params.unconfigured = param->u.unconfigured; + break; default: err("ERROR. Invalid global parameter %d!", param->type); return -2; Modified: openhpi/trunk/openhpid/init.c =================================================================== --- openhpi/trunk/openhpid/init.c 2010-06-11 21:53:25 UTC (rev 7099) +++ openhpi/trunk/openhpid/init.c 2010-06-12 21:08:14 UTC (rev 7100) @@ -11,6 +11,7 @@ * * Author(s): * Renier Morales <re...@op...> + * Bryan Sutula <su...@us...> * */ @@ -37,6 +38,7 @@ static int initialized = 0; struct oh_parsed_config config = { NULL, 0, 0 }; struct oh_global_param config_param = { .type = OPENHPI_CONF }; + struct oh_global_param unconf_param = { .type = OPENHPI_UNCONFIGURED }; SaErrorT rval; data_access_lock(); @@ -66,6 +68,16 @@ return SA_ERR_HPI_NOT_PRESENT; } + /* One particular variable, OPENHPI_UNCONFIGURED, can cause us to exit + * immediately, without trying to run the daemon any further. + */ + oh_get_global_param(&unconf_param); + if (unconf_param.u.unconfigured) { + err("OpenHPI is not configured. See openhpi.conf file."); + data_access_unlock(); + return SA_ERR_HPI_ERROR; + } + /* Initialize uid_utils */ rval = oh_uid_initialize(); if( (rval != SA_OK) && (rval != SA_ERR_HPI_ERROR) ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <uli...@us...> - 2010-06-14 06:52:03
|
Revision: 7102 http://openhpi.svn.sourceforge.net/openhpi/?rev=7102&view=rev Author: ulikleber Date: 2010-06-14 06:51:53 +0000 (Mon, 14 Jun 2010) Log Message: ----------- Fix for #3013166 saHpiInitialize and version compatibility Modified Paths: -------------- openhpi/trunk/baselib/oh_client.cpp openhpi/trunk/include/oHpi.h Modified: openhpi/trunk/baselib/oh_client.cpp =================================================================== --- openhpi/trunk/baselib/oh_client.cpp 2010-06-13 15:44:00 UTC (rev 7101) +++ openhpi/trunk/baselib/oh_client.cpp 2010-06-14 06:51:53 UTC (rev 7102) @@ -146,7 +146,8 @@ SAHPI_OUT SaHpiUint32T *FailedOption, SAHPI_OUT SaErrorT *OptionError) { - if ( RequestedVersion != SAHPI_INTERFACE_VERSION ) { + if ( RequestedVersion < OH_SAHPI_INTERFACE_VERSION_MIN_SUPPORTED ) || + ( RequestedVersion > OH_SAHPI_INTERFACE_VERSION_MAX_SUPPORTED ) { return SA_ERR_HPI_UNSUPPORTED_API; } if ( ( NumOptions != 0 ) && ( Options == NULL ) ) { Modified: openhpi/trunk/include/oHpi.h =================================================================== --- openhpi/trunk/include/oHpi.h 2010-06-13 15:44:00 UTC (rev 7101) +++ openhpi/trunk/include/oHpi.h 2010-06-14 06:51:53 UTC (rev 7102) @@ -23,6 +23,9 @@ #define OPENHPI_DEFAULT_DAEMON_PORT 4743 #define MAX_PLUGIN_NAME_LENGTH 32 +#define OH_SAHPI_INTERFACE_VERSION_MIN_SUPPORTED (SaHpiVersionT)0x020101 /* B.01.01 */ +#define OH_SAHPI_INTERFACE_VERSION_MAX_SUPPORTED SAHPI_INTERFACE_VERSION + typedef SaHpiUint32T oHpiHandlerIdT; typedef struct { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2010-06-15 21:24:51
|
Revision: 7108 http://openhpi.svn.sourceforge.net/openhpi/?rev=7108&view=rev Author: avpak Date: 2010-06-15 21:24:40 +0000 (Tue, 15 Jun 2010) Log Message: ----------- Fix for #3014969 Modified Paths: -------------- openhpi/trunk/Makefile.am openhpi/trunk/openhpid/Makefile.am openhpi/trunk/openhpid/t/ohpi/Makefile.am openhpi/trunk/plugins/ipmi/t/Makefile.am openhpi/trunk/plugins/simulator/t/Makefile.am openhpi/trunk/plugins/snmp_bc/t/Makefile.am Modified: openhpi/trunk/Makefile.am =================================================================== --- openhpi/trunk/Makefile.am 2010-06-14 16:23:07 UTC (rev 7107) +++ openhpi/trunk/Makefile.am 2010-06-15 21:24:40 UTC (rev 7108) @@ -54,8 +54,8 @@ MOSTLYCLEANFILES = tags -SUBDIRS = utils scripts @SSLDIR@ @SNMPDIR@ transport marshal baselib plugins docs @ENABLED_DIRS@ hpi_shell -DIST_SUBDIRS = utils scripts snmp ssl transport marshal baselib plugins docs openhpid clients cpp hpi_shell +SUBDIRS = utils scripts @SSLDIR@ @SNMPDIR@ transport marshal baselib @ENABLED_DIRS@ plugins docs hpi_shell +DIST_SUBDIRS = utils scripts snmp ssl transport marshal baselib openhpid plugins docs clients cpp hpi_shell DISTCHECK_CONFIGURE_FLAGS = --with-initdir=prefix Modified: openhpi/trunk/openhpid/Makefile.am =================================================================== --- openhpi/trunk/openhpid/Makefile.am 2010-06-14 16:23:07 UTC (rev 7107) +++ openhpi/trunk/openhpid/Makefile.am 2010-06-15 21:24:40 UTC (rev 7108) @@ -26,30 +26,39 @@ EXTRA_DIST = \ openhpid.sh.in +# daemon library +noinst_LTLIBRARIES = libopenhpidaemon.la +libopenhpidaemon_la_SOURCES = config.c \ + domain.c \ + event.c \ + threaded.c \ + alarm.c \ + hotswap.c \ + lock.c \ + plugin.c \ + plugin_static.c \ + init.c \ + safhpi.c \ + session.c \ + ohpi.c + +libopenhpidaemon_la_LIBADD = $(top_builddir)/utils/libopenhpiutils.la \ + $(top_builddir)/marshal/libopenhpimarshal.la \ + $(top_builddir)/transport/libopenhpitransport.la +if HAVE_OPENSSL +libopenhpidaemon_la_LIBADD += $(top_builddir)/$(SSLDIR)/libopenhpi_ssl.la +endif +libopenhpidaemon_la_LDFLAGS = -version-info @HPI_LIB_VERSION@ + # daemon sbin_PROGRAMS = openhpid -openhpid_SOURCES = config.c \ - domain.c \ - event.c \ - threaded.c \ - alarm.c \ - hotswap.c \ - lock.c \ - plugin.c \ - plugin_static.c \ - init.c \ - safhpi.c \ - session.c \ - ohpi.c \ - openhpid.cpp +openhpid_SOURCES = openhpid.cpp - - -openhpid_LDADD = $(top_builddir)/baselib/libopenhpi.la \ - $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/marshal/libopenhpimarshal.la \ - $(top_builddir)/transport/libopenhpitransport.la +openhpid_LDADD = libopenhpidaemon.la \ + $(top_builddir)/utils/libopenhpiutils.la \ + $(top_builddir)/marshal/libopenhpimarshal.la \ + $(top_builddir)/transport/libopenhpitransport.la if HAVE_OPENSSL openhpid_LDADD += $(top_builddir)/$(SSLDIR)/libopenhpi_ssl.la endif Modified: openhpi/trunk/openhpid/t/ohpi/Makefile.am =================================================================== --- openhpi/trunk/openhpid/t/ohpi/Makefile.am 2010-06-14 16:23:07 UTC (rev 7107) +++ openhpi/trunk/openhpid/t/ohpi/Makefile.am 2010-06-15 21:24:40 UTC (rev 7108) @@ -15,13 +15,13 @@ INCLUDES = @OPENHPI_INCLUDES@ -TDEPLIB = $(top_builddir)/baselib/libopenhpi.la \ +TDEPLIB = $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/utils/libopenhpiutils.la TESTS_ENVIRONMENT = OPENHPI_PATH=$(top_builddir)/plugins/simulator:$(top_builddir)/plugins/watchdog -TESTS_ENVIRONMENT += OPENHPI_UID_MAP=$(top_builddir)/src/t/ohpi/uid_map -TESTS_ENVIRONMENT += OPENHPI_CONF=$(top_srcdir)/src/t/ohpi/openhpi.conf -TESTS_ENVIRONMENT += LD_LIBRARY_PATH=$(top_srcdir)/baselib/.libs:$(top_srcdir)/ssl/.libs:$(top_srcdir)/utils/.libs +TESTS_ENVIRONMENT += OPENHPI_UID_MAP=$(top_builddir)/openhpid/t/ohpi/uid_map +TESTS_ENVIRONMENT += OPENHPI_CONF=$(top_srcdir)/openhpid/t/ohpi/openhpi.conf +TESTS_ENVIRONMENT += LD_LIBRARY_PATH=$(top_srcdir)/openhpid/.libs:$(top_srcdir)/ssl/.libs:$(top_srcdir)/utils/.libs TESTS = \ ohpi_007 \ Modified: openhpi/trunk/plugins/ipmi/t/Makefile.am =================================================================== --- openhpi/trunk/plugins/ipmi/t/Makefile.am 2010-06-14 16:23:07 UTC (rev 7107) +++ openhpi/trunk/plugins/ipmi/t/Makefile.am 2010-06-15 21:24:40 UTC (rev 7108) @@ -33,12 +33,11 @@ noinst_PROGRAMS = ipmi_thres_test INCLUDES = @OPENHPI_INCLUDES@ -LD_DIRS = -L$(top_builddir)/baselib -L$(top_builddir)/utils - #noinst_PROGRAMS = set_thres ipmi_thres_test_SOURCES = ipmi_thres_test.c -ipmi_thres_test_LDADD = $(LD_DIRS) -luuid -lopenhpiutils -lopenhpi +ipmi_thres_test_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la #set_thres_SOURCES = set_thres.c #set_thres_LDADD = $(top_builddir)/baselib/libopenhpi.la Modified: openhpi/trunk/plugins/simulator/t/Makefile.am =================================================================== --- openhpi/trunk/plugins/simulator/t/Makefile.am 2010-06-14 16:23:07 UTC (rev 7107) +++ openhpi/trunk/plugins/simulator/t/Makefile.am 2010-06-15 21:24:40 UTC (rev 7108) @@ -15,13 +15,13 @@ MAINTAINERCLEANFILES = Makefile.in -TDEPLIB = $(top_builddir)/baselib/libopenhpi.la \ +TDEPLIB = $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/utils/libopenhpiutils.la TESTS_ENVIRONMENT = OPENHPI_PATH=$(top_builddir)/plugins/simulator TESTS_ENVIRONMENT += OPENHPI_UID_MAP=$(top_builddir)/plugins/simulator/t/uid_map TESTS_ENVIRONMENT += OPENHPI_CONF=$(top_srcdir)/plugins/simulator/t/openhpi.conf -TESTS_ENVIRONMENT += LD_LIBRARY_PATH=$(top_srcdir)/baselib/.libs:$(top_srcdir)/ssl/.libs:$(top_srcdir)/utils/.libs +TESTS_ENVIRONMENT += LD_LIBRARY_PATH=$(top_srcdir)/openhpid/.libs:$(top_srcdir)/ssl/.libs:$(top_srcdir)/utils/.libs TESTS = sim_sanity_000 \ sim_sanity_001 \ Modified: openhpi/trunk/plugins/snmp_bc/t/Makefile.am =================================================================== --- openhpi/trunk/plugins/snmp_bc/t/Makefile.am 2010-06-14 16:23:07 UTC (rev 7107) +++ openhpi/trunk/plugins/snmp_bc/t/Makefile.am 2010-06-15 21:24:40 UTC (rev 7108) @@ -95,7 +95,7 @@ TESTS_ENVIRONMENT += OPENHPI_SIMTEST_FILE=$(srcdir)/sim_test_file #TESTS_ENVIRONMENT += OPENHPI_ERROR=YES #TESTS_ENVIRONMENT += OPENHPI_DEBUG=YES -TESTS_ENVIRONMENT += LD_LIBRARY_PATH=$(top_srcdir)/baselib/.libs:$(top_srcdir)/ssl/.libs:$(top_srcdir)/utils/.libs:$(top_srcdir)/plugins/snmp/.libs:$(top_srcdir)/plugins/snmp_bc/t/.libs +TESTS_ENVIRONMENT += LD_LIBRARY_PATH=$(top_srcdir)/openhpid/.libs:$(top_srcdir)/ssl/.libs:$(top_srcdir)/utils/.libs:$(top_srcdir)/plugins/snmp/.libs:$(top_srcdir)/plugins/snmp_bc/t/.libs TESTS_ENVIRONMENT += OPENHPI_UID_MAP=$(shell pwd)/uid_map TESTS_ENVIRONMENT += OPENHPI_PATH=$(shell pwd) @@ -180,425 +180,425 @@ # Unit test using normal IF calls and simulation library tsim_file_SOURCES = tsim_file.c tsim_file_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # Unit test using normal IF calls and simulation library tevent_SOURCES = tevent.c tevent_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # Unit test using normal IF calls and simulation library tcontrol_parms_SOURCES = tcontrol_parms.c tcontrol_parms_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # Unit test using normal IF calls and simulation library tset_resource_tag_SOURCES = tset_resource_tag.c tset_resource_tag_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # Unit test using normal IF calls and simulation library tset_resource_sev_SOURCES = tset_resource_sev.c tset_resource_sev_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # Unit test using normal IF calls and simulation library tsnmp_bc_getset_SOURCES = tsnmp_bc_getset.c tsnmp_bc_getset_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget001_SOURCES = tsensorget001.c tsensorget001_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget002_SOURCES = tsensorget002.c tsensorget002_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget003_SOURCES = tsensorget003.c tsensorget003_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget004_SOURCES = tsensorget004.c tsensorget004_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget005_SOURCES = tsensorget005.c tsensorget005_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget010_SOURCES = tsensorget010.c tsensorget010_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget013_SOURCES = tsensorget013.c tsensorget013_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget016_SOURCES = tsensorget016.c tsensorget016_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget031_SOURCES = tsensorget031.c tsensorget031_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget033_SOURCES = tsensorget033.c tsensorget033_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget034_SOURCES = tsensorget034.c tsensorget034_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget035_SOURCES = tsensorget035.c tsensorget035_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget036_SOURCES = tsensorget036.c tsensorget036_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget040_SOURCES = tsensorget040.c tsensorget040_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorget041_SOURCES = tsensorget041.c tsensorget041_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset001_SOURCES = tsensorset001.c tsensorset001_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset002_SOURCES = tsensorset002.c tsensorset002_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset003_SOURCES = tsensorset003.c tsensorset003_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset004_SOURCES = tsensorset004.c tsensorset004_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset005_SOURCES = tsensorset005.c tsensorset005_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset006_SOURCES = tsensorset006.c tsensorset006_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset007_SOURCES = tsensorset007.c tsensorset007_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset008_SOURCES = tsensorset008.c tsensorset008_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset009_SOURCES = tsensorset009.c tsensorset009_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset010_SOURCES = tsensorset010.c tsensorset010_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset011_SOURCES = tsensorset011.c tsensorset011_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset012_SOURCES = tsensorset012.c tsensorset012_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset013_SOURCES = tsensorset013.c tsensorset013_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset015_SOURCES = tsensorset015.c tsensorset015_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset017_SOURCES = tsensorset017.c tsensorset017_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset018_SOURCES = tsensorset018.c tsensorset018_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset019_SOURCES = tsensorset019.c tsensorset019_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset020_SOURCES = tsensorset020.c tsensorset020_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset021_SOURCES = tsensorset021.c tsensorset021_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset022_SOURCES = tsensorset022.c tsensorset022_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset023_SOURCES = tsensorset023.c tsensorset023_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsensorset024_SOURCES = tsensorset024.c tsensorset024_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tel001_SOURCES = tel001.c tel001_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tel002_SOURCES = tel002.c tel002_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tel003_SOURCES = tel003.c tel003_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tel004_SOURCES = tel004.c tel004_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tel005_SOURCES = tel005.c tel005_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tel006_SOURCES = tel006.c tel006_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tel007_SOURCES = tel007.c tel007_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tinv001_SOURCES = tinv001.c tinv001_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tinv002_SOURCES = tinv002.c tinv002_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tinv003_SOURCES = tinv003.c tinv003_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tinv004_SOURCES = tinv004.c tinv004_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tinv005_SOURCES = tinv005.c tinv005_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tinv006_SOURCES = tinv006.c tinv006_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tinv007_SOURCES = tinv007.c tinv007_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # thotswap001_SOURCES = thotswap001.c thotswap001_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # thotswap_mhs001_SOURCES = thotswap-mhs001.c thotswap_mhs001_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # thotswap_simple001_SOURCES = thotswap-simple001.c thotswap_simple001_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tpower001_SOURCES = tpower001.c tpower001_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # treset001_SOURCES = treset001.c treset001_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsptime001_SOURCES = tsptime001.c tsptime001_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tsptime002_SOURCES = tsptime002.c tsptime002_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tdiscover001_SOURCES = tdiscover001.c tdiscover001_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # #tdiscover002_SOURCES = tdiscover002.c #tdiscover002_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ -# $(top_builddir)/baselib/libopenhpi.la \ +# $(top_builddir)/openhpid/libopenhpidaemon.la \ # $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tcontrol001_SOURCES = tcontrol001.c tcontrol001_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tcontrol002_SOURCES = tcontrol002.c tcontrol002_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # tcontrol003_SOURCES = tcontrol003.c tcontrol003_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la tcontrolfailover_SOURCES = tcontrolfailover.c tcontrolfailover_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ - $(top_builddir)/baselib/libopenhpi.la \ + $(top_builddir)/openhpid/libopenhpidaemon.la \ $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la # Unit test using normal IF calls and simulation library #tsnmp_bc_get_guid_SOURCES = tsnmp_bc_get_guid.c #tsnmp_bc_get_guid_LDADD = $(top_builddir)/utils/libopenhpiutils.la \ -# $(top_builddir)/baselib/libopenhpi.la \ +# $(top_builddir)/openhpid/libopenhpidaemon.la \ # $(top_builddir)/plugins/snmp_bc/t/libsnmp_bc.la This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <uli...@us...> - 2010-06-17 08:35:09
|
Revision: 7111 http://openhpi.svn.sourceforge.net/openhpi/?rev=7111&view=rev Author: ulikleber Date: 2010-06-17 08:35:01 +0000 (Thu, 17 Jun 2010) Log Message: ----------- Fix for #3011456 Domain Support for Clients Fix for #3014317 hpisettime input parameter check Fix for #3014897 DIMI and FUMI options do not work hpitop Additional fixes: - hpiel.c correct copyright statement added - usage texts wherever some existing options where missing in the usage text. - man pages, where existing options were missing. - in section "see also" a reference to all other clients added. - added a check for some other options requiring a mandatory value. Now in these case, the usage text will be printed. See e.g. hpievents -t or hpifan -s. - In hpireset added a test option to allow test without reset being issued. That option -q is not documented in usage, and will exit the program just before reset would be issued. Modified Paths: -------------- openhpi/trunk/clients/hpialarms.c openhpi/trunk/clients/hpiel.c openhpi/trunk/clients/hpievents.c openhpi/trunk/clients/hpifan.c openhpi/trunk/clients/hpiinv.c openhpi/trunk/clients/hpipower.c openhpi/trunk/clients/hpireset.c openhpi/trunk/clients/hpisensor.c openhpi/trunk/clients/hpisettime.c openhpi/trunk/clients/hpithres.c openhpi/trunk/clients/hpitop.c openhpi/trunk/clients/hpitree.c openhpi/trunk/clients/hpiwdt.c openhpi/trunk/docs/man/hpialarms.pod.1 openhpi/trunk/docs/man/hpiel.pod.1 openhpi/trunk/docs/man/hpievents.pod.1 openhpi/trunk/docs/man/hpifan.pod.1 openhpi/trunk/docs/man/hpiinv.pod.1 openhpi/trunk/docs/man/hpipower.pod.1 openhpi/trunk/docs/man/hpireset.pod.1 openhpi/trunk/docs/man/hpisensor.pod.1 openhpi/trunk/docs/man/hpisettime.pod.1 openhpi/trunk/docs/man/hpithres.pod.1 openhpi/trunk/docs/man/hpitop.pod.1 openhpi/trunk/docs/man/hpitree.pod.1 openhpi/trunk/docs/man/hpiwdt.pod.1 Modified: openhpi/trunk/clients/hpialarms.c =================================================================== --- openhpi/trunk/clients/hpialarms.c 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/clients/hpialarms.c 2010-06-17 08:35:01 UTC (rev 7111) @@ -1,6 +1,7 @@ /* * Copyright (c) 2003 Intel Corporation. * (C) Copyright IBM Corp 2007 + * (C) Copyright Nokia Siemens Networks 2010 * * 04/15/03 Andy Cress - created * 04/17/03 Andy Cress - mods for resourceid, first good run @@ -11,10 +12,12 @@ * 02/23/04 Andy Cress - v1.1 add checking/setting disk LEDs * 10/13/04 Andy Cress - v1.2 add ifdefs for HPI_A & HPI_B, added -d/raw * < ...for more changes look at svn logs... > + * 09/06/2010 ulikleber New option -D to select domain * * Author(s): * Andy Cress <and...@in...> * Renier Morales <re...@op...> + * Ulrich Kleber <uli...@us...> */ /*M* Copyright (c) 2003, Intel Corporation @@ -48,6 +51,7 @@ #include <stdlib.h> #include <getopt.h> #include <SaHpi.h> +#include <oHpi.h> #include <oh_clients.h> #define OH_SVN_REV "$Revision$" @@ -78,6 +82,7 @@ { int c; SaErrorT rv; + SaHpiDomainIdT domainid = SAHPI_UNSPECIFIED_DOMAIN_ID; SaHpiSessionIdT sessionid; SaHpiRptEntryT rptentry; SaHpiEntryIdT rptentryid; @@ -92,11 +97,15 @@ int raw_val = 0; int j; uchar b = 0; + SaHpiBoolT printusage = FALSE; oh_prog_version(argv[0], OH_SVN_REV); - while ( (c = getopt( argc, argv,"rxa:b:c:m:n:p:i:d:o?")) != EOF ) + while ( (c = getopt( argc, argv,"D:rxa:b:c:m:n:p:i:d:o?")) != EOF ) switch(c) { - + case 'D': + if (optarg) domainid = atoi(optarg); + else printusage = TRUE; + break; case 'c': b = atoi(optarg); /* set crit alarm value */ leds[1].fset = 1; leds[1].val = b; @@ -133,9 +142,12 @@ } break; case 'x': fdebug = 1; break; /* debug messages */ - default: + default: printusage = TRUE; + } + if (printusage) { printf("Usage: %s [-a -b -c -i -m -n -p -o -x]\n", argv[0]); - printf(" where -c1 sets Critical Alarm on\n"); + printf(" where -D domain id Selects the domain\n"); + printf(" -c1 sets Critical Alarm on\n"); printf(" -c0 sets Critical Alarm off\n"); printf(" -m1 sets Major Alarm on\n"); printf(" -m0 sets Major Alarm off\n"); @@ -154,8 +166,11 @@ printf(" -x show eXtra debug messages\n"); exit(1); } - - rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID,&sessionid,NULL); + if (fdebug) { + if (domainid==SAHPI_UNSPECIFIED_DOMAIN_ID) printf("saHpiSessionOpen\n"); + else printf("saHpiSessionOpen to domain %d\n",domainid); + } + rv = saHpiSessionOpen(domainid,&sessionid,NULL); if (rv != SA_OK) { printf("saHpiSessionOpen error %d\n",rv); exit(-1); Modified: openhpi/trunk/clients/hpiel.c =================================================================== --- openhpi/trunk/clients/hpiel.c 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/clients/hpiel.c 2010-06-17 08:35:01 UTC (rev 7111) @@ -1,12 +1,24 @@ /* -*- linux-c -*- * * (C) Copyright IBM Corp 2006 + * (C) Copyright Nokia Siemens Networks 2010 * + * This program 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. This + * file and program are licensed under a BSD style license. See + * the Copying file included with the OpenHPI distribution for + * full licensing terms. + * * Author(s): * Renier Morales <re...@op...> + * Ulrich Kleber <uli...@us...> * * hpiel - Displays HPI event log entries. * + * + * Changes: + * 09/06/2010 ulikleber New option -D to select domain */ #include <stdlib.h> @@ -47,6 +59,8 @@ int dbg; /* Display debug messages. */ } opts = { 0, NULL, 0, 0, 0, 0 }; +SaHpiDomainIdT domainid = SAHPI_UNSPECIFIED_DOMAIN_ID; + /* Prototypes */ SaErrorT parse_options(int argc, char ***argv, struct hpiel_opts *opts); SaErrorT harvest_sels(SaHpiSessionIdT sid, SaHpiDomainInfoT *dinfo, char *ep); @@ -68,7 +82,7 @@ } /* Program really begins here - all options parsed at this point */ - error = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL); + error = saHpiSessionOpen(domainid, &sid, NULL); show_error_quit("saHpiSessionOpen() returned %s. Exiting.\n"); error = saHpiDiscover(sid); @@ -77,8 +91,11 @@ error = saHpiDomainInfoGet(sid, &dinfo); show_error_quit("saHpiDomainInfoGet() returned %s. Exiting.\n"); - printf("Domain Info: UpdateCount = %d, UpdateTime = %lx\n", - dinfo.RptUpdateCount, (unsigned long)dinfo.RptUpdateTimestamp); + if (domainid==SAHPI_UNSPECIFIED_DOMAIN_ID) + printf("Domain Info: UpdateCount = %d, UpdateTime = %lx\n", + dinfo.RptUpdateCount, (unsigned long)dinfo.RptUpdateTimestamp); + else printf("Domain Info: DomainId = %d, UpdateCount = %d, UpdateTime = %lx\n", + domainid, dinfo.RptUpdateCount, (unsigned long)dinfo.RptUpdateTimestamp); if (opts.ep) { /* Entity path specified */ error = harvest_sels(sid, &dinfo, opts.ep); @@ -102,6 +119,7 @@ do { \ printf("\nUsage:\n" \ " hpiel - Displays HPI event log entries.\n\n" \ + " --Domain=\"<arg>\", -D \"<arg>\" select domain id\n" \ " --del, -d display domain event log entries\n" \ " --entitypath=\"<arg>\", -e \"<arg>\" display resource event log entries\n" \ " (e.g. -e \"{SYSTEM_CHASSIS,2}{SBC_BLADE,5}\")\n" \ @@ -119,6 +137,7 @@ SaErrorT parse_options(int argc, char ***argv, struct hpiel_opts *opts) { static struct option long_options[] = { + {"Domain", required_argument, 0, 'D'}, {"del", no_argument, 0, 'd'}, {"entitypath", required_argument, 0, 'e'}, {"clear", no_argument, 0, 'c'}, @@ -130,13 +149,25 @@ }; int c, option_index = 0; - while ((c = getopt_long(argc, *argv, "de:cprvh", long_options, &option_index)) != -1) { + while ((c = getopt_long(argc, *argv, "D:de:cprvh", long_options, &option_index)) != -1) { switch(c) { + case 'D': + if (optarg) domainid = atoi(optarg); + else { + printf("hpiel: option requires an argument -- D"); + print_usage_quit(); + } + break; + case 'd': opts->del = 1; break; case 'e': - opts->ep = strdup(optarg); + if (optarg) opts->ep = strdup(optarg); + else { + printf("hpiel: option requires an argument -- e"); + print_usage_quit(); + } break; case 'c': opts->clear = 1; @@ -155,10 +186,12 @@ break; case '?': printf("extraneous option found, %d\n", optopt); + print_usage_quit(); break; default: printf("Found bad option %d.\n", c); - return -1; + print_usage_quit(); + break; } } Modified: openhpi/trunk/clients/hpievents.c =================================================================== --- openhpi/trunk/clients/hpievents.c 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/clients/hpievents.c 2010-06-17 08:35:01 UTC (rev 7111) @@ -1,6 +1,7 @@ /* -*- linux-c -*- * * (C) Copyright IBM Corp. 2003, 2004, 2007 + * (C) Copyright Nokia Siemens Networks 2010 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,10 +14,12 @@ * Peter D Phan <pd...@us...> * Steve Sherman <st...@us...> * Renier Morales <re...@op...> + * Ulrich Kleber <uli...@us...> * * 10/13/2004 kouzmich changed -t option for infinite wait * added -d option for call saHpiDiscover after saHpiSubscribe * 11/17/2004 kouzmich linux style and checking timeout error + * 09/06/2010 ulikleber New option -D to select domain */ #include <stdio.h> @@ -35,11 +38,13 @@ #define HPI_NSEC_PER_SEC 1000000000LL int fdebug = 0; +SaHpiDomainIdT domainid = SAHPI_UNSPECIFIED_DOMAIN_ID; static void Usage(char **argv) { - printf("Usage %s [-t <value> | SAHPI_TIMEOUT_BLOCK | BLOCK] [-d] [-x]\n",argv[0]); - printf(" where: -t <value> - wait <value> seconds for event;\n"); + printf("Usage %s [-D <value>] [-t <value> | SAHPI_TIMEOUT_BLOCK | BLOCK] [-d] [-x]\n",argv[0]); + printf(" where: -D <value> - select domain id\n"); + printf(" -t <value> - wait <value> seconds for event;\n"); printf(" -t SAHPI_TIMEOUT_BLOCK or BLOCK - infinite wait\n"); printf(" -d - call saHpiDiscover() after saHpiSubscribe()\n"); printf(" -x - displays eXtra debug messages\n"); @@ -66,10 +71,23 @@ oh_prog_version(argv[0], OH_SVN_REV); - while ( (c = getopt( argc, argv,"t:xd?")) != EOF ) { + while ( (c = getopt( argc, argv,"D:t:xd?")) != EOF ) { switch(c) { + case 'D': + if (optarg) domainid = atoi(optarg); + else { + printf("hpievents: option requires an argument -- D"); + Usage(argv); + exit(1); + } + break; case 't': - timeout_str = optarg; + if (optarg) timeout_str = optarg; + else { + printf("hpievents: option requires an argument -- t"); + Usage(argv); + exit(1); + } break; case 'd': do_discover_after_subscribe = 1; @@ -96,7 +114,12 @@ printf("************** timeout:[%lld] ****************\n", timeout); - rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sessionid, NULL); + if (fdebug) { + if (domainid==SAHPI_UNSPECIFIED_DOMAIN_ID) printf("saHpiSessionOpen\n"); + else printf("saHpiSessionOpen to domain %d\n",domainid); + } + + rv = saHpiSessionOpen(domainid, &sessionid, NULL); if (rv != SA_OK) { if (rv == SA_ERR_HPI_ERROR) printf("saHpiSessionOpen: error %d, SpiLibd not running\n", rv); Modified: openhpi/trunk/clients/hpifan.c =================================================================== --- openhpi/trunk/clients/hpifan.c 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/clients/hpifan.c 2010-06-17 08:35:01 UTC (rev 7111) @@ -2,6 +2,7 @@ * hpifan.cpp * * Copyright (c) 2003,2004 by FORCE Computers + * (C) Copyright Nokia Siemens Networks 2010 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -12,8 +13,12 @@ * * Authors: * Thomas Kanngieser <tho...@fc...> + * Ulrich Kleber <uli...@us...> * + * Changes: * 10/13/2004 kouzmich porting to HPI B + * 09/06/2010 ulikleber New option -D to select domain + * */ #include <stdio.h> @@ -29,14 +34,16 @@ #define OH_SVN_REV "$Revision$" static int fan_speed = -1; +SaHpiDomainIdT domainid = SAHPI_UNSPECIFIED_DOMAIN_ID; static int usage( char *progname ) { - fprintf( stderr, "usage: %s [-h] [-s fan_speed_level]\n", progname ); - fprintf( stderr, "\t\t -h help\n" ); - fprintf( stderr, "\t\t -s speed set fan speed for ALL fans\n" ); + fprintf( stderr, "usage: %s [-D domainid] [-h] [-s fan_speed_level]\n", progname ); + fprintf( stderr, "\t\t -D domainid select the domain to work on\n" ); + fprintf( stderr, "\t\t -h help\n" ); + fprintf( stderr, "\t\t -s speed set fan speed for ALL fans in domain\n" ); return 1; } @@ -256,14 +263,25 @@ oh_prog_version(argv[0], OH_SVN_REV); - while( (c = getopt( argc, argv,"hs:") ) != -1 ) + while( (c = getopt( argc, argv,"D:hs:") ) != -1 ) switch( c ) { + case 'D': + if (optarg) domainid = atoi(optarg); + else { + printf("hpifan: option requires an argument -- D"); + help = 1; + } + break; case 'h': help = 1; break; case 's': - fan_speed = atoi( optarg ); + if (optarg) fan_speed = atoi( optarg ); + else { + printf("hpifan: option requires an argument -- s"); + help = 1; + } break; default: @@ -276,13 +294,15 @@ return usage(argv[0]); SaHpiSessionIdT sessionid; - rv = saHpiSessionOpen( SAHPI_UNSPECIFIED_DOMAIN_ID, &sessionid, 0 ); - + rv = saHpiSessionOpen(domainid, &sessionid, NULL); if ( rv != SA_OK ) { printf( "saHpiSessionOpen: %s\n", oh_lookup_error( rv ) ); return 1; } + if (domainid!=SAHPI_UNSPECIFIED_DOMAIN_ID) + printf("HPI Session to domain %d\n",domainid); + rv = saHpiDiscover( sessionid ); if ( rv != SA_OK ) { Modified: openhpi/trunk/clients/hpiinv.c =================================================================== --- openhpi/trunk/clients/hpiinv.c 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/clients/hpiinv.c 2010-06-17 08:35:01 UTC (rev 7111) @@ -4,6 +4,7 @@ * * Copyright (c) 2003-2005 by Intel Corp. * (C) Copyright IBM Corp. 2004 + * (C) Copyright Nokia Siemens Networks 2010 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,12 +19,14 @@ * Renier Morales <re...@op...> * Tariq Shureih <tar...@in...> * Racing Guo <rac...@in...> + * Ulrich Kleber <uli...@us...> * * Log: * 6/29/04 Copied from hpifru.c and modified for general use * 11/30/04 ver 0.2 for openhpi-2.0.0 * 2/09/05 ARCress re-merged with hpifru.c, adding IdrFieldSet, * generalized for other HPI libraris also. + * 09/06/10 ulikleber New option -D to select domain */ #define OPENHPI_USED 1 @@ -456,6 +459,7 @@ { int c; SaErrorT rv,rv_rdr; + SaHpiDomainIdT domainid = SAHPI_UNSPECIFIED_DOMAIN_ID; SaHpiSessionIdT sessionid; SaHpiDomainInfoT rptinfo; SaHpiRptEntryT rptentry; @@ -469,12 +473,17 @@ SaHpiIdrIdT idrid; int invfound = 0; int nloops = 0; + SaHpiBoolT printusage = FALSE; oh_prog_version(argv[0], OH_SVN_REV); atag.tlen = 0; - while ( (c = getopt( argc, argv,"a:vxz?")) != EOF ) + while ( (c = getopt( argc, argv,"D:a:vxz?")) != EOF ) switch(c) { + case 'D': + if (optarg) domainid = atoi(optarg); + else printusage = TRUE; + break; case 'z': fzdebug = 1; /* fall thru to include next setting */ case 'x': fdebug = 1; break; case 'v': fverbose = 1; break; @@ -484,19 +493,29 @@ atag.tag = (char *)strdup(optarg); atag.tlen = strlen(optarg); } + else printusage = TRUE; break; - default: + default: printusage = TRUE; + } + if (printusage) { printf("Usage: %s [-x] [-a asset_tag]\n", argv[0]); - printf(" -a Sets the asset tag\n"); - printf(" -x Display debug messages\n"); - printf(" -z Display extra debug messages\n"); + printf(" -D domainid Selects the domain\n"); + printf(" -a tag Sets the asset tag\n"); + printf(" -v Use verbose output mode\n"); + printf(" -x Display debug messages\n"); + printf(" -z Display extra debug messages\n"); exit(1); } /* compile error */ // inv = (SaHpiIdrAreaHeaderT *)&inbuff[0]; inv = (SaHpiIdrAreaHeaderT *)(void *)&inbuff[0]; - rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID,&sessionid,NULL); + + if (fdebug) { + if (domainid==SAHPI_UNSPECIFIED_DOMAIN_ID) printf("saHpiSessionOpen\n"); + else printf("saHpiSessionOpen to domain %d\n",domainid); + } + rv = saHpiSessionOpen(domainid,&sessionid,NULL); if (fdebug) printf("saHpiSessionOpen rv = %d sessionid = %x\n",rv,sessionid); if (rv != SA_OK) { printf("saHpiSessionOpen error %d\n",rv); Modified: openhpi/trunk/clients/hpipower.c =================================================================== --- openhpi/trunk/clients/hpipower.c 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/clients/hpipower.c 2010-06-17 08:35:01 UTC (rev 7111) @@ -1,6 +1,7 @@ /* -*- linux-c -*- * * (C) Copyright IBM Corp. 2004-2006 + * (C) Copyright Nokia Siemens Networks 2010 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -11,6 +12,10 @@ * * Author(s): * Carl McAdams <ca...@us...> + * Ulrich Kleber <uli...@us...> + * + * Changes: + * 09/06/2010 ulikleber New option -D to select domain */ #include <stdio.h> @@ -85,6 +90,7 @@ GSList* Computer; GSList* ComputerListHead; int option; + SaHpiDomainIdT domainid = SAHPI_UNSPECIFIED_DOMAIN_ID; SaHpiSessionIdT SessionId; SaErrorT Status, Clean_Up_Status; SaHpiEntryIdT RptEntry, RptNextEntry; @@ -112,7 +118,7 @@ /* Parse out option instructions */ while (1) { - option = getopt(argc, argv, "dpruxb:"); + option = getopt(argc, argv, "D:dpruxb:"); if ((option == EOF) || (PrintUsage == TRUE)) { break; //break out of the while loop @@ -120,6 +126,13 @@ switch (option) { + case 'D': + if (optarg) domainid = atoi(optarg); + else { + printf("hpipower: option requires an argument -- D"); + PrintUsage = TRUE; + } + break; case 'd': Action = SAHPI_POWER_OFF; ActionSelected = TRUE; @@ -142,6 +155,7 @@ case 'b': if (*optarg == 0) { + printf("hpipower: option requires an argument -- b"); PrintUsage = TRUE; break; //no argument } @@ -171,6 +185,7 @@ HPI_POWER_DEBUG_PRINT("1.0 Initializing the List Structure for the computers\n"); Computer = g_slist_alloc(); ComputerListHead = Computer; + HPI_POWER_DEBUG_PRINT("1.1 Allocating space for the information on each computer\n"); ComputerPtr = (COMPUTER_DATA*)malloc(sizeof(COMPUTER_DATA)); @@ -178,12 +193,13 @@ /* Initialize HPI domain and session */ HPI_POWER_DEBUG_PRINT("2.1 Initalizing HPI Session\n"); - Status = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, + Status = saHpiSessionOpen(domainid, &SessionId, NULL); if (Status == SA_OK) { + if (domainid!=SAHPI_UNSPECIFIED_DOMAIN_ID) printf("Session opened to HPI domain %d\n",domainid); /* Find all of the individual systems */ // regenerate the Resource Presence Table(RPT) HPI_POWER_DEBUG_PRINT("2.2 Hpi Discovery\n"); @@ -386,7 +402,8 @@ void UsageMessage(char *ProgramName) { printf("%s usage: \n\r",ProgramName); - printf("\n %s [dprubx]\n\r",ProgramName); + printf("\n %s [Ddprubx]\n\r",ProgramName); + printf(" -D <n> Specify domain \n\r"); printf(" -d power down target object \n\r"); printf(" -p power on target object \n\r"); printf(" -r reset target object \n\r"); Modified: openhpi/trunk/clients/hpireset.c =================================================================== --- openhpi/trunk/clients/hpireset.c 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/clients/hpireset.c 2010-06-17 08:35:01 UTC (rev 7111) @@ -1,6 +1,7 @@ /* -*- linux-c -*- * * Copyright (c) 2003 by Intel Corp. + * (C) Copyright Nokia Siemens Networks 2010 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -11,8 +12,11 @@ * * Authors: * Andy Cress <ar...@us...> + * Ulrich Kleber <uli...@us...> + * * Changes: * 10/13/2004 kouzmich porting to HPI B + * 09/06/2010 ulikleber New option -D to select domain */ #include <stdio.h> @@ -28,10 +32,12 @@ static void Usage(char *pname) { - printf("Usage: %s [-r -d -x]\n", pname); - printf(" where -r hard Resets the system\n"); + printf("Usage: %s [-D <n> ] [ -r -d -w -c -n -o -s -x]\n", pname); + printf(" where -D <n> Select domain\n"); + printf(" -r hard resets the system\n"); printf(" -d powers Down the system\n"); - printf(" -c power Cycles the system\n"); + printf(" -w warm resets the system\n"); + printf(" -c power cycles the system\n"); printf(" -n sends NMI to the system\n"); printf(" -o soft-shutdown OS\n"); printf(" -s reboots to Service Partition\n"); @@ -44,6 +50,7 @@ int c; int is_reset = 0; SaErrorT rv; + SaHpiDomainIdT domainid = SAHPI_UNSPECIFIED_DOMAIN_ID; SaHpiSessionIdT sessionid; SaHpiDomainInfoT domainInfo; SaHpiRptEntryT rptentry; @@ -59,8 +66,15 @@ oh_prog_version(argv[0], OH_SVN_REV); breset = 3; /* hard reset as default */ bopt = 0; /* Boot Options default */ - while ( (c = getopt( argc, argv,"rdwconsx?")) != EOF ) + while ( (c = getopt( argc, argv,"D:rdwconsxq?")) != EOF ) switch(c) { + case 'D': + if (optarg) domainid = atoi(optarg); + else { + printf("hpipower: option requires an argument -- D"); + Usage(argv[0]); + } + break; case 'd': breset = 0; break; /* power down */ case 'r': breset = 3; @@ -70,6 +84,7 @@ action = SAHPI_WARM_RESET; break; case 'x': fdebug = 1; break; /* debug messages */ + case 'q': fdebug = 42; break; /* just for testing, will exit before any reset */ case 'c': breset = 2; break; /* power cycle */ case 'o': fshutdown = 1; break; /* shutdown OS */ case 'n': breset = 4; break; /* interrupt (NMI) */ @@ -80,7 +95,11 @@ } if (fshutdown) breset = 5; /* soft shutdown option */ - rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sessionid, NULL); + if (fdebug) { + if (domainid==SAHPI_UNSPECIFIED_DOMAIN_ID) printf("saHpiSessionOpen\n"); + else printf("saHpiSessionOpen to domain %d\n",domainid); + } + rv = saHpiSessionOpen(domainid, &sessionid, NULL); if (rv != SA_OK) { if (rv == SA_ERR_HPI_ERROR) printf("saHpiSessionOpen: error %d, SpiLibd not running\n",rv); @@ -112,6 +131,10 @@ entryid,resourceid, rptentry.ResourceTag.Data); if (rptentry.ResourceCapabilities & SAHPI_CAPABILITY_RESET) { is_reset = 1; + + /* Allow debugging the beginning of program without reset */ + if (fdebug == 42) exit (42); + rv1 = saHpiResourceResetStateSet(sessionid, resourceid, action); //resourceid, SAHPI_POWER_OFF); Modified: openhpi/trunk/clients/hpisensor.c =================================================================== --- openhpi/trunk/clients/hpisensor.c 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/clients/hpisensor.c 2010-06-17 08:35:01 UTC (rev 7111) @@ -2,6 +2,7 @@ * * Copyright (c) 2003 by Intel Corp. * (C) Copyright IBM Corp. 2004 + * (C) Copyright Nokia Siemens Networks 2010 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,10 +14,12 @@ * Author(s): * Andy Cress <ar...@us...> * Renier Morales <re...@op...> + * Ulrich Kleber <uli...@us...> * * ChangeLog: * 09/08/04 pd...@us... Add sensor number to the display. * 01/06/05 arcress reduce number of display lines per sensor + * 09/06/10 ulikleber New option -D to select domain */ #include <stdio.h> @@ -199,6 +202,7 @@ int c; char *ep_string = NULL; SaErrorT rv; + SaHpiDomainIdT domainid = SAHPI_UNSPECIFIED_DOMAIN_ID; SaHpiDomainInfoT dinfo; SaHpiSessionIdT sessionid; SaHpiRptEntryT rptentry; @@ -209,11 +213,15 @@ SaHpiResourceIdT resourceid; SaHpiRdrT rdr; SaHpiEntityPathT ep_target; + SaHpiBoolT printusage = FALSE; oh_prog_version(argv[0], OH_SVN_REV); - while ( (c = getopt( argc, argv,"rtse:x?")) != EOF ) + while ( (c = getopt( argc, argv,"D:rtse:x?")) != EOF ) switch(c) { + case 'D': if (optarg) domainid = atoi(optarg); + else printusage = TRUE; + break; case 't': fshowthr = 1; break; case 'r': fshowrange = 1; break; case 's': fshowstate = 1; break; @@ -222,21 +230,30 @@ if (optarg) { ep_string = (char *)strdup(optarg); } + else printusage = TRUE; oh_encode_entitypath(ep_string, &ep_target); break; - default: - printf("Usage %s [-t -r -x -e]\n", argv[0]); - printf("where -t = show Thresholds also\n"); + default: printusage = TRUE; + } + + if (printusage) { + printf("Usage %s [-D -t -r -s -x -e]\n", argv[0]); + printf("where -D id = select domain\n"); + printf(" -t = show Thresholds also\n"); printf(" -r = show Range values also\n"); printf(" -s = show EventState also\n"); printf(" -e entity path = limit to a single entity\n"); printf(" -x = show eXtra debug messages\n"); exit(1); - } + } - rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID,&sessionid,NULL); + if (fdebug) { + if (domainid==SAHPI_UNSPECIFIED_DOMAIN_ID) printf("saHpiSessionOpen\n"); + else printf("saHpiSessionOpen to domain %d\n",domainid); + } + rv = saHpiSessionOpen(domainid,&sessionid,NULL); if (rv != SA_OK) { - printf("saHpiSessionOpen: %s", oh_lookup_error(rv)); + printf("saHpiSessionOpen: %s\n", oh_lookup_error(rv)); exit(-1); } Modified: openhpi/trunk/clients/hpisettime.c =================================================================== --- openhpi/trunk/clients/hpisettime.c 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/clients/hpisettime.c 2010-06-17 08:35:01 UTC (rev 7111) @@ -2,8 +2,11 @@ * * * (C) Copyright IBM Corp 2003,2004 + * (C) Copyright Nokia Siemens Networks 2010 + * * Authors: * Peter D.Phan pd...@us... + * Ulrich Kleber <uli...@us...> * * 01/13/2004 pdphan module created * Change clock for event log on IBM Blade Center E. @@ -11,6 +14,7 @@ * 10/12/2004 kouzmich porting to HPI B. * check month, day, year, hours, minutes and seconds * for correctness + * 07/06/2010 ulikleber New option -D to select domain */ /* Redistribution and use in source and binary forms, with or without @@ -56,9 +60,10 @@ static void usage(char **argv) { printf("Usage\n\t%s -d mm/dd/yyyy -t HH:MM:SS [-x]\n",argv[0]); - printf("\twhere -d date in mm/dd/yyyy format\n"); + printf("\twhere -D domainid selects the domain\n"); + printf("\t -d date in mm/dd/yyyy format\n"); printf("\t -t time of day in 24-hr format\n"); - printf("\t -x displays eXtra debug messages\n"); + printf("\t -x displays eXtra debug messages\n"); return; } @@ -71,6 +76,7 @@ int day_array[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; struct tm new_tm_time; SaErrorT rv; + SaHpiDomainIdT domainid = SAHPI_UNSPECIFIED_DOMAIN_ID; SaHpiSessionIdT sessionid; SaHpiDomainInfoT domainInfo; SaHpiRptEntryT rptentry; @@ -85,16 +91,35 @@ oh_prog_version(argv[0], OH_SVN_REV); - while ( (c = getopt( argc, argv,"d:t:x")) != EOF ) + while ( (c = getopt( argc, argv,"D:d:t:x")) != EOF ) { switch(c) { + case 'D': + if (optarg) domainid = atoi(optarg); + else { + usage(argv); + exit(1); + } + break; case 'd': - findate = 1; - strcpy(i_newdate, optarg); + if (optarg) { + findate = 1; + strcpy(i_newdate, optarg); + } + else { + usage(argv); + exit(1); + } break; case 't': - fintime = 1; - strcpy(i_newtime, optarg); + if (optarg) { + fintime = 1; + strcpy(i_newtime, optarg); + } + else { + usage(argv); + exit(1); + } break; case 'x': fdebug = 1; @@ -112,8 +137,10 @@ if (findate) { if (fdebug) printf("New date to be set: %s\n",i_newdate); - if (sscanf(i_newdate,"%2d/%2d/%4d", &month, &day, &year) < 8) { + if (sscanf(i_newdate,"%2d/%2d/%4d", &month, &day, &year) != 3) { printf("%s: Invalid date\n", argv[0]); + usage(argv); + exit(1); } /* check month, day and year for correctness */ if ((month < 1) || (month > 12)) { @@ -146,8 +173,10 @@ if (fintime) { if (fdebug) printf("New time to be set: %s\n",i_newtime); if (sscanf(i_newtime,"%2d:%2d:%2d", - &new_tm_time.tm_hour, &new_tm_time.tm_min, &new_tm_time.tm_sec) < 6) { + &new_tm_time.tm_hour, &new_tm_time.tm_min, &new_tm_time.tm_sec) != 3) { printf("%s: Invalid time\n", argv[0]); + usage(argv); + exit(1); } /* check hours, minutes and seconds for correctness */ if ((new_tm_time.tm_hour < 0) || (new_tm_time.tm_hour > 24)) { @@ -172,9 +201,13 @@ new_tm_time.tm_hour, new_tm_time.tm_min, new_tm_time.tm_sec); newtime = (SaHpiTimeT) mktime(&new_tm_time) * 1000000000; - if (fdebug) printf("New date and time in SaHpiTimeT %lli\n", (long long int)newtime); - rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sessionid,NULL); + if (fdebug) { + printf("New date and time in SaHpiTimeT %lli\n\n", (long long int)newtime); + if (domainid==SAHPI_UNSPECIFIED_DOMAIN_ID) printf("saHpiSessionOpen\n"); + else printf("saHpiSessionOpen to domain %d\n",domainid); + } + rv = saHpiSessionOpen(domainid,&sessionid,NULL); if (rv != SA_OK) { if (rv == SA_ERR_HPI_ERROR) printf("saHpiSessionOpen: error %d, SpiLibd not running\n",rv); Modified: openhpi/trunk/clients/hpithres.c =================================================================== --- openhpi/trunk/clients/hpithres.c 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/clients/hpithres.c 2010-06-17 08:35:01 UTC (rev 7111) @@ -1,6 +1,7 @@ /* -*- linux-c -*- * * Copyright (c) 2003 by Intel Corp. + * (C) Copyright Nokia Siemens Networks 2010 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -12,11 +13,14 @@ * Authors: * Bill Barkely * Andy Cress <ar...@us...> + * Ulrich Kleber <uli...@us...> + * * Changes: * 02/26/04 ARCress - added general search for any Fan sensor. * 03/17/04 ARCress - changed to Temp sensor (always has Lower Major) * 11/03/2004 kouzmich porting to HPI B * 11/25/2004 kouzmich changed as new threshold client (first release) + * 09/06/2010 ulikleber New option -D to select domain */ #include <stdio.h> @@ -95,6 +99,7 @@ int fdebug = 0; +SaHpiDomainIdT domainid = SAHPI_UNSPECIFIED_DOMAIN_ID; SaHpiSessionIdT sessionid; static void *resize_array(void *Ar, int item_size, int *last_num, int add_num) @@ -642,21 +647,33 @@ SaErrorT rv; char buf[READ_BUF_SIZE]; char *S; + SaHpiBoolT printusage = FALSE; oh_prog_version(argv[0], OH_SVN_REV); - while ( (c = getopt( argc, argv,"x?")) != EOF ) + while ( (c = getopt( argc, argv,"D:x?")) != EOF ) switch(c) { + case 'D': + if (optarg) domainid = atoi(optarg); + else printusage = TRUE; + break; case 'x': fdebug = 1; break; - default: - printf("Usage: %s [-x]\n", argv[0]); - printf(" -x Display debug messages\n"); - return(1); - } + default: printusage = TRUE; + } + if (printusage) { + printf("Usage: %s [-D domain] [-x]\n", argv[0]); + printf(" -D domainid Select domain\n"); + printf(" -x Display debug messages\n"); + return(1); + } + + if (fdebug) { + if (domainid==SAHPI_UNSPECIFIED_DOMAIN_ID) printf("saHpiSessionOpen\n"); + else printf("saHpiSessionOpen to domain %d\n",domainid); + } + rv = saHpiSessionOpen(domainid,&sessionid,NULL); - rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sessionid, NULL); - if (rv != SA_OK) { printf("saHpiSessionOpen: %s\n", oh_lookup_error(rv)); return(-1); Modified: openhpi/trunk/clients/hpitop.c =================================================================== --- openhpi/trunk/clients/hpitop.c 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/clients/hpitop.c 2010-06-17 08:35:01 UTC (rev 7111) @@ -2,6 +2,7 @@ * * Copyright (c) 2003 by Intel Corp. * (C) Copyright IBM Corp. 2004, 2005 + * (C) Copyright Nokia Siemens Networks 2010 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -12,6 +13,7 @@ * * Authors: * Peter D. Phan <pd...@us...> + * Ulrich Kleber <uli...@us...> * * Log: * Start from hpitree.c @@ -19,6 +21,7 @@ * * Changes: * 09/02/2010 lwetzel Fixed Bug: ResourceId 255 (0xFF) is a valid ResourceId + * 07/06/2010 ulikleber New option -D to select domain * */ @@ -112,14 +115,22 @@ { SaErrorT rv = SA_OK; + SaHpiDomainIdT domainid = SAHPI_UNSPECIFIED_DOMAIN_ID; SaHpiSessionIdT sessionid; SaHpiResourceIdT resourceid = 0; - + SaHpiBoolT printusage = FALSE; int c; oh_prog_version(argv[0], OH_SVN_REV); - while ( (c = getopt( argc, argv,"rsicawn:x?")) != EOF ) { + while ( (c = getopt( argc, argv,"rsicwadfD:n:x?")) != EOF ) { switch(c) { + case 'D': + if (optarg) { + domainid = atoi(optarg); + } + else printusage = TRUE; + break; + case 'r': f_rpt = 1; break; case 's': f_sensor = 1; break; case 'i': f_inv = 1; break; @@ -133,30 +144,40 @@ resourceid = atoi(optarg); f_allres = 0; } + else printusage = TRUE; break; + case 'x': fdebug = 1; break; - default: - printf("\n\tUsage: %s [-option]\n\n", argv[0]); - printf("\t (No Option) Display system topology: rpt & rdr headers\n"); - printf("\t -r Display only rpts\n"); - printf("\t -s Display only sensors\n"); - printf("\t -c Display only controls\n"); - printf("\t -w Display only watchdogs\n"); - printf("\t -i Display only inventories\n"); - printf("\t -a Display only annunciators\n"); - printf("\t -f Display only fumis\n"); - printf("\t -d Display only dimis\n"); - printf("\t -x Display debug messages\n"); - printf("\n\n\n\n"); - exit(1); + default: printusage = TRUE; break; } } + if (printusage == TRUE) + { + printf("\n\tUsage: %s [-option]\n\n", argv[0]); + printf("\t (No Option) Display system topology via default domain: rpt & rdr headers\n"); + printf("\t -D nn Select domain id nn\n"); + printf("\t -r Display only rpts\n"); + printf("\t -s Display only sensors\n"); + printf("\t -c Display only controls\n"); + printf("\t -w Display only watchdogs\n"); + printf("\t -i Display only inventories\n"); + printf("\t -a Display only annunciators\n"); + printf("\t -f Display only fumis\n"); + printf("\t -d Display only dimis\n"); + printf("\t -n nn Display only resource nn and its topology\n"); + printf("\t -x Display debug messages\n"); + printf("\n\n\n\n"); + exit(1); + } if (argc == 1) f_overview = 1; memset (previous_system, 0, SAHPI_MAX_TEXT_BUFFER_LENGTH); - if (fdebug) printf("saHpiSessionOpen\n"); - rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID,&sessionid,NULL); + if (fdebug) { + if (domainid==SAHPI_UNSPECIFIED_DOMAIN_ID) printf("saHpiSessionOpen\n"); + else printf("saHpiSessionOpen to domain %d\n",domainid); + } + rv = saHpiSessionOpen(domainid,&sessionid,NULL); if (rv != SA_OK) { printf("saHpiSessionOpen returns %s\n",oh_lookup_error(rv)); exit(-1); Modified: openhpi/trunk/clients/hpitree.c =================================================================== --- openhpi/trunk/clients/hpitree.c 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/clients/hpitree.c 2010-06-17 08:35:01 UTC (rev 7111) @@ -2,6 +2,7 @@ * * Copyright (c) 2003 by Intel Corp. * (C) Copyright IBM Corp. 2004 + * (C) Copyright Nokia Siemens Networks 2010 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,6 +14,7 @@ * Authors: * Peter D. Phan <pd...@us...> * Tariq Shureih <tar...@in...> + * Ulrich Kleber <uli...@us...> * * Log: * Copied from hpifru.c and modified for general use @@ -20,6 +22,7 @@ * Changes: * 11/03/2004 kouzmich Fixed Bug #1057934 * 09/02/2010 lwetzel Fixed Bug ResourceId 255 (0xFF) is a valid ResourceId + * 07/06/2010 ulikleber New option -D to select domain * */ @@ -109,12 +112,21 @@ SaHpiSessionIdT sessionid; SaHpiResourceIdT resourceid = 0; + SaHpiDomainIdT domainid = SAHPI_UNSPECIFIED_DOMAIN_ID; + SaHpiBoolT printusage = FALSE; int c; oh_prog_version(argv[0], OH_SVN_REV); - while ( (c = getopt( argc, argv,"adrsoiwcn:x?")) != EOF ) { + while ( (c = getopt( argc, argv,"D:acdirswon:x?")) != EOF ) { switch(c) { + case 'D': + if (optarg) { + domainid = atoi(optarg); + } + else printusage = TRUE; + break; + case 'a': f_listall = 1; break; case 'c': f_ctrl = 1; break; case 'd': f_rdr = 1; break; @@ -128,31 +140,40 @@ resourceid = atoi(optarg); f_allres = 0; } + else printusage = TRUE; break; case 'x': fdebug = 1; break; - default: - printf("\n\tUsage: %s [-option]\n\n", argv[0]); - printf("\t (No Option) Display all rpts and rdrs\n"); - printf("\t -a Display all rpts and rdrs\n"); - printf("\t -c Display only controls\n"); - printf("\t -d Display rdr records\n"); - printf("\t -i Display only inventories\n"); - printf("\t -o Display system overview: rpt & rdr headers\n"); - printf("\t -r Display only rpts\n"); - printf("\t -s Display only sensors\n"); - printf("\t -w Display only watchdog\n"); - printf("\t -n Select particular resource id to display\n"); - printf("\t (Used with [-cdirs] options)\n"); - printf("\t -x Display debug messages\n"); - printf("\n\n\n\n"); - exit(1); + default: printusage = TRUE; break; } } + if (printusage == TRUE) + { + printf("\n\tUsage: %s [-option]\n\n", argv[0]); + printf("\t (No Option) Display all rpts and rdrs via default domain\n"); + printf("\t -D nn Select domain id nn\n"); + printf("\t -a Display all rpts and rdrs\n"); + printf("\t -c Display only controls\n"); + printf("\t -d Display rdr records\n"); + printf("\t -i Display only inventories\n"); + printf("\t -o Display system overview: rpt & rdr headers\n"); + printf("\t -r Display only rpts\n"); + printf("\t -s Display only sensors\n"); + printf("\t -w Display only watchdog\n"); + printf("\t -n nn Select particular resource id to display\n"); + printf("\t (Used with [-cdirs] options)\n"); + printf("\t -x Display debug messages\n"); + printf("\n\n\n\n"); + exit(1); + } - if (argc == 1) f_listall = 1; + if (f_rpt+f_sensor+f_inv+f_ctrl+f_rdr+f_wdog == 0) f_listall = 1; - if (fdebug) printf("saHpiSessionOpen\n"); - rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID,&sessionid,NULL); + if (fdebug) { + if (domainid==SAHPI_UNSPECIFIED_DOMAIN_ID) printf("saHpiSessionOpen\n"); + else printf("saHpiSessionOpen to domain %d\n",domainid); + } + rv = saHpiSessionOpen(domainid,&sessionid,NULL); + if (rv != SA_OK) { printf("saHpiSessionOpen returns %s\n",oh_lookup_error(rv)); exit(-1); Modified: openhpi/trunk/clients/hpiwdt.c =================================================================== --- openhpi/trunk/clients/hpiwdt.c 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/clients/hpiwdt.c 2010-06-17 08:35:01 UTC (rev 7111) @@ -1,6 +1,7 @@ /* -*- linux-c -*- * * Copyright (c) 2004 by Intel Corp. + * (C) Copyright Nokia Siemens Networks 2010 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -11,11 +12,13 @@ * * Filename: hpiwdt.c * Authors: Andy Cress <ar...@us...> + * Ulrich Kleber <uli...@us...> * * Changes: * 03/15/04 Andy Cress - v1.0 added strings for use & actions in show_wdt * 10/13/04 kouzmich - porting to HPI B * 12/02/04 Andy Cress - v1.1 fixed domain/RPT loop, added some decoding + * 09/06/2010 ulikleber New option -D to select domain */ /* * This tool reads and enables the watchdog timer via HPI. @@ -33,6 +36,7 @@ #include <getopt.h> #include <SaHpi.h> #include <oh_clients.h> +#include <oHpi.h> #define uchar unsigned char #define OH_SVN_REV "$Revision$" @@ -89,6 +93,7 @@ { int c; SaErrorT rv; + SaHpiDomainIdT domainid = SAHPI_UNSPECIFIED_DOMAIN_ID; SaHpiSessionIdT sessionid; SaHpiDomainInfoT domainInfo; SaHpiRptEntryT rptentry; @@ -101,10 +106,15 @@ char freset = 0; char fenable = 0; char fdisable = 0; + SaHpiBoolT printusage = FALSE; oh_prog_version(argv[0], OH_SVN_REV); - while ( (c = getopt( argc, argv,"dert:x?")) != EOF ) + while ( (c = getopt( argc, argv,"D:dert:x?")) != EOF ) switch(c) { + case 'D': + if (optarg) domainid = atoi(optarg); + else printusage = TRUE; + break; case 'r': /* reset wdt */ freset = 1; break; @@ -115,22 +125,32 @@ fdisable = 1; break; case 't': /* timeout (enable implied) */ - t = atoi(optarg); - fenable = 1; + if (optarg) { + t = atoi(optarg); + fenable = 1; + } + else printusage = TRUE; break; case 'x': fdebug = 1; break; /* debug messages */ - default: + default: printusage = TRUE; + } + if (printusage) { printf("Usage: %s [-derx -t sec]\n", argv[0]); - printf(" where -e enables the watchdog timer\n"); - printf(" -d disables the watchdog timer\n"); - printf(" -r resets the watchdog timer\n"); - printf(" -t N sets timeout to N seconds\n"); - printf(" -x show eXtra debug messages\n"); + printf(" where -D domainid Selects the domain\n"); + printf(" -e enables the watchdog timer\n"); + printf(" -d disables the watchdog timer\n"); + printf(" -r resets the watchdog timer\n"); + printf(" -t N sets timeout to N seconds\n"); + printf(" -x show eXtra debug messages\n"); exit(1); - } + } if (t == 0) t = 120; - - rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sessionid, NULL); + + if (fdebug) { + if (domainid==SAHPI_UNSPECIFIED_DOMAIN_ID) printf("saHpiSessionOpen\n"); + else printf("saHpiSessionOpen to domain %d\n",domainid); + } + rv = saHpiSessionOpen(domainid,&sessionid,NULL); if (rv != SA_OK) { printf("saHpiSessionOpen error %d\n",rv); exit(-1); Modified: openhpi/trunk/docs/man/hpialarms.pod.1 =================================================================== --- openhpi/trunk/docs/man/hpialarms.pod.1 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/docs/man/hpialarms.pod.1 2010-06-17 08:35:01 UTC (rev 7111) @@ -4,35 +4,38 @@ =head1 SYNOPSIS -hpialarms [-a -b -c -i -m -n -p -o -x] +hpialarms [-D -a -b -c -i -m -n -p -o -x] =head1 DESCRIPTION hpialarms walks the RPT (Resource Present Table) for resouces that have "Alarm Control" management instruments (SAHPI_CTRL_LED). +If no domain is selected, hpialarms uses a session with the default domain. The selected domain id must be configured via the openhpidclient.conf file specified in the environment. + =head1 OPTIONS =over 2 - -c1 sets Critical Alarm on - -c0 sets Critical Alarm off - -m1 sets Major Alarm on - -m0 sets Major Alarm off - -n1 sets Minor Alarm on - -n0 sets Minor Alarm off - -p1 sets Power Alarm on - -p0 sets Power Alarm off - -i5 sets Chassis ID on for 5 sec - -i0 sets Chassis ID off - -a1 sets Disk A fault on - -a0 sets Disk A fault off - -b1 sets Disk B fault on - -b0 sets Disk B fault off - -d[byte] sets raw Alarm byte - -o sets all Alarms off - -x show eXtra debug messages + -D domain id Select domain id + -c1 sets Critical Alarm on + -c0 sets Critical Alarm off + -m1 sets Major Alarm on + -m0 sets Major Alarm off + -n1 sets Minor Alarm on + -n0 sets Minor Alarm off + -p1 sets Power Alarm on + -p0 sets Power Alarm off + -i5 sets Chassis ID on for 5 sec + -i0 sets Chassis ID off + -a1 sets Disk A fault on + -a0 sets Disk A fault off + -b1 sets Disk B fault on + -b0 sets Disk B fault off + -d[byte] sets raw Alarm byte + -o sets all Alarms off + -x show eXtra debug messages =back @@ -54,9 +57,12 @@ =head1 SEE ALSO +hpiel, hpievents, hpifan, hpiinv, hpionIBMblade, hpipower, hpireset, hpisensor, hpisettime, hpithres, hpitop, hpitree, hpiwdt + =head1 AUTHORS Authors of this man page: Peter D Phan (pd...@us...) + Ulrich Kleber (uli...@us...) Modified: openhpi/trunk/docs/man/hpiel.pod.1 =================================================================== --- openhpi/trunk/docs/man/hpiel.pod.1 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/docs/man/hpiel.pod.1 2010-06-17 08:35:01 UTC (rev 7111) @@ -4,17 +4,23 @@ =head1 SYNOPSIS -hpiel [ -d -e -c -p -r -x -v -h ] +hpiel [-D domain] [-d] [-e entitypath] [-c -p -r -x -v -h ] +hpiel [--Domain="domainid"] [--del] [-entitypath="entitypath"] [--clear --resource --rdr --xml --verbose --help] + =head1 DESCRIPTION hpiel searches the RPT (Resource Present Table) for resources with SAHPI_CAPABILITY_EVENT_LOG and displays event log entries for resources found. +If no domain is selected, hpiel uses a session with the default domain. The selected domain id must be configured via the openhpidclient.conf file specified in the environment. + + =head1 OPTIONS =over 2 - --del, -d display domain event log entries + --Domain="<arg>", -D "<arg>" select domain id + --del, -d display domain event log entries --entitypath="<arg>", -e "<arg>" display resource event log entries (e.g. -e "{SYSTEM_CHASSIS,2}{SBC_BLADE,5}") --clear, -c clear log before reading event log entries @@ -59,9 +65,13 @@ =head1 SEE ALSO +hpialarms, hpievents, hpifan, hpiinv, hpionIBMblade, hpipower, hpireset, hpisensor, hpisettime, hpithres, hpitop, hpitree, hpiwdt + + =head1 AUTHORS Authors of this man page: Peter D Phan (pd...@us...) + Ulrich Kleber (uli...@us...) Modified: openhpi/trunk/docs/man/hpievents.pod.1 =================================================================== --- openhpi/trunk/docs/man/hpievents.pod.1 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/docs/man/hpievents.pod.1 2010-06-17 08:35:01 UTC (rev 7111) @@ -4,17 +4,21 @@ =head1 SYNOPSIS -hpievents [ -t -d -x ] +hpievents [ -D <value> ][ -t <value> ] [ -d -x ] =head1 DESCRIPTION hpievents polls for events in an opened HPI session. User can specify wait time for the event. User can also select the order between hpi resource (resource event) discovery and hpi event subscription. +If no domain is selected, hpievents polls for events in the default domain. The selected domain id must be configured via the openhpidclient.conf file specified in the environment. + + =head1 OPTIONS =over 2 - where: -t <value> - wait <value> seconds for event; + where: -D <value> - select domain id + -t <value> - wait <value> seconds for event; -t SAHPI_TIMEOUT_BLOCK or BLOCK - infinite wait -d - call saHpiDiscover() after saHpiSubscribe() -x - displays eXtra debug messages @@ -46,10 +50,11 @@ =head1 SEE ALSO +hpialarms, hpiel, hpifan, hpiinv, hpionIBMblade, hpipower, hpireset, hpisensor, hpisettime, hpithres, hpitop, hpitree, hpiwdt =head1 AUTHORS Authors of this man page: Peter D Phan (pd...@us...) - + Ulrich Kleber (uli...@us...) Modified: openhpi/trunk/docs/man/hpifan.pod.1 =================================================================== --- openhpi/trunk/docs/man/hpifan.pod.1 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/docs/man/hpifan.pod.1 2010-06-17 08:35:01 UTC (rev 7111) @@ -4,29 +4,33 @@ =head1 SYNOPSIS -hpifan [-h] [-s fan_speed_level] +hpifan [-D domainid] [-h] [-s fan_speed_level] =head1 DESCRIPTION hpifan walks the RPT (Resource Present Table) for resouces that have "Fan Control" management instruments (SAHPI_CTRL_FAN_SPEED). +If no domain is selected, hpifan uses a session to the default domain. The selected domain id must be configured via the openhpidclient.conf file specified in the environment. =head1 OPTIONS =over 2 - -h help - -s <speed> set fan speed for ALL fans + -D <domainid> select domain id + -s <speed> set fan speed for ALL fans + -h help =back =head1 SEE ALSO +hpialarms, hpiel, hpievents, hpiinv, hpionIBMblade, hpipower, hpireset, hpisensor, hpisettime, hpithres, hpitop, hpitree, hpiwdt =head1 AUTHORS Authors of this man page: Peter D Phan (pd...@us...) + Ulrich Kleber (uli...@us...) Modified: openhpi/trunk/docs/man/hpiinv.pod.1 =================================================================== --- openhpi/trunk/docs/man/hpiinv.pod.1 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/docs/man/hpiinv.pod.1 2010-06-17 08:35:01 UTC (rev 7111) @@ -4,19 +4,23 @@ =head1 SYNOPSIS -hpiinv [-x] [-a asset_tag] +hpiinv [-D domain] [-vxz] [-a asset_tag] =head1 DESCRIPTION hpiinv walks the RPT (Resource Present Table) looking for resources that have Inventory Capability. It displays all inventory records found. +If no domain is selected, hpiinv uses a session with the default domain. The selected domain id must be configured via the openhpidclient.conf file specified in the environment. + =head1 OPTIONS =over 2 - -a Sets the asset tag - -x Display debug messages - -z Display extra debug messages + -D domainid Select the domain + -a tag Sets the asset tag + -v Use verbose output mode + -x Display debug messages + -z Display extra debug messages =back @@ -33,9 +37,12 @@ =head1 SEE ALSO +hpialarms, hpiel, hpievents, hpifan, hpionIBMblade, hpipower, hpireset, hpisensor, hpisettime, hpithres, hpitop, hpitree, hpiwdt + =head1 AUTHORS Authors of this man page: Peter D Phan (pd...@us...) + Ulrich Kleber (uli...@us...) Modified: openhpi/trunk/docs/man/hpipower.pod.1 =================================================================== --- openhpi/trunk/docs/man/hpipower.pod.1 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/docs/man/hpipower.pod.1 2010-06-17 08:35:01 UTC (rev 7111) @@ -4,30 +4,38 @@ =head1 SYNOPSIS -hpipower [ -d -p -r -u -b -x ] +hpipower [ -D <value> ] [ -d -p -r -b -x ] [ -u <value> ] =head1 DESCRIPTION hpipower searches the Resource Presence Table (RPT) for resources with Power Capability. It sends the requested power action to the selected target. +If no domain is selected, hpievents polls for events in the default domain. The selected domain id must be configured via the openhpidclient.conf file specified in the environment. + + =head1 OPTIONS =over 2 - -d power down target object - -p power on target object - -r reset target object - -u unattended - -b <n> Specify blade <n> (1...n) - -x debug messages + -D <value> Specify domain id + -d power down target object + -p power on target object + -r reset target object + -u unattended + -b <n> Specify blade <n> (1...n) + -x debug messages =back =head1 SEE ALSO +hpialarms, hpiel, hpievents, hpifan, hpiinv, hpionIBMblade, hpireset, hpisensor, hpisettime, hpithres, hpitop, hpitree, hpiwdt + + =head1 AUTHORS Authors of this man page: Peter D Phan (pd...@us...) + Ulrich Kleber (uli...@us...) Modified: openhpi/trunk/docs/man/hpireset.pod.1 =================================================================== --- openhpi/trunk/docs/man/hpireset.pod.1 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/docs/man/hpireset.pod.1 2010-06-17 08:35:01 UTC (rev 7111) @@ -4,31 +4,40 @@ =head1 SYNOPSIS -hpireset [-r -d -x] +hpireset [-D id] [-r -d -w -c -n -o -s -x] =head1 DESCRIPTION hpireset searches the Resource Presence Table (RPT) for resources with Reset Capability. It sends the requested reset action to all resources with SAHPI_CAPABILITY_RESET. +If no domain is selected, hpireset uses a session with the default domain. The selected domain id must be configured via the openhpidclient.conf file specified in the environment. + + =head1 OPTIONS =over 2 - -r hard Resets the system - -d powers Down the system - -c power Cycles the system - -n sends NMI to the system - -o soft-shutdown OS - -s reboots to Service Partition - -x show eXtra debug messages + -D <id> select the domain id + -r hard resets the system + -d powers down the system + -w warm resets the system + -c power cycles the system + -n sends NMI to the system + -o soft-shutdown OS + -s reboots to Service Partition + -x show eXtra debug messages =back =head1 SEE ALSO +hpialarms, hpiel, hpievents, hpifan, hpiinv, hpionIBMblade, hpipower, hpisensor, hpisettime, hpithres, hpitop, hpitree, hpiwdt + + =head1 AUTHORS Authors of this man page: Peter D Phan (pd...@us...) + Ulrich Kleber (uli...@us...) Modified: openhpi/trunk/docs/man/hpisensor.pod.1 =================================================================== --- openhpi/trunk/docs/man/hpisensor.pod.1 2010-06-15 21:30:44 UTC (rev 7110) +++ openhpi/trunk/docs/man/hpisensor.pod.1 2010-06-17 08:35:01 UTC (rev 7111) @@ -4,29 +4,37 @@ =head1 SYNOPSIS -hpisensor [-t -r -x -e] +hpisensor [-D domain] [-t -r -x] [-e entitypath] =head1 DESCRIPTION hpisensor displays sensor info for all resources with Sensor Capability . +If no domain is selec... [truncated message content] |
From: <av...@us...> - 2010-07-15 11:22:41
|
Revision: 7123 http://openhpi.svn.sourceforge.net/openhpi/?rev=7123&view=rev Author: avpak Date: 2010-07-15 11:22:34 +0000 (Thu, 15 Jul 2010) Log Message: ----------- Feature request #3028899 Modified Paths: -------------- openhpi/trunk/hpi_shell/service.c openhpi/trunk/utils/Makefile.am openhpi/trunk/utils/sahpi_struct_utils.c openhpi/trunk/utils/sahpi_struct_utils.h openhpi/trunk/utils/t/epath/Makefile.am openhpi/trunk/utils/t/rpt/Makefile.am openhpi/trunk/utils/t/sahpi/Makefile.am openhpi/trunk/utils/t/uid/Makefile.am Modified: openhpi/trunk/hpi_shell/service.c =================================================================== --- openhpi/trunk/hpi_shell/service.c 2010-07-15 10:12:49 UTC (rev 7122) +++ openhpi/trunk/hpi_shell/service.c 2010-07-15 11:22:34 UTC (rev 7123) @@ -125,51 +125,12 @@ return(string); } -static void append_char_to_big_text(oh_big_textbuffer * buf, unsigned char c) -{ - buf->Data[buf->DataLength] = c; - ++buf->DataLength; -} - -static void append_hex_to_big_text(oh_big_textbuffer * buf, unsigned char c) -{ - static const unsigned char tt[] = "0123456789ABCDEF"; - append_char_to_big_text(buf, tt[c >> 4]); - append_char_to_big_text(buf, tt[c & 0xF]); -} - -static void decode_guid(const SaHpiGuidT * guid, oh_big_textbuffer * buf) -{ - unsigned int i; - oh_init_bigtext(buf); - for (i = 0; i < 4; ++i) { - append_hex_to_big_text(buf, (*guid)[i]); - } - append_char_to_big_text(buf, '-'); - for (i = 4; i < 6; ++i) { - append_hex_to_big_text(buf, (*guid)[i]); - } - append_char_to_big_text(buf, '-'); - for (i = 6; i < 8; ++i) { - append_hex_to_big_text(buf, (*guid)[i]); - } - append_char_to_big_text(buf, '-'); - for (i = 8; i < 10; ++i) { - append_hex_to_big_text(buf, (*guid)[i]); - } - append_char_to_big_text(buf,'-'); - for (i = 10; i < 16; ++i) { - append_hex_to_big_text(buf, (*guid)[i]); - } - append_char_to_big_text(buf,'\0'); -} - static void decode_configdata(const SaHpiUint8T * configdata, oh_big_textbuffer * buf) { unsigned int i; for ( i = 0; i < SAHPI_CTRL_OEM_CONFIG_LENGTH; ++i ) { - append_hex_to_big_text(buf, configdata[i]); - append_char_to_big_text(buf, ' '); + oh_append_hex_bigtext(buf, configdata[i]); + oh_append_char_bigtext(buf, ' '); } } @@ -177,8 +138,8 @@ { unsigned int i; for ( i = 0; i < oem_state->BodyLength; ++i ) { - append_hex_to_big_text(buf, oem_state->Body[i]); - append_char_to_big_text(buf, ' '); + oh_append_hex_bigtext(buf, oem_state->Body[i]); + oh_append_char_bigtext(buf, ' '); } } @@ -195,7 +156,7 @@ if (rv != SA_OK) return(-1); break; case GUID_PROC: - decode_guid((const SaHpiGuidT*)val, &tmpbuf); + oh_decode_guid((const SaHpiGuidT*)val, &tmpbuf); break; case CONFIGDATA_PROC: decode_configdata((const SaHpiUint8T*)val, &tmpbuf); @@ -345,7 +306,7 @@ static void oh_manufacturer_id(SaHpiManufacturerIdT mid, char *buf, int bufsize) { if (mid != SAHPI_MANUFACTURER_ID_UNSPECIFIED) { - snprintf(buf, bufsize, "%d (0x%08X)", mid, mid); + snprintf(buf, bufsize, "%d (0x%08x)", mid, mid); } else { strcpy(buf, "Unspecified"); } Modified: openhpi/trunk/utils/Makefile.am =================================================================== --- openhpi/trunk/utils/Makefile.am 2010-07-15 10:12:49 UTC (rev 7122) +++ openhpi/trunk/utils/Makefile.am 2010-07-15 11:22:34 UTC (rev 7123) @@ -84,7 +84,7 @@ uid_utils.c libopenhpiutils_la_LDFLAGS = -version-info @HPI_LIB_VERSION@ -libopenhpiutils_la_LIBADD = -luuid +libopenhpiutils_la_LIBADD = # FIXME:: Add when we can auto-generate files for SMP systems #$(GENERATED_FILES): $(top_srcdir)/include/SaHpi.h $(top_srcdir)/scripts/SaHpi2code.pl Modified: openhpi/trunk/utils/sahpi_struct_utils.c =================================================================== --- openhpi/trunk/utils/sahpi_struct_utils.c 2010-07-15 10:12:49 UTC (rev 7122) +++ openhpi/trunk/utils/sahpi_struct_utils.c 2010-07-15 11:22:34 UTC (rev 7123) @@ -23,7 +23,6 @@ #include <string.h> #include <ctype.h> #include <errno.h> -#include <uuid/uuid.h> #include <SaHpi.h> #include <oh_utils.h> @@ -933,6 +932,24 @@ return(SA_OK); } +SaErrorT oh_append_char_bigtext(oh_big_textbuffer * big_buffer, unsigned char c) +{ + big_buffer->Data[big_buffer->DataLength] = c; + ++big_buffer->DataLength; + + return(SA_OK); +} + +SaErrorT oh_append_hex_bigtext(oh_big_textbuffer * buf, unsigned char c) +{ + static const unsigned char tt[] = "0123456789abcdef"; + oh_append_char_bigtext(buf, tt[c >> 4]); + oh_append_char_bigtext(buf, tt[c & 0xF]); + + return(SA_OK); +} + + /** * oh_fprint_ctrlrec: * @stream: File handle. @@ -1035,7 +1052,6 @@ static SaErrorT oh_build_resourceinfo(oh_big_textbuffer *buffer, const SaHpiResourceInfoT *ResourceInfo, int offsets) { char str[SAHPI_MAX_TEXT_BUFFER_LENGTH]; - char tempstr[SAHPI_MAX_TEXT_BUFFER_LENGTH]; int found; oh_big_textbuffer working; SaHpiTextBufferT tmpbuffer; @@ -1116,15 +1132,10 @@ memset(empty_guid, 0, sizeof(SaHpiGuidT)); if (memcmp(empty_guid, ResourceInfo->Guid, sizeof(SaHpiGuidT))) { -#if defined(__sun) && defined(__SVR4) - uuid_unparse((unsigned char *)ResourceInfo->Guid, tempstr); -#else - uuid_unparse(ResourceInfo->Guid, tempstr); -#endif oh_append_offset(&working, offsets); - snprintf(str, SAHPI_MAX_TEXT_BUFFER_LENGTH, "GUID: %s\n", - tempstr); - oh_append_bigtext(&working, str); + oh_append_bigtext(&working, "GUID: "); + oh_decode_guid( &ResourceInfo->Guid, &working); + oh_append_char_bigtext(&working, '\n'); found++; } } @@ -2571,6 +2582,37 @@ return(SA_OK); } +/** + * oh_decode_guid: + * @guid: pointer to GUID data of type SaHpiGuidT. + * @buffer: Location to store the string. + * + * Converts @guid type into a string based. + * + * Returns: + * SA_OK - Normal operation. + * SA_ERR_HPI_INVALID_PARAMS - @buffer is NULL + **/ +SaErrorT oh_decode_guid(const SaHpiGuidT *guid, oh_big_textbuffer *buffer) +{ + unsigned int i; + + if (!buffer) { + dbg("Invalid parameter."); + return(SA_ERR_HPI_INVALID_PARAMS); + } + + for (i = 0; i < 16; ++i) { + if ((i == 4) || (i == 6) || (i == 8) || (i == 10)) { + oh_append_char_bigtext(buffer, '-'); + } + oh_append_hex_bigtext(buffer, (*guid)[i]); + } + + return(SA_OK); +} + + //========================== /** Modified: openhpi/trunk/utils/sahpi_struct_utils.h =================================================================== --- openhpi/trunk/utils/sahpi_struct_utils.h 2010-07-15 10:12:49 UTC (rev 7122) +++ openhpi/trunk/utils/sahpi_struct_utils.h 2010-07-15 11:22:34 UTC (rev 7123) @@ -89,6 +89,8 @@ SaErrorT oh_decode_fumicapabilities(SaHpiFumiCapabilityT capabilities, SaHpiTextBufferT *buffer); +SaErrorT oh_decode_guid(const SaHpiGuidT *guid, oh_big_textbuffer *buffer); + /************************* * Validate HPI structures *************************/ @@ -118,6 +120,10 @@ SaErrorT oh_append_offset(oh_big_textbuffer *buffer, int offsets); +SaErrorT oh_append_char_bigtext(oh_big_textbuffer * big_buffer, unsigned char c); + +SaErrorT oh_append_hex_bigtext(oh_big_textbuffer * buf, unsigned char c); + #define oh_print_event(event_ptr, ep, offsets) oh_fprint_event(stdout, event_ptr, ep, offsets) SaErrorT oh_fprint_event(FILE *stream, const SaHpiEventT *event, Modified: openhpi/trunk/utils/t/epath/Makefile.am =================================================================== --- openhpi/trunk/utils/t/epath/Makefile.am 2010-07-15 10:12:49 UTC (rev 7122) +++ openhpi/trunk/utils/t/epath/Makefile.am 2010-07-15 11:22:34 UTC (rev 7123) @@ -46,8 +46,6 @@ INCLUDES = @OPENHPI_INCLUDES@ -LIBS += -luuid - $(REMOTE_SOURCES): if test ! -f $@ -a ! -L $@; then \ if test -f $(top_srcdir)/utils/$@; then \ Modified: openhpi/trunk/utils/t/rpt/Makefile.am =================================================================== --- openhpi/trunk/utils/t/rpt/Makefile.am 2010-07-15 10:12:49 UTC (rev 7122) +++ openhpi/trunk/utils/t/rpt/Makefile.am 2010-07-15 11:22:34 UTC (rev 7123) @@ -27,8 +27,6 @@ EXTRA_DIST = rpt_resources.h -LIBS += -luuid - $(REMOTE_SOURCES): if test ! -f $@ -a ! -L $@; then \ $(LN_S) $(top_srcdir)/utils/$@; \ Modified: openhpi/trunk/utils/t/sahpi/Makefile.am =================================================================== --- openhpi/trunk/utils/t/sahpi/Makefile.am 2010-07-15 10:12:49 UTC (rev 7122) +++ openhpi/trunk/utils/t/sahpi/Makefile.am 2010-07-15 11:22:34 UTC (rev 7123) @@ -25,8 +25,6 @@ AM_CFLAGS = -std=c99 # the -std=c99 comment above is required to have unicode in the tests -LIBS += -luuid - $(REMOTE_SOURCES): if test ! -f $@ -a ! -L $@; then \ if test -f $(top_srcdir)/utils/$@; then \ Modified: openhpi/trunk/utils/t/uid/Makefile.am =================================================================== --- openhpi/trunk/utils/t/uid/Makefile.am 2010-07-15 10:12:49 UTC (rev 7122) +++ openhpi/trunk/utils/t/uid/Makefile.am 2010-07-15 11:22:34 UTC (rev 7123) @@ -26,8 +26,6 @@ INCLUDES = @OPENHPI_INCLUDES@ -LIBS += -luuid - $(REMOTE_SOURCES): if test ! -f $@ -a ! -L $@; then \ $(LN_S) $(top_srcdir)/utils/$@; \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2010-07-19 12:29:02
|
Revision: 7126 http://openhpi.svn.sourceforge.net/openhpi/?rev=7126&view=rev Author: avpak Date: 2010-07-19 12:28:55 +0000 (Mon, 19 Jul 2010) Log Message: ----------- Fix for #3031568 Modified Paths: -------------- openhpi/trunk/baselib/oh_client.cpp openhpi/trunk/baselib/oh_client_conf.h openhpi/trunk/baselib/oh_client_session.cpp openhpi/trunk/baselib/oh_client_session.h openhpi/trunk/include/oHpi.h openhpi/trunk/include/oh_alarm.h openhpi/trunk/include/oh_config.h openhpi/trunk/include/oh_domain.h openhpi/trunk/include/oh_init.h openhpi/trunk/include/oh_lock.h openhpi/trunk/include/oh_plugin.h openhpi/trunk/include/oh_session.h openhpi/trunk/include/openhpi.h openhpi/trunk/marshal/marshal_hpi_types.h openhpi/trunk/utils/epath_utils.h Modified: openhpi/trunk/baselib/oh_client.cpp =================================================================== --- openhpi/trunk/baselib/oh_client.cpp 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/baselib/oh_client.cpp 2010-07-19 12:28:55 UTC (rev 7126) @@ -16,8 +16,6 @@ * */ -extern "C" -{ #include <string.h> #include <glib.h> #include <SaHpi.h> @@ -25,7 +23,6 @@ #include <oh_error.h> #include <oh_domain.h> #include <config.h> -} #include <marshal_hpi.h> Modified: openhpi/trunk/baselib/oh_client_conf.h =================================================================== --- openhpi/trunk/baselib/oh_client_conf.h 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/baselib/oh_client_conf.h 2010-07-19 12:28:55 UTC (rev 7126) @@ -14,13 +14,28 @@ * */ +#ifndef __OH_CLIENT_CONF_H +#define __OH_CLIENT_CONF_H + #include <glib.h> #include <SaHpi.h> +#ifdef __cplusplus +extern "C" { +#endif + struct oh_domain_conf { SaHpiDomainIdT did; char host[SAHPI_MAX_TEXT_BUFFER_LENGTH]; unsigned int port; }; + int oh_load_client_config(const char *filename, GHashTable *domains); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __OH_CLIENT_CONF_H */ + Modified: openhpi/trunk/baselib/oh_client_session.cpp =================================================================== --- openhpi/trunk/baselib/oh_client_session.cpp 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/baselib/oh_client_session.cpp 2010-07-19 12:28:55 UTC (rev 7126) @@ -16,15 +16,13 @@ */ #include "oh_client_session.h" -extern "C" -{ + #include <pthread.h> #include <oHpi.h> #include <oh_error.h> #include <config.h> #include <oh_domain.h> #include "oh_client_conf.h" -} GHashTable *ohd_domains = NULL; GHashTable *ohd_sessions = NULL; Modified: openhpi/trunk/baselib/oh_client_session.h =================================================================== --- openhpi/trunk/baselib/oh_client_session.h 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/baselib/oh_client_session.h 2010-07-19 12:28:55 UTC (rev 7126) @@ -20,12 +20,13 @@ #include <strmsock.h> -extern "C" -{ #include <glib.h> #include <SaHpi.h> -} +#ifdef __cplusplus +extern "C" { +#endif + struct oh_client_session { SaHpiDomainIdT did; /* Domain Id */ SaHpiSessionIdT csid; /* Client Session Id */ @@ -45,4 +46,8 @@ SaHpiSessionIdT oh_open_session(SaHpiDomainIdT, SaHpiSessionIdT, pcstrmsock); SaErrorT oh_close_session(SaHpiSessionIdT); +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* __OH_CLIENT_SESSION_H */ Modified: openhpi/trunk/include/oHpi.h =================================================================== --- openhpi/trunk/include/oHpi.h 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/include/oHpi.h 2010-07-19 12:28:55 UTC (rev 7126) @@ -26,6 +26,10 @@ #define OH_SAHPI_INTERFACE_VERSION_MIN_SUPPORTED (SaHpiVersionT)0x020101 /* B.01.01 */ #define OH_SAHPI_INTERFACE_VERSION_MAX_SUPPORTED SAHPI_INTERFACE_VERSION +#ifdef __cplusplus +extern "C" { +#endif + typedef SaHpiUint32T oHpiHandlerIdT; typedef struct { @@ -113,4 +117,8 @@ v += (strtoull(start, &end, 10) << 16); \ } +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /*__OHPI_H*/ Modified: openhpi/trunk/include/oh_alarm.h =================================================================== --- openhpi/trunk/include/oh_alarm.h 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/include/oh_alarm.h 2010-07-19 12:28:55 UTC (rev 7126) @@ -21,6 +21,10 @@ #include <oh_domain.h> #include <oh_event.h> +#ifdef __cplusplus +extern "C" { +#endif + #define OH_MAX_DAT_SIZE_LIMIT 0 #define OH_MAX_DAT_USER_LIMIT 0 @@ -70,5 +74,9 @@ SaErrorT oh_alarms_to_file(struct oh_dat *at, char *filename); SaErrorT oh_alarms_from_file(struct oh_domain *d, char *filename); +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* __OH_ALARM_H */ Modified: openhpi/trunk/include/oh_config.h =================================================================== --- openhpi/trunk/include/oh_config.h 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/include/oh_config.h 2010-07-19 12:28:55 UTC (rev 7126) @@ -18,14 +18,14 @@ #ifndef __OH_CONFIG_H #define __OH_CONFIG_H +#include <glib.h> +#include <SaHpi.h> +#include <oh_utils.h> + #ifdef __cplusplus extern "C" { #endif -#include <glib.h> -#include <SaHpi.h> -#include <oh_utils.h> - struct oh_parsed_config { GSList *handler_configs; guint handlers_defined; Modified: openhpi/trunk/include/oh_domain.h =================================================================== --- openhpi/trunk/include/oh_domain.h 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/include/oh_domain.h 2010-07-19 12:28:55 UTC (rev 7126) @@ -19,14 +19,14 @@ #define OH_DEFAULT_DOMAIN_ID 0 +#include <SaHpi.h> +#include <glib.h> +#include <oh_utils.h> + #ifdef __cplusplus extern "C" { #endif -#include <SaHpi.h> -#include <glib.h> -#include <oh_utils.h> - /* * Global table of all active domains (oh_domain). * Encapsulated in a struct to store a lock alongside of it. Modified: openhpi/trunk/include/oh_init.h =================================================================== --- openhpi/trunk/include/oh_init.h 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/include/oh_init.h 2010-07-19 12:28:55 UTC (rev 7126) @@ -20,7 +20,15 @@ #include <SaHpi.h> +#ifdef __cplusplus +extern "C" { +#endif + int oh_init(void); int oh_finit(void); +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* __OH_INIT_H */ Modified: openhpi/trunk/include/oh_lock.h =================================================================== --- openhpi/trunk/include/oh_lock.h 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/include/oh_lock.h 2010-07-19 12:28:55 UTC (rev 7126) @@ -20,6 +20,10 @@ #include <config.h> +#ifdef __cplusplus +extern "C" { +#endif + extern int oh_will_block; int data_access_block_times(void); @@ -77,4 +81,8 @@ dbg_lock("%p - released the lock", g_thread_self()); \ } while(0) +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* __OH_LOCK_H */ Modified: openhpi/trunk/include/oh_plugin.h =================================================================== --- openhpi/trunk/include/oh_plugin.h 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/include/oh_plugin.h 2010-07-19 12:28:55 UTC (rev 7126) @@ -19,6 +19,10 @@ #include <glib.h> #include <oh_handler.h> +#ifdef __cplusplus +extern "C" { +#endif + /* * Plugins are kept in a list within the oh_plugins struct */ @@ -95,4 +99,8 @@ /* Bind abi functions into plugin */ int oh_load_plugin_functions(struct oh_plugin *plugin, struct oh_abi_v2 **abi); +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /*__OH_PLUGIN_H*/ Modified: openhpi/trunk/include/oh_session.h =================================================================== --- openhpi/trunk/include/oh_session.h 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/include/oh_session.h 2010-07-19 12:28:55 UTC (rev 7126) @@ -21,6 +21,10 @@ #include <oh_event.h> #include <glib.h> +#ifdef __cplusplus +extern "C" { +#endif + /* * Global table of all active sessions (oh_session). This table is * populated and depopulated by calls to saHpiSessionOpen() and @@ -78,5 +82,9 @@ SaErrorT oh_destroy_session(SaHpiSessionIdT sid); SaErrorT oh_destroy_domain_sessions(SaHpiDomainIdT did); +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* __OH_SESSION_H */ Modified: openhpi/trunk/include/openhpi.h =================================================================== --- openhpi/trunk/include/openhpi.h 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/include/openhpi.h 2010-07-19 12:28:55 UTC (rev 7126) @@ -33,12 +33,4 @@ #include <oh_hotswap.h> #include <oh_utils.h> -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - #endif /* __OPENHPI_H */ Modified: openhpi/trunk/marshal/marshal_hpi_types.h =================================================================== --- openhpi/trunk/marshal/marshal_hpi_types.h 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/marshal/marshal_hpi_types.h 2010-07-19 12:28:55 UTC (rev 7126) @@ -22,16 +22,9 @@ #define dMarshalHpiTypes_h -#ifdef __cplusplus -extern "C" { -#endif - #include <SaHpi.h> #include <oHpi.h> #include <oh_utils.h> -#ifdef __cplusplus -} -#endif #ifndef dMarshal_h Modified: openhpi/trunk/utils/epath_utils.h =================================================================== --- openhpi/trunk/utils/epath_utils.h 2010-07-15 20:44:50 UTC (rev 7125) +++ openhpi/trunk/utils/epath_utils.h 2010-07-19 12:28:55 UTC (rev 7126) @@ -34,6 +34,11 @@ /* Definitions for describing entity path patterns */ #define OH_MAX_EP_TUPLES SAHPI_MAX_ENTITY_PATH+1 +#ifdef __cplusplus +extern "C" { +#endif + + typedef struct { SaHpiBoolT is_dot; SaHpiEntityTypeT type; @@ -54,9 +59,6 @@ oh_entity_pattern epattern[OH_MAX_EP_TUPLES]; } oh_entitypath_pattern; -#ifdef __cplusplus -extern "C" { -#endif SaHpiBoolT oh_cmp_ep(const SaHpiEntityPathT *ep1, const SaHpiEntityPathT *ep2); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |