From: <av...@us...> - 2012-05-02 13:41:16
|
Revision: 7427 http://openhpi.svn.sourceforge.net/openhpi/?rev=7427&view=rev Author: avpak Date: 2012-05-02 13:41:05 +0000 (Wed, 02 May 2012) Log Message: ----------- Fix for #3523021 Modified Paths: -------------- openhpi/trunk/openhpi.conf.example openhpi/trunk/openhpid/conf.c Modified: openhpi/trunk/openhpi.conf.example =================================================================== --- openhpi/trunk/openhpi.conf.example 2012-05-02 12:18:02 UTC (rev 7426) +++ openhpi/trunk/openhpi.conf.example 2012-05-02 13:41:05 UTC (rev 7427) @@ -18,6 +18,12 @@ #OPENHPI_DAT_SAVE = "NO" #OPENHPI_PATH = "/usr/local/lib/openhpi:/usr/lib/openhpi" #OPENHPI_VARPATH = "/usr/local/var/lib/openhpi" + +## Auto insertion timeout +## Use "BLOCK" or "IMMEDIATE" or positive integer value +## Negative integer value shall be quoted due to Glib scanner limitation +## For example "-1". +## All negative values will be interpreted as "BLOCK" #OPENHPI_AUTOINSERT_TIMEOUT = 0 #OPENHPI_AUTOINSERT_TIMEOUT_READONLY = "YES" Modified: openhpi/trunk/openhpid/conf.c =================================================================== --- openhpi/trunk/openhpid/conf.c 2012-05-02 12:18:02 UTC (rev 7426) +++ openhpi/trunk/openhpid/conf.c 2012-05-02 13:41:05 UTC (rev 7427) @@ -19,6 +19,7 @@ * Bryan Sutula <su...@us...> */ +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -163,6 +164,7 @@ TRUE /* char_2_token */, TRUE /* symbol_2_token */, FALSE /* scope_0_fallback */, + TRUE /* store_int64 */, }; static void process_global_param(const char *name, char *value) @@ -209,7 +211,16 @@ global_params.unconfigured = SAHPI_FALSE; } } else if (!strcmp("OPENHPI_AUTOINSERT_TIMEOUT", name)) { - global_params.ai_timeout = strtoll(value, 0, 10); + if (!strcmp(value, "BLOCK")) { + global_params.ai_timeout = SAHPI_TIMEOUT_BLOCK; + } else if (!strcmp(value, "IMMEDIATE")) { + global_params.ai_timeout = SAHPI_TIMEOUT_IMMEDIATE; + } else { + global_params.ai_timeout = strtoll(value, 0, 10); + if (global_params.ai_timeout < 0) { + global_params.ai_timeout = SAHPI_TIMEOUT_BLOCK; + } + } } else if (!strcmp("OPENHPI_AUTOINSERT_TIMEOUT_READONLY", name)) { if (!strcmp("YES", value)) { global_params.ai_timeout_readonly = SAHPI_TRUE; @@ -316,10 +327,18 @@ int current_token = g_scanner_get_next_token(oh_scanner); if (current_token == G_TOKEN_INT) { + // TODO seems everyone now relies that + // value shall be string. + // So this code may break a plug-in expectations. + // Investigate gulong *value_int = g_new0(gulong, 1); - *value_int = oh_scanner->value.v_int; + *value_int = (gulong)oh_scanner->value.v_int64; value = (gpointer)value_int; } else if (current_token == G_TOKEN_FLOAT) { + // TODO seems everyone now relies that + // value shall be string. + // So this code may break a plug-in expectations. + // Investigate gdouble *value_float = g_new0(gdouble, 1); *value_float = oh_scanner->value.v_float; value = (gpointer)value_float; @@ -408,15 +427,9 @@ } if (current_token == G_TOKEN_INT) { - guint num_chars = 0, result; - result = scanner->value.v_int; - while (result) { - result = result / 10; - num_chars++; - } - value = (char *)g_malloc0(++num_chars); - result = scanner->value.v_int; - snprintf(value, num_chars, "%u", result); + const guint max_digits = 32; // More than enough for uint64. + value = (char *)g_malloc0(max_digits); + snprintf(value, max_digits, "%" PRIu64, scanner->value.v_int64); } else { value = g_strdup(scanner->value.v_string); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2012-05-03 15:27:20
|
Revision: 7428 http://openhpi.svn.sourceforge.net/openhpi/?rev=7428&view=rev Author: avpak Date: 2012-05-03 15:27:12 +0000 (Thu, 03 May 2012) Log Message: ----------- Feature request #3523023 Modified Paths: -------------- openhpi/trunk/Makefile.mingw32 openhpi/trunk/hpi_shell/cmdparser.c openhpi/trunk/hpi_shell/commands.c openhpi/trunk/hpi_shell/ctrl_inv.c openhpi/trunk/hpi_shell/dimi.c openhpi/trunk/hpi_shell/fumi.c openhpi/trunk/hpi_shell/hpi_cmd.c openhpi/trunk/hpi_shell/hpi_cmd.h openhpi/trunk/hpi_shell/inputcmd.c openhpi/trunk/hpi_shell/sensor.c openhpi/trunk/hpi_shell/service.c openhpi/trunk/hpi_shell/session.c openhpi/trunk/hpi_shell/show.c Added Paths: ----------- openhpi/trunk/hpi_shell/Makefile.mingw32 Modified: openhpi/trunk/Makefile.mingw32 =================================================================== --- openhpi/trunk/Makefile.mingw32 2012-05-02 13:41:05 UTC (rev 7427) +++ openhpi/trunk/Makefile.mingw32 2012-05-03 15:27:12 UTC (rev 7428) @@ -15,6 +15,7 @@ baselib \ clients \ clients/hpixml \ + hpi_shell \ openhpid \ plugins/slave \ plugins/test_agent @@ -58,6 +59,7 @@ mkdir -p ${progs} cp clients/*.exe ${progs} cp clients/hpixml/hpixml.exe ${progs} + cp hpi_shell/hpi_shell.exe ${progs} cp openhpid/openhpid.exe ${progs} mkdir -p ${plugins} cp plugins/slave/libslave.dll ${plugins} Added: openhpi/trunk/hpi_shell/Makefile.mingw32 =================================================================== --- openhpi/trunk/hpi_shell/Makefile.mingw32 (rev 0) +++ openhpi/trunk/hpi_shell/Makefile.mingw32 2012-05-03 15:27:12 UTC (rev 7428) @@ -0,0 +1,48 @@ + +# $(top_srcdir)/clients/clients.c + +include ../Makefile.mingw32.def + +TARGET := hpi_shell.exe + +SRC := ../clients/clients.c \ + cmdparser.c \ + commands.c \ + ctrl_inv.c \ + dimi.c \ + fumi.c \ + hpi_cmd.c \ + inputcmd.c \ + sensor.c \ + service.c \ + session.c \ + show.c \ + version.rc + +OBJ := $(patsubst %.rc, %.o, $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, ${SRC}))) + +DEFS := -DG_LOG_DOMAIN=\"hpi_shell\" +DEFS += -DSAHPI_API="__declspec(dllimport)" + +INCLUDES := ${GLIB_INCLUDES} -I ../mingw32 -I ../include -I ../utils -I ../clients + +LIBS := ${GLIB_LIBS} ${GTHREAD_LIBS} +LIBS += -L ../baselib -lopenhpi +LIBS += -L ../utils -lopenhpiutils + +CPPFLAGS += ${DEFS} ${INCLUDES} + +.PHONY: all clean +.SUFFIXES: .rc + +all : ${TARGET} + +${TARGET} : ${OBJ} + ${CXX} -o $@ $^ ${LIBS} + +.rc.o: + ${RC} ${RCFLAGS} $< $@ + +clean: + rm -f ${OBJ} ${TARGET} + Modified: openhpi/trunk/hpi_shell/cmdparser.c =================================================================== --- openhpi/trunk/hpi_shell/cmdparser.c 2012-05-02 13:41:05 UTC (rev 7427) +++ openhpi/trunk/hpi_shell/cmdparser.c 2012-05-03 15:27:12 UTC (rev 7428) @@ -21,13 +21,22 @@ #include <stdlib.h> #include <string.h> #include <ctype.h> + +#ifdef _WIN32 +#include <io.h> +#include <windows.h> +#else +#include <sys/ioctl.h> #include <unistd.h> -#include <sys/ioctl.h> +#endif + #if defined(__sun) && defined(__SVR4) #include <termios.h> #endif + #include "hpi_cmd.h" + #define MAX_IN_FILES 10 #define MAX_REDIRECTIONS 10 @@ -74,9 +83,17 @@ printf("Can not open/create file: %s\n", name); return(-1); }; +#ifdef _WIN32 + output_files[out_files_count] = _dup(1); +#else output_files[out_files_count] = dup(STDOUT_FILENO); +#endif fflush(stdout); +#ifdef _WIN32 + _dup2(_fileno(out), 1); +#else dup2(fileno(out), STDOUT_FILENO); +#endif fclose(out); out_files_count++; return(0); @@ -87,8 +104,13 @@ if (out_files_count == 0) return; out_files_count--; fflush(stdout); +#ifdef _WIN32 + _dup2(output_files[out_files_count], 1); + _close(output_files[out_files_count]); +#else dup2(output_files[out_files_count], STDOUT_FILENO); close(output_files[out_files_count]); +#endif } static int delete_input_file(void) @@ -630,9 +652,30 @@ return(0); } +static void get_term_size( int * rows, int * cols ) +{ + *rows = 24; + *cols = 80; + +#ifdef _WIN32 + COORD ws = GetLargestConsoleWindowSize(GetStdHandle(STD_OUTPUT_HANDLE)); + if ((ws.Y != 0) && (ws.X != 0)) { + *rows = ws.Y; + *cols = ws.X; + } +#else + struct winsize ws; + int cc = ioctl(termfd, TIOCGWINSZ, &ws); + + if ((cc == 0) && (ws.ws_row != 0) && (ws.ws_col != 0)) { + *rows = ws.ws_row; + *cols = ws.ws_col; + } +#endif +} + Pr_ret_t ui_print(char *Str) { - struct winsize win; int i, len, c, add_nl = 1; char *tmp, *s; char buf[LINE_BUF_SIZE]; @@ -640,14 +683,7 @@ // const char yellow[] = "\033[0;40;33m"; const char reset[] = "\033[0m"; - i = ioctl(termfd, TIOCGWINSZ, &win); - if ((i != 0) || (win.ws_row == 0) || (win.ws_col == 0)) { - window_nrows = 24; - window_ncols = 80; - } else { - window_nrows = win.ws_row; - window_ncols = win.ws_col; - }; + get_term_size(&window_nrows, &window_ncols); strncpy(buf, Str, LINE_BUF_SIZE); s = tmp = buf; for (i = 0, len = 0; *tmp != 0; i++, tmp++) { Modified: openhpi/trunk/hpi_shell/commands.c =================================================================== --- openhpi/trunk/hpi_shell/commands.c 2012-05-02 13:41:05 UTC (rev 7427) +++ openhpi/trunk/hpi_shell/commands.c 2012-05-03 15:27:12 UTC (rev 7428) @@ -25,10 +25,11 @@ #include <string.h> #include <time.h> #include <ctype.h> -#include <unistd.h> +#include <glib.h> #include <config.h> #include <oHpi.h> -#include <hpi_ui.h> + +#include "hpi_ui.h" #include "hpi_cmd.h" #define SEV_BUF_SIZE 32 @@ -66,7 +67,7 @@ (cmd->type != block_type) && (cmd->type != UNDEF_COM)) continue; - printf("%-20s", cmd->cmd); + printf("%-19s", cmd->cmd); if ((++width % 4) == 0) printf("\n"); } @@ -172,6 +173,16 @@ return HPI_SHELL_OK; } +#ifdef _WIN32 +static int setenv(const char * var, const char * val, int dummy) +{ + static const size_t BUFSIZE = 1024; + char buf[BUFSIZE]; + snprintf(buf, BUFSIZE, "%s=%s", var, val); + return _putenv(buf); +} +#endif + static ret_code_t debugset(void) { char *val; @@ -1222,7 +1233,7 @@ }; do { rv = saHpiSessionClose(Domain->sessionId); - sleep( 1 ); + g_usleep(G_USEC_PER_SEC); } while ( ( fflag == 0 ) && ( rv != SA_OK ) && ( rv != SA_ERR_HPI_NO_RESPONSE ) && Modified: openhpi/trunk/hpi_shell/ctrl_inv.c =================================================================== --- openhpi/trunk/hpi_shell/ctrl_inv.c 2012-05-02 13:41:05 UTC (rev 7427) +++ openhpi/trunk/hpi_shell/ctrl_inv.c 2012-05-03 15:27:12 UTC (rev 7428) @@ -20,7 +20,8 @@ #include <string.h> #include <time.h> #include <ctype.h> -#include <hpi_ui.h> + +#include "hpi_ui.h" #include "hpi_cmd.h" typedef struct { Modified: openhpi/trunk/hpi_shell/dimi.c =================================================================== --- openhpi/trunk/hpi_shell/dimi.c 2012-05-02 13:41:05 UTC (rev 7427) +++ openhpi/trunk/hpi_shell/dimi.c 2012-05-03 15:27:12 UTC (rev 7428) @@ -15,10 +15,13 @@ * */ +#include <inttypes.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <hpi_ui.h> + +#include "hpi_ui.h" #include "hpi_cmd.h" typedef struct { @@ -107,7 +110,7 @@ printf( "\n" ); } - printf( " Expected Run Duration: %lld nsec\n", test.ExpectedRunDuration ); + printf( " Expected Run Duration: %" PRId64 " nsec\n", (int64_t)test.ExpectedRunDuration ); oh_decode_dimitestcapabilities( test.TestCapabilities, &tmpbuf ); printf( " Test capabilities: %s\n", tmpbuf.Data ); @@ -372,7 +375,7 @@ oh_decode_time( results.ResultTimeStamp, &tb ); print_text_buffer_text(" Result timestamp: ", &tb, "\n", ui_print); - printf( " Run duration: %lld nsec\n", results.RunDuration ); + printf( " Run duration: %" PRId64 " nsec\n", (int64_t)results.RunDuration ); printf( " Last run status: %s\n", oh_lookup_dimitestrunstatus( results.LastRunStatus ) ); printf( " Test error code: " ); Modified: openhpi/trunk/hpi_shell/fumi.c =================================================================== --- openhpi/trunk/hpi_shell/fumi.c 2012-05-02 13:41:05 UTC (rev 7427) +++ openhpi/trunk/hpi_shell/fumi.c 2012-05-03 15:27:12 UTC (rev 7428) @@ -18,7 +18,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <hpi_ui.h> + +#include "hpi_ui.h" #include "hpi_cmd.h" typedef struct { Modified: openhpi/trunk/hpi_shell/hpi_cmd.c =================================================================== --- openhpi/trunk/hpi_shell/hpi_cmd.c 2012-05-02 13:41:05 UTC (rev 7427) +++ openhpi/trunk/hpi_shell/hpi_cmd.c 2012-05-03 15:27:12 UTC (rev 7428) @@ -25,7 +25,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <getopt.h> #include "hpi_cmd.h" #include <oh_clients.h> Modified: openhpi/trunk/hpi_shell/hpi_cmd.h =================================================================== --- openhpi/trunk/hpi_shell/hpi_cmd.h 2012-05-02 13:41:05 UTC (rev 7427) +++ openhpi/trunk/hpi_shell/hpi_cmd.h 2012-05-03 15:27:12 UTC (rev 7428) @@ -18,9 +18,10 @@ #ifndef _INC_HPI_CMD_H #define _INC_HPI_CMD_H #include <SaHpi.h> -#include <hpi_ui.h> #include <glib.h> +#include "hpi_ui.h" + #define KUZ_DEBUG0 #define READ_BUF_SIZE 1024 Modified: openhpi/trunk/hpi_shell/inputcmd.c =================================================================== --- openhpi/trunk/hpi_shell/inputcmd.c 2012-05-02 13:41:05 UTC (rev 7427) +++ openhpi/trunk/hpi_shell/inputcmd.c 2012-05-03 15:27:12 UTC (rev 7428) @@ -20,8 +20,14 @@ #include <string.h> #include <time.h> #include <ctype.h> + +#ifdef _WIN32 +// TODO +#else +#include <fcntl.h> #include <termios.h> -#include <fcntl.h> +#endif + #include "hpi_cmd.h" #define CTRL_A_KEY 0x01 @@ -67,7 +73,13 @@ static char clear_buf[READ_BUF_SIZE]; static int no_stty = 1; + +#ifdef _WIN32 +// TODO +#else static struct termios saved_termio; +#endif + static int is_insert_key = 0; static char **History; static int hist_ind = 0; @@ -364,6 +376,9 @@ static int set_term_flags(void) { +#ifdef _WIN32 + // TODO +#else int res, c; char name[1024]; struct termios termio; @@ -388,14 +403,19 @@ termio.c_cc[VTIME] = 0; res = tcsetattr(termfd, TCSANOW, &termio); no_stty = 0; +#endif return(0); } void restore_term_flags(void) { +#ifdef _WIN32 + // TODO +#else if (no_stty) return; tcsetattr(termfd, TCSANOW, &saved_termio); no_stty = 1; +#endif } char *get_command_line(int new_cmd, int comp_type) Modified: openhpi/trunk/hpi_shell/sensor.c =================================================================== --- openhpi/trunk/hpi_shell/sensor.c 2012-05-02 13:41:05 UTC (rev 7427) +++ openhpi/trunk/hpi_shell/sensor.c 2012-05-03 15:27:12 UTC (rev 7428) @@ -15,12 +15,15 @@ * */ +#include <inttypes.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <ctype.h> -#include <hpi_ui.h> + +#include "hpi_ui.h" #include "hpi_cmd.h" typedef struct { @@ -90,10 +93,10 @@ return(""); switch (item->Type) { case SAHPI_SENSOR_READING_TYPE_INT64: - snprintf(buf, len, "%lld", item->Value.SensorInt64); + snprintf(buf, len, "%" PRId64, (int64_t)item->Value.SensorInt64); break; case SAHPI_SENSOR_READING_TYPE_UINT64: - snprintf(buf, len, "%llu", item->Value.SensorUint64); + snprintf(buf, len, "%" PRIu64, (uint64_t)item->Value.SensorUint64); break; case SAHPI_SENSOR_READING_TYPE_FLOAT64: snprintf(buf, len, "%10.3f", item->Value.SensorFloat64); @@ -539,7 +542,7 @@ return(HPI_SHELL_CMD_ERROR); }; if ( timeout != SAHPI_TIMEOUT_BLOCK ) { - printf("Auto-insert timeout: %lld nsec\n", timeout); + printf("Auto-insert timeout: %" PRId64 " nsec\n", (int64_t)timeout); } else { printf("Auto-insert timeout: BLOCK\n"); } @@ -553,7 +556,7 @@ return(HPI_SHELL_CMD_ERROR); }; if ( timeout != SAHPI_TIMEOUT_BLOCK ) { - printf("Auto-extract timeout: %lld nsec\n", timeout); + printf("Auto-extract timeout: %" PRId64 " nsec\n", (int64_t)timeout); } else { printf("Auto-extract timeout: BLOCK\n"); } Modified: openhpi/trunk/hpi_shell/service.c =================================================================== --- openhpi/trunk/hpi_shell/service.c 2012-05-02 13:41:05 UTC (rev 7427) +++ openhpi/trunk/hpi_shell/service.c 2012-05-03 15:27:12 UTC (rev 7428) @@ -13,12 +13,15 @@ * Kouzmich < Mik...@in... > * */ +#include <inttypes.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> -#include <hpi_ui.h> +#include "hpi_ui.h" + // function numbers for lookup_proc #define LANG_PROC 1 @@ -357,10 +360,10 @@ return(-1); switch (item->Type) { case SAHPI_SENSOR_READING_TYPE_INT64: - snprintf(buf, size, "%lld", item->Value.SensorInt64); + snprintf(buf, size, "%" PRId64, (int64_t)item->Value.SensorInt64); break; case SAHPI_SENSOR_READING_TYPE_UINT64: - snprintf(buf, size, "%llu", item->Value.SensorUint64); + snprintf(buf, size, "%" PRIu64, (uint64_t)item->Value.SensorUint64); break; case SAHPI_SENSOR_READING_TYPE_FLOAT64: snprintf(buf, size, "%10.3f", item->Value.SensorFloat64); Modified: openhpi/trunk/hpi_shell/session.c =================================================================== --- openhpi/trunk/hpi_shell/session.c 2012-05-02 13:41:05 UTC (rev 7427) +++ openhpi/trunk/hpi_shell/session.c 2012-05-03 15:27:12 UTC (rev 7428) @@ -21,15 +21,14 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <unistd.h> -#include <signal.h> -#include <pthread.h> +#include <glib.h> #include <SaHpi.h> #include <oh_utils.h> + #include "hpi_cmd.h" -static pthread_t ge_thread; -static pthread_t prog_thread; +static GThread *ge_thread; +static GThread *prog_thread; int prt_flag = 0; int show_event_short = 0; static int in_progress = 0; @@ -77,7 +76,7 @@ { progress_mes = mes; in_progress = 1; - pthread_create(&prog_thread, NULL, progress_bar, NULL); + prog_thread = g_thread_create(progress_bar, 0, FALSE, 0); } /* This function deletes thread for progress bar. */ @@ -170,7 +169,10 @@ } } }/*the loop for retrieving event*/ - sleep(1); + if (rv == SA_ERR_HPI_INVALID_SESSION) { + break; + } + g_usleep(G_USEC_PER_SEC); } return (void *)1; } @@ -276,7 +278,7 @@ if (eflag) { show_event_short = 1; prt_flag = 1; - pthread_create(&ge_thread, NULL, get_event, NULL); + ge_thread = g_thread_create(get_event, 0, FALSE, 0); }; // add main domain to the domain list if (add_domain(par_domain) != SA_OK) return(-1); @@ -285,7 +287,7 @@ printf("\tEnter a command or \"help\" for list of commands\n"); if (! eflag) - pthread_create(&ge_thread, NULL, get_event, NULL); + ge_thread = g_thread_create(get_event, 0, FALSE, 0); return 0; } @@ -293,13 +295,12 @@ { SaErrorT rv; - /* Bug 2171901, replace pthread_kill(ge_thread, SIGKILL); */ - pthread_cancel(ge_thread); - rv = saHpiSessionClose(Domain->sessionId); if (rv != SA_OK) { printf("saHpiSessionClose error %s\n", oh_lookup_error(rv)); return -1; } + // Wait a bit for get_event thread completion + g_usleep(G_USEC_PER_SEC / 4); return 0; } Modified: openhpi/trunk/hpi_shell/show.c =================================================================== --- openhpi/trunk/hpi_shell/show.c 2012-05-02 13:41:05 UTC (rev 7427) +++ openhpi/trunk/hpi_shell/show.c 2012-05-03 15:27:12 UTC (rev 7428) @@ -14,11 +14,14 @@ * * */ +#include <inttypes.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <hpi_ui.h> +#include "hpi_ui.h" + #define SHOW_BUF_SZ 1024 #define HPIBOOL2STR( x ) ( ( x == SAHPI_TRUE ) ? "TRUE" : "FALSE" ) @@ -89,12 +92,12 @@ }; switch (item->Type) { case SAHPI_SENSOR_READING_TYPE_INT64: - snprintf(buf, SHOW_BUF_SZ, "%s %lld\n", mes, - item->Value.SensorInt64); + snprintf(buf, SHOW_BUF_SZ, "%s %" PRId64 "\n", mes, + (int64_t)item->Value.SensorInt64); break; case SAHPI_SENSOR_READING_TYPE_UINT64: - snprintf(buf, SHOW_BUF_SZ, "%s %llu\n", mes, - item->Value.SensorUint64); + snprintf(buf, SHOW_BUF_SZ, "%s %" PRIu64 "\n", mes, + (uint64_t)item->Value.SensorUint64); break; case SAHPI_SENSOR_READING_TYPE_FLOAT64: snprintf(buf, SHOW_BUF_SZ, "%s %10.3f\n", mes, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2012-05-25 12:35:16
|
Revision: 7437 http://openhpi.svn.sourceforge.net/openhpi/?rev=7437&view=rev Author: avpak Date: 2012-05-25 12:35:10 +0000 (Fri, 25 May 2012) Log Message: ----------- Fix for #3529744 Modified Paths: -------------- openhpi/trunk/baselib/ohpi.cpp openhpi/trunk/marshal/marshal_hpi_types.h Modified: openhpi/trunk/baselib/ohpi.cpp =================================================================== --- openhpi/trunk/baselib/ohpi.cpp 2012-05-24 13:41:24 UTC (rev 7436) +++ openhpi/trunk/baselib/ohpi.cpp 2012-05-25 12:35:10 UTC (rev 7437) @@ -29,6 +29,7 @@ #include <config.h> #include <marshal_hpi.h> #include <oh_rpc_params.h> +#include <oh_utils.h> #include "conf.h" #include "init.h" Modified: openhpi/trunk/marshal/marshal_hpi_types.h =================================================================== --- openhpi/trunk/marshal/marshal_hpi_types.h 2012-05-24 13:41:24 UTC (rev 7436) +++ openhpi/trunk/marshal/marshal_hpi_types.h 2012-05-25 12:35:10 UTC (rev 7437) @@ -23,10 +23,7 @@ #include <SaHpi.h> -#include <oHpi.h> -#include <oh_utils.h> - #ifndef dMarshal_h #include "marshal.h" #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2012-05-25 14:35:19
|
Revision: 7438 http://openhpi.svn.sourceforge.net/openhpi/?rev=7438&view=rev Author: avpak Date: 2012-05-25 14:35:09 +0000 (Fri, 25 May 2012) Log Message: ----------- Fix for #3529766 Modified Paths: -------------- openhpi/trunk/acinclude.m4 openhpi/trunk/clients/hpiwdt.c openhpi/trunk/openhpid/domain.c openhpi/trunk/openhpid/ohpi.c openhpi/trunk/openhpid/safhpi.c openhpi/trunk/plugins/dynamic_simulator/new_sim_file_annunciator.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_control.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_dimi.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_fumi.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_inventory.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_sensor.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_file_watchdog.cpp openhpi/trunk/plugins/dynamic_simulator/new_sim_watchdog.cpp openhpi/trunk/plugins/snmp_bc/snmp_bc_discover.c openhpi/trunk/plugins/snmp_bc/snmp_bc_discover_bc.c openhpi/trunk/plugins/snmp_bc/snmp_bc_event.c openhpi/trunk/plugins/snmp_bc/snmp_bc_sel.c openhpi/trunk/plugins/snmp_bc/snmp_bc_sensor.c openhpi/trunk/utils/epath_utils.c Modified: openhpi/trunk/acinclude.m4 =================================================================== --- openhpi/trunk/acinclude.m4 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/acinclude.m4 2012-05-25 14:35:09 UTC (rev 7438) @@ -56,15 +56,15 @@ echo "int main() {" >> $OH_SSSOURCE # add more here if you need them # the lots of slashes are needed to do the processing below right - echo "printf(\"unsigned char %d\\\\n\",sizeof(unsigned char));" >> $OH_SSSOURCE - echo "printf(\"unsigned short %d\\\\n\",sizeof(unsigned short));" >> $OH_SSSOURCE - echo "printf(\"unsigned int %d\\\\n\",sizeof(unsigned int));" >> $OH_SSSOURCE - echo "printf(\"char %d\\\\n\",sizeof(char));" >> $OH_SSSOURCE - echo "printf(\"short %d\\\\n\",sizeof(short));" >> $OH_SSSOURCE - echo "printf(\"int %d\\\\n\",sizeof(int));" >> $OH_SSSOURCE - echo "printf(\"long long %d\\\\n\",sizeof(long long));" >> $OH_SSSOURCE - echo "printf(\"float %d\\\\n\",sizeof(float));" >> $OH_SSSOURCE - echo "printf(\"double %d\\\\n\",sizeof(double));" >> $OH_SSSOURCE + echo "printf(\"unsigned char %u\\\\n\",(unsigned int)sizeof(unsigned char));" >> $OH_SSSOURCE + echo "printf(\"unsigned short %u\\\\n\",(unsigned int)sizeof(unsigned short));" >> $OH_SSSOURCE + echo "printf(\"unsigned int %u\\\\n\",(unsigned int)sizeof(unsigned int));" >> $OH_SSSOURCE + echo "printf(\"char %u\\\\n\",(unsigned int)sizeof(char));" >> $OH_SSSOURCE + echo "printf(\"short %u\\\\n\",(unsigned int)sizeof(short));" >> $OH_SSSOURCE + echo "printf(\"int %u\\\\n\",(unsigned int)sizeof(int));" >> $OH_SSSOURCE + echo "printf(\"long long %u\\\\n\",(unsigned int)sizeof(long long));" >> $OH_SSSOURCE + echo "printf(\"float %u\\\\n\",(unsigned int)sizeof(float));" >> $OH_SSSOURCE + echo "printf(\"double %u\\\\n\",(unsigned int)sizeof(double));" >> $OH_SSSOURCE echo "return 0;" >> $OH_SSSOURCE echo "}" >> $OH_SSSOURCE Modified: openhpi/trunk/clients/hpiwdt.c =================================================================== --- openhpi/trunk/clients/hpiwdt.c 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/clients/hpiwdt.c 2012-05-25 14:35:09 UTC (rev 7438) @@ -180,7 +180,7 @@ /* clear FRB2, timeout back to 120 sec */ /* TODO: add setting wdt values here */ wdt.TimerUse = SAHPI_WTU_NONE; /* 1=FRB2 2=POST 3=OSLoad 4=SMS_OS 5=OEM */ - wdt.TimerAction = SAHPI_WAE_NO_ACTION; /* 0=none 1=reset 2=powerdown 3=powercycle */ + wdt.TimerAction = SAHPI_WA_NO_ACTION; /* 0=none 1=reset 2=powerdown 3=powercycle */ wdt.PretimerInterrupt = SAHPI_WPI_NONE; /* 0=none 1=SMI 2=NMI 3=message */ wdt.PreTimeoutInterval = 60000; /*msec*/ wdt.InitialCount = 120000; /*msec*/ @@ -194,7 +194,7 @@ /* hard reset action, no pretimeout, clear SMS/OS when done */ /* use ftimeout for timeout */ wdt.TimerUse = SAHPI_WTU_SMS_OS; /* 1=FRB2 2=POST 3=OSLoad 4=SMS_OS 5=OEM */ - wdt.TimerAction = SAHPI_WAE_RESET; /* 0=none 1=reset 2=powerdown 3=powercycle */ + wdt.TimerAction = SAHPI_WA_RESET; /* 0=none 1=reset 2=powerdown 3=powercycle */ wdt.PretimerInterrupt = SAHPI_WPI_NMI; /* 0=none 1=SMI 2=NMI 3=message */ wdt.PreTimeoutInterval = (ftimeout / 2) * 1000; /*msec*/ wdt.InitialCount = ftimeout * 1000; /*msec*/ Modified: openhpi/trunk/openhpid/domain.c =================================================================== --- openhpi/trunk/openhpid/domain.c 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/openhpid/domain.c 2012-05-25 14:35:09 UTC (rev 7438) @@ -638,7 +638,7 @@ struct oh_domain *domain = NULL; GSList *node = NULL; - if (did < 0 || !nextentryid || !drtentry) { + if (!nextentryid || !drtentry) { CRIT("Error - Invalid parameters passed."); return SA_ERR_HPI_INVALID_PARAMS; } Modified: openhpi/trunk/openhpid/ohpi.c =================================================================== --- openhpi/trunk/openhpid/ohpi.c 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/openhpid/ohpi.c 2012-05-25 14:35:09 UTC (rev 7438) @@ -358,7 +358,8 @@ return SA_ERR_HPI_INTERNAL_ERROR; } - p.type = param->Type; + // TODO fix this ugly cast + p.type = (oh_global_param_type)param->Type; if (oh_get_global_param(&p)) { oh_release_domain(d); /* Unlock domain */ @@ -397,7 +398,8 @@ return SA_ERR_HPI_INTERNAL_ERROR; } - p.type = param->Type; + // TODO fix this ugly cast + p.type = (oh_global_param_type)param->Type; memcpy(&p.u, ¶m->u, sizeof(oh_global_param_union)); if (oh_set_global_param(&p)){ Modified: openhpi/trunk/openhpid/safhpi.c =================================================================== --- openhpi/trunk/openhpid/safhpi.c 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/openhpid/safhpi.c 2012-05-25 14:35:09 UTC (rev 7438) @@ -2157,7 +2157,7 @@ return SA_ERR_HPI_NOT_PRESENT; } sec = rdr_cur->RdrTypeUnion.SensorRec.EventCtrl; - if ((sec == SAHPI_SEC_READ_ONLY)) { + if (sec == SAHPI_SEC_READ_ONLY) { oh_release_domain(d); /* Unlock domain */ return SA_ERR_HPI_READ_ONLY; } Modified: openhpi/trunk/plugins/dynamic_simulator/new_sim_file_annunciator.cpp =================================================================== --- openhpi/trunk/plugins/dynamic_simulator/new_sim_file_annunciator.cpp 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/plugins/dynamic_simulator/new_sim_file_annunciator.cpp 2012-05-25 14:35:09 UTC (rev 7438) @@ -69,7 +69,7 @@ if (cur_token != G_TOKEN_LEFT_CURLY) { err("Processing parse configuration: Expected left curly token."); - return false; + return NULL; } m_depth++; Modified: openhpi/trunk/plugins/dynamic_simulator/new_sim_file_control.cpp =================================================================== --- openhpi/trunk/plugins/dynamic_simulator/new_sim_file_control.cpp 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/plugins/dynamic_simulator/new_sim_file_control.cpp 2012-05-25 14:35:09 UTC (rev 7438) @@ -78,7 +78,7 @@ if (cur_token != G_TOKEN_LEFT_CURLY) { err("Processing parse configuration: Expected left curly token."); - return false; + return NULL; } m_depth++; @@ -157,7 +157,7 @@ } else if (!strcmp(field, "TypeUnion.Text")) { if (cur_token != G_TOKEN_LEFT_CURLY) { err("Processing parse control rdr entry - Missing left curly at TypeUnion"); - return false; + return NULL; } else { success = process_type_text(); } @@ -165,7 +165,7 @@ } else if (!strcmp(field, "TypeUnion.Oem")) { if (cur_token != G_TOKEN_LEFT_CURLY) { err("Processing parse control rdr entry - Missing left curly at TypeUnion"); - return false; + return NULL; } else { success = process_type_oem(); } @@ -214,7 +214,7 @@ field = g_strdup(m_scanner->value.v_string); } else { err("Processing parse control GET token - don't find field string"); - return false; + return NULL; } cur_token = g_scanner_get_next_token(m_scanner); Modified: openhpi/trunk/plugins/dynamic_simulator/new_sim_file_dimi.cpp =================================================================== --- openhpi/trunk/plugins/dynamic_simulator/new_sim_file_dimi.cpp 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/plugins/dynamic_simulator/new_sim_file_dimi.cpp 2012-05-25 14:35:09 UTC (rev 7438) @@ -71,7 +71,7 @@ if (cur_token != G_TOKEN_LEFT_CURLY) { err("Processing parse configuration: Expected left curly token."); - return false; + return NULL; } m_depth++; Modified: openhpi/trunk/plugins/dynamic_simulator/new_sim_file_fumi.cpp =================================================================== --- openhpi/trunk/plugins/dynamic_simulator/new_sim_file_fumi.cpp 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/plugins/dynamic_simulator/new_sim_file_fumi.cpp 2012-05-25 14:35:09 UTC (rev 7438) @@ -70,7 +70,7 @@ if (cur_token != G_TOKEN_LEFT_CURLY) { err("Processing parse configuration: Expected left curly token."); - return false; + return NULL; } m_depth++; Modified: openhpi/trunk/plugins/dynamic_simulator/new_sim_file_inventory.cpp =================================================================== --- openhpi/trunk/plugins/dynamic_simulator/new_sim_file_inventory.cpp 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/plugins/dynamic_simulator/new_sim_file_inventory.cpp 2012-05-25 14:35:09 UTC (rev 7438) @@ -71,7 +71,7 @@ if (cur_token != G_TOKEN_LEFT_CURLY) { err("Processing parse configuration: Expected left curly token."); - return false; + return NULL; } m_depth++; Modified: openhpi/trunk/plugins/dynamic_simulator/new_sim_file_sensor.cpp =================================================================== --- openhpi/trunk/plugins/dynamic_simulator/new_sim_file_sensor.cpp 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/plugins/dynamic_simulator/new_sim_file_sensor.cpp 2012-05-25 14:35:09 UTC (rev 7438) @@ -77,7 +77,7 @@ if (cur_token != G_TOKEN_LEFT_CURLY) { err("Processing parse configuration: Expected left curly token."); - return false; + return NULL; } m_depth++; Modified: openhpi/trunk/plugins/dynamic_simulator/new_sim_file_watchdog.cpp =================================================================== --- openhpi/trunk/plugins/dynamic_simulator/new_sim_file_watchdog.cpp 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/plugins/dynamic_simulator/new_sim_file_watchdog.cpp 2012-05-25 14:35:09 UTC (rev 7438) @@ -69,7 +69,7 @@ if (cur_token != G_TOKEN_LEFT_CURLY) { err("Processing parse configuration: Expected left curly token."); - return false; + return NULL; } m_depth++; Modified: openhpi/trunk/plugins/dynamic_simulator/new_sim_watchdog.cpp =================================================================== --- openhpi/trunk/plugins/dynamic_simulator/new_sim_watchdog.cpp 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/plugins/dynamic_simulator/new_sim_watchdog.cpp 2012-05-25 14:35:09 UTC (rev 7438) @@ -331,7 +331,7 @@ cTime now( cTime::Now() ); now -= m_start; - if ( m_wdt_data.InitialCount - now.GetMsec() < 0 ) { + if ( m_wdt_data.InitialCount < now.GetMsec() ) { watchdog.PresentCount = 0; } else { watchdog.PresentCount = m_wdt_data.InitialCount - now.GetMsec(); Modified: openhpi/trunk/plugins/snmp_bc/snmp_bc_discover.c =================================================================== --- openhpi/trunk/plugins/snmp_bc/snmp_bc_discover.c 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/plugins/snmp_bc/snmp_bc_discover.c 2012-05-25 14:35:09 UTC (rev 7438) @@ -390,7 +390,7 @@ SaErrorT err; SaHpiTextBufferT working; - if (!buffer || loc < 0 || + if (!buffer || loc > (pow(10, OH_MAX_LOCATION_DIGITS) - 1)) { return(SA_ERR_HPI_INVALID_PARAMS); } Modified: openhpi/trunk/plugins/snmp_bc/snmp_bc_discover_bc.c =================================================================== --- openhpi/trunk/plugins/snmp_bc/snmp_bc_discover_bc.c 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/plugins/snmp_bc/snmp_bc_discover_bc.c 2012-05-25 14:35:09 UTC (rev 7438) @@ -1167,7 +1167,7 @@ /* ---------------------------------------- */ /* Find resource's rdrs: sensors, controls, etc. */ snmp_bc_discover_sensors(handle, snmp_bc_chassis_sensors, e); - if ( (custom_handle->platform == SNMP_BC_PLATFORM_BCT) ) { + if ( custom_handle->platform == SNMP_BC_PLATFORM_BCT ) { snmp_bc_discover_sensors(handle, snmp_bc_chassis_sensors_bct_filter, e); } if ( (custom_handle->platform == SNMP_BC_PLATFORM_BCT) || @@ -3646,7 +3646,7 @@ /* because virtual resource has loc 0 */ for (i=0; logsrc2res->ep.Entry[i].EntityType != SAHPI_ENT_SYSTEM_CHASSIS; i++) { - switch (logsrc2res->ep.Entry[i].EntityType) { + switch ((int)logsrc2res->ep.Entry[i].EntityType) { case SAHPI_ENT_SBC_BLADE: case SAHPI_ENT_FAN: case SAHPI_ENT_POWER_SUPPLY: @@ -3708,7 +3708,7 @@ err = snmp_bc_reset_resource_slot_state_sensor(handle, res); oh_remove_resource(handle->rptcache, res->ResourceId); - switch (hotswap_entitytype) { + switch ((int)hotswap_entitytype) { case SAHPI_ENT_SBC_BLADE: /* Fetch blade installed vector */ get_installed_mask(SNMP_BC_PB_INSTALLED, get_value); @@ -3794,7 +3794,7 @@ /* Fetch various resource installation maps from BladeCenter */ /* --------------------------------------------------------- */ - switch (hotswap_entitytype) { + switch ((int)hotswap_entitytype) { case SAHPI_ENT_SBC_BLADE: /* Fetch blade installed vector */ get_installed_mask(SNMP_BC_PB_INSTALLED, get_value); @@ -4089,7 +4089,7 @@ SAHPI_ENT_CHASSIS_SPECIFIC, entitylocation + SNMP_BC_HPI_LOCATION_BASE); - switch (entitytype) { + switch ((int)entitytype) { case SAHPI_ENT_PHYSICAL_SLOT: e->resource.ResourceEntity.Entry[0].EntityType = SAHPI_ENT_PHYSICAL_SLOT; comment = SNMP_BC_PHYSICAL_SLOT; Modified: openhpi/trunk/plugins/snmp_bc/snmp_bc_event.c =================================================================== --- openhpi/trunk/plugins/snmp_bc/snmp_bc_event.c 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/plugins/snmp_bc/snmp_bc_event.c 2012-05-25 14:35:09 UTC (rev 7438) @@ -1464,7 +1464,7 @@ } /* FIXME:: Need to rewrite this section when discover multiple BEMs/blade */ /* Also switches aren't currently supported with the Source field - can remove this logic */ - if ((isexpansioncard == SAHPI_TRUE)) { + if (isexpansioncard == SAHPI_TRUE) { err = oh_set_ep_location(&ep, entity_type, 1); } else { Modified: openhpi/trunk/plugins/snmp_bc/snmp_bc_sel.c =================================================================== --- openhpi/trunk/plugins/snmp_bc/snmp_bc_sel.c 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/plugins/snmp_bc/snmp_bc_sel.c 2012-05-25 14:35:09 UTC (rev 7438) @@ -572,8 +572,8 @@ goto out; } - if ((fetchentry->event.Event.Timestamp == - (SaHpiTimeT)mktime(&sel_entry.time) * 1000000000)) { + if (fetchentry->event.Event.Timestamp == + (SaHpiTimeT)mktime(&sel_entry.time) * 1000000000) { current--; cacheupdate = 1; break; Modified: openhpi/trunk/plugins/snmp_bc/snmp_bc_sensor.c =================================================================== --- openhpi/trunk/plugins/snmp_bc/snmp_bc_sensor.c 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/plugins/snmp_bc/snmp_bc_sensor.c 2012-05-25 14:35:09 UTC (rev 7438) @@ -1956,7 +1956,7 @@ oidIndex = SNMP_BC_NOT_VALID; thisOID = NULL; - switch (res->ResourceEntity.Entry[0].EntityType) + switch ((int)res->ResourceEntity.Entry[0].EntityType) { case BLADECENTER_PERIPHERAL_BAY_SLOT: oidIndex = 2; Modified: openhpi/trunk/utils/epath_utils.c =================================================================== --- openhpi/trunk/utils/epath_utils.c 2012-05-25 12:35:10 UTC (rev 7437) +++ openhpi/trunk/utils/epath_utils.c 2012-05-25 14:35:09 UTC (rev 7438) @@ -663,11 +663,6 @@ return(NULL); } - if (offset < 0) { - CRIT("Invalid location offset."); - return(NULL); - } - if (!(base == 10 || base == 16)) { CRIT("Invalid base."); return(NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2012-05-29 15:21:01
|
Revision: 7444 http://openhpi.svn.sourceforge.net/openhpi/?rev=7444&view=rev Author: avpak Date: 2012-05-29 15:20:51 +0000 (Tue, 29 May 2012) Log Message: ----------- Fix for #3530559 Modified Paths: -------------- openhpi/trunk/clients/hpionIBMblade.c openhpi/trunk/clients/ohhandler.c openhpi/trunk/clients/ohparam.c openhpi/trunk/include/oHpi.h openhpi/trunk/openhpid/ohpi.c Modified: openhpi/trunk/clients/hpionIBMblade.c =================================================================== --- openhpi/trunk/clients/hpionIBMblade.c 2012-05-29 14:02:14 UTC (rev 7443) +++ openhpi/trunk/clients/hpionIBMblade.c 2012-05-29 15:20:51 UTC (rev 7444) @@ -236,9 +236,9 @@ } /* If this resource belongs to the ipmi handler, then display it*/ - if (strcmp(handler_info.plugin_name, "libipmi") == 0) { + if (strcmp((const char*)handler_info.plugin_name, "libipmi") == 0) { return(1); - } else if(strcmp(handler_info.plugin_name, "libsnmp_bc") == 0) { + } else if(strcmp((const char*)handler_info.plugin_name, "libsnmp_bc") == 0) { for (i=0; i<SAHPI_MAX_ENTITY_PATH; i++) { if ((Rpt->Rpt.ResourceEntity.Entry[i].EntityType == SAHPI_ENT_PHYSICAL_SLOT) && (Rpt->Rpt.ResourceEntity.Entry[i].EntityLocation == blade_slot)) Modified: openhpi/trunk/clients/ohhandler.c =================================================================== --- openhpi/trunk/clients/ohhandler.c 2012-05-29 14:02:14 UTC (rev 7443) +++ openhpi/trunk/clients/ohhandler.c 2012-05-29 15:20:51 UTC (rev 7444) @@ -360,7 +360,7 @@ if (copt.domainid==SAHPI_UNSPECIFIED_DOMAIN_ID) printf("\n\nInfo for handler %u in default domain:\n\n",handlerid); else printf("\n\nInfo for handler %u in domain %u:\n\n",handlerid, copt.domainid); - printf("Plugin name: %s\n",handlerinfo.plugin_name); + printf("Plugin name: %s\n",(const char *)handlerinfo.plugin_name); printf("Root "); oh_print_ep (&(handlerinfo.entity_root),0); @@ -368,7 +368,7 @@ printf("Failed attempts to load handler: %u\n",handlerinfo.load_failed); printf("\nHandler configuration:\n"); - printf (" plugin %s\n", handlerinfo.plugin_name); + printf (" plugin %s\n", (const char *)handlerinfo.plugin_name); printf (" entity_root \"%s\"\n",(const char *) g_hash_table_lookup(handlerconfig, "entity_root")); g_hash_table_foreach(handlerconfig, print_pair, NULL); printf("\n\n"); @@ -495,7 +495,7 @@ } else { printf("Handler %u: %s, ", - nexthandlerid, handlerinfo.plugin_name); + nexthandlerid, (const char *)handlerinfo.plugin_name); oh_print_ep (&(handlerinfo.entity_root),0); } g_hash_table_destroy(config); Modified: openhpi/trunk/clients/ohparam.c =================================================================== --- openhpi/trunk/clients/ohparam.c 2012-05-29 14:02:14 UTC (rev 7443) +++ openhpi/trunk/clients/ohparam.c 2012-05-29 15:20:51 UTC (rev 7444) @@ -262,7 +262,7 @@ oh_lookup_error(rv)); return rv; } - printf("OPENHPI_PATH = %s\n",param.u.Path); + printf("OPENHPI_PATH = %s\n",(const char*)param.u.Path); param.Type =OHPI_VARPATH; rv = oHpiGlobalParamGet (sessionid, ¶m); @@ -271,7 +271,7 @@ oh_lookup_error(rv)); return rv; } - printf("OPENHPI_VARPATH = %s\n",param.u.VarPath); + printf("OPENHPI_VARPATH = %s\n",(const char*)param.u.VarPath); param.Type =OHPI_CONF; rv = oHpiGlobalParamGet (sessionid, ¶m); @@ -280,7 +280,7 @@ oh_lookup_error(rv)); return rv; } - printf("OPENHPI_CONF = %s\n",param.u.Conf); + printf("OPENHPI_CONF = %s\n",(const char*)param.u.Conf); return SA_OK; } @@ -300,9 +300,9 @@ param.Type = ptype; switch (ptype){ //strings - case OHPI_PATH: strcpy(param.u.Path, setparam);break; - case OHPI_VARPATH: strcpy(param.u.VarPath, setparam);break; - case OHPI_CONF: strcpy(param.u.Conf, setparam);break; + case OHPI_PATH: strcpy((char*)param.u.Path, setparam);break; + case OHPI_VARPATH: strcpy((char*)param.u.VarPath, setparam);break; + case OHPI_CONF: strcpy((char*)param.u.Conf, setparam);break; //severity case OHPI_LOG_ON_SEV: strncpy((char *)buffer.Data, setparam, SAHPI_MAX_TEXT_BUFFER_LENGTH); @@ -358,9 +358,9 @@ if (param.u.DatSave) printf("TRUE\n"); else printf("FALSE\n"); break; - case OHPI_PATH: printf("OHPENPI_PATH = %s\n",param.u.Path);break; - case OHPI_VARPATH: printf("OPENHPI_VARPATH = %s\n",param.u.VarPath);break; - case OHPI_CONF: printf("OPENHPI_CONF = %s\n",param.u.Conf);break; + case OHPI_PATH: printf("OHPENPI_PATH = %s\n",(const char*)param.u.Path);break; + case OHPI_VARPATH: printf("OPENHPI_VARPATH = %s\n",(const char*)param.u.VarPath);break; + case OHPI_CONF: printf("OPENHPI_CONF = %s\n",(const char*)param.u.Conf);break; default: return SA_ERR_HPI_UNSUPPORTED_PARAMS; } return SA_OK; Modified: openhpi/trunk/include/oHpi.h =================================================================== --- openhpi/trunk/include/oHpi.h 2012-05-29 14:02:14 UTC (rev 7443) +++ openhpi/trunk/include/oHpi.h 2012-05-29 15:20:51 UTC (rev 7444) @@ -47,9 +47,9 @@ typedef struct { oHpiHandlerIdT id; - char plugin_name[MAX_PLUGIN_NAME_LENGTH]; + SaHpiUint8T plugin_name[MAX_PLUGIN_NAME_LENGTH]; SaHpiEntityPathT entity_root; - int load_failed; + SaHpiInt32T load_failed; } oHpiHandlerInfoT; @@ -92,9 +92,9 @@ //unsigned char Debug; /* 1 = YES, 0 = NO */ //unsigned char DebugTrace; /* !0 = YES, 0 = NO */ //unsigned char DebugLock; /* !0 = YES, 0 = NO */ - char Path[OH_PATH_PARAM_MAX_LENGTH]; /* Dir path to openhpi plugins */ - char VarPath[OH_PATH_PARAM_MAX_LENGTH]; /* Dir path for openhpi data */ - char Conf[OH_PATH_PARAM_MAX_LENGTH]; /* File path of openhpi configuration */ + SaHpiUint8T Path[OH_PATH_PARAM_MAX_LENGTH]; /* Dir path to openhpi plugins */ + SaHpiUint8T VarPath[OH_PATH_PARAM_MAX_LENGTH]; /* Dir path for openhpi data */ + SaHpiUint8T Conf[OH_PATH_PARAM_MAX_LENGTH]; /* File path of openhpi configuration */ } oHpiGlobalParamUnionT; Modified: openhpi/trunk/openhpid/ohpi.c =================================================================== --- openhpi/trunk/openhpid/ohpi.c 2012-05-29 14:02:14 UTC (rev 7443) +++ openhpi/trunk/openhpid/ohpi.c 2012-05-29 15:20:51 UTC (rev 7444) @@ -191,7 +191,7 @@ } info->id = id; - strncpy(info->plugin_name, h->plugin_name, MAX_PLUGIN_NAME_LENGTH); + strncpy((char*)info->plugin_name, h->plugin_name, MAX_PLUGIN_NAME_LENGTH); oh_encode_entitypath((const char *)g_hash_table_lookup(h->config, "entity_root"), &info->entity_root); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2012-06-04 14:58:52
|
Revision: 7449 http://openhpi.svn.sourceforge.net/openhpi/?rev=7449&view=rev Author: avpak Date: 2012-06-04 14:58:42 +0000 (Mon, 04 Jun 2012) Log Message: ----------- Feature request #3531917 Modified Paths: -------------- openhpi/trunk/baselibs/csharp/openhpi_baselib/HpiDataTypesGen.cs openhpi/trunk/baselibs/csharp/openhpi_baselib/HpiUtilGen.cs openhpi/trunk/baselibs/java/openhpi_baselib/HpiDataTypesGen.java openhpi/trunk/baselibs/java/openhpi_baselib/HpiUtilGen.java openhpi/trunk/baselibs/python/openhpi_baselib/HpiDataTypesGen.py openhpi/trunk/baselibs/python/openhpi_baselib/HpiUtilGen.py openhpi/trunk/clients/hpixml/schema.xsd openhpi/trunk/include/SaHpi.h openhpi/trunk/utils/sahpi_enum_utils.c Modified: openhpi/trunk/baselibs/csharp/openhpi_baselib/HpiDataTypesGen.cs =================================================================== --- openhpi/trunk/baselibs/csharp/openhpi_baselib/HpiDataTypesGen.cs 2012-05-30 13:44:13 UTC (rev 7448) +++ openhpi/trunk/baselibs/csharp/openhpi_baselib/HpiDataTypesGen.cs 2012-06-04 14:58:42 UTC (rev 7449) @@ -427,11 +427,11 @@ public const long SAHPI_ENT_REMOTE = 38L; public const long SAHPI_ENT_EXTERNAL_ENVIRONMENT = 39L; public const long SAHPI_ENT_BATTERY = 40L; - public const long SAHPI_ENT_RESERVED_1 = 41L; - public const long SAHPI_ENT_RESERVED_2 = 42L; - public const long SAHPI_ENT_RESERVED_3 = 43L; - public const long SAHPI_ENT_RESERVED_4 = 44L; - public const long SAHPI_ENT_RESERVED_5 = 45L; + public const long SAHPI_ENT_PROCESSING_BLADE = 41L; + public const long SAHPI_ENT_CONNECTIVITY_SWITCH = 42L; + public const long SAHPI_ENT_PROCESSOR_MEMORY_MODULE = 43L; + public const long SAHPI_ENT_IO_MODULE = 44L; + public const long SAHPI_ENT_PROCESSOR_IO_MODULE = 45L; public const long SAHPI_ENT_MC_FIRMWARE = 46L; public const long SAHPI_ENT_IPMI_CHANNEL = 47L; public const long SAHPI_ENT_PCI_BUS = 48L; Modified: openhpi/trunk/baselibs/csharp/openhpi_baselib/HpiUtilGen.cs =================================================================== --- openhpi/trunk/baselibs/csharp/openhpi_baselib/HpiUtilGen.cs 2012-05-30 13:44:13 UTC (rev 7448) +++ openhpi/trunk/baselibs/csharp/openhpi_baselib/HpiUtilGen.cs 2012-06-04 14:58:42 UTC (rev 7449) @@ -2215,16 +2215,16 @@ return "EXTERNAL_ENVIRONMENT"; case HpiConst.SAHPI_ENT_BATTERY: return "BATTERY"; - case HpiConst.SAHPI_ENT_RESERVED_1: - return "RESERVED_1"; - case HpiConst.SAHPI_ENT_RESERVED_2: - return "RESERVED_2"; - case HpiConst.SAHPI_ENT_RESERVED_3: - return "RESERVED_3"; - case HpiConst.SAHPI_ENT_RESERVED_4: - return "RESERVED_4"; - case HpiConst.SAHPI_ENT_RESERVED_5: - return "RESERVED_5"; + case HpiConst.SAHPI_ENT_PROCESSING_BLADE: + return "PROCESSING_BLADE"; + case HpiConst.SAHPI_ENT_CONNECTIVITY_SWITCH: + return "CONNECTIVITY_SWITCH"; + case HpiConst.SAHPI_ENT_PROCESSOR_MEMORY_MODULE: + return "PROCESSOR_MEMORY_MODULE"; + case HpiConst.SAHPI_ENT_IO_MODULE: + return "IO_MODULE"; + case HpiConst.SAHPI_ENT_PROCESSOR_IO_MODULE: + return "PROCESSOR_IO_MODULE"; case HpiConst.SAHPI_ENT_MC_FIRMWARE: return "MC_FIRMWARE"; case HpiConst.SAHPI_ENT_IPMI_CHANNEL: @@ -2497,20 +2497,20 @@ if ( s == "BATTERY" ) { return HpiConst.SAHPI_ENT_BATTERY; } - if ( s == "RESERVED_1" ) { - return HpiConst.SAHPI_ENT_RESERVED_1; + if ( s == "PROCESSING_BLADE" ) { + return HpiConst.SAHPI_ENT_PROCESSING_BLADE; } - if ( s == "RESERVED_2" ) { - return HpiConst.SAHPI_ENT_RESERVED_2; + if ( s == "CONNECTIVITY_SWITCH" ) { + return HpiConst.SAHPI_ENT_CONNECTIVITY_SWITCH; } - if ( s == "RESERVED_3" ) { - return HpiConst.SAHPI_ENT_RESERVED_3; + if ( s == "PROCESSOR_MEMORY_MODULE" ) { + return HpiConst.SAHPI_ENT_PROCESSOR_MEMORY_MODULE; } - if ( s == "RESERVED_4" ) { - return HpiConst.SAHPI_ENT_RESERVED_4; + if ( s == "IO_MODULE" ) { + return HpiConst.SAHPI_ENT_IO_MODULE; } - if ( s == "RESERVED_5" ) { - return HpiConst.SAHPI_ENT_RESERVED_5; + if ( s == "PROCESSOR_IO_MODULE" ) { + return HpiConst.SAHPI_ENT_PROCESSOR_IO_MODULE; } if ( s == "MC_FIRMWARE" ) { return HpiConst.SAHPI_ENT_MC_FIRMWARE; Modified: openhpi/trunk/baselibs/java/openhpi_baselib/HpiDataTypesGen.java =================================================================== --- openhpi/trunk/baselibs/java/openhpi_baselib/HpiDataTypesGen.java 2012-05-30 13:44:13 UTC (rev 7448) +++ openhpi/trunk/baselibs/java/openhpi_baselib/HpiDataTypesGen.java 2012-06-04 14:58:42 UTC (rev 7449) @@ -431,11 +431,11 @@ public static final long SAHPI_ENT_REMOTE = 38L; public static final long SAHPI_ENT_EXTERNAL_ENVIRONMENT = 39L; public static final long SAHPI_ENT_BATTERY = 40L; - public static final long SAHPI_ENT_RESERVED_1 = 41L; - public static final long SAHPI_ENT_RESERVED_2 = 42L; - public static final long SAHPI_ENT_RESERVED_3 = 43L; - public static final long SAHPI_ENT_RESERVED_4 = 44L; - public static final long SAHPI_ENT_RESERVED_5 = 45L; + public static final long SAHPI_ENT_PROCESSING_BLADE = 41L; + public static final long SAHPI_ENT_CONNECTIVITY_SWITCH = 42L; + public static final long SAHPI_ENT_PROCESSOR_MEMORY_MODULE = 43L; + public static final long SAHPI_ENT_IO_MODULE = 44L; + public static final long SAHPI_ENT_PROCESSOR_IO_MODULE = 45L; public static final long SAHPI_ENT_MC_FIRMWARE = 46L; public static final long SAHPI_ENT_IPMI_CHANNEL = 47L; public static final long SAHPI_ENT_PCI_BUS = 48L; Modified: openhpi/trunk/baselibs/java/openhpi_baselib/HpiUtilGen.java =================================================================== --- openhpi/trunk/baselibs/java/openhpi_baselib/HpiUtilGen.java 2012-05-30 13:44:13 UTC (rev 7448) +++ openhpi/trunk/baselibs/java/openhpi_baselib/HpiUtilGen.java 2012-06-04 14:58:42 UTC (rev 7449) @@ -2401,20 +2401,20 @@ if ( x == SAHPI_ENT_BATTERY ) { return "BATTERY"; } - if ( x == SAHPI_ENT_RESERVED_1 ) { - return "RESERVED_1"; + if ( x == SAHPI_ENT_PROCESSING_BLADE ) { + return "PROCESSING_BLADE"; } - if ( x == SAHPI_ENT_RESERVED_2 ) { - return "RESERVED_2"; + if ( x == SAHPI_ENT_CONNECTIVITY_SWITCH ) { + return "CONNECTIVITY_SWITCH"; } - if ( x == SAHPI_ENT_RESERVED_3 ) { - return "RESERVED_3"; + if ( x == SAHPI_ENT_PROCESSOR_MEMORY_MODULE ) { + return "PROCESSOR_MEMORY_MODULE"; } - if ( x == SAHPI_ENT_RESERVED_4 ) { - return "RESERVED_4"; + if ( x == SAHPI_ENT_IO_MODULE ) { + return "IO_MODULE"; } - if ( x == SAHPI_ENT_RESERVED_5 ) { - return "RESERVED_5"; + if ( x == SAHPI_ENT_PROCESSOR_IO_MODULE ) { + return "PROCESSOR_IO_MODULE"; } if ( x == SAHPI_ENT_MC_FIRMWARE ) { return "MC_FIRMWARE"; @@ -2759,20 +2759,20 @@ if ( s.equals( "BATTERY" ) ) { return SAHPI_ENT_BATTERY; } - if ( s.equals( "RESERVED_1" ) ) { - return SAHPI_ENT_RESERVED_1; + if ( s.equals( "PROCESSING_BLADE" ) ) { + return SAHPI_ENT_PROCESSING_BLADE; } - if ( s.equals( "RESERVED_2" ) ) { - return SAHPI_ENT_RESERVED_2; + if ( s.equals( "CONNECTIVITY_SWITCH" ) ) { + return SAHPI_ENT_CONNECTIVITY_SWITCH; } - if ( s.equals( "RESERVED_3" ) ) { - return SAHPI_ENT_RESERVED_3; + if ( s.equals( "PROCESSOR_MEMORY_MODULE" ) ) { + return SAHPI_ENT_PROCESSOR_MEMORY_MODULE; } - if ( s.equals( "RESERVED_4" ) ) { - return SAHPI_ENT_RESERVED_4; + if ( s.equals( "IO_MODULE" ) ) { + return SAHPI_ENT_IO_MODULE; } - if ( s.equals( "RESERVED_5" ) ) { - return SAHPI_ENT_RESERVED_5; + if ( s.equals( "PROCESSOR_IO_MODULE" ) ) { + return SAHPI_ENT_PROCESSOR_IO_MODULE; } if ( s.equals( "MC_FIRMWARE" ) ) { return SAHPI_ENT_MC_FIRMWARE; Modified: openhpi/trunk/baselibs/python/openhpi_baselib/HpiDataTypesGen.py =================================================================== --- openhpi/trunk/baselibs/python/openhpi_baselib/HpiDataTypesGen.py 2012-05-30 13:44:13 UTC (rev 7448) +++ openhpi/trunk/baselibs/python/openhpi_baselib/HpiDataTypesGen.py 2012-06-04 14:58:42 UTC (rev 7449) @@ -422,11 +422,11 @@ SAHPI_ENT_REMOTE = 38L SAHPI_ENT_EXTERNAL_ENVIRONMENT = 39L SAHPI_ENT_BATTERY = 40L -SAHPI_ENT_RESERVED_1 = 41L -SAHPI_ENT_RESERVED_2 = 42L -SAHPI_ENT_RESERVED_3 = 43L -SAHPI_ENT_RESERVED_4 = 44L -SAHPI_ENT_RESERVED_5 = 45L +SAHPI_ENT_PROCESSING_BLADE = 41L +SAHPI_ENT_CONNECTIVITY_SWITCH = 42L +SAHPI_ENT_PROCESSOR_MEMORY_MODULE = 43L +SAHPI_ENT_IO_MODULE = 44L +SAHPI_ENT_PROCESSOR_IO_MODULE = 45L SAHPI_ENT_MC_FIRMWARE = 46L SAHPI_ENT_IPMI_CHANNEL = 47L SAHPI_ENT_PCI_BUS = 48L Modified: openhpi/trunk/baselibs/python/openhpi_baselib/HpiUtilGen.py =================================================================== --- openhpi/trunk/baselibs/python/openhpi_baselib/HpiUtilGen.py 2012-05-30 13:44:13 UTC (rev 7448) +++ openhpi/trunk/baselibs/python/openhpi_baselib/HpiUtilGen.py 2012-06-04 14:58:42 UTC (rev 7449) @@ -2591,16 +2591,16 @@ return "EXTERNAL_ENVIRONMENT" if x == SAHPI_ENT_BATTERY: return "BATTERY" - if x == SAHPI_ENT_RESERVED_1: - return "RESERVED_1" - if x == SAHPI_ENT_RESERVED_2: - return "RESERVED_2" - if x == SAHPI_ENT_RESERVED_3: - return "RESERVED_3" - if x == SAHPI_ENT_RESERVED_4: - return "RESERVED_4" - if x == SAHPI_ENT_RESERVED_5: - return "RESERVED_5" + if x == SAHPI_ENT_PROCESSING_BLADE: + return "PROCESSING_BLADE" + if x == SAHPI_ENT_CONNECTIVITY_SWITCH: + return "CONNECTIVITY_SWITCH" + if x == SAHPI_ENT_PROCESSOR_MEMORY_MODULE: + return "PROCESSOR_MEMORY_MODULE" + if x == SAHPI_ENT_IO_MODULE: + return "IO_MODULE" + if x == SAHPI_ENT_PROCESSOR_IO_MODULE: + return "PROCESSOR_IO_MODULE" if x == SAHPI_ENT_MC_FIRMWARE: return "MC_FIRMWARE" if x == SAHPI_ENT_IPMI_CHANNEL: @@ -2828,16 +2828,16 @@ return SAHPI_ENT_EXTERNAL_ENVIRONMENT if s == "BATTERY": return SAHPI_ENT_BATTERY - if s == "RESERVED_1": - return SAHPI_ENT_RESERVED_1 - if s == "RESERVED_2": - return SAHPI_ENT_RESERVED_2 - if s == "RESERVED_3": - return SAHPI_ENT_RESERVED_3 - if s == "RESERVED_4": - return SAHPI_ENT_RESERVED_4 - if s == "RESERVED_5": - return SAHPI_ENT_RESERVED_5 + if s == "PROCESSING_BLADE": + return SAHPI_ENT_PROCESSING_BLADE + if s == "CONNECTIVITY_SWITCH": + return SAHPI_ENT_CONNECTIVITY_SWITCH + if s == "PROCESSOR_MEMORY_MODULE": + return SAHPI_ENT_PROCESSOR_MEMORY_MODULE + if s == "IO_MODULE": + return SAHPI_ENT_IO_MODULE + if s == "PROCESSOR_IO_MODULE": + return SAHPI_ENT_PROCESSOR_IO_MODULE if s == "MC_FIRMWARE": return SAHPI_ENT_MC_FIRMWARE if s == "IPMI_CHANNEL": Modified: openhpi/trunk/clients/hpixml/schema.xsd =================================================================== --- openhpi/trunk/clients/hpixml/schema.xsd 2012-05-30 13:44:13 UTC (rev 7448) +++ openhpi/trunk/clients/hpixml/schema.xsd 2012-06-04 14:58:42 UTC (rev 7449) @@ -409,11 +409,11 @@ <xs:enumeration value="REMOTE"/> <xs:enumeration value="EXTERNAL_ENVIRONMENT"/> <xs:enumeration value="BATTERY"/> - <xs:enumeration value="RESERVED_1"/> - <xs:enumeration value="RESERVED_2"/> - <xs:enumeration value="RESERVED_3"/> - <xs:enumeration value="RESERVED_4"/> - <xs:enumeration value="RESERVED_5"/> + <xs:enumeration value="PROCESSING_BLADE"/> + <xs:enumeration value="CONNECTIVITY_SWITCH"/> + <xs:enumeration value="PROCESSOR_MEMORY_MODULE"/> + <xs:enumeration value="IO_MODULE"/> + <xs:enumeration value="PROCESSOR_IO_MODULE"/> <xs:enumeration value="MC_FIRMWARE"/> <xs:enumeration value="IPMI_CHANNEL"/> <xs:enumeration value="PCI_BUS"/> Modified: openhpi/trunk/include/SaHpi.h =================================================================== --- openhpi/trunk/include/SaHpi.h 2012-05-30 13:44:13 UTC (rev 7448) +++ openhpi/trunk/include/SaHpi.h 2012-06-04 14:58:42 UTC (rev 7449) @@ -612,6 +612,25 @@ SAHPI_ENT_RESERVED_3, SAHPI_ENT_RESERVED_4, SAHPI_ENT_RESERVED_5, + /** + * The following five symbols are not defined by the SAF HPI specification, + * but are included here to align with the IPMI 2.0 specification + **/ + /* Processing blade (a blade module that contain processor, memory, + and I/O connections that enable it to operate as a processing entity) */ + SAHPI_ENT_PROCESSING_BLADE = SAHPI_ENT_RESERVED_1, + /* Connectivity switch (a blade module that provides the fabric or network + connection for one or more processing blades or modules) */ + SAHPI_ENT_CONNECTIVITY_SWITCH = SAHPI_ENT_RESERVED_2, + /* Processor/memory module (processor and memory together on a module) */ + SAHPI_ENT_PROCESSOR_MEMORY_MODULE = SAHPI_ENT_RESERVED_3, + /* I/O module + (a module that contains the main elements of an I/O interface) */ + SAHPI_ENT_IO_MODULE = SAHPI_ENT_RESERVED_4, + /* Processor/ IO module (a module that contains the main elements of an I/O + interface combination processor and i/O module) */ + SAHPI_ENT_PROCESSOR_IO_MODULE = SAHPI_ENT_RESERVED_5, + SAHPI_ENT_MC_FIRMWARE , /* Management Controller Firmware, represents firmware or software running on a management controller */ Modified: openhpi/trunk/utils/sahpi_enum_utils.c =================================================================== --- openhpi/trunk/utils/sahpi_enum_utils.c 2012-05-30 13:44:13 UTC (rev 7448) +++ openhpi/trunk/utils/sahpi_enum_utils.c 2012-06-04 14:58:42 UTC (rev 7449) @@ -668,16 +668,16 @@ return "EXTERNAL_ENVIRONMENT"; case SAHPI_ENT_BATTERY: return "BATTERY"; - case SAHPI_ENT_RESERVED_1: - return "RESERVED_1"; - case SAHPI_ENT_RESERVED_2: - return "RESERVED_2"; - case SAHPI_ENT_RESERVED_3: - return "RESERVED_3"; - case SAHPI_ENT_RESERVED_4: - return "RESERVED_4"; - case SAHPI_ENT_RESERVED_5: - return "RESERVED_5"; + case SAHPI_ENT_PROCESSING_BLADE: + return "PROCESSING_BLADE"; + case SAHPI_ENT_CONNECTIVITY_SWITCH: + return "CONNECTIVITY_SWITCH"; + case SAHPI_ENT_PROCESSOR_MEMORY_MODULE: + return "PROCESSOR_MEMORY_MODULE"; + case SAHPI_ENT_IO_MODULE: + return "IO_MODULE"; + case SAHPI_ENT_PROCESSOR_IO_MODULE: + return "PROCESSOR_IO_MODULE"; case SAHPI_ENT_MC_FIRMWARE: return "MC_FIRMWARE"; case SAHPI_ENT_IPMI_CHANNEL: @@ -841,11 +841,11 @@ {SAHPI_ENT_REMOTE, "REMOTE"}, {SAHPI_ENT_EXTERNAL_ENVIRONMENT, "EXTERNAL_ENVIRONMENT"}, {SAHPI_ENT_BATTERY, "BATTERY"}, - {SAHPI_ENT_RESERVED_1, "RESERVED_1"}, - {SAHPI_ENT_RESERVED_2, "RESERVED_2"}, - {SAHPI_ENT_RESERVED_3, "RESERVED_3"}, - {SAHPI_ENT_RESERVED_4, "RESERVED_4"}, - {SAHPI_ENT_RESERVED_5, "RESERVED_5"}, + {SAHPI_ENT_PROCESSING_BLADE, "PROCESSING_BLADE"}, + {SAHPI_ENT_CONNECTIVITY_SWITCH, "CONNECTIVITY_SWITCH"}, + {SAHPI_ENT_PROCESSOR_MEMORY_MODULE, "PROCESSOR_MEMORY_MODULE"}, + {SAHPI_ENT_IO_MODULE, "IO_MODULE"}, + {SAHPI_ENT_PROCESSOR_IO_MODULE, "PROCESSOR_IO_MODULE"}, {SAHPI_ENT_MC_FIRMWARE, "MC_FIRMWARE"}, {SAHPI_ENT_IPMI_CHANNEL, "IPMI_CHANNEL"}, {SAHPI_ENT_PCI_BUS, "PCI_BUS"}, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2012-06-05 16:31:12
|
Revision: 7453 http://openhpi.svn.sourceforge.net/openhpi/?rev=7453&view=rev Author: avpak Date: 2012-06-05 16:31:01 +0000 (Tue, 05 Jun 2012) Log Message: ----------- Feature request #3530530 Modified Paths: -------------- openhpi/trunk/plugins/test_agent/Makefile.am openhpi/trunk/plugins/test_agent/Makefile.mingw32 openhpi/trunk/plugins/test_agent/abi.cpp openhpi/trunk/plugins/test_agent/annunciator.cpp openhpi/trunk/plugins/test_agent/annunciator.h openhpi/trunk/plugins/test_agent/codec.cpp openhpi/trunk/plugins/test_agent/console.cpp openhpi/trunk/plugins/test_agent/console.h openhpi/trunk/plugins/test_agent/control.cpp openhpi/trunk/plugins/test_agent/control.h openhpi/trunk/plugins/test_agent/dimi.cpp openhpi/trunk/plugins/test_agent/dimi.h openhpi/trunk/plugins/test_agent/fumi.cpp openhpi/trunk/plugins/test_agent/fumi.h openhpi/trunk/plugins/test_agent/handler.cpp openhpi/trunk/plugins/test_agent/handler.h openhpi/trunk/plugins/test_agent/instrument.cpp openhpi/trunk/plugins/test_agent/instrument.h openhpi/trunk/plugins/test_agent/instruments.cpp openhpi/trunk/plugins/test_agent/instruments.h openhpi/trunk/plugins/test_agent/inventory.cpp openhpi/trunk/plugins/test_agent/inventory.h openhpi/trunk/plugins/test_agent/resource.cpp openhpi/trunk/plugins/test_agent/resource.h openhpi/trunk/plugins/test_agent/sensor.cpp openhpi/trunk/plugins/test_agent/sensor.h openhpi/trunk/plugins/test_agent/server.cpp openhpi/trunk/plugins/test_agent/structs.cpp openhpi/trunk/plugins/test_agent/structs.h openhpi/trunk/plugins/test_agent/utils.cpp openhpi/trunk/plugins/test_agent/utils.h openhpi/trunk/plugins/test_agent/watchdog.cpp openhpi/trunk/plugins/test_agent/watchdog.h openhpi/trunk/test_agent.data.example Added Paths: ----------- openhpi/trunk/plugins/test_agent/test.cpp openhpi/trunk/plugins/test_agent/test.h Modified: openhpi/trunk/plugins/test_agent/Makefile.am =================================================================== --- openhpi/trunk/plugins/test_agent/Makefile.am 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/Makefile.am 2012-06-05 16:31:01 UTC (rev 7453) @@ -63,6 +63,8 @@ server.h \ structs.cpp \ structs.h \ + test.cpp \ + test.h \ timers.cpp \ timers.h \ utils.cpp \ Modified: openhpi/trunk/plugins/test_agent/Makefile.mingw32 =================================================================== --- openhpi/trunk/plugins/test_agent/Makefile.mingw32 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/Makefile.mingw32 2012-06-05 16:31:01 UTC (rev 7453) @@ -22,6 +22,7 @@ sensor.cpp \ server.cpp \ structs.cpp \ + test.cpp \ timers.cpp \ utils.cpp \ vars.cpp \ Modified: openhpi/trunk/plugins/test_agent/abi.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/abi.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/abi.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -34,6 +34,7 @@ #include "log.h" #include "resource.h" #include "sensor.h" +#include "test.h" #include "utils.h" #include "watchdog.h" @@ -196,6 +197,22 @@ return 0; } +static cTest * GetTest( cHandler * h, + SaHpiResourceIdT rid, + SaHpiDimiNumT num, + SaHpiDimiTestNumT tnum ) +{ + cDimi * dimi = GetDimi( h, rid, num ); + if ( dimi ) { + cTest * test = dimi->GetTest( tnum ); + if ( test && test->IsVisible() ) { + return test; + } + } + + return 0; +} + static cFumi * GetFumi( cHandler * h, SaHpiResourceIdT rid, SaHpiFumiNumT num ) @@ -1184,7 +1201,14 @@ SaHpiDimiNumT num, SaHpiDimiInfoT * info ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cDimi * dimi = TA::GetDimi( handler, rid, num ); + if ( !dimi ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return dimi->GetInfo( *info ); } @@ -1199,7 +1223,14 @@ SaHpiDimiTestNumT testnum, SaHpiDimiTestT * test ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cTest * t = TA::GetTest( handler, rid, num, testnum ); + if ( !t ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return t->GetInfo( *test ); } @@ -1214,7 +1245,14 @@ SaHpiDimiTestNumT testnum, SaHpiDimiReadyT * ready ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cTest * t = TA::GetTest( handler, rid, num, testnum ); + if ( !t ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return t->GetReadiness( *ready ); } @@ -1230,7 +1268,14 @@ SaHpiUint8T numparams, SaHpiDimiTestVariableParamsT * paramslist ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cTest * t = TA::GetTest( handler, rid, num, testnum ); + if ( !t ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return t->Start( numparams, paramslist ); } @@ -1244,7 +1289,14 @@ SaHpiDimiNumT num, SaHpiDimiTestNumT testnum ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cTest * t = TA::GetTest( handler, rid, num, testnum ); + if ( !t ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return t->Cancel(); } @@ -1260,7 +1312,14 @@ SaHpiDimiTestPercentCompletedT * percentcompleted, SaHpiDimiTestRunStatusT * runstatus ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cTest * t = TA::GetTest( handler, rid, num, testnum ); + if ( !t ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return t->GetStatus( *percentcompleted, *runstatus ); } @@ -1275,7 +1334,14 @@ SaHpiDimiTestNumT testnum, SaHpiDimiTestResultsT * testresults ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cTest * t = TA::GetTest( handler, rid, num, testnum ); + if ( !t ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return t->GetResults( *testresults ); } Modified: openhpi/trunk/plugins/test_agent/annunciator.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/annunciator.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/annunciator.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -171,8 +171,11 @@ *************************************************************/ const std::string cAnnunciator::classname( "ann" ); -cAnnunciator::cAnnunciator( cResource& resource, SaHpiAnnunciatorNumT num ) - : cInstrument( resource, +cAnnunciator::cAnnunciator( cHandler& handler, + cResource& resource, + SaHpiAnnunciatorNumT num ) + : cInstrument( handler, + resource, AssembleNumberedObjectName( classname, num ), SAHPI_ANNUNCIATOR_RDR, MakeDefaultAnnunciatorRec( num ) ), Modified: openhpi/trunk/plugins/test_agent/annunciator.h =================================================================== --- openhpi/trunk/plugins/test_agent/annunciator.h 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/annunciator.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -37,7 +37,9 @@ static const std::string classname; - explicit cAnnunciator( cResource& resource, SaHpiAnnunciatorNumT num ); + explicit cAnnunciator( cHandler& handler, + cResource& resource, + SaHpiAnnunciatorNumT num ); virtual ~cAnnunciator(); public: Modified: openhpi/trunk/plugins/test_agent/codec.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/codec.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/codec.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -1330,7 +1330,7 @@ switch ( type ) { case SAHPI_TL_TYPE_UNICODE: - // TODO + // TODO unicode break; case SAHPI_TL_TYPE_BCDPLUS: case SAHPI_TL_TYPE_ASCII6: @@ -1371,7 +1371,7 @@ switch ( type ) { case SAHPI_TL_TYPE_UNICODE: - // TODO + // TODO unicode return false; case SAHPI_TL_TYPE_BCDPLUS: case SAHPI_TL_TYPE_ASCII6: Modified: openhpi/trunk/plugins/test_agent/console.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/console.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/console.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -25,6 +25,8 @@ #include "codec.h" #include "console.h" +#include "handler.h" +#include "utils.h" namespace TA { @@ -112,8 +114,10 @@ /************************************************************** * class cConsole *************************************************************/ -cConsole::cConsole( uint16_t port, cObject& root ) - : cServer( port ), m_root( root ) +cConsole::cConsole( cHandler& handler, uint16_t port, cObject& root ) + : cServer( port ), + m_handler( handler ), + m_root( root ) { // empty } @@ -197,7 +201,6 @@ void cConsole::ProcessUserLine( const std::vector<char>& line, bool& quit ) { -// TODO lock handler m_quit = false; bool rc = IsNonCommand( line ); @@ -213,6 +216,8 @@ return; } + cLocker<cHandler> al( &m_handler ); + for ( size_t i = 0, n = m_cmds.size(); i < n; ++i ) { const cConsoleCmd& cmd = m_cmds[i]; if ( name == cmd.name ) { Modified: openhpi/trunk/plugins/test_agent/console.h =================================================================== --- openhpi/trunk/plugins/test_agent/console.h 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/console.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -64,13 +64,14 @@ /************************************************************** * class cConsole *************************************************************/ +class cHandler; typedef std::list<std::string> ObjectPath; class cConsole : private cServer { public: - explicit cConsole( uint16_t port, cObject& root ); + explicit cConsole( cHandler& handler, uint16_t port, cObject& root ); virtual ~cConsole(); bool Init(); @@ -110,10 +111,11 @@ private: // data + cHandler& m_handler; std::vector<cConsoleCmd > m_cmds; - bool m_quit; - ObjectPath m_path; - cObject& m_root; + bool m_quit; + ObjectPath m_path; + cObject& m_root; }; Modified: openhpi/trunk/plugins/test_agent/control.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/control.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/control.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -73,8 +73,9 @@ const std::string cControl::classname( "ctrl"); static const std::string line_name( "Line" ); -cControl::cControl( cResource& resource, SaHpiCtrlNumT num ) - : cInstrument( resource, +cControl::cControl( cHandler& handler, cResource& resource, SaHpiCtrlNumT num ) + : cInstrument( handler, + resource, AssembleNumberedObjectName( classname, num ), SAHPI_CTRL_RDR, MakeDefaultCtrlRec( num ) ), Modified: openhpi/trunk/plugins/test_agent/control.h =================================================================== --- openhpi/trunk/plugins/test_agent/control.h 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/control.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -36,7 +36,7 @@ static const std::string classname; - explicit cControl( cResource& resource, SaHpiCtrlNumT num ); + explicit cControl( cHandler& handler, cResource& resource, SaHpiCtrlNumT num ); virtual ~cControl(); public: // HPI interface Modified: openhpi/trunk/plugins/test_agent/dimi.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/dimi.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/dimi.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -13,10 +13,12 @@ * Anton Pak <ant...@pi...> */ +#include <algorithm> #include <string> #include "codec.h" #include "dimi.h" +#include "test.h" namespace TA { @@ -38,37 +40,185 @@ /************************************************************** + * Functors for working with tests + *************************************************************/ +struct TestDeleter +{ + void operator ()( cTest * test ) + { + delete test; + } +}; + +struct ObjectCollector +{ + explicit ObjectCollector( cObject::Children& _children ) + : children( _children ) + { + // empty + } + + void operator ()( cTest * test ) + { + if ( test ) { + children.push_back( test ); + } + } + + cObject::Children& children; +}; + + +/************************************************************** * class cDimi *************************************************************/ const std::string cDimi::classname( "dimi" ); -cDimi::cDimi( cResource& resource, SaHpiDimiNumT num ) - : cInstrument( resource, +cDimi::cDimi( cHandler& handler, cResource& resource, SaHpiDimiNumT num ) + : cInstrument( handler, + resource, AssembleNumberedObjectName( classname, num ), SAHPI_DIMI_RDR, MakeDefaultDimiRec( num ) ), - m_rec( GetRdr().RdrTypeUnion.DimiRec ) + m_rec( GetRdr().RdrTypeUnion.DimiRec ), + m_update_count( 0 ) { // empty } cDimi::~cDimi() { - // empty + TestDeleter deleter; + std::for_each( m_tests.begin(), m_tests.end(), deleter ); + m_tests.clear(); } +cTest * cDimi::GetTest( SaHpiDimiTestNumT tnum ) const +{ + return ( tnum < m_tests.size() ) ? m_tests[tnum] : 0; +} + +void cDimi::PostEvent( SaHpiDimiTestNumT tnum, + SaHpiDimiTestRunStatusT status, + SaHpiDimiTestPercentCompletedT progress ) +{ + SaHpiEventUnionT data; + SaHpiDimiEventT& de = data.DimiEvent; + + de.DimiNum = m_rec.DimiNum; + de.TestNum = tnum; + de.DimiTestRunStatus = status; + de.DimiTestPercentCompleted = progress; + + cInstrument::PostEvent( SAHPI_ET_DIMI, data, SAHPI_INFORMATIONAL ); +} + + // HPI interface -// TODO +SaErrorT cDimi::GetInfo( SaHpiDimiInfoT& info ) const +{ + info.NumberOfTests = m_tests.size(); + info.TestNumUpdateCounter = m_update_count; + return SA_OK; +} + + // cObject virtual functions -void cDimi::GetVars( cVars& vars ) +void cDimi::GetNewNames( cObject::NewNames& names ) const { - cInstrument::GetVars( vars ); + cObject::GetNewNames( names ); + names.push_back( cTest::classname + "-XXX" ); +} - // TODO +bool cDimi::CreateChild( const std::string& name ) +{ + bool rc; + + rc = cObject::CreateChild( name ); + if ( rc ) { + return true; + } + + std::string cname; + SaHpiUint32T id; + rc = DisassembleNumberedObjectName( name, cname, id ); + if ( !rc ) { + return false; + } + + if ( cname != cTest::classname ) { + return false; + } + + if ( id > m_tests.size() ) { + return false; + } + if ( id == m_tests.size() ) { + m_tests.push_back( 0 ); + } + if ( m_tests[id] ) { + return false; + } + + m_tests[id] = new cTest( m_handler, *this, id ); + Update(); + + return true; } +bool cDimi::RemoveChild( const std::string& name ) +{ + bool rc; + rc = cObject::RemoveChild( name ); + if ( rc ) { + return true; + } + + std::string cname; + SaHpiUint32T id; + rc = DisassembleNumberedObjectName( name, cname, id ); + if ( !rc ) { + return false; + } + + if ( id >= m_tests.size() ) { + return false; + } + if ( m_tests[id] == 0 ) { + return false; + } + + delete m_tests[id]; + m_tests[id] = 0; + Update(); + + return true; +} + +void cDimi::GetChildren( Children& children ) const +{ + cObject::GetChildren( children ); + + ObjectCollector collector( children ); + std::for_each( m_tests.begin(), m_tests.end(), collector ); +} + + +void cDimi::Update() +{ + ++m_update_count; + + SaHpiEventUnionT data; + SaHpiDimiUpdateEventT& due = data.DimiUpdateEvent; + + due.DimiNum = m_rec.DimiNum; + + cInstrument::PostEvent( SAHPI_ET_DIMI_UPDATE, data, SAHPI_INFORMATIONAL ); +} + + }; // namespace TA Modified: openhpi/trunk/plugins/test_agent/dimi.h =================================================================== --- openhpi/trunk/plugins/test_agent/dimi.h 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/dimi.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -17,6 +17,7 @@ #define DIMI_H_FB2B5DD5_4E7D_49F5_9397_C2FEC21B4010 #include <string> +#include <vector> #include <SaHpi.h> @@ -29,20 +30,34 @@ /************************************************************** * class cDimi *************************************************************/ +class cTest; + class cDimi : public cInstrument { public: static const std::string classname; - explicit cDimi( cResource& resource, SaHpiDimiNumT num ); + explicit cDimi( cHandler& handler, cResource& resource, SaHpiDimiNumT num ); virtual ~cDimi(); +public: + + cTest * GetTest( SaHpiDimiTestNumT tnum ) const; + void PostEvent( SaHpiDimiTestNumT tnum, + SaHpiDimiTestRunStatusT status, + SaHpiDimiTestPercentCompletedT progress ); + public: // HPI interface + SaErrorT GetInfo( SaHpiDimiInfoT& info ) const; + protected: // cObject virtual functions - virtual void GetVars( cVars& vars ); + virtual void GetNewNames( cObject::NewNames& names ) const; + virtual bool CreateChild( const std::string& name ); + virtual bool RemoveChild( const std::string& name ); + virtual void GetChildren( cObject::Children& children ) const; private: @@ -56,9 +71,13 @@ return SAHPI_CAPABILITY_DIMI; } + void Update(); + private: // data const SaHpiDimiRecT& m_rec; + std::vector<cTest*> m_tests; + SaHpiUint32T m_update_count; }; Modified: openhpi/trunk/plugins/test_agent/fumi.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/fumi.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/fumi.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -45,8 +45,9 @@ *************************************************************/ const std::string cFumi::classname( "fumi" ); -cFumi::cFumi( cResource& resource, SaHpiFumiNumT num ) - : cInstrument( resource, +cFumi::cFumi( cHandler& handler, cResource& resource, SaHpiFumiNumT num ) + : cInstrument( handler, + resource, AssembleNumberedObjectName( classname, num ), SAHPI_FUMI_RDR, MakeDefaultFumiRec( num ) ), @@ -62,14 +63,14 @@ // HPI interface -// TODO +// TODO hpi interface // cObject virtual functions void cFumi::GetVars( cVars& vars ) { cInstrument::GetVars( vars ); - // TODO + // TODO getvars } Modified: openhpi/trunk/plugins/test_agent/fumi.h =================================================================== --- openhpi/trunk/plugins/test_agent/fumi.h 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/fumi.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -35,7 +35,7 @@ static const std::string classname; - explicit cFumi( cResource& resource, SaHpiFumiNumT num ); + explicit cFumi( cHandler& handler, cResource& resource, SaHpiFumiNumT num ); virtual ~cFumi(); public: // HPI interface Modified: openhpi/trunk/plugins/test_agent/handler.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/handler.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/handler.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -45,7 +45,7 @@ oh_evt_queue& eventq ) : cObject( "root" ), - cConsole( port, *this ), + cConsole( *this, port, *this ), m_id( id ), m_eventq( eventq ), m_ai_timeout( SAHPI_TIMEOUT_IMMEDIATE ) @@ -75,7 +75,7 @@ CRIT( "cannot initialize console" ); return false; } - rc = m_timers.Start(); + rc = cTimers::Start(); if ( !rc ) { CRIT( "cannot start timers" ); return false; @@ -197,7 +197,7 @@ return false; } - cResource * r = new cResource( *this, m_timers, ep ); + cResource * r = new cResource( *this, ep ); m_resources[r->GetResourceId()] = r; return true; Modified: openhpi/trunk/plugins/test_agent/handler.h =================================================================== --- openhpi/trunk/plugins/test_agent/handler.h 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/handler.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -40,7 +40,7 @@ *************************************************************/ class cResource; -class cHandler : private cObject, private cConsole +class cHandler : public cTimers, private cObject, private cConsole { public: @@ -95,7 +95,6 @@ GStaticMutex m_lock; Resources m_resources; SaHpiTimeoutT m_ai_timeout; - cTimers m_timers; }; Modified: openhpi/trunk/plugins/test_agent/instrument.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/instrument.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/instrument.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -74,11 +74,13 @@ /************************************************************** * class cInstrument *************************************************************/ -cInstrument::cInstrument( cResource& resource, +cInstrument::cInstrument( cHandler& handler, + cResource& resource, const std::string& name, SaHpiRdrTypeT type, const SaHpiRdrTypeUnionT& data ) : cObject( name, SAHPI_FALSE ), + m_handler( handler ), m_resource( resource ) { MakeDefaultRdr( resource.GetEntityPath(), @@ -138,6 +140,7 @@ } } + // Event generation void cInstrument::PostEvent( SaHpiEventTypeT type, const SaHpiEventUnionT& data, @@ -158,6 +161,7 @@ m_resource.PostEvent( type, data, severity, l, l_remove ); } + void cInstrument::PostUpdateEvent( bool remove ) const { SaHpiEventUnionT data; Modified: openhpi/trunk/plugins/test_agent/instrument.h =================================================================== --- openhpi/trunk/plugins/test_agent/instrument.h 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/instrument.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -29,13 +29,16 @@ /************************************************************** * class cInstrument *************************************************************/ +class cHandler; class cResource; +class cTimers; class cInstrument : public cObject { public: - explicit cInstrument( cResource& resource, + explicit cInstrument( cHandler& handler, + cResource& resource, const std::string& name, SaHpiRdrTypeT type, const SaHpiRdrTypeUnionT& data ); @@ -77,6 +80,7 @@ protected: // data + cHandler& m_handler; cResource& m_resource; private: // data Modified: openhpi/trunk/plugins/test_agent/instruments.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/instruments.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/instruments.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -22,6 +22,7 @@ #include "control.h" #include "dimi.h" #include "fumi.h" +#include "handler.h" #include "instruments.h" #include "inventory.h" #include "sensor.h" @@ -81,8 +82,9 @@ /************************************************************** * class cInstruments *************************************************************/ -cInstruments::cInstruments( cResource& resource ) - : m_resource( resource ) +cInstruments::cInstruments( cHandler& handler, cResource& resource ) + : m_handler( handler ), + m_resource( resource ) { // empty } @@ -266,43 +268,43 @@ if ( cname == cControl::classname ) { if ( !GetControl( num ) ) { - m_controls[num] = new cControl( m_resource, num ); + m_controls[num] = new cControl( m_handler, m_resource, num ); return true; } } if ( cname == cSensor::classname ) { if ( !GetSensor( num ) ) { - m_sensors[num] = new cSensor( m_resource, num ); + m_sensors[num] = new cSensor( m_handler, m_resource, num ); return true; } } if ( cname == cInventory::classname ) { if ( !GetInventory( num ) ) { - m_invs[num] = new cInventory( m_resource, num ); + m_invs[num] = new cInventory( m_handler, m_resource, num ); return true; } } if ( cname == cWatchdog::classname ) { if ( !GetWatchdog( num ) ) { - m_wdts[num] = new cWatchdog( m_resource, num ); + m_wdts[num] = new cWatchdog( m_handler, m_resource, num ); return true; } } if ( cname == cAnnunciator::classname ) { if ( !GetAnnunciator( num ) ) { - m_anns[num] = new cAnnunciator( m_resource, num ); + m_anns[num] = new cAnnunciator( m_handler, m_resource, num ); return true; } } if ( cname == cDimi::classname ) { if ( !GetDimi( num ) ) { - m_dimis[num] = new cDimi( m_resource, num ); + m_dimis[num] = new cDimi( m_handler, m_resource, num ); return true; } } if ( cname == cFumi::classname ) { if ( !GetFumi( num ) ) { - m_fumis[num] = new cFumi( m_resource, num ); + m_fumis[num] = new cFumi( m_handler, m_resource, num ); return true; } } Modified: openhpi/trunk/plugins/test_agent/instruments.h =================================================================== --- openhpi/trunk/plugins/test_agent/instruments.h 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/instruments.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -32,6 +32,7 @@ /************************************************************** * class cInstruments *************************************************************/ +class cHandler; class cResource; class cControl; class cSensor; @@ -58,7 +59,7 @@ protected: - explicit cInstruments( cResource& resource ); + explicit cInstruments( cHandler& handler, cResource& resource ); virtual ~cInstruments(); protected: @@ -76,6 +77,7 @@ private: // data + cHandler& m_handler; cResource& m_resource; typedef std::map<SaHpiCtrlNumT, cControl *> Controls; Modified: openhpi/trunk/plugins/test_agent/inventory.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/inventory.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/inventory.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -128,8 +128,9 @@ *************************************************************/ const std::string cInventory::classname = "inv"; -cInventory::cInventory( cResource& resource, SaHpiIdrIdT num ) - : cInstrument( resource, +cInventory::cInventory( cHandler& handler, cResource& resource, SaHpiIdrIdT num ) + : cInstrument( handler, + resource, AssembleNumberedObjectName( classname, num ), SAHPI_INVENTORY_RDR, MakeDefaultInvRec( num ) ), Modified: openhpi/trunk/plugins/test_agent/inventory.h =================================================================== --- openhpi/trunk/plugins/test_agent/inventory.h 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/inventory.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -38,7 +38,7 @@ static const std::string classname; - explicit cInventory( cResource& resource, SaHpiIdrIdT num ); + explicit cInventory( cHandler& handler, cResource& resource, SaHpiIdrIdT num ); virtual ~cInventory(); public: Modified: openhpi/trunk/plugins/test_agent/resource.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/resource.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/resource.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -78,13 +78,11 @@ * class cResource *************************************************************/ cResource::cResource( cHandler& handler, - cTimers& timers, const SaHpiEntityPathT& ep ) : cObject( AssembleResourceObjectName( ep ), SAHPI_FALSE ), - cInstruments( *this ), + cInstruments( handler, *this ), m_handler( handler ), - m_timers( timers ), m_log( 0 ) { MakeDefaultRptEntry( ep, m_rpte ); @@ -106,7 +104,7 @@ { delete m_log; m_log = 0; - m_timers.CancelTimer( this ); + m_handler.CancelTimer( this ); SetVisible( false ); } @@ -135,11 +133,6 @@ m_rpte.ResourceCapabilities |= caps; } -cTimers& cResource::GetTimers() const -{ - return m_timers; -} - cLog * cResource::GetLog() const { return m_log; @@ -174,7 +167,7 @@ return SA_ERR_HPI_INVALID_REQUEST; } - m_timers.CancelTimer( this ); + m_handler.CancelTimer( this ); return SA_OK; } @@ -234,7 +227,7 @@ return SA_ERR_HPI_INVALID_REQUEST; } - m_timers.CancelTimer( this ); + m_handler.CancelTimer( this ); m_new_hs_state = state; CommitChanges(); @@ -269,7 +262,7 @@ } CommitChanges(); - m_timers.SetTimer( this, t ); + m_handler.SetTimer( this, t ); return SA_OK; } @@ -716,10 +709,10 @@ SaHpiTimeoutT ait, aet, t; if ( m_hs_state == SAHPI_HS_STATE_INSERTION_PENDING ) { GetTimeouts( t, aet ); - m_timers.SetTimer( this, t ); + m_handler.SetTimer( this, t ); } else if ( m_hs_state == SAHPI_HS_STATE_EXTRACTION_PENDING ) { GetTimeouts( ait, t ); - m_timers.SetTimer( this, t ); + m_handler.SetTimer( this, t ); } } Modified: openhpi/trunk/plugins/test_agent/resource.h =================================================================== --- openhpi/trunk/plugins/test_agent/resource.h 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/resource.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -39,7 +39,6 @@ public: explicit cResource( cHandler& handler, - cTimers& timers, const SaHpiEntityPathT& ep ); virtual ~cResource(); @@ -50,7 +49,6 @@ const SaHpiEntityPathT& GetEntityPath() const; bool IsFailed() const; void UpdateCaps( SaHpiCapabilitiesT caps ); - cTimers& GetTimers() const; cLog * GetLog() const; @@ -119,7 +117,6 @@ private: // data cHandler& m_handler; - cTimers& m_timers; cLog * m_log; SaHpiRptEntryT m_rpte; SaHpiBoolT m_failed; Modified: openhpi/trunk/plugins/test_agent/sensor.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/sensor.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/sensor.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -232,8 +232,9 @@ *************************************************************/ const std::string cSensor::classname( "sen" ); -cSensor::cSensor( cResource& resource, SaHpiSensorNumT num ) - : cInstrument( resource, +cSensor::cSensor( cHandler& handler, cResource& resource, SaHpiSensorNumT num ) + : cInstrument( handler, + resource, AssembleNumberedObjectName( classname, num ), SAHPI_SENSOR_RDR, MakeDefaultSensorRec( num ) ), @@ -586,7 +587,7 @@ } if ( send_enable_event ) { - SendEnableChangeEvent(); + PostEnableChangeEvent(); } // Check if event shall be generated @@ -605,15 +606,15 @@ for ( size_t i = 0; i < 15; ++i ) { SaHpiEventStateT s = ( 1 << i ); if ( s & a ) { - SendEvent( true, s ); + PostEvent( true, s ); } if ( s & d ) { - SendEvent( false, s ); + PostEvent( false, s ); } } } -void cSensor::SendEnableChangeEvent() const +void cSensor::PostEnableChangeEvent() const { SaHpiEventUnionT data; SaHpiSensorEnableChangeEventT& sece = data.SensorEnableChangeEvent; @@ -628,10 +629,10 @@ sece.OptionalDataPresent = SAHPI_SEOD_CURRENT_STATE; sece.CurrentState = m_states; - PostEvent( SAHPI_ET_SENSOR_ENABLE_CHANGE, data, SAHPI_INFORMATIONAL ); + cInstrument::PostEvent( SAHPI_ET_SENSOR_ENABLE_CHANGE, data, SAHPI_INFORMATIONAL ); } -void cSensor::SendEvent( bool assertion, SaHpiEventStateT state ) const +void cSensor::PostEvent( bool assertion, SaHpiEventStateT state ) const { SaHpiEventUnionT data; SaHpiSensorEventT& se = data.SensorEvent; @@ -653,7 +654,7 @@ if ( m_rec.Category == SAHPI_EC_THRESHOLD ) { se.OptionalDataPresent |= SAHPI_SOD_TRIGGER_READING; se.TriggerReading = m_reading; -// TODO +// TODO SAHPI_SOD_TRIGGER_THRESHOLD #if 0 #define SAHPI_SOD_TRIGGER_THRESHOLD (SaHpiSensorOptionalDataT)0x02 #endif @@ -662,7 +663,7 @@ SaHpiSeverityT sev = GetEventSeverity( m_rec.Category, assertion, state ); - PostEvent( SAHPI_ET_SENSOR, data, sev ); + cInstrument::PostEvent( SAHPI_ET_SENSOR, data, sev ); } Modified: openhpi/trunk/plugins/test_agent/sensor.h =================================================================== --- openhpi/trunk/plugins/test_agent/sensor.h 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/sensor.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -35,7 +35,7 @@ static const std::string classname; - explicit cSensor( cResource& resource, SaHpiSensorNumT num ); + explicit cSensor( cHandler& handler, cResource& resource, SaHpiSensorNumT num ); virtual ~cSensor(); public: // HPI interface @@ -75,8 +75,8 @@ return SAHPI_CAPABILITY_SENSOR; } - void SendEnableChangeEvent() const; - void SendEvent( bool assertion, SaHpiEventStateT state ) const; + void PostEnableChangeEvent() const; + void PostEvent( bool assertion, SaHpiEventStateT state ) const; SaHpiEventStateT CalculateThresholdEventStates() const; void CommitChanges(); Modified: openhpi/trunk/plugins/test_agent/server.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/server.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/server.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -200,8 +200,8 @@ gpointer cServer::ThreadProcAdapter( gpointer data ) { - cServer * handler = reinterpret_cast<cServer*>(data); - handler->ThreadProc(); + cServer * me = reinterpret_cast<cServer*>(data); + me->ThreadProc(); return 0; } Modified: openhpi/trunk/plugins/test_agent/structs.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/structs.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/structs.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -13,6 +13,9 @@ * Anton Pak <ant...@pi...> */ +#include <stddef.h> +#include <stdio.h> + #include "structs.h" #include "vars.h" @@ -759,7 +762,110 @@ << VAR_END(); } +static void GetVars( const std::string& name, + SaHpiDimiTestParamsDefinitionT& pd, + cVars& vars ) +{ + vars << name + ".ParamName" + << dtDimiTestParamName + << DATA( pd.ParamName ) + << VAR_END(); + vars << name + ".ParamInfo" + << dtSaHpiTextBufferT + << DATA( pd.ParamInfo ) + << VAR_END(); + vars << name + ".ParamType" + << dtSaHpiDimiTestParamTypeT + << DATA( pd.ParamType ) + << VAR_END(); + if ( pd.ParamType == SAHPI_DIMITEST_PARAM_TYPE_INT32 ) { + vars << name + ".MinValue.IntValue" + << dtSaHpiInt32T + << DATA( pd.MinValue.IntValue ) + << VAR_END(); + vars << name + ".MaxValue.IntValue" + << dtSaHpiInt32T + << DATA( pd.MaxValue.IntValue ) + << VAR_END(); + } else if ( pd.ParamType == SAHPI_DIMITEST_PARAM_TYPE_FLOAT64 ) { + vars << name + ".MinValue.FloatValue" + << dtSaHpiFloat64T + << DATA( pd.MinValue.FloatValue ) + << VAR_END(); + vars << name + ".MaxValue.FloatValue" + << dtSaHpiFloat64T + << DATA( pd.MaxValue.FloatValue ) + << VAR_END(); + } + if ( pd.ParamType == SAHPI_DIMITEST_PARAM_TYPE_BOOLEAN ) { + vars << name + ".DefaultParam.parambool" + << dtSaHpiBoolT + << DATA( pd.DefaultParam.parambool ) + << VAR_END(); + } else if ( pd.ParamType == SAHPI_DIMITEST_PARAM_TYPE_INT32 ) { + vars << name + ".DefaultParam.paramint" + << dtSaHpiInt32T + << DATA( pd.DefaultParam.paramint ) + << VAR_END(); + } else if ( pd.ParamType == SAHPI_DIMITEST_PARAM_TYPE_FLOAT64 ) { + vars << name + ".DefaultParam.paramfloat" + << dtSaHpiFloat64T + << DATA( pd.DefaultParam.paramfloat ) + << VAR_END(); + } else if ( pd.ParamType == SAHPI_DIMITEST_PARAM_TYPE_TEXT ) { + vars << name + ".DefaultParam.paramtext" + << dtSaHpiTextBufferT + << DATA( pd.DefaultParam.paramtext ) + << VAR_END(); + } +} +void GetVars( SaHpiDimiTestT& info, cVars& vars ) +{ + char prefix[256]; + + vars << "TestInfo.TestName" + << dtSaHpiTextBufferT + << DATA( info.TestName ) + << VAR_END(); + vars << "TestInfo.ServiceImpact" + << dtSaHpiDimiTestServiceImpactT + << DATA( info.ServiceImpact ) + << VAR_END(); + for ( size_t i = 0; i < SAHPI_DIMITEST_MAX_ENTITIESIMPACTED; ++i ) { + snprintf( &prefix[0], sizeof(prefix), "TestInfo.EntitiesImpacted[%u]", (unsigned int)i ); + vars << std::string( prefix ) + ".EntityImpacted" + << dtSaHpiEntityPathT + << DATA( info.EntitiesImpacted[i].EntityImpacted ) + << VAR_END(); + vars << std::string( prefix ) + ".ServiceImpact" + << dtSaHpiDimiTestServiceImpactT + << DATA( info.EntitiesImpacted[i].ServiceImpact ) + << VAR_END(); + } + vars << "TestInfo.NeedServiceOS" + << dtSaHpiBoolT + << DATA( info.NeedServiceOS ) + << VAR_END(); + vars << "TestInfo.ServiceOS" + << dtSaHpiTextBufferT + << DATA( info.ServiceOS ) + << VAR_END(); + vars << "TestInfo.ExpectedRunDuration" + << dtSaHpiTimeT + << DATA( info.ExpectedRunDuration ) + << VAR_END(); + vars << "TestInfo.TestCapabilities" + << dtSaHpiDimiTestCapabilityT + << DATA( info.TestCapabilities ) + << VAR_END(); + for ( size_t i = 0; i < SAHPI_DIMITEST_MAX_PARAMETERS; ++i ) { + snprintf( &prefix[0], sizeof(prefix), "TestInfo.TestParameters[%u]", (unsigned int)i ); + GetVars( prefix, info.TestParameters[i], vars ); + } +} + + }; // namespace Structs Modified: openhpi/trunk/plugins/test_agent/structs.h =================================================================== --- openhpi/trunk/plugins/test_agent/structs.h 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/structs.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -40,6 +40,7 @@ void GetVars( SaHpiSensorThresholdsT& ths, cVars& vars ); void GetVars( SaHpiWatchdogT& wd, cVars& vars ); void GetVars( SaHpiAnnouncementT& a, cVars& vars ); +void GetVars( SaHpiDimiTestT& info, cVars& vars ); }; // namespace Structs Added: openhpi/trunk/plugins/test_agent/test.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/test.cpp (rev 0) +++ openhpi/trunk/plugins/test_agent/test.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -0,0 +1,338 @@ +/* -*- c++ -*- + * + * (C) Copyright Pigeon Point Systems. 2011 + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTAREALITY 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): + * Anton Pak <ant...@pi...> + */ + +#include <stddef.h> +#include <stdio.h> +#include <string.h> + +#include <algorithm> +#include <string> + +#include <oh_utils.h> + +#include "codec.h" +#include "dimi.h" +#include "handler.h" +#include "structs.h" +#include "test.h" +#include "utils.h" + + +namespace TA { + + +/************************************************************** + * Helper functions + *************************************************************/ +static SaHpiDimiTestT MakeDefaultTestInfo( SaHpiDimiTestNumT num ) +{ + SaHpiDimiTestT info; + + FormatHpiTextBuffer( info.TestName, "test %u", (unsigned int)num ); + info.ServiceImpact = SAHPI_DIMITEST_NONDEGRADING; + for ( size_t i = 0; i < SAHPI_DIMITEST_MAX_ENTITIESIMPACTED; ++i ) { + MakeUnspecifiedHpiEntityPath( info.EntitiesImpacted[i].EntityImpacted ); + info.EntitiesImpacted[i].ServiceImpact = SAHPI_DIMITEST_NONDEGRADING; + } + info.NeedServiceOS = SAHPI_FALSE; + MakeHpiTextBuffer( info.ServiceOS, "Unspecified OS" ); + info.ExpectedRunDuration = 2000000000LL; // 2 sec + info.TestCapabilities = SAHPI_DIMITEST_CAPABILITY_TESTCANCEL; + + for ( size_t i = 0; i < SAHPI_DIMITEST_MAX_PARAMETERS; ++i ) { + SaHpiDimiTestParamsDefinitionT& pd = info.TestParameters[i]; + memset( &pd.ParamName[0], 0, SAHPI_DIMITEST_PARAM_NAME_LEN ); + snprintf( reinterpret_cast<char *>(&pd.ParamName[0]), + SAHPI_DIMITEST_PARAM_NAME_LEN, + "Param %u", + (unsigned int)i ); + FormatHpiTextBuffer( pd.ParamInfo, "This is param %u", (unsigned int)i ); + pd.ParamType = SAHPI_DIMITEST_PARAM_TYPE_INT32; + pd.MinValue.IntValue = 0; + pd.MaxValue.IntValue = 255; + pd.DefaultParam.paramint = i; + + } + + return info; +} + +static SaHpiDimiTestResultsT MakeDefaultTestResults() +{ + SaHpiDimiTestResultsT results; + + results.ResultTimeStamp = SAHPI_TIME_UNSPECIFIED; + results.RunDuration = SAHPI_TIMEOUT_IMMEDIATE; + results.LastRunStatus = SAHPI_DIMITEST_STATUS_NOT_RUN; + results.TestErrorCode = SAHPI_DIMITEST_STATUSERR_NOERR; + MakeHpiTextBuffer( results.TestResultString, "http://openhpi.org" ); + results.TestResultStringIsURI = SAHPI_TRUE; + + return results; +} + + +/************************************************************** + * class cTest + *************************************************************/ +const std::string cTest::classname( "test" ); + +cTest::cTest( cHandler& handler, cDimi& dimi, SaHpiDimiTestNumT num ) + : cObject( AssembleNumberedObjectName( classname, num ) ), + m_handler( handler ), + m_dimi( dimi ), + m_num( num ), + m_info( MakeDefaultTestInfo( num ) ), + m_ready( SAHPI_DIMI_READY ), + m_status( SAHPI_DIMITEST_STATUS_NOT_RUN ), + m_progress( 0xff ), + m_prev_results( MakeDefaultTestResults() ), + m_start_timestamp( SAHPI_TIME_UNSPECIFIED ) +{ + m_next.run_duration = m_info.ExpectedRunDuration; + m_next.err = SAHPI_DIMITEST_STATUSERR_NOERR; + MakeHpiTextBuffer( m_next.result_string, "No error has been detected" ); + m_next.result_string_is_uri = SAHPI_FALSE; +} + +cTest::~cTest() +{ + m_handler.CancelTimer( this ); +} + + +// HPI Interface +SaErrorT cTest::GetInfo( SaHpiDimiTestT& info ) const +{ + info = m_info; + + return SA_OK; +} + +SaErrorT cTest::GetReadiness( SaHpiDimiReadyT& ready ) +{ + if ( m_status == SAHPI_DIMITEST_STATUS_RUNNING ) { + ready = SAHPI_DIMI_BUSY; + } else { + ready = m_ready; + } + + return SA_OK; +} + +SaErrorT cTest::Start( SaHpiUint8T nparams, + const SaHpiDimiTestVariableParamsT * params ) +{ + SaHpiDimiReadyT ready; + SaErrorT rv = GetReadiness( ready ); + if ( rv != SA_OK ) { + return rv; + } + if ( ready != SAHPI_DIMI_READY ) { + return SA_ERR_HPI_INVALID_STATE; + } + bool rc= CheckParams( nparams, params ); + if ( !rc ) { + return SA_ERR_HPI_INVALID_DATA; + } + + ChangeStatus( SAHPI_DIMITEST_STATUS_RUNNING ); + + m_handler.SetTimer( this, m_next.run_duration ); + + return SA_OK; +} + +SaErrorT cTest::Cancel() +{ + if ( m_status != SAHPI_DIMITEST_STATUS_RUNNING ) { + return SA_ERR_HPI_INVALID_STATE; + } + if ( ( m_info.TestCapabilities & SAHPI_DIMITEST_CAPABILITY_TESTCANCEL ) == 0 ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + m_handler.CancelTimer( this ); + + ChangeStatus( SAHPI_DIMITEST_STATUS_CANCELED ); + + return SA_OK; +} + +SaErrorT cTest::GetStatus( SaHpiDimiTestPercentCompletedT& progress, + SaHpiDimiTestRunStatusT& status ) const +{ + progress = m_progress; + status = m_status; + + return SA_OK; +} + +SaErrorT cTest::GetResults( SaHpiDimiTestResultsT& results ) const +{ + results = m_prev_results; + + return SA_OK; +} + + +// cObject virtual functions +void cTest::GetVars( cVars& vars ) +{ + cObject::GetVars( vars ); + Structs::GetVars( m_info, vars ); + + vars << "Readiness" + << dtSaHpiDimiReadyT + << DATA( m_ready ) + << VAR_END(); + vars << "Status" + << dtSaHpiDimiTestRunStatusT + << DATA( m_status ) + << READONLY() + << VAR_END(); + vars << "Progress" + << dtSaHpiDimiTestPercentCompletedT + << DATA( m_progress ) + << READONLY() + << VAR_END(); + vars << "Next.RunDuration" + << dtSaHpiTimeoutT + << DATA( m_next.run_duration ) + << VAR_END(); + vars << "Next.TestErrorCode" + << dtSaHpiDimiTestErrCodeT + << DATA( m_next.err ) + << VAR_END(); + vars << "Next.TestResultString" + << dtSaHpiTextBufferT + << DATA( m_next.result_string ) + << VAR_END(); + vars << "Next.TestResultStringIsURI" + << dtSaHpiBoolT + << DATA( m_next.result_string_is_uri ) + << VAR_END(); +} + +void cTest::AfterVarSet( const std::string& var_name ) +{ + cObject::AfterVarSet( var_name ); +} + + +bool cTest::CheckParams( SaHpiUint8T nparams, + const SaHpiDimiTestVariableParamsT * params ) const +{ + for ( size_t i = 0; i < nparams; ++i ) { + const SaHpiDimiTestVariableParamsT * p = ¶ms[i]; + const SaHpiDimiTestParamsDefinitionT * pd; + size_t j; + for ( j = 0; j < SAHPI_DIMITEST_MAX_PARAMETERS; ++j ) { + pd = &m_info.TestParameters[j]; + int cc = strncmp( reinterpret_cast<const char *>( &p->ParamName[0] ), + reinterpret_cast<const char *>( &pd->ParamName[0] ), + SAHPI_DIMITEST_PARAM_NAME_LEN ); + if ( cc == 0 ) { + break; + } + } + if ( j == SAHPI_DIMITEST_MAX_PARAMETERS ) { + continue; + } + if ( p->ParamType != pd->ParamType ) { + return false; + } + if ( p->ParamType == SAHPI_DIMITEST_PARAM_TYPE_INT32 ) { + if ( p->Value.paramint < pd->MinValue.IntValue ) { + return false; + } + if ( p->Value.paramint > pd->MaxValue.IntValue ) { + return false; + } + } + if ( p->ParamType == SAHPI_DIMITEST_PARAM_TYPE_FLOAT64 ) { + if ( p->Value.paramfloat < pd->MinValue.FloatValue ) { + return false; + } + if ( p->Value.paramfloat > pd->MaxValue.FloatValue ) { + return false; + } + } + } + + return true; +} + +void cTest::ChangeStatus( SaHpiDimiTestRunStatusT status ) +{ + m_status = status; + + SaHpiTimeT now; + oh_gettimeofday( &now ); + + if ( m_status == SAHPI_DIMITEST_STATUS_RUNNING ) { + m_start_timestamp = now; + } else if ( m_status == SAHPI_DIMITEST_STATUS_NOT_RUN ) { + // Do nothing + } else { + // Update results + m_prev_results.ResultTimeStamp = now; + m_prev_results.RunDuration = now - m_start_timestamp; + m_prev_results.LastRunStatus = m_status; + m_prev_results.TestErrorCode = m_next.err; + if ( m_status != SAHPI_DIMITEST_STATUS_CANCELED ) { + m_prev_results.TestResultString = m_next.result_string; + m_prev_results.TestResultStringIsURI = m_next.result_string_is_uri; + } else { + MakeHpiTextBuffer( m_prev_results.TestResultString, "The test has been cancelled" ); + m_prev_results.TestResultStringIsURI = SAHPI_FALSE; + } + } + + // Post event + if ( !IsVisible() ) { + return; + } + + SaHpiEventUnionT data; + + SaHpiDimiEventT& de = data.DimiEvent; + de.DimiNum = m_dimi.GetRdr().RdrTypeUnion.DimiRec.DimiNum; + de.TestNum = m_num; + de.DimiTestRunStatus = status; + de.DimiTestPercentCompleted = m_progress; + + m_dimi.PostEvent( m_num, m_status, m_progress ); +} + + +// cTimerCallback virtual functions +void cTest::TimerEvent() +{ + cLocker<cHandler> al( &m_handler ); + + SaHpiDimiTestRunStatusT status; + if ( m_next.err == SAHPI_DIMITEST_STATUSERR_NOERR ) { + status = SAHPI_DIMITEST_STATUS_FINISHED_NO_ERRORS; + } else { + status = SAHPI_DIMITEST_STATUS_FINISHED_ERRORS; + } + + ChangeStatus( status ); +} + + +}; // namespace TA + Added: openhpi/trunk/plugins/test_agent/test.h =================================================================== --- openhpi/trunk/plugins/test_agent/test.h (rev 0) +++ openhpi/trunk/plugins/test_agent/test.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -0,0 +1,103 @@ +/* -*- c++ -*- + * + * (C) Copyright Pigeon Point Systems. 2012 + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTTESTLITY 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): + * Anton Pak <ant...@pi...> + */ + +#ifndef TEST_H_FB2B5DD5_4E7D_49F5_9397_C2FEC21B4010 +#define TEST_H_FB2B5DD5_4E7D_49F5_9397_C2FEC21B4010 + +#include <list> +#include <string> + +#include <SaHpi.h> + +#include "object.h" +#include "timers.h" + + +namespace TA { + + +/************************************************************** + * class cTest + *************************************************************/ +class cHandler; +class cDimi; + +class cTest : public cObject, private cTimerCallback +{ +public: + + static const std::string classname; + + explicit cTest( cHandler& handler, cDimi& dimi, SaHpiDimiTestNumT num ); + virtual ~cTest(); + +public: // HPI interface + + SaErrorT GetInfo( SaHpiDimiTestT& info ) const; + SaErrorT GetReadiness( SaHpiDimiReadyT& ready ); + SaErrorT Start( SaHpiUint8T nparams, + const SaHpiDimiTestVariableParamsT * params ); + SaErrorT Cancel(); + SaErrorT GetStatus( SaHpiDimiTestPercentCompletedT& progress, + SaHpiDimiTestRunStatusT& status ) const; + SaErrorT GetResults( SaHpiDimiTestResultsT& results ) const; + +protected: // cObject virtual functions + + virtual void GetVars( cVars& vars ); + virtual void AfterVarSet( const std::string& var_name ); + +private: + + cTest( const cTest& ); + cTest& operator =( const cTest& ); + +private: + + bool CheckParams( SaHpiUint8T nparams, + const SaHpiDimiTestVariableParamsT * params ) const; + void ChangeStatus( SaHpiDimiTestRunStatusT status ); + +private: // cTimerCallback virtual functions + + virtual void TimerEvent(); + +private: // data + + cHandler& m_handler; + cDimi& m_dimi; + const SaHpiDimiTestNumT m_num; + SaHpiDimiTestT m_info; + SaHpiDimiReadyT m_ready; + SaHpiDimiTestRunStatusT m_status; + SaHpiDimiTestPercentCompletedT m_progress; + + SaHpiDimiTestResultsT m_prev_results; + SaHpiTimeT m_start_timestamp; + struct + { + SaHpiTimeoutT run_duration; + SaHpiDimiTestErrCodeT err; + SaHpiTextBufferT result_string; + SaHpiBoolT result_string_is_uri; + } m_next; +}; + + +}; // namespace TA + + +#endif // TEST_H_FB2B5DD5_4E7D_49F5_9397_C2FEC21B4010 + Modified: openhpi/trunk/plugins/test_agent/utils.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/utils.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/utils.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -13,6 +13,7 @@ * Anton Pak <ant...@pi...> */ +#include <stddef.h> #include <string.h> #include <algorithm> @@ -25,6 +26,18 @@ /************************************************************** + * Entity Path Helpers + *************************************************************/ +void MakeUnspecifiedHpiEntityPath( SaHpiEntityPathT& ep ) +{ + for ( size_t i = 0; i < SAHPI_MAX_ENTITY_PATH; ++i ) { + ep.Entry[i].EntityType = SAHPI_ENT_UNSPECIFIED; + ep.Entry[i].EntityLocation = 0; + } +} + + +/************************************************************** * Text Buffer Helpers *************************************************************/ void MakeHpiTextBuffer( SaHpiTextBufferT& tb, const char * s ) Modified: openhpi/trunk/plugins/test_agent/utils.h =================================================================== --- openhpi/trunk/plugins/test_agent/utils.h 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/utils.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -82,6 +82,12 @@ /************************************************************** + * Entity Path Helpers + *************************************************************/ +void MakeUnspecifiedHpiEntityPath( SaHpiEntityPathT& ep ); + + +/************************************************************** * Text Buffer Helpers *************************************************************/ void MakeHpiTextBuffer( SaHpiTextBufferT& tb, const char * s ); Modified: openhpi/trunk/plugins/test_agent/watchdog.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/watchdog.cpp 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/watchdog.cpp 2012-06-05 16:31:01 UTC (rev 7453) @@ -16,6 +16,7 @@ #include <string> #include "codec.h" +#include "handler.h" #include "resource.h" #include "structs.h" #include "watchdog.h" @@ -98,8 +99,11 @@ *************************************************************/ const std::string cWatchdog::classname( "wdt" ); -cWatchdog::cWatchdog( cResource& resource, SaHpiWatchdogNumT num ) - : cInstrument( resource, +cWatchdog::cWatchdog( cHandler& handler, + cResource& resource, + SaHpiWatchdogNumT num ) + : cInstrument( handler, + resource, AssembleNumberedObjectName( classname, num ), SAHPI_WATCHDOG_RDR, MakeDefaultWatchdogRec( num ) ), @@ -111,7 +115,7 @@ cWatchdog::~cWatchdog() { - // empty + m_handler.CancelTimer( this ); } @@ -138,7 +142,7 @@ m_wdt.InitialCount = wdt.InitialCount; if ( wdt.Running == SAHPI_FALSE ) { - m_resource.GetTimers().CancelTimer( this ); + m_handler.CancelTimer( this ); m_wdt.Running = SAHPI_FALSE; } else { m_wdt.PresentCount = m_wdt.InitialCount; @@ -160,7 +164,7 @@ m_wdt.Running = SAHPI_TRUE; m_wdt.PresentCount = m_wdt.InitialCount; if ( m_wdt.InitialCount != 0 ) { - m_resource.GetTimers().SetTimer( this, 1000000LL ); // 1 ms tick + m_handler.SetTimer( this, 1000000LL ); // 1 ms tick } else { ProcessTick(); } @@ -192,23 +196,23 @@ if ( m_wdt.PretimerInterrupt != SAHPI_WPI_NONE ) { if ( m_wdt.PresentCount == m_wdt.PreTimeoutInterval ) { // Pre-timer interrupt - SendEvent( SAHPI_WAE_TIMER_INT ); + PostEvent( SAHPI_WAE_TIMER_INT ); } } if ( m_wdt.PresentCount == 0 ) { // Expired m_wdt.TimerUseExpFlags |= TimerUseToExpFlags( m_wdt.TimerUse ); m_wdt.Running = SAHPI_FALSE; - SendEvent( ActionEvent( m_wdt.TimerAction ) ); + PostEvent( ActionEvent( m_wdt.TimerAction ) ); } // Schedule next tick if ( m_wdt.Running != SAHPI_FALSE ) { - m_resource.GetTimers().SetTimer( this, 1000000LL ); // 1 ms tick + m_handler.SetTimer( this, 1000000LL ); // 1 ms tick } } -void cWatchdog::SendEvent( SaHpiWatchdogActionEventT ae ) +void cWatchdog::PostEvent( SaHpiWatchdogActionEventT ae ) { if ( m_wdt.Log == SAHPI_FALSE ) { return; @@ -216,13 +220,13 @@ SaHpiEventUnionT data; SaHpiWatchdogEventT& we = data.WatchdogEvent; - + we.WatchdogNum = m_rec.WatchdogNum; we.WatchdogAction = ae; we.WatchdogPreTimerAction = m_wdt.PretimerInterrupt; we.WatchdogUse = m_wdt.TimerUse; - PostEvent( SAHPI_ET_WATCHDOG, data, SAHPI_INFORMATIONAL ); + cInstrument::PostEvent( SAHPI_ET_WATCHDOG, data, SAHPI_INFORMATIONAL ); } Modified: openhpi/trunk/plugins/test_agent/watchdog.h =================================================================== --- openhpi/trunk/plugins/test_agent/watchdog.h 2012-06-05 06:02:32 UTC (rev 7452) +++ openhpi/trunk/plugins/test_agent/watchdog.h 2012-06-05 16:31:01 UTC (rev 7453) @@ -36,7 +36,9 @@ static const std::string classname; ... [truncated message content] |
From: <av...@us...> - 2012-06-13 14:50:51
|
Revision: 7467 http://openhpi.svn.sourceforge.net/openhpi/?rev=7467&view=rev Author: avpak Date: 2012-06-13 14:50:45 +0000 (Wed, 13 Jun 2012) Log Message: ----------- Fix for #3534897 Modified Paths: -------------- openhpi/trunk/include/oh_plugin.h openhpi/trunk/openhpid/ohpi.c openhpi/trunk/openhpid/plugin.c Modified: openhpi/trunk/include/oh_plugin.h =================================================================== --- openhpi/trunk/include/oh_plugin.h 2012-06-11 21:32:22 UTC (rev 7466) +++ openhpi/trunk/include/oh_plugin.h 2012-06-13 14:50:45 UTC (rev 7467) @@ -19,6 +19,7 @@ #include <glib.h> #include <gmodule.h> +#include <oHpi.h> #include <oh_handler.h> #ifdef __cplusplus @@ -96,6 +97,7 @@ int oh_getnext_handler_id(unsigned int hid, unsigned int *next_hid); SaErrorT oh_create_handler(GHashTable *handler_config, unsigned int *hid); int oh_destroy_handler(unsigned int hid); +SaErrorT oh_get_handler_info(unsigned int hid, oHpiHandlerInfoT *info, GHashTable *conf_params); SaErrorT oh_discovery(void); /* Bind abi functions into plugin */ Modified: openhpi/trunk/openhpid/ohpi.c =================================================================== --- openhpi/trunk/openhpid/ohpi.c 2012-06-11 21:32:22 UTC (rev 7466) +++ openhpi/trunk/openhpid/ohpi.c 2012-06-13 14:50:45 UTC (rev 7467) @@ -153,20 +153,15 @@ /** * oHpiHandlerInfo **/ -// function to copy hash table -static void copy_hashed_config_info (gpointer key, gpointer value, gpointer newhash) -{ - g_hash_table_insert ( newhash, g_strdup(key), g_strdup(value) ); -} SaErrorT SAHPI_API oHpiHandlerInfo ( SAHPI_IN SaHpiSessionIdT sid, SAHPI_IN oHpiHandlerIdT id, SAHPI_OUT oHpiHandlerInfoT *info, SAHPI_INOUT GHashTable *conf_params ) { + SaErrorT error = SA_OK; SaHpiDomainIdT did; struct oh_domain *d = NULL; - struct oh_handler *h = NULL; if (sid == 0) return SA_ERR_HPI_INVALID_SESSION; @@ -184,35 +179,11 @@ return SA_ERR_HPI_INTERNAL_ERROR; } - h = oh_get_handler(id); - if (!h) { - oh_release_domain(d); /* Unlock domain */ - return SA_ERR_HPI_NOT_PRESENT; - } + error = oh_get_handler_info(id, info, conf_params); - info->id = id; - strncpy((char*)info->plugin_name, h->plugin_name, MAX_PLUGIN_NAME_LENGTH); - oh_init_ep(&info->entity_root); - const char * entity_root_str = (const char *)g_hash_table_lookup(h->config, "entity_root"); - if ( entity_root_str ) { - oh_encode_entitypath(entity_root_str, &info->entity_root); - } - - if (!h->hnd) info->load_failed = 1; - else info->load_failed = 0; - - // copy h->config to the output hash table - g_hash_table_foreach(h->config,copy_hashed_config_info,conf_params); - - //Don't transmit passwords in case the handler has a password in its config - if (g_hash_table_lookup(conf_params,"password")) - g_hash_table_replace(conf_params, - g_strdup("password"), g_strdup("********")); - - oh_release_handler(h); oh_release_domain(d); /* Unlock domain */ - return SA_OK; + return error; } /** Modified: openhpi/trunk/openhpid/plugin.c =================================================================== --- openhpi/trunk/openhpid/plugin.c 2012-06-11 21:32:22 UTC (rev 7466) +++ openhpi/trunk/openhpid/plugin.c 2012-06-13 14:50:45 UTC (rev 7467) @@ -30,6 +30,7 @@ #include <oh_domain.h> #include <oh_error.h> #include <oh_plugin.h> +#include <oh_utils.h> #include "conf.h" #include "event.h" @@ -645,6 +646,59 @@ } /** + * oh_get_handler_info + * + * Returns: SA_OK on success. + **/ + +// helper function to copy hash table +static void copy_hashed_config_info (gpointer key, gpointer value, gpointer newhash) +{ + g_hash_table_insert ( newhash, g_strdup(key), g_strdup(value) ); +} + +SaErrorT oh_get_handler_info(unsigned int hid, oHpiHandlerInfoT *info, GHashTable *conf_params) +{ + struct oh_handler *h = NULL; + GSList *node = NULL; + + if ((hid == 0) || (!info) || (!conf_params)) { + return SA_ERR_HPI_INVALID_PARAMS; + } + + g_static_rec_mutex_lock(&oh_handlers.lock); + node = g_hash_table_lookup(oh_handlers.table, &hid); + h = node ? (struct oh_handler *)(node->data) : NULL; + if (!h) { + g_static_rec_mutex_unlock(&oh_handlers.lock); + return SA_ERR_HPI_NOT_PRESENT; + } + + info->id = hid; + strncpy((char*)info->plugin_name, (const char*)h->plugin_name, MAX_PLUGIN_NAME_LENGTH); + oh_init_ep(&info->entity_root); + const char * entity_root_str = (const char *)g_hash_table_lookup(h->config, "entity_root"); + if ( entity_root_str ) { + oh_encode_entitypath(entity_root_str, &info->entity_root); + } + + info->load_failed = (!h->hnd) ? 1 : 0; + + // copy h->config to the output hash table + g_hash_table_foreach(h->config,copy_hashed_config_info,conf_params); + + //Don't transmit passwords in case the handler has a password in its config + if (g_hash_table_lookup(conf_params,"password")) + g_hash_table_replace(conf_params, + g_strdup("password"), + g_strdup("********")); + + g_static_rec_mutex_unlock(&oh_handlers.lock); + + return SA_OK; +} + +/** * oh_discover_resources * * Returns: SA_OK on success. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2012-06-25 21:39:59
|
Revision: 7473 http://openhpi.svn.sourceforge.net/openhpi/?rev=7473&view=rev Author: avpak Date: 2012-06-25 21:39:50 +0000 (Mon, 25 Jun 2012) Log Message: ----------- Feature request #3530531 Modified Paths: -------------- openhpi/trunk/plugins/test_agent/Makefile.am openhpi/trunk/plugins/test_agent/Makefile.mingw32 openhpi/trunk/plugins/test_agent/abi.cpp openhpi/trunk/plugins/test_agent/console.cpp openhpi/trunk/plugins/test_agent/control.cpp openhpi/trunk/plugins/test_agent/control.h openhpi/trunk/plugins/test_agent/dimi.cpp openhpi/trunk/plugins/test_agent/dimi.h openhpi/trunk/plugins/test_agent/fumi.cpp openhpi/trunk/plugins/test_agent/fumi.h openhpi/trunk/plugins/test_agent/instrument.cpp openhpi/trunk/plugins/test_agent/instrument.h openhpi/trunk/plugins/test_agent/object.cpp openhpi/trunk/plugins/test_agent/object.h openhpi/trunk/plugins/test_agent/sensor.cpp openhpi/trunk/plugins/test_agent/sensor.h openhpi/trunk/plugins/test_agent/structs.cpp openhpi/trunk/plugins/test_agent/structs.h openhpi/trunk/plugins/test_agent/test.cpp openhpi/trunk/plugins/test_agent/test.h openhpi/trunk/plugins/test_agent/timers.cpp openhpi/trunk/plugins/test_agent/timers.h openhpi/trunk/plugins/test_agent/utils.h openhpi/trunk/test_agent.data.example Added Paths: ----------- openhpi/trunk/plugins/test_agent/bank.cpp openhpi/trunk/plugins/test_agent/bank.h Modified: openhpi/trunk/plugins/test_agent/Makefile.am =================================================================== --- openhpi/trunk/plugins/test_agent/Makefile.am 2012-06-21 10:42:54 UTC (rev 7472) +++ openhpi/trunk/plugins/test_agent/Makefile.am 2012-06-25 21:39:50 UTC (rev 7473) @@ -31,6 +31,8 @@ annunciator.h \ area.cpp \ area.h \ + bank.cpp \ + bank.h \ codec.cpp \ codec.h \ console.cpp \ Modified: openhpi/trunk/plugins/test_agent/Makefile.mingw32 =================================================================== --- openhpi/trunk/plugins/test_agent/Makefile.mingw32 2012-06-21 10:42:54 UTC (rev 7472) +++ openhpi/trunk/plugins/test_agent/Makefile.mingw32 2012-06-25 21:39:50 UTC (rev 7473) @@ -6,6 +6,7 @@ announcement.cpp \ annunciator.cpp \ area.cpp \ + bank.cpp \ codec.cpp \ console.cpp \ control.cpp \ Modified: openhpi/trunk/plugins/test_agent/abi.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/abi.cpp 2012-06-21 10:42:54 UTC (rev 7472) +++ openhpi/trunk/plugins/test_agent/abi.cpp 2012-06-25 21:39:50 UTC (rev 7473) @@ -26,6 +26,7 @@ #include "abi.h" #include "annunciator.h" #include "area.h" +#include "bank.h" #include "control.h" #include "dimi.h" #include "fumi.h" @@ -228,7 +229,23 @@ return 0; } +static cBank * GetBank( cHandler * h, + SaHpiResourceIdT rid, + SaHpiFumiNumT num, + SaHpiBankNumT bnum ) +{ + cFumi * fumi = GetFumi( h, rid, num ); + if ( fumi ) { + cBank * bank = fumi->GetBank( bnum ); + if ( bank && bank->IsVisible() ) { + return bank; + } + } + return 0; +} + + }; // namespace TA @@ -1355,7 +1372,14 @@ SaHpiFumiNumT num, SaHpiFumiSpecInfoT * specinfo ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cFumi * fumi = TA::GetFumi( handler, rid, num ); + if ( !fumi ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return fumi->GetSpecInfo( *specinfo ); } @@ -1369,7 +1393,14 @@ SaHpiFumiNumT num, SaHpiFumiServiceImpactDataT * serviceimpact ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cFumi * fumi = TA::GetFumi( handler, rid, num ); + if ( !fumi ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return fumi->GetServiceImpact( *serviceimpact ); } @@ -1384,7 +1415,14 @@ SaHpiBankNumT banknum, SaHpiTextBufferT * sourceuri ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, banknum ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->SetSource( *sourceuri ); } @@ -1398,7 +1436,14 @@ SaHpiFumiNumT num, SaHpiBankNumT banknum ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, banknum ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->StartSourceValidation(); } @@ -1413,7 +1458,14 @@ SaHpiBankNumT banknum, SaHpiFumiSourceInfoT * sourceinfo ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, banknum ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->GetSourceInfo( *sourceinfo ); } @@ -1430,7 +1482,14 @@ SaHpiEntryIdT * nextcompid, SaHpiFumiComponentInfoT * compinfo ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, banknum ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->GetSourceComponentInfo( compid, *nextcompid, *compinfo ); } @@ -1445,7 +1504,14 @@ SaHpiBankNumT banknum, SaHpiFumiBankInfoT * bankinfo ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, banknum ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->GetTargetInfo( *bankinfo ); } @@ -1462,7 +1528,14 @@ SaHpiEntryIdT * nextcompid, SaHpiFumiComponentInfoT * compinfo ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, banknum ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->GetTargetComponentInfo( compid, *nextcompid, *compinfo ); } @@ -1476,7 +1549,14 @@ SaHpiFumiNumT num, SaHpiFumiLogicalBankInfoT * bankinfo ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, 0 ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->GetLogicalTargetInfo( *bankinfo ); } @@ -1492,7 +1572,14 @@ SaHpiEntryIdT * nextcompid, SaHpiFumiLogicalComponentInfoT * compinfo ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, 0 ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->GetLogicalTargetComponentInfo( compid, *nextcompid, *compinfo ); } @@ -1505,7 +1592,14 @@ SaHpiResourceIdT rid, SaHpiFumiNumT num ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, 0 ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->StartBackup(); } @@ -1520,7 +1614,14 @@ SaHpiBankNumT banknum, SaHpiUint32T position ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cFumi * fumi = TA::GetFumi( handler, rid, num ); + if ( !fumi ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return fumi->SetBootOrder( banknum, position ); } @@ -1535,7 +1636,14 @@ SaHpiBankNumT sourcebanknum, SaHpiBankNumT targetbanknum ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, sourcebanknum ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->StartCopy( targetbanknum ); } @@ -1549,7 +1657,14 @@ SaHpiFumiNumT num, SaHpiBankNumT banknum ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, banknum ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->StartInstallation(); } @@ -1564,7 +1679,14 @@ SaHpiBankNumT banknum, SaHpiFumiUpgradeStatusT * status ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, banknum ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->GetUpgradeStatus( *status ); } @@ -1578,7 +1700,14 @@ SaHpiFumiNumT num, SaHpiBankNumT banknum ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, banknum ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->StartTargetVerification(); } @@ -1591,7 +1720,14 @@ SaHpiResourceIdT rid, SaHpiFumiNumT num ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, 0 ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->StartTargetMainVerification(); } @@ -1605,7 +1741,14 @@ SaHpiFumiNumT num, SaHpiBankNumT banknum ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, banknum ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->CancelUpgrade(); } @@ -1619,7 +1762,14 @@ SaHpiFumiNumT num, SaHpiBoolT * disable ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cFumi * fumi = TA::GetFumi( handler, rid, num ); + if ( !fumi ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return fumi->GetAutoRollbackDisabled( *disable ); } @@ -1633,7 +1783,14 @@ SaHpiFumiNumT num, SaHpiBoolT disable ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cFumi * fumi = TA::GetFumi( handler, rid, num ); + if ( !fumi ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return fumi->SetAutoRollbackDisabled( disable ); } @@ -1646,7 +1803,14 @@ SaHpiResourceIdT rid, SaHpiFumiNumT num ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, 0 ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->StartRollback(); } @@ -1673,7 +1837,14 @@ SaHpiFumiNumT num, SaHpiBoolT logical ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cFumi * fumi = TA::GetFumi( handler, rid, num ); + if ( !fumi ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return fumi->StartActivation( logical ); } @@ -1687,7 +1858,14 @@ SaHpiFumiNumT num, SaHpiBankNumT banknum ) { - return SA_ERR_HPI_UNSUPPORTED_API; + TA::cHandler * handler = TA::GetHandler( hnd ); + TA::cLocker<TA::cHandler> al( handler ); + TA::cBank * b = TA::GetBank( handler, rid, num, banknum ); + if ( !b ) { + return SA_ERR_HPI_NOT_PRESENT; + } + + return b->Cleanup(); } Added: openhpi/trunk/plugins/test_agent/bank.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/bank.cpp (rev 0) +++ openhpi/trunk/plugins/test_agent/bank.cpp 2012-06-25 21:39:50 UTC (rev 7473) @@ -0,0 +1,1068 @@ +/* -*- c++ -*- + * + * (C) Copyright Pigeon Point Systems. 2012 + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTAREALITY 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): + * Anton Pak <ant...@pi...> + */ + +#include <stdio.h> + +#include <string> + +#include "bank.h" +#include "codec.h" +#include "fumi.h" +#include "handler.h" +#include "structs.h" +#include "utils.h" + + +namespace TA { + + +/************************************************************** + * Helper functions + *************************************************************/ +static SaHpiFumiBankInfoT MakeDefaultBankInfo( SaHpiBankNumT num ) +{ + SaHpiFumiBankInfoT info; + + info.BankId = num; + info.BankSize = ( num == 0 ) ? 0 : 42; + info.Position = num; + info.BankState = ( num == 0 ) ? SAHPI_FUMI_BANK_UNKNOWN : SAHPI_FUMI_BANK_VALID; + FormatHpiTextBuffer( info.Identifier, "/banks/bank%u.img", (unsigned int)num ); + MakeHpiTextBuffer( info.Description, "Firmware" ); + MakeHpiTextBuffer( info.DateTime, "1979-06-10" ); + info.MajorVersion = 1; + info.MinorVersion = 2; + info.AuxVersion = 3; + + return info; +} + +static SaHpiFumiLogicalBankInfoT MakeDefaultLogicalBankInfo( SaHpiBankNumT num ) +{ + SaHpiFumiLogicalBankInfoT info; + + info.FirmwarePersistentLocationCount = 3; + info.BankStateFlags = 0; + + SaHpiFumiFirmwareInstanceInfoT& pfw = info.PendingFwInstance; + pfw.InstancePresent = SAHPI_FALSE; + FormatHpiTextBuffer( pfw.Identifier, "/banks/bank%u_pending.img", (unsigned int)num ); + MakeHpiTextBuffer( pfw.Description, "Firmware" ); + MakeHpiTextBuffer( pfw.DateTime, "1979-06-14" ); + pfw.MajorVersion = 1; + pfw.MinorVersion = 2; + pfw.AuxVersion = 4; + + SaHpiFumiFirmwareInstanceInfoT& rfw = info.RollbackFwInstance; + rfw.InstancePresent = SAHPI_FALSE; + FormatHpiTextBuffer( rfw.Identifier, "/banks/bank%u_rollback.img", (unsigned int)num ); + MakeHpiTextBuffer( rfw.Description, "Firmware" ); + MakeHpiTextBuffer( rfw.DateTime, "1979-06-05" ); + rfw.MajorVersion = 1; + rfw.MinorVersion = 2; + rfw.AuxVersion = 2; + + return info; +} + +static SaHpiFumiSourceInfoT MakeDefaultSourceInfo() +{ + SaHpiFumiSourceInfoT info; + + MakeHpiTextBuffer( info.SourceUri, "file:///tmp/1.fw" ); + info.SourceStatus = SAHPI_FUMI_SRC_VALID; + MakeHpiTextBuffer( info.Identifier, "" ); + MakeHpiTextBuffer( info.Description, "Firmware" ); + MakeHpiTextBuffer( info.DateTime, "1979-06-14" ); + info.MajorVersion = 1; + info.MinorVersion = 2; + info.AuxVersion = 4; + + return info; +} + +static void MakeDefaultComponents( SaHpiFumiComponentInfoT * components, + size_t max_components ) +{ + for ( size_t i = 0; i < max_components; ++i ) { + SaHpiFumiComponentInfoT& c = components[i]; + SaHpiFumiFirmwareInstanceInfoT& fw = c.MainFwInstance; + + c.EntryId = i; + c.ComponentId = i; + fw.InstancePresent = SAHPI_TRUE; + FormatHpiTextBuffer( fw.Identifier, "/components/component%u.img", (unsigned int)i ); + MakeHpiTextBuffer( fw.Description, "Firmware" ); + MakeHpiTextBuffer( fw.DateTime, "1979-06-10" ); + fw.MajorVersion = 1; + fw.MinorVersion = 2; + fw.AuxVersion = 3; + c.ComponentFlags = 0; + } +} + +static void MakeDefaultLogicalComponents( SaHpiFumiLogicalComponentInfoT * components, + size_t max_components ) +{ + for ( size_t i = 0; i < max_components; ++i ) { + SaHpiFumiLogicalComponentInfoT& c = components[i]; + + c.EntryId = i; + c.ComponentId = i; + + SaHpiFumiFirmwareInstanceInfoT& pfw = c.PendingFwInstance; + pfw.InstancePresent = SAHPI_FALSE; + FormatHpiTextBuffer( pfw.Identifier, "/components/component%u_pending.img", (unsigned int)i ); + MakeHpiTextBuffer( pfw.Description, "Firmware" ); + MakeHpiTextBuffer( pfw.DateTime, "1979-06-14" ); + pfw.MajorVersion = 1; + pfw.MinorVersion = 2; + pfw.AuxVersion = 4; + + SaHpiFumiFirmwareInstanceInfoT& rfw = c.RollbackFwInstance; + rfw.InstancePresent = SAHPI_FALSE; + FormatHpiTextBuffer( rfw.Identifier, "/components/component%u_rollback.img", (unsigned int)i ); + MakeHpiTextBuffer( rfw.Description, "Firmware" ); + MakeHpiTextBuffer( rfw.DateTime, "1979-06-05" ); + rfw.MajorVersion = 1; + rfw.MinorVersion = 2; + rfw.AuxVersion = 2; + + c.ComponentFlags = 0; + } +} + +static void MakeDefaultSourceComponents( SaHpiFumiComponentInfoT * components, + size_t max_components ) +{ + for ( size_t i = 0; i < max_components; ++i ) { + SaHpiFumiComponentInfoT& c = components[i]; + SaHpiFumiFirmwareInstanceInfoT& fw = c.MainFwInstance; + + c.EntryId = i; + c.ComponentId = i; + fw.InstancePresent = SAHPI_TRUE; + FormatHpiTextBuffer( fw.Identifier, "/components/component%u.img", (unsigned int)i ); + MakeHpiTextBuffer( fw.Description, "Firmware" ); + MakeHpiTextBuffer( fw.DateTime, "1979-06-14" ); + fw.MajorVersion = 1; + fw.MinorVersion = 2; + fw.AuxVersion = 4; + c.ComponentFlags = 0; + } +} + +static bool GetEntryIds( SaHpiEntryIdT requested_eid, + const SaHpiBoolT * arr_enabled, + size_t arr_size, + SaHpiEntryIdT& eid, + SaHpiEntryIdT& next_eid ) +{ + if ( requested_eid >= arr_size ) { + return false; + } + if ( requested_eid == SAHPI_FIRST_ENTRY ) { + eid = SAHPI_LAST_ENTRY; + for ( SaHpiEntryIdT i = 0; i < arr_size; ++i ) { + if ( arr_enabled[i] != SAHPI_FALSE ) { + eid = i; + break; + } + } + if ( eid == SAHPI_LAST_ENTRY ) { + return false; + } + } else { + eid = requested_eid; + if ( arr_enabled[eid] == SAHPI_FALSE ) { + return false; + } + } + next_eid = SAHPI_LAST_ENTRY; + for ( SaHpiEntryIdT i = eid + 1; i < arr_size; ++i ) { + if ( arr_enabled[i] != SAHPI_FALSE ) { + next_eid = i; + break; + } + } + + return true; +} + +static void ResetSourceInfo( SaHpiFumiSourceInfoT& info, + SaHpiFumiSourceStatusT status, + bool reset_uri ) +{ + if ( reset_uri ) { + MakeHpiTextBuffer( info.SourceUri, "" ); + } + info.SourceStatus = status; + MakeHpiTextBuffer( info.Identifier, "" ); + MakeHpiTextBuffer( info.Description, "" ); + MakeHpiTextBuffer( info.DateTime, "" ); + info.MajorVersion = 0; + info.MinorVersion = 0; + info.AuxVersion = 0; +} + +static void ResetComponents( SaHpiBoolT * enabled, + SaHpiFumiComponentInfoT * components, + size_t max_components ) +{ + for ( size_t i = 0; i < max_components; ++i ) { + enabled[i] = SAHPI_FALSE; + + SaHpiFumiComponentInfoT& c = components[i]; + SaHpiFumiFirmwareInstanceInfoT& fw = c.MainFwInstance; + + c.EntryId = i; + c.ComponentId = i; + fw.InstancePresent = SAHPI_FALSE; + MakeHpiTextBuffer( fw.Identifier, "" ); + MakeHpiTextBuffer( fw.Description, "" ); + MakeHpiTextBuffer( fw.DateTime, "" ); + fw.MajorVersion = 0; + fw.MinorVersion = 0; + fw.AuxVersion = 0; + c.ComponentFlags = 0; + } +} + +static bool SplitUri( const SaHpiTextBufferT& uri, + std::string& proto, + std::string& path ) +{ + std::string s; + ToTxt( Var( dtSaHpiTextBufferT, "", &uri, 0 ), s ); + + size_t pos = 0, pos2; + + pos2 = s.find_first_of( ':', pos ); + if ( pos2 == std::string::npos ) { + return false; + } + std::string type( s.begin() + pos, s.begin() + pos2 ); + if ( ( type != "TEXT" ) && ( type != "ASCII6" ) ) { + return false; + } + + pos = pos2 + 1; + pos2 = s.find( "://", pos ); + if ( pos2 == std::string::npos ) { + return false; + } + proto.assign( s.begin() + pos, s.begin() + pos2 ); + + pos = pos2 + 3; + if ( pos >= s.size() ) { + return false; + } + path.assign( s.begin() + pos, s.end() ); + + return true; +} + + +/************************************************************** + * class cBank + *************************************************************/ +const std::string cBank::classname( "bank" ); + +cBank::cBank( cHandler& handler, cFumi& fumi, SaHpiBankNumT num ) + : cObject( AssembleNumberedObjectName( classname, num ) ), + m_handler( handler ), + m_fumi( fumi ), + m_info( MakeDefaultBankInfo( num ) ), + m_logical_info( MakeDefaultLogicalBankInfo( num ) ), + m_src_set( SAHPI_FALSE ), + m_src_info( MakeDefaultSourceInfo() ), + m_status( SAHPI_FUMI_OPERATION_NOTSTARTED ), + m_verify_main( false ), + m_copy_dest_num( 0xFFU ) +{ + MakeDefaultComponents( m_components, MAX_COMPONENTS ); + MakeDefaultLogicalComponents( m_logical_components, MAX_COMPONENTS ); + MakeDefaultSourceComponents( m_src_components, MAX_COMPONENTS ); + + for ( size_t i = 0; i < MAX_COMPONENTS; ++i ) { + m_enabled_components[i] = SAHPI_FALSE; + m_enabled_src_components[i] = SAHPI_FALSE; + } + + m_enabled_components[2] = SAHPI_TRUE; + m_enabled_components[5] = SAHPI_TRUE; + + m_enabled_src_components[1] = SAHPI_TRUE; + m_enabled_src_components[3] = SAHPI_TRUE; + + m_next.action_duration = 5000000000LL; // 5 sec + m_next.pass.validate = SAHPI_TRUE; + m_next.pass.install = SAHPI_TRUE; + m_next.pass.rollback = SAHPI_TRUE; + m_next.pass.backup = SAHPI_TRUE; + m_next.pass.copy = SAHPI_TRUE; + m_next.pass.verify = SAHPI_TRUE; + m_next.pass.verifymain = SAHPI_TRUE; + m_next.pass.activate = SAHPI_TRUE; + m_next.src_fail_status = SAHPI_FUMI_SRC_UNREACHABLE; + m_next.src_info = MakeDefaultSourceInfo(); +} + +cBank::~cBank() +{ + m_handler.CancelTimer( this ); +} + + +SaHpiUint32T cBank::Position() const +{ + return m_info.Position; +} + +void cBank::SetPosition( SaHpiUint32T pos ) +{ + m_info.Position = pos; +} + +SaHpiFumiBankStateT cBank::State() const +{ + return m_info.BankState; +} + + +// HPI Interface +SaErrorT cBank::SetSource( const SaHpiTextBufferT& uri ) +{ + if ( m_src_set != SAHPI_FALSE ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + ResetSourceInfo( m_src_info, SAHPI_FUMI_SRC_VALIDATION_NOT_STARTED, true ); + ResetComponents( m_enabled_src_components, m_src_components, MAX_COMPONENTS ); + m_src_info.SourceUri = uri; + m_src_set = SAHPI_TRUE; + + return SA_OK; +} + +SaErrorT cBank::StartSourceValidation() +{ + if ( m_src_set == SAHPI_FALSE ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + bool has = m_handler.HasTimerSet( this ); + if ( has ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + m_src_info.SourceStatus = SAHPI_FUMI_SRC_VALIDATION_INITIATED; + ChangeStatus( SAHPI_FUMI_SOURCE_VALIDATION_INITIATED ); + m_handler.SetTimer( this, m_next.action_duration ); + + return SA_OK; +} + +SaErrorT cBank::GetSourceInfo( SaHpiFumiSourceInfoT& info ) const +{ + if ( m_src_set == SAHPI_FALSE ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + info = m_src_info; + + return SA_OK; +} + +SaErrorT cBank::GetSourceComponentInfo( SaHpiEntryIdT eid, + SaHpiEntryIdT& next_eid, + SaHpiFumiComponentInfoT& info ) const +{ + if ( ( m_fumi.Capabilities() & SAHPI_FUMI_CAP_COMPONENTS ) == 0 ) { + return SA_ERR_HPI_CAPABILITY; + } + + if ( m_src_set == SAHPI_FALSE ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + bool rc = GetEntryIds( eid, + m_enabled_src_components, + MAX_COMPONENTS, + eid, + next_eid ); + if ( !rc ) { + return SA_ERR_HPI_NOT_PRESENT; + } + info = m_src_components[eid]; + + return SA_OK; +} + +SaErrorT cBank::GetTargetInfo( SaHpiFumiBankInfoT& info ) const +{ + info = m_info; + return SA_OK; +} + +SaErrorT cBank::GetTargetComponentInfo( SaHpiEntryIdT eid, + SaHpiEntryIdT& next_eid, + SaHpiFumiComponentInfoT& info ) const +{ + if ( ( m_fumi.Capabilities() & SAHPI_FUMI_CAP_COMPONENTS ) == 0 ) { + return SA_ERR_HPI_CAPABILITY; + } + + bool rc = GetEntryIds( eid, + m_enabled_components, + MAX_COMPONENTS, + eid, + next_eid ); + if ( !rc ) { + return SA_ERR_HPI_NOT_PRESENT; + } + info = m_components[eid]; + + return SA_OK; +} + +SaErrorT cBank::GetLogicalTargetInfo( SaHpiFumiLogicalBankInfoT& info ) const +{ + if ( m_info.BankId != 0 ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + info = m_logical_info; + + return SA_OK; +} + +SaErrorT cBank::GetLogicalTargetComponentInfo( SaHpiEntryIdT eid, + SaHpiEntryIdT& next_eid, + SaHpiFumiLogicalComponentInfoT& info ) const +{ + if ( ( m_fumi.Capabilities() & SAHPI_FUMI_CAP_COMPONENTS ) == 0 ) { + return SA_ERR_HPI_CAPABILITY; + } + + if ( m_info.BankId != 0 ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + bool rc = GetEntryIds( eid, + m_enabled_components, + MAX_COMPONENTS, + eid, + next_eid ); + if ( !rc ) { + return SA_ERR_HPI_NOT_PRESENT; + } + info = m_logical_components[eid]; + + return SA_OK; +} + +SaErrorT cBank::StartBackup() +{ + if ( ( m_fumi.Capabilities() & SAHPI_FUMI_CAP_BACKUP ) == 0 ) { + return SA_ERR_HPI_CAPABILITY; + } + + if ( m_info.BankId != 0 ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + bool has = m_handler.HasTimerSet( this ); + if ( has ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + ChangeStatus( SAHPI_FUMI_BACKUP_INITIATED ); + m_handler.SetTimer( this, m_next.action_duration ); + + return SA_OK; +} + +SaErrorT cBank::StartCopy( SaHpiBankNumT dest_num ) +{ + if ( ( m_fumi.Capabilities() & SAHPI_FUMI_CAP_BANKCOPY ) == 0 ) { + return SA_ERR_HPI_CAPABILITY; + } + + if ( m_info.BankId == 0 ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + if ( dest_num == 0 ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + if ( m_info.BankId == dest_num ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + cBank * dest = m_fumi.GetBank( dest_num ); + if ( !dest ) { + return SA_ERR_HPI_INVALID_DATA; + } + + bool has = m_handler.HasTimerSet( this ); + if ( has ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + m_copy_dest_num = dest_num; + ChangeStatus( SAHPI_FUMI_BANK_COPY_INITIATED ); + m_handler.SetTimer( this, m_next.action_duration ); + + return SA_OK; +} + +SaErrorT cBank::StartInstallation() +{ + if ( m_src_set == SAHPI_FALSE ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + bool ok = false; + ok = ok || ( m_src_info.SourceStatus == SAHPI_FUMI_SRC_VALID ); + ok = ok || ( m_src_info.SourceStatus == SAHPI_FUMI_SRC_VALIDITY_UNKNOWN ); + if ( !ok ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + bool has = m_handler.HasTimerSet( this ); + if ( has ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + ChangeStatus( SAHPI_FUMI_INSTALL_INITIATED ); + m_handler.SetTimer( this, m_next.action_duration ); + + return SA_OK; +} + +SaErrorT cBank::GetUpgradeStatus( SaHpiFumiUpgradeStatusT& status ) const +{ + status = m_status; + return SA_OK; +} + +SaErrorT cBank::StartTargetVerification() +{ + if ( ( m_fumi.Capabilities() & SAHPI_FUMI_CAP_TARGET_VERIFY ) == 0 ) { + return SA_ERR_HPI_CAPABILITY; + } + + if ( m_src_set == SAHPI_FALSE ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + bool ok = false; + ok = ok || ( m_src_info.SourceStatus == SAHPI_FUMI_SRC_VALID ); + ok = ok || ( m_src_info.SourceStatus == SAHPI_FUMI_SRC_VALIDITY_UNKNOWN ); + if ( !ok ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + if ( m_info.BankId == 0 ) { + if ( m_logical_info.PendingFwInstance.InstancePresent == SAHPI_FALSE ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + } + + bool has = m_handler.HasTimerSet( this ); + if ( has ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + m_verify_main = false; + ChangeStatus( SAHPI_FUMI_TARGET_VERIFY_INITIATED ); + m_handler.SetTimer( this, m_next.action_duration ); + + return SA_OK; +} + +SaErrorT cBank::StartTargetMainVerification() +{ + if ( ( m_fumi.Capabilities() & SAHPI_FUMI_CAP_TARGET_VERIFY_MAIN ) == 0 ) { + return SA_ERR_HPI_CAPABILITY; + } + + if ( m_info.BankId != 0 ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + if ( m_src_set == SAHPI_FALSE ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + bool ok = false; + ok = ok || ( m_src_info.SourceStatus == SAHPI_FUMI_SRC_VALID ); + ok = ok || ( m_src_info.SourceStatus == SAHPI_FUMI_SRC_VALIDITY_UNKNOWN ); + if ( !ok ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + bool has = m_handler.HasTimerSet( this ); + if ( has ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + m_verify_main = true; + ChangeStatus( SAHPI_FUMI_TARGET_VERIFY_INITIATED ); + m_handler.SetTimer( this, m_next.action_duration ); + + return SA_OK; +} + +SaErrorT cBank::CancelUpgrade() +{ + bool has = m_handler.HasTimerSet( this ); + if ( !has ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + m_handler.CancelTimer( this ); + + SaHpiFumiUpgradeStatusT new_status; + + switch ( m_status ) { + case SAHPI_FUMI_SOURCE_VALIDATION_INITIATED: + new_status = SAHPI_FUMI_SOURCE_VALIDATION_CANCELLED; + break; + case SAHPI_FUMI_INSTALL_INITIATED: + new_status = SAHPI_FUMI_INSTALL_CANCELLED; + break; + case SAHPI_FUMI_BACKUP_INITIATED: + new_status = SAHPI_FUMI_BACKUP_CANCELLED; + break; + case SAHPI_FUMI_BANK_COPY_INITIATED: + new_status = SAHPI_FUMI_BANK_COPY_CANCELLED; + break; + case SAHPI_FUMI_TARGET_VERIFY_INITIATED: + new_status = SAHPI_FUMI_TARGET_VERIFY_CANCELLED; + break; + case SAHPI_FUMI_ACTIVATE_INITIATED: + new_status = SAHPI_FUMI_ACTIVATE_CANCELLED; + break; + case SAHPI_FUMI_ROLLBACK_INITIATED: + case SAHPI_FUMI_INSTALL_FAILED_ROLLBACK_INITIATED: + case SAHPI_FUMI_ACTIVATE_FAILED_ROLLBACK_INITIATED: + new_status = SAHPI_FUMI_ROLLBACK_CANCELLED; + break; + default: + new_status = m_status; + } + + ChangeStatus( new_status ); + + return SA_OK; +} + +SaErrorT cBank::StartRollback() +{ + if ( ( m_fumi.Capabilities() & SAHPI_FUMI_CAP_ROLLBACK ) == 0 ) { + return SA_ERR_HPI_CAPABILITY; + } + + if ( m_info.BankId != 0 ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + if ( m_logical_info.RollbackFwInstance.InstancePresent == SAHPI_FALSE ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + bool has = m_handler.HasTimerSet( this ); + if ( has ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + ChangeStatus( SAHPI_FUMI_ROLLBACK_INITIATED ); + m_handler.SetTimer( this, m_next.action_duration ); + + return SA_OK; +} + +SaErrorT cBank::StartActivation( SaHpiBoolT pass ) +{ + if ( m_info.BankId == 0 ) { + if ( m_logical_info.PendingFwInstance.InstancePresent == SAHPI_FALSE ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + } + + bool has = m_handler.HasTimerSet( this ); + if ( has ) { + return SA_ERR_HPI_INVALID_REQUEST; + } + + m_next.pass.activate = pass; + ChangeStatus( SAHPI_FUMI_ACTIVATE_INITIATED ); + m_handler.SetTimer( this, m_next.action_duration ); + + return SA_OK; +} + +SaErrorT cBank::Cleanup() +{ + m_handler.CancelTimer( this ); + + ResetSourceInfo( m_src_info, SAHPI_FUMI_SRC_VALIDATION_NOT_STARTED, true ); + ResetComponents( m_enabled_src_components, m_src_components, MAX_COMPONENTS ); + m_src_set = SAHPI_FALSE; + + m_verify_main = false; + m_copy_dest_num = 0xFFU; + + ChangeStatus( SAHPI_FUMI_OPERATION_NOTSTARTED ); + + return SA_OK; +} + + +// cObject virtual functions +void cBank::GetVars( cVars& vars ) +{ + cObject::GetVars( vars ); + Structs::GetVars( m_info, vars ); + if ( m_info.BankId == 0 ) { + Structs::GetVars( m_logical_info, vars ); + } + + for ( size_t i = 0; i < MAX_COMPONENTS; ++i ) { + char prefix[256]; + snprintf( &prefix[0], sizeof(prefix), "Component[%u]", (unsigned int)i ); + const std::string name( prefix ); + + vars << name + ".Enabled" + << dtSaHpiBoolT + << DATA( m_enabled_components[i] ) + << VAR_END(); + + if ( m_enabled_components[i] != SAHPI_FALSE ) { + Structs::GetVars( name, m_components[i], vars ); + if ( m_info.BankId == 0 ) { + Structs::GetVars( name, m_logical_components[i], vars ); + } + } + } + + vars << "Next.ActionDuration" + << dtSaHpiTimeoutT + << DATA( m_next.action_duration ) + << VAR_END(); + vars << "Next.Pass.Validate" + << dtSaHpiBoolT + << DATA( m_next.pass.validate ) + << VAR_END(); + vars << "Next.Pass.Install" + << dtSaHpiBoolT + << DATA( m_next.pass.install ) + << VAR_END(); + vars << "Next.Pass.Rollback" + << dtSaHpiBoolT + << DATA( m_next.pass.rollback ) + << VAR_END(); + vars << "Next.Pass.Backup" + << dtSaHpiBoolT + << DATA( m_next.pass.backup ) + << VAR_END(); + vars << "Next.Pass.Copy" + << dtSaHpiBoolT + << DATA( m_next.pass.copy ) + << VAR_END(); + vars << "Next.Pass.Verify" + << dtSaHpiBoolT + << DATA( m_next.pass.verify ) + << VAR_END(); + vars << "Next.Pass.Verifymain" + << dtSaHpiBoolT + << DATA( m_next.pass.verifymain ) + << VAR_END(); + vars << "Next.Pass.SourceFailStatus" + << dtSaHpiFumiSourceStatusT + << DATA( m_next.src_fail_status ) + << VAR_END(); + + Structs::GetVars( "Next.SourceInfo", m_next.src_info, true, vars ); +} + +void cBank::AfterVarSet( const std::string& var_name ) +{ + cObject::AfterVarSet( var_name ); +} + + +// cTimerCallback virtual functions +void cBank::TimerEvent() +{ + cLocker<cHandler> al( &m_handler ); + + switch ( m_status ) { + case SAHPI_FUMI_SOURCE_VALIDATION_INITIATED: + DoValidation(); + break; + case SAHPI_FUMI_INSTALL_INITIATED: + DoInstall(); + break; + case SAHPI_FUMI_BACKUP_INITIATED: + DoBackup(); + break; + case SAHPI_FUMI_BANK_COPY_INITIATED: + DoCopy(); + break; + case SAHPI_FUMI_TARGET_VERIFY_INITIATED: + DoVerification(); + break; + case SAHPI_FUMI_ACTIVATE_INITIATED: + DoActivation(); + break; + case SAHPI_FUMI_ROLLBACK_INITIATED: + case SAHPI_FUMI_INSTALL_FAILED_ROLLBACK_INITIATED: + case SAHPI_FUMI_ACTIVATE_FAILED_ROLLBACK_INITIATED: + DoRollback(); + break; + default: + break; + } +} + + +void cBank::ChangeStatus( SaHpiFumiUpgradeStatusT status ) +{ + if ( m_status == status ) { + return; + } + + m_status = status; + if ( IsVisible() ) { + m_fumi.PostEvent( m_info.BankId, m_status ); + } +} + + +void cBank::DoValidation() +{ + bool rc; + std::string proto, path; + rc = SplitUri( m_src_info.SourceUri, proto, path ); + if ( !rc ) { + m_src_info.SourceStatus = SAHPI_FUMI_SRC_PROTOCOL_NOT_SUPPORTED; + ChangeStatus( SAHPI_FUMI_SOURCE_VALIDATION_FAILED ); + return; + } + rc = m_fumi.CheckProtocol( proto ); + if ( !rc ) { + m_src_info.SourceStatus = SAHPI_FUMI_SRC_PROTOCOL_NOT_SUPPORTED; + ChangeStatus( SAHPI_FUMI_SOURCE_VALIDATION_FAILED ); + return; + } + + if ( m_next.pass.validate == SAHPI_FALSE ) { + m_src_info.SourceStatus = m_next.src_fail_status; + ChangeStatus( SAHPI_FUMI_SOURCE_VALIDATION_FAILED ); + return; + } + + m_next.src_info.SourceUri = m_src_info.SourceUri; + m_next.src_info.SourceStatus = SAHPI_FUMI_SRC_VALID; + m_src_info = m_next.src_info; + for ( size_t i = 0; i < MAX_COMPONENTS; ++i ) { + m_enabled_src_components[i] = m_enabled_components[i]; + SaHpiFumiComponentInfoT& c = m_src_components[i]; + c = m_components[i]; + c.MainFwInstance.DateTime = m_next.src_info.DateTime; + c.MainFwInstance.MajorVersion = m_next.src_info.MajorVersion; + c.MainFwInstance.MinorVersion = m_next.src_info.MinorVersion; + c.MainFwInstance.AuxVersion = m_next.src_info.AuxVersion; + } + + ChangeStatus( SAHPI_FUMI_SOURCE_VALIDATION_DONE ); +} + +void cBank::DoInstall() +{ + if ( m_next.pass.install == SAHPI_FALSE ) { + SaHpiFumiUpgradeStatusT new_status = SAHPI_FUMI_INSTALL_FAILED_ROLLBACK_NOT_POSSIBLE; + if ( m_info.BankId == 0 ) { + bool has_rb_fw = ( m_logical_info.RollbackFwInstance.InstancePresent != SAHPI_FALSE ); + bool has_autorb_cap = ( ( m_fumi.Capabilities() & SAHPI_FUMI_CAP_AUTOROLLBACK ) != 0 ); + bool autorb_disabled = m_fumi.IsAutoRollbackDisabled(); + if ( has_rb_fw ) { + if ( has_autorb_cap && ( !autorb_disabled ) ) { + new_status = SAHPI_FUMI_INSTALL_FAILED_ROLLBACK_INITIATED; + } else { + new_status = SAHPI_FUMI_INSTALL_FAILED_ROLLBACK_NEEDED; + } + } + } + ChangeStatus( new_status ); + if ( new_status == SAHPI_FUMI_INSTALL_FAILED_ROLLBACK_INITIATED ) { + m_handler.SetTimer( this, m_next.action_duration ); + } + return; + } + + if ( m_info.BankId == 0 ) { + m_logical_info.PendingFwInstance.InstancePresent = SAHPI_TRUE; + m_logical_info.PendingFwInstance.Identifier = m_src_info.Identifier; + m_logical_info.PendingFwInstance.Description = m_src_info.Description; + m_logical_info.PendingFwInstance.DateTime = m_src_info.DateTime; + m_logical_info.PendingFwInstance.MajorVersion = m_src_info.MajorVersion; + m_logical_info.PendingFwInstance.MinorVersion = m_src_info.MinorVersion; + m_logical_info.PendingFwInstance.AuxVersion = m_src_info.AuxVersion; + for ( size_t i = 0; i < MAX_COMPONENTS; ++i ) { + m_logical_components[i].PendingFwInstance = m_src_components[i].MainFwInstance; + } + } else { + m_info.Identifier = m_src_info.Identifier; + m_info.Description = m_src_info.Description; + m_info.DateTime = m_src_info.DateTime; + m_info.MajorVersion = m_src_info.MajorVersion; + m_info.MinorVersion = m_src_info.MinorVersion; + m_info.AuxVersion = m_src_info.AuxVersion; + for ( size_t i = 0; i < MAX_COMPONENTS; ++i ) { + m_components[i].MainFwInstance = m_src_components[i].MainFwInstance; + } + } + + ChangeStatus( SAHPI_FUMI_INSTALL_DONE ); +} + +void cBank::DoBackup() +{ + if ( m_next.pass.backup == SAHPI_FALSE ) { + ChangeStatus( SAHPI_FUMI_BACKUP_FAILED ); + } + + m_logical_info.RollbackFwInstance.InstancePresent = SAHPI_TRUE; + m_logical_info.RollbackFwInstance.Identifier = m_info.Identifier; + m_logical_info.RollbackFwInstance.Description = m_info.Description; + m_logical_info.RollbackFwInstance.DateTime = m_info.DateTime; + m_logical_info.RollbackFwInstance.MajorVersion = m_info.MajorVersion; + m_logical_info.RollbackFwInstance.MinorVersion = m_info.MinorVersion; + m_logical_info.RollbackFwInstance.AuxVersion = m_info.AuxVersion; + + for ( size_t i = 0; i < MAX_COMPONENTS; ++i ) { + m_logical_components[i].RollbackFwInstance = m_components[i].MainFwInstance; + } + + ChangeStatus( SAHPI_FUMI_BACKUP_DONE ); +} + +void cBank::DoCopy() +{ + if ( m_next.pass.copy == SAHPI_FALSE ) { + ChangeStatus( SAHPI_FUMI_BANK_COPY_FAILED ); + return; + } + + cBank * dest = m_fumi.GetBank( m_copy_dest_num ); + if ( !dest ) { + ChangeStatus( SAHPI_FUMI_BANK_COPY_FAILED ); + return; + } + + dest->m_info.Identifier = m_info.Identifier; + dest->m_info.Description = m_info.Description; + dest->m_info.DateTime = m_info.DateTime; + dest->m_info.MajorVersion = m_info.MajorVersion; + dest->m_info.MinorVersion = m_info.MinorVersion; + dest->m_info.AuxVersion = m_info.AuxVersion; + for ( size_t i = 0; i < MAX_COMPONENTS; ++i ) { + dest->m_enabled_components[i] = m_enabled_components[i]; + dest->m_components[i] = m_components[i]; + } + + ChangeStatus( SAHPI_FUMI_BANK_COPY_DONE ); +} + +void cBank::DoVerification() +{ + bool fail; + if ( m_verify_main ) { + fail = ( m_next.pass.verifymain == SAHPI_FALSE ); + } else { + fail = ( m_next.pass.verify == SAHPI_FALSE ); + } + if ( fail ) { + ChangeStatus( SAHPI_FUMI_TARGET_VERIFY_FAILED ); + return; + } + + ChangeStatus( SAHPI_FUMI_TARGET_VERIFY_DONE ); +} + +void cBank::DoActivation() +{ + if ( m_next.pass.activate == SAHPI_FALSE ) { + SaHpiFumiUpgradeStatusT new_status = SAHPI_FUMI_ACTIVATE_FAILED_ROLLBACK_NOT_POSSIBLE; + if ( m_info.BankId == 0 ) { + bool has_rb_fw = ( m_logical_info.RollbackFwInstance.InstancePresent != SAHPI_FALSE ); + bool has_autorb_cap = ( ( m_fumi.Capabilities() & SAHPI_FUMI_CAP_AUTOROLLBACK ) != 0 ); + bool autorb_disabled = m_fumi.IsAutoRollbackDisabled(); + if ( has_rb_fw ) { + if ( has_autorb_cap && ( !autorb_disabled ) ) { + new_status = SAHPI_FUMI_ACTIVATE_FAILED_ROLLBACK_INITIATED; + } else { + new_status = SAHPI_FUMI_ACTIVATE_FAILED_ROLLBACK_NEEDED; + } + } + } + ChangeStatus( new_status ); + if ( new_status == SAHPI_FUMI_ACTIVATE_FAILED_ROLLBACK_INITIATED ) { + m_handler.SetTimer( this, m_next.action_duration ); + } + return; + } + + if ( m_info.BankId == 0 ) { + m_info.Identifier = m_logical_info.PendingFwInstance.Identifier; + m_info.Description = m_logical_info.PendingFwInstance.Description; + m_info.DateTime = m_logical_info.PendingFwInstance.DateTime; + m_info.MajorVersion = m_logical_info.PendingFwInstance.MajorVersion; + m_info.MinorVersion = m_logical_info.PendingFwInstance.MinorVersion; + m_info.AuxVersion = m_logical_info.PendingFwInstance.AuxVersion; + m_logical_info.PendingFwInstance.InstancePresent = SAHPI_FALSE; + for ( size_t i = 0; i < MAX_COMPONENTS; ++i ) { + m_components[i].MainFwInstance = m_logical_components[i].PendingFwInstance; + m_logical_components[i].PendingFwInstance.InstancePresent = SAHPI_FALSE; + } + } + + ChangeStatus( SAHPI_FUMI_ACTIVATE_DONE ); +} + +void cBank::DoRollback() +{ + if ( m_next.pass.rollback == SAHPI_FALSE ) { + ChangeStatus( SAHPI_FUMI_ROLLBACK_FAILED ); + return; + } + + m_info.Identifier = m_logical_info.RollbackFwInstance.Identifier; + m_info.Description = m_logical_info.RollbackFwInstance.Description; + m_info.DateTime = m_logical_info.RollbackFwInstance.DateTime; + m_info.MajorVersion = m_logical_info.RollbackFwInstance.MajorVersion; + m_info.MinorVersion = m_logical_info.RollbackFwInstance.MinorVersion; + m_info.AuxVersion = m_logical_info.RollbackFwInstance.AuxVersion; + m_logical_info.RollbackFwInstance.InstancePresent = SAHPI_FALSE; + for ( size_t i = 0; i < MAX_COMPONENTS; ++i ) { + m_components[i].MainFwInstance = m_logical_components[i].RollbackFwInstance; + m_logical_components[i].RollbackFwInstance.InstancePresent = SAHPI_FALSE; + } + + ChangeStatus( SAHPI_FUMI_ROLLBACK_DONE ); +} + + +}; // namespace TA + Added: openhpi/trunk/plugins/test_agent/bank.h =================================================================== --- openhpi/trunk/plugins/test_agent/bank.h (rev 0) +++ openhpi/trunk/plugins/test_agent/bank.h 2012-06-25 21:39:50 UTC (rev 7473) @@ -0,0 +1,151 @@ +/* -*- c++ -*- + * + * (C) Copyright Pigeon Point Systems. 2012 + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTBANKLITY 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): + * Anton Pak <ant...@pi...> + */ + +#ifndef BANK_H_FB2B5DD5_4E7D_49F5_9397_C2FEC21B4010 +#define BANK_H_FB2B5DD5_4E7D_49F5_9397_C2FEC21B4010 + +#include <stddef.h> + +#include <list> +#include <string> + +#include <SaHpi.h> + +#include "object.h" +#include "timers.h" + + +namespace TA { + + +/************************************************************** + * class cBank + *************************************************************/ +class cHandler; +class cFumi; + +class cBank : public cObject, private cTimerCallback +{ +public: + + static const std::string classname; + + explicit cBank( cHandler& handler, cFumi& fumi, SaHpiBankNumT num ); + virtual ~cBank(); + +public: + + SaHpiUint32T Position() const; + void SetPosition( SaHpiUint32T pos ); + SaHpiFumiBankStateT State() const; + +public: // HPI interface + + SaErrorT SetSource( const SaHpiTextBufferT& uri ); + SaErrorT StartSourceValidation(); + SaErrorT GetSourceInfo( SaHpiFumiSourceInfoT& info ) const; + SaErrorT GetSourceComponentInfo( SaHpiEntryIdT eid, + SaHpiEntryIdT& next_eid, + SaHpiFumiComponentInfoT& info ) const; + SaErrorT GetTargetInfo( SaHpiFumiBankInfoT& info ) const; + SaErrorT GetTargetComponentInfo( SaHpiEntryIdT eid, + SaHpiEntryIdT& next_eid, + SaHpiFumiComponentInfoT& info ) const; + SaErrorT GetLogicalTargetInfo( SaHpiFumiLogicalBankInfoT& info ) const; + SaErrorT GetLogicalTargetComponentInfo( SaHpiEntryIdT eid, + SaHpiEntryIdT& next_eid, + SaHpiFumiLogicalComponentInfoT& info ) const; + SaErrorT StartBackup(); + SaErrorT StartCopy( SaHpiBankNumT dest_num ); + SaErrorT StartInstallation(); + SaErrorT GetUpgradeStatus( SaHpiFumiUpgradeStatusT& status ) const; + SaErrorT StartTargetVerification(); + SaErrorT StartTargetMainVerification(); + SaErrorT CancelUpgrade(); + SaErrorT StartRollback(); + SaErrorT StartActivation( SaHpiBoolT pass ); + SaErrorT Cleanup(); + +protected: // cObject virtual functions + + virtual void GetVars( cVars& vars ); + virtual void AfterVarSet( const std::string& var_name ); + +private: + + cBank( const cBank& ); + cBank& operator =( const cBank& ); + +private: // cTimerCallback virtual functions + + virtual void TimerEvent(); + +private: + + void ChangeStatus( SaHpiFumiUpgradeStatusT status ); + + void DoValidation(); + void DoInstall(); + void DoBackup(); + void DoCopy(); + void DoVerification(); + void DoActivation(); + void DoRollback(); + +private: // data + + static const size_t MAX_COMPONENTS = 8; + + cHandler& m_handler; + cFumi& m_fumi; + SaHpiFumiBankInfoT m_info; + SaHpiFumiLogicalBankInfoT m_logical_info; + SaHpiBoolT m_enabled_components[MAX_COMPONENTS]; + SaHpiFumiComponentInfoT m_components[MAX_COMPONENTS]; + SaHpiFumiLogicalComponentInfoT m_logical_components[MAX_COMPONENTS]; + SaHpiBoolT m_src_set; + SaHpiFumiSourceInfoT m_src_info; + SaHpiBoolT m_enabled_src_components[MAX_COMPONENTS]; + SaHpiFumiComponentInfoT m_src_components[MAX_COMPONENTS]; + SaHpiFumiUpgradeStatusT m_status; + + struct + { + SaHpiTimeoutT action_duration; + struct + { + SaHpiBoolT validate; + SaHpiBoolT install; + SaHpiBoolT rollback; + SaHpiBoolT backup; + SaHpiBoolT copy; + SaHpiBoolT verify; + SaHpiBoolT verifymain; + SaHpiBoolT activate; + } pass; + SaHpiFumiSourceStatusT src_fail_status; + SaHpiFumiSourceInfoT src_info; + } m_next; + + bool m_verify_main; + SaHpiBankNumT m_copy_dest_num; +}; + + +}; // namespace TA + + +#endif // BANK_H_FB2B5DD5_4E7D_49F5_9397_C2FEC21B4010 + Modified: openhpi/trunk/plugins/test_agent/console.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/console.cpp 2012-06-21 10:42:54 UTC (rev 7472) +++ openhpi/trunk/plugins/test_agent/console.cpp 2012-06-25 21:39:50 UTC (rev 7473) @@ -336,6 +336,15 @@ Send( "Current object: " ); SendCurrentPath(); Send( "\n" ); + + std::string nb; + obj->GetNB( nb ); + if ( !nb.empty() ) { + Send( sepline, sizeof(sepline) ); + Send( "NB!:\n\n" ); + Send( nb ); + } + SendOK( "Object changed." ); } Modified: openhpi/trunk/plugins/test_agent/control.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/control.cpp 2012-06-21 10:42:54 UTC (rev 7472) +++ openhpi/trunk/plugins/test_agent/control.cpp 2012-06-25 21:39:50 UTC (rev 7473) @@ -219,12 +219,12 @@ // Handling RDR changes -void cControl::HandleRdrChange( const std::string& var_name, - SaHpiRdrTypeUnionT& data ) +void cControl::UpdateRdr( const std::string& field_name, + SaHpiRdrTypeUnionT& data ) { - cInstrument::HandleRdrChange( var_name, data ); + cInstrument::UpdateRdr( field_name, data ); - if ( var_name == "Rdr.CtrlRec.Type" ) { + if ( field_name == "Rdr.CtrlRec.Type" ) { m_state.Type = data.CtrlRec.Type; } } Modified: openhpi/trunk/plugins/test_agent/control.h =================================================================== --- openhpi/trunk/plugins/test_agent/control.h 2012-06-21 10:42:54 UTC (rev 7472) +++ openhpi/trunk/plugins/test_agent/control.h 2012-06-25 21:39:50 UTC (rev 7473) @@ -56,8 +56,8 @@ private: // Handling RDR changes - virtual void HandleRdrChange( const std::string& var_name, - SaHpiRdrTypeUnionT& data ); + virtual void UpdateRdr( const std::string& field_name, + SaHpiRdrTypeUnionT& data ); private: Modified: openhpi/trunk/plugins/test_agent/dimi.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/dimi.cpp 2012-06-21 10:42:54 UTC (rev 7472) +++ openhpi/trunk/plugins/test_agent/dimi.cpp 2012-06-25 21:39:50 UTC (rev 7473) @@ -99,8 +99,8 @@ return ( tnum < m_tests.size() ) ? m_tests[tnum] : 0; } -void cDimi::PostEvent( SaHpiDimiTestNumT tnum, - SaHpiDimiTestRunStatusT status, +void cDimi::PostEvent( SaHpiDimiTestNumT tnum, + SaHpiDimiTestRunStatusT status, SaHpiDimiTestPercentCompletedT progress ) { SaHpiEventUnionT data; @@ -126,6 +126,18 @@ // cObject virtual functions +void cDimi::GetNB( std::string& nb ) const +{ + cObject::GetNB( nb ); + nb += "- Test Agent supports creation of a DIMI test with\n"; + nb += " id == current number of tests.\n"; + nb += "- Test Agent supports removal of a DIMI test with\n"; + nb += " id == (current number of tests - 1).\n"; + nb += "- Be careful when removing a test:\n"; + nb += "-- Any DIMI API directed to the removed test will fail.\n"; + nb += "-- Any DIMI asynchronous operation on the test can fail or cause crash.\n"; +} + void cDimi::GetNewNames( cObject::NewNames& names ) const { cObject::GetNewNames( names ); @@ -152,17 +164,11 @@ return false; } - if ( id > m_tests.size() ) { + if ( id != m_tests.size() ) { return false; } - if ( id == m_tests.size() ) { - m_tests.push_back( 0 ); - } - if ( m_tests[id] ) { - return false; - } - m_tests[id] = new cTest( m_handler, *this, id ); + m_tests.push_back( new cTest( m_handler, *this, id ) ); Update(); return true; @@ -184,15 +190,13 @@ return false; } - if ( id >= m_tests.size() ) { + if ( ( id + 1 ) != m_tests.size() ) { return false; } - if ( m_tests[id] == 0 ) { - return false; - } delete m_tests[id]; m_tests[id] = 0; + m_tests.resize( id ); Update(); return true; Modified: openhpi/trunk/plugins/test_agent/dimi.h =================================================================== --- openhpi/trunk/plugins/test_agent/dimi.h 2012-06-21 10:42:54 UTC (rev 7472) +++ openhpi/trunk/plugins/test_agent/dimi.h 2012-06-25 21:39:50 UTC (rev 7473) @@ -54,6 +54,7 @@ protected: // cObject virtual functions + virtual void GetNB( std::string& nb ) const; virtual void GetNewNames( cObject::NewNames& names ) const; virtual bool CreateChild( const std::string& name ); virtual bool RemoveChild( const std::string& name ); Modified: openhpi/trunk/plugins/test_agent/fumi.cpp =================================================================== --- openhpi/trunk/plugins/test_agent/fumi.cpp 2012-06-21 10:42:54 UTC (rev 7472) +++ openhpi/trunk/plugins/test_agent/fumi.cpp 2012-06-25 21:39:50 UTC (rev 7473) @@ -13,10 +13,17 @@ * Anton Pak <ant...@pi...> */ +#include <algorithm> #include <string> +#include <vector> +#include <SaHpi.h> + +#include "bank.h" #include "codec.h" #include "fumi.h" +#include "structs.h" +#include "utils.h" namespace TA { @@ -31,16 +38,76 @@ SaHpiFumiRecT& rec = data.FumiRec; rec.Num = num; - rec.AccessProt = SAHPI_FUMI_PROT_LOCAL | SAHPI_FUMI_PROT_TFTP; - rec.Capability = SAHPI_FUMI_CAP_COMPONENTS; + rec.AccessProt = SAHPI_FUMI_PROT_LOCAL; + rec.Capability = SAHPI_FUMI_CAP_ROLLBACK | + SAHPI_FUMI_CAP_BACKUP | + SAHPI_FUMI_CAP_TARGET_VERIFY | + SAHPI_FUMI_CAP_TARGET_VERIFY_MAIN | + SAHPI_FUMI_CAP_COMPONENTS | + SAHPI_FUMI_CAP_AUTOROLLBACK | + SAHPI_FUMI_CAP_AUTOROLLBACK_CAN_BE_DISABLED; rec.NumBanks = 0; rec.Oem = 0; return data; } +static SaHpiFumiSpecInfoT MakeDefaultSpecInfo() +{ + SaHpiFumiSpecInfoT spec_info; + spec_info.SpecInfoType = SAHPI_FUMI_SPEC_INFO_SAF_DEFINED; + spec_info.SpecInfoTypeUnion.SafDefined.SpecID = SAHPI_FUMI_SPEC_HPM1; + spec_info.SpecInfoTypeUnion.SafDefined.RevisionID = 0; + + return spec_info; +} + +static SaHpiFumiServiceImpactDataT MakeDefaultServiceImpact() +{ + SaHpiFumiServiceImpactDataT service_impact; + + service_impact.NumEntities = 0; + for ( size_t i = 0; i < SAHPI_FUMI_MAX_ENTITIES_IMPACTED; ++i ) { + MakeUnspecifiedHpiEntityPath( service_impact.ImpactedEntities[i].ImpactedEntity ); + service_impact.ImpactedEntities[i].ServiceImpact = SAHPI_FUMI_PROCESS_NONDEGRADING; + } + + return service_impact; +} + + /************************************************************** + * Functors for working with banks + *************************************************************/ +struct BankDeleter +{ + void operator ()( cBank * bank ) + { + delete bank; + } +}; + +struct ObjectCollector +{ + explicit ObjectCollector( cObject::Children& _children ) + : children( _children ) + { + // empty + } + + void operator ()( cBank * bank ) + { + if ( bank ) { + children.push_back( bank ); + } + } + + cObject::Children& children; +}; + + +/************************************************************** * class cFumi *************************************************************/ const std::string cFumi::classname( "fumi" ); @@ -51,28 +118,317 @@ AssembleNumberedObjectName( classname, num ), SAHPI_FUMI_RDR, MakeDefaultFumiRec( num ) ), - m_rec( GetRdr().RdrTypeUnion.FumiRec ) + m_rec( GetRdr().RdrTypeUnion.FumiRec ), + m_spec_info( MakeDefaultSpecInfo() ), + m_service_impact( MakeDefaultServiceImpact() ), + m_auto_rb_disabled( SAHPI_FALSE ) { - // empty + m_next.pass.activate = SAHPI_TRUE; + + // Create logical bank + m_banks.push_back( new cBank( m_handler, *this, 0 ) ); } cFumi::~cFumi() { - // empty + BankDeleter deleter; + std::for_each( m_banks.begin(), m_banks.end(), deleter ); + m_banks.clear(); } +SaHpiFumiCapabilityT cFumi::Capabilities() const +{ + return m_rec.Capability; +} + +bool cFumi::CheckProtocol( const std::string& proto ) const +{ + if ( proto == "tftp" ) { + return ( m_rec.AccessProt & SAHPI_FUMI_PROT_TFTP ) != 0; + } + if ( proto == "ftp" ) { + return ( m_rec.AccessProt & SAHPI_FUMI_PROT_FTP ) != 0; + } + if ( proto == "http" ) { + return ( m_rec.AccessProt & SAHPI_FUMI_PROT_HTTP ) != 0; + } + if ( proto == "https" ) { + return ( m_rec.AccessProt & SAHPI_FUMI_PROT_HTTP ) != 0; + } + if ( proto == "ldap" ) { + return ( m_rec.AccessProt & SAHPI_FUMI_PROT_LDAP ) != 0; + } + if ( proto == "file" ) { + return ( m_rec.AccessProt & SAHPI_FUMI_PROT_LOCAL ) != 0; + } + ... [truncated message content] |
From: <av...@us...> - 2012-08-07 06:27:29
|
Revision: 7492 http://openhpi.svn.sourceforge.net/openhpi/?rev=7492&view=rev Author: avpak Date: 2012-08-07 06:27:23 +0000 (Tue, 07 Aug 2012) Log Message: ----------- Moving trunk version to 3.3.0 Modified Paths: -------------- openhpi/trunk/Makefile.mingw32.def openhpi/trunk/baselibs/csharp/openhpi_baselib/AssemblyInfo.cs openhpi/trunk/baselibs/java/openhpi_baselib/manifest.txt openhpi/trunk/baselibs/python/openhpi_baselib/OhpiVersion.py openhpi/trunk/configure.ac Modified: openhpi/trunk/Makefile.mingw32.def =================================================================== --- openhpi/trunk/Makefile.mingw32.def 2012-08-07 06:19:54 UTC (rev 7491) +++ openhpi/trunk/Makefile.mingw32.def 2012-08-07 06:27:23 UTC (rev 7492) @@ -2,9 +2,9 @@ ARCH := x86 #ARCH := amd64 -VERSION := 3.2.0 +VERSION := 3.3.0 # This is for resource compiler -BINARY_VERSION := 3,2,0,0 +BINARY_VERSION := 3,3,0,0 ############################################################################ TOOLCHAIN_PATH := /home/avpak/usr/cross/mingw32 Modified: openhpi/trunk/baselibs/csharp/openhpi_baselib/AssemblyInfo.cs =================================================================== --- openhpi/trunk/baselibs/csharp/openhpi_baselib/AssemblyInfo.cs 2012-08-07 06:19:54 UTC (rev 7491) +++ openhpi/trunk/baselibs/csharp/openhpi_baselib/AssemblyInfo.cs 2012-08-07 06:27:23 UTC (rev 7492) @@ -24,6 +24,6 @@ [assembly: AssemblyTitle( "OpenHPI Base Library For .NET" )] [assembly: AssemblyDescription( "OpenHPI Base Library For .NET" )] [assembly: AssemblyProduct( "OpenHPI" )] -[assembly: AssemblyVersion( "3.2.0.0" )] +[assembly: AssemblyVersion( "3.3.0.0" )] [assembly: AssemblyCulture( "" )] Modified: openhpi/trunk/baselibs/java/openhpi_baselib/manifest.txt =================================================================== --- openhpi/trunk/baselibs/java/openhpi_baselib/manifest.txt 2012-08-07 06:19:54 UTC (rev 7491) +++ openhpi/trunk/baselibs/java/openhpi_baselib/manifest.txt 2012-08-07 06:27:23 UTC (rev 7492) @@ -3,5 +3,5 @@ Implementation-Title: OpenHPI Base Library For Java Implementation-Vendor: openhpi.org Implementation-URL: http://openhpi.org -Implementation-Version: 3.2.0 +Implementation-Version: 3.3.0 Modified: openhpi/trunk/baselibs/python/openhpi_baselib/OhpiVersion.py =================================================================== --- openhpi/trunk/baselibs/python/openhpi_baselib/OhpiVersion.py 2012-08-07 06:19:54 UTC (rev 7491) +++ openhpi/trunk/baselibs/python/openhpi_baselib/OhpiVersion.py 2012-08-07 06:27:23 UTC (rev 7492) @@ -14,5 +14,5 @@ # Anton Pak <ant...@pi...> # -__version_info__ = ( 3, 2, 0 ) +__version_info__ = ( 3, 3, 0 ) Modified: openhpi/trunk/configure.ac =================================================================== --- openhpi/trunk/configure.ac 2012-08-07 06:19:54 UTC (rev 7491) +++ openhpi/trunk/configure.ac 2012-08-07 06:27:23 UTC (rev 7492) @@ -5,7 +5,7 @@ AC_PREREQ(2.57) -AC_INIT(openhpi, 3.2.0) +AC_INIT(openhpi, 3.3.0) AC_CONFIG_SRCDIR(openhpi.spec.in) AM_INIT_AUTOMAKE([1.8]) @@ -23,7 +23,7 @@ # minor version: 11 = 11 # patch version: 4 = 4 # -HPI_LIB_VERSION=5:0:2 +HPI_LIB_VERSION=6:0:3 HPI_PKG=$PACKAGE_NAME HPI_UTIL_PKG=${PACKAGE_NAME}utils HPI_CLIENT_PKG=${PACKAGE_NAME}client This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2012-08-31 14:17:55
|
Revision: 7510 http://openhpi.svn.sourceforge.net/openhpi/?rev=7510&view=rev Author: avpak Date: 2012-08-31 14:17:43 +0000 (Fri, 31 Aug 2012) Log Message: ----------- Initial implementation of feature request #3519485 Modified Paths: -------------- openhpi/trunk/baselib/session.cpp openhpi/trunk/marshal/marshal.c openhpi/trunk/marshal/marshal.h openhpi/trunk/marshal/marshal_hpi.c openhpi/trunk/marshal/marshal_hpi.h openhpi/trunk/marshal/marshal_hpi_types.c openhpi/trunk/openhpid/server.cpp Modified: openhpi/trunk/baselib/session.cpp =================================================================== --- openhpi/trunk/baselib/session.cpp 2012-08-28 14:32:08 UTC (rev 7509) +++ openhpi/trunk/baselib/session.cpp 2012-08-31 14:17:43 UTC (rev 7510) @@ -172,13 +172,18 @@ return SA_ERR_HPI_UNSUPPORTED_API; } + int cc; char data[dMaxPayloadLength]; uint32_t data_len; uint8_t rp_type; uint32_t rp_id; int rp_byte_order; - data_len = HpiMarshalRequest( hm, data, iparams.const_array ); + cc = HpiMarshalRequest( hm, data, iparams.const_array ); + if ( cc < 0 ) { + return SA_ERR_HPI_INTERNAL_ERROR; + } + data_len = cc; bool rc = false; for ( size_t attempt = 0; attempt < RPC_ATTEMPTS; ++attempt ) { @@ -207,10 +212,13 @@ } oparams.SetFirst( &rv ); - int mr = HpiDemarshalReply( rp_byte_order, hm, data, oparams.array ); + cc = HpiDemarshalReply( rp_byte_order, hm, data, oparams.array ); - if ( ( mr <= 0 ) || ( rp_type != eMhMsg ) || ( id != rp_id ) ) { - g_static_private_set( &m_sockets, 0, 0 ); // close socket + if ( ( cc <= 0 ) || ( rp_type != eMhMsg ) || ( id != rp_id ) ) { + //Closing main socket(the socket that was used for saHpiSessionOpen) + // may disrupt HPI session on remote side. + // TODO: Investigate and fix on OpenHPI daemon side and then uncomment. + //g_static_private_set( &m_sockets, 0, 0 ); // close socket return SA_ERR_HPI_NO_RESPONSE; } Modified: openhpi/trunk/marshal/marshal.c =================================================================== --- openhpi/trunk/marshal/marshal.c 2012-08-28 14:32:08 UTC (rev 7509) +++ openhpi/trunk/marshal/marshal.c 2012-08-31 14:17:43 UTC (rev 7510) @@ -16,74 +16,88 @@ * Anton Pak <anton.pak.pigeonpoint.com> */ -#include <assert.h> +#include <errno.h> +#include <stddef.h> +#include <stdint.h> #include <stdlib.h> -//#include <stdio.h> #include <string.h> #include <glib.h> +#include <oh_error.h> + #include "marshal.h" cMarshalType Marshal_VoidType = { - .m_type = eMtVoid + .m_type = eMtVoid, + .m_name = "Void" }; cMarshalType Marshal_Uint8Type = { - .m_type = eMtUint8 + .m_type = eMtUint8, + .m_name = "Uint8" }; cMarshalType Marshal_Uint16Type = { - .m_type = eMtUint16 + .m_type = eMtUint16, + .m_name = "Uint16" }; cMarshalType Marshal_Uint32Type = { - .m_type = eMtUint32 + .m_type = eMtUint32, + .m_name = "Uint32" }; cMarshalType Marshal_Uint64Type = { - .m_type = eMtUint64 + .m_type = eMtUint64, + .m_name = "Uint64" }; cMarshalType Marshal_Int8Type = { - .m_type = eMtInt8 + .m_type = eMtInt8, + .m_name = "Int8" }; cMarshalType Marshal_Int16Type = { - .m_type = eMtInt16 + .m_type = eMtInt16, + .m_name = "Int16" }; cMarshalType Marshal_Int32Type = { - .m_type = eMtInt32 + .m_type = eMtInt32, + .m_name = "Int32" }; cMarshalType Marshal_Int64Type = { - .m_type = eMtInt64 + .m_type = eMtInt64, + .m_name = "Int64" }; cMarshalType Marshal_Float32Type = { - .m_type = eMtFloat32 + .m_type = eMtFloat32, + .m_name = "Float32" }; cMarshalType Marshal_Float64Type = { - .m_type = eMtFloat64 + .m_type = eMtFloat64, + .m_name = "Float64" }; -static int +static gboolean IsSimpleType( tMarshalType type ) { switch( type ) @@ -99,7 +113,7 @@ case eMtUint64: case eMtFloat32: case eMtFloat64: - return 1; + return TRUE; case eMtArray: case eMtVarArray: @@ -108,11 +122,11 @@ case eMtUnion: case eMtUnionElement: case eMtUserDefined: - return 0; + return FALSE; default: - assert( 0 ); - return 0; + CRIT( "Unknown marshal type %d!", type ); + return FALSE; } } @@ -156,8 +170,8 @@ memcpy(buffer, data, sizeof(tFloat64)); return sizeof(tFloat64); default: - assert( 0 ); - return -1; + CRIT( "Unknown marshal type %d!", type ); + return -ENOSYS; } } @@ -172,7 +186,7 @@ * * returns obtained integer value (casted to size_t) * or - * returns (size_t)(-1) and throws assertion + * returns SIZE_MAX * * NB * function does NOT check for @@ -222,8 +236,8 @@ case eMtUint64: return (size_t)(*u.ui64); default: - assert( 0 ); - return (size_t)(-1); + CRIT( "GetStructElementIntegerValue: Unsupported type %d!", elem->m_type ); + return SIZE_MAX; } } @@ -275,7 +289,6 @@ case eMtArray: { const size_t nelems = type->u.m_array.m_nelements; - assert( nelems > 0 ); size_t i; for( i = 0; i < nelems; i++ ) @@ -283,16 +296,16 @@ const cMarshalType *elem = type->u.m_array.m_element; const size_t elem_sizeof = type->u.m_array.m_element_sizeof; - int s = Marshal( elem, data, buffer ); - if ( s < 0 ) + int cc = Marshal( elem, data, buffer ); + if ( cc < 0 ) { - assert( 0 ); - return -1; + CRIT( "Marshal: %s[%d]: failure, cc = %d!", type->m_name, i, cc ); + return cc; } data += elem_sizeof; - buffer += s; - size += s; + buffer += cc; + size += cc; } } break; @@ -300,30 +313,30 @@ case eMtStruct: { const cMarshalType *elems = &type->u.m_struct.m_elements[0]; - assert( elems ); - size_t i; for( i = 0; elems[i].m_type == eMtStructElement; i++ ) { const cMarshalType *elem = elems[i].u.m_struct_element.m_element; const size_t offset = elems[i].u.m_struct_element.m_offset; - int s = 0; + int cc = 0; if ( elem->m_type == eMtUnion ) { - size_t mod2_idx = elem->u.m_union.m_mod_idx; - // the union modifier field must be before this entry. - // this is a limitation of demarshaling of unions - assert( mod2_idx < i ); - size_t mod2 = GetStructElementIntegerValue( type, mod2_idx, data ); + const size_t mod2_idx = elem->u.m_union.m_mod_idx; + const size_t mod2 = GetStructElementIntegerValue( type, mod2_idx, data ); const cMarshalType *elem2 = GetUnionElement( elem, mod2 ); - assert( elem2 ); + if ( !elem2 ) { + CRIT( "Marshal: %s:%s: invalid mod value %u!", + type->m_name, elems[i].m_name, (unsigned int)mod2 ); + return -EINVAL; + } - s = Marshal( elem2, data + offset, buffer ); - if ( s < 0 ) + cc = Marshal( elem2, data + offset, buffer ); + if ( cc < 0 ) { - assert( 0 ); - return -1; + CRIT( "Marshal: %s:%s, mod %u: failure, cc = %d!", + type->m_name, elems[i].m_name, (unsigned int)mod2, cc ); + return -EINVAL; } } else if ( elem->m_type == eMtVarArray ) @@ -331,11 +344,6 @@ const size_t nelems2_idx = elem->u.m_var_array.m_nelements_idx; const cMarshalType *elem2 = elem->u.m_var_array.m_element; const size_t elem2_sizeof = elem->u.m_var_array.m_element_sizeof; - - // the array nelements field must be before this entry. - // this is a limitation of demarshaling of var arrays - assert( nelems2_idx < i ); - const size_t nelems2 = GetStructElementIntegerValue( type, nelems2_idx, data ); // (data + offset ) points to pointer to var array content @@ -346,50 +354,46 @@ size_t i2; for( i2 = 0; i2 < nelems2; i2++ ) { - int s2 = Marshal( elem2, data2, buffer2 ); - if ( s2 < 0 ) + int cc2 = Marshal( elem2, data2, buffer2 ); + if ( cc2 < 0 ) { - assert( 0 ); - return -1; + CRIT( "Marshal: %s:%s[%d]: failure, cc = %d!", + type->m_name, elems[i].m_name, i2, cc2 ); + return cc2; } data2 += elem2_sizeof; - buffer2 += s2; - s += s2; + buffer2 += cc2; + cc += cc2; } } else { - s = Marshal( elem, data + offset, buffer ); - if ( s < 0 ) + cc = Marshal( elem, data + offset, buffer ); + if ( cc < 0 ) { - assert( 0 ); - return -1; + CRIT( "Marshal: %s:%s: failure, cc = %d!", + type->m_name, elems[i].m_name, cc ); + return cc; } } - buffer += s; - size += s; + buffer += cc; + size += cc; } } break; - case eMtUnion: - assert( 0 ); - return -1; - case eMtUserDefined: { tMarshalFunction marshaller = type->u.m_user_defined.m_marshaller; - assert( marshaller ); void * user_data = type->u.m_user_defined.m_user_data; - size = marshaller( type, d, b, user_data ); + size = marshaller ? marshaller( type, d, b, user_data ) : 0; } break; default: - assert( 0 ); - return -1; + return -ENOSYS; } return size; @@ -402,18 +406,18 @@ int size = 0; unsigned char *buffer = b; - size_t i; + int i; for( i = 0; types[i]; i++ ) { - int s = Marshal( types[i], data[i], buffer ); - if ( s < 0 ) + int cc = Marshal( types[i], data[i], buffer ); + if ( cc < 0 ) { - assert( 0 ); - return -1; + CRIT( "MarshalArray[%d]: %s: failure, cc = %d!", i, types[i]->m_name, cc ); + return cc; } - size += s; - buffer += s; + size += cc; + buffer += cc; } return size; @@ -524,8 +528,8 @@ return sizeof(tFloat64); default: - assert( 0 ); - return -1; + CRIT( "Unknown marshal type %d!", type ); + return -ENOSYS; } } @@ -547,7 +551,6 @@ case eMtArray: { const size_t nelems = type->u.m_array.m_nelements; - assert( nelems > 0 ); size_t i; for( i = 0; i < nelems; i++ ) @@ -555,16 +558,16 @@ const cMarshalType *elem = type->u.m_array.m_element; const size_t elem_sizeof = type->u.m_array.m_element_sizeof; - int s = Demarshal( byte_order, elem, data, buffer ); - if ( s < 0 ) + int cc = Demarshal( byte_order, elem, data, buffer ); + if ( cc < 0 ) { - assert( 0 ); - return -1; + CRIT( "Demarshal: %s[%d]: failure, cc = %d!", type->m_name, i, cc ); + return cc; } data += elem_sizeof; - buffer += s; - size += s; + buffer += cc; + size += cc; } } break; @@ -572,30 +575,36 @@ case eMtStruct: { const cMarshalType *elems = &type->u.m_struct.m_elements[0]; - assert( elems ); - size_t i; for( i = 0; elems[i].m_type == eMtStructElement; i++ ) { const cMarshalType *elem = elems[i].u.m_struct_element.m_element; const size_t offset = elems[i].u.m_struct_element.m_offset; - int s = 0; + int cc = 0; if ( elem->m_type == eMtUnion ) { - size_t mod2_idx = elem->u.m_union.m_mod_idx; - // the union modifier field must be before this entry. - // this is a limitation of demarshaling of unions - assert( mod2_idx < i ); - size_t mod2 = GetStructElementIntegerValue( type, mod2_idx, data ); + const size_t mod2_idx = elem->u.m_union.m_mod_idx; + if ( mod2_idx >= i ) { + // NB: this is a limitation of demarshaling of unions + CRIT( "Demarshal: %s:%s: mod field must be before union!", + type->m_name, elems[i].m_name ); + return -EINVAL; + } + const size_t mod2 = GetStructElementIntegerValue( type, mod2_idx, data ); const cMarshalType *elem2 = GetUnionElement( elem, mod2 ); - assert( elem2 ); + if ( !elem2 ) { + CRIT( "Demarshal: %s:%s: invalid mod value %u!", + type->m_name, elems[i].m_name, (unsigned int)mod2 ); + return -EINVAL; + } - s = Demarshal( byte_order, elem2, data + offset, buffer ); - if ( s < 0 ) + cc = Demarshal( byte_order, elem2, data + offset, buffer ); + if ( cc < 0 ) { - assert( 0 ); - return -1; + CRIT( "Demarshal: %s:%s, mod %u: failure, cc = %d!", + type->m_name, elems[i].m_name, (unsigned int)mod2, cc ); + return cc; } } else if ( elem->m_type == eMtVarArray ) @@ -604,10 +613,12 @@ const cMarshalType *elem2 = elem->u.m_var_array.m_element; const size_t elem2_sizeof = elem->u.m_var_array.m_element_sizeof; - // the array nelements field must be before this entry. - // this is a limitation of demarshaling of var arrays - assert( nelems2_idx < i ); - + if ( nelems2_idx >= i ) { + // NB: this is a limitation of demarshaling of var arrays + CRIT( "Demarshal: %s:%s: nelements field must be before vararray!", + type->m_name, elems[i].m_name ); + return -EINVAL; + } const size_t nelems2 = GetStructElementIntegerValue( type, nelems2_idx, data ); // allocate storage for var array content @@ -619,57 +630,47 @@ size_t i2; for( i2 = 0; i2 < nelems2; i2++ ) { - int s2 = Demarshal( byte_order, elem2, data2, buffer2 ); - if ( s2 < 0 ) + int cc2 = Demarshal( byte_order, elem2, data2, buffer2 ); + if ( cc2 < 0 ) { - assert( 0 ); - return -1; + CRIT( "Demarshal: %s:%s[%d]: failure, cc = %d!", + type->m_name, elems[i].m_name, i2, cc2 ); + return cc2; } data2 += elem2_sizeof; - buffer2 += s2; - s += s2; + buffer2 += cc2; + cc += cc2; } } else { - s = Demarshal( byte_order, elem, data + offset, buffer ); - if ( s < 0 ) + cc = Demarshal( byte_order, elem, data + offset, buffer ); + if ( cc < 0 ) { - assert( 0 ); - return -1; + CRIT( "Demarshal: %s:%s: failure, cc = %d!", + type->m_name, elems[i].m_name, cc ); + return cc; } } - buffer += s; - size += s; + buffer += cc; + size += cc; } } break; - case eMtUnion: - // unions must me encapsulate in structs - assert( 0 ); - return -1; - - case eMtStructElement: - case eMtUnionElement: - assert( 0 ); - return -1; - case eMtUserDefined: { tDemarshalFunction demarshaller = type->u.m_user_defined.m_demarshaller; - assert( demarshaller ); void * user_data = type->u.m_user_defined.m_user_data; - size = demarshaller( byte_order, type, d, b, user_data ); + size = demarshaller ? demarshaller( byte_order, type, d, b, user_data ) : 0; } break; default: - assert( 0 ); - return -1; + return -ENOSYS; } return size; @@ -682,18 +683,18 @@ int size = 0; const unsigned char *buffer = b; - size_t i; + int i; for( i = 0; types[i]; i++ ) { - int s = Demarshal( byte_order, types[i], data[i], buffer ); - if ( s < 0 ) + int cc = Demarshal( byte_order, types[i], data[i], buffer ); + if ( cc < 0 ) { - assert( 0 ); - return -1; + CRIT( "DemarshalArray[%d]: %s: failure, cc = %d!", i, types[i]->m_name, cc ); + return cc; } - size += s; - buffer += s; + size += cc; + buffer += cc; } return size; Modified: openhpi/trunk/marshal/marshal.h =================================================================== --- openhpi/trunk/marshal/marshal.h 2012-08-28 14:32:08 UTC (rev 7509) +++ openhpi/trunk/marshal/marshal.h 2012-08-31 14:17:43 UTC (rev 7510) @@ -74,9 +74,10 @@ // helper macro for arrays -#define dArray( nelements, element_type, element ) \ +#define dArray( name, nelements, element_type, element ) \ { \ .m_type = eMtArray, \ + .m_name = name, \ .u.m_array = \ { \ .m_nelements = nelements, \ @@ -86,9 +87,10 @@ } // helper macro for var arrays -#define dVarArray( nelements_idx, element_type, element ) \ +#define dVarArray( name, nelements_idx, element_type, element ) \ { \ .m_type = eMtVarArray, \ + .m_name = name, \ .u.m_var_array = \ { \ .m_nelements_idx = nelements_idx, \ @@ -101,6 +103,7 @@ #define dStruct( elements ) \ { \ .m_type = eMtStruct, \ + .m_name = #elements, \ .u.m_struct = \ { \ .m_elements = &elements[0] \ @@ -111,6 +114,7 @@ #define dStructElement( struct_type, field, element ) \ { \ .m_type = eMtStructElement, \ + .m_name = #field, \ .u.m_struct_element = \ { \ .m_offset = offsetof( struct_type, field ), \ @@ -121,13 +125,15 @@ // helper marco for struct end #define dStructElementEnd() \ { \ - .m_type = eMtUnknown \ + .m_type = eMtUnknown, \ + .m_name = "" \ } // helper marco for unions #define dUnion( mod_idx, elements ) \ { \ .m_type = eMtUnion, \ + .m_name = #elements, \ .u.m_union = \ { \ .m_mod_idx = mod_idx, \ @@ -139,6 +145,7 @@ #define dUnionElement( mod, element ) \ { \ .m_type = eMtUnionElement, \ + .m_name = #mod, \ .u.m_union_element = \ { \ .m_mod = mod, \ @@ -149,13 +156,15 @@ // helper marco for union end #define dUnionElementEnd() \ { \ - .m_type = eMtUnknown \ + .m_type = eMtUnknown, \ + .m_name = "" \ } // helper macro for user define mashaller #define dUserDefined( marshaller, demarshaller, user_data ) \ { \ .m_type = eMtUserDefined, \ + .m_name = "user", \ .u.m_user_defined = \ { \ .m_marshaller = marshaller, \ @@ -176,6 +185,7 @@ struct sMarshalType { tMarshalType m_type; + const char * m_name; union { Modified: openhpi/trunk/marshal/marshal_hpi.c =================================================================== --- openhpi/trunk/marshal/marshal_hpi.c 2012-08-28 14:32:08 UTC (rev 7509) +++ openhpi/trunk/marshal/marshal_hpi.c 2012-08-31 14:17:43 UTC (rev 7510) @@ -22,6 +22,8 @@ #include <stddef.h> +#include <oh_error.h> + #include "marshal_hpi.h" @@ -2168,7 +2170,11 @@ int HpiMarshalRequest( cHpiMarshal *m, void *buffer, const void **param ) { - return MarshalArray( m->m_request, param, buffer ); + int cc = MarshalArray( m->m_request, param, buffer ); + if ( cc < 0 ) { + CRIT( "%s: HpiMarshalRequest: failure, cc = %d", m->m_name, cc ); + } + return cc; } @@ -2253,7 +2259,11 @@ int HpiDemarshalRequest( int byte_order, cHpiMarshal *m, const void *buffer, void **params ) { - return DemarshalArray( byte_order, m->m_request, params, buffer ); + int cc = DemarshalArray( byte_order, m->m_request, params, buffer ); + if ( cc < 0 ) { + CRIT( "%s: HpiDemarshalRequest: failure, cc = %d", m->m_name, cc ); + } + return cc; } @@ -2335,13 +2345,20 @@ int HpiMarshalReply( cHpiMarshal *m, void *buffer, const void **params ) { - // the first value is the result. - SaErrorT err = *(const SaErrorT *)params[0]; + // the first value is the result. + SaErrorT err = *(const SaErrorT *)params[0]; - if ( err == SA_OK ) - return MarshalArray( m->m_reply, params, buffer ); + int cc; + if ( err == SA_OK ) { + cc = MarshalArray( m->m_reply, params, buffer ); + } else { + cc = Marshal( &SaErrorType, &err, buffer ); + } + if ( cc < 0 ) { + CRIT( "%s: HpiMarshalReply: failure, cc = %d", m->m_name, cc ); + } - return Marshal( &SaErrorType, &err, buffer ); + return cc; } @@ -2427,18 +2444,20 @@ int HpiDemarshalReply( int byte_order, cHpiMarshal *m, const void *buffer, void **params ) { - // the first value is the error code - int rv = Demarshal( byte_order, &SaErrorType, params[0], buffer ); + int cc; + // the first value is the error code + cc = Demarshal( byte_order, &SaErrorType, params[0], buffer ); + if ( cc > 0 ) { + SaErrorT err = *(SaErrorT *)params[0]; + if ( err == SA_OK ) { + cc = DemarshalArray( byte_order, m->m_reply, params, buffer ); + } + } + if ( cc < 0 ) { + CRIT( "%s: HpiDemarshalReply: failure, cc = %d", m->m_name, cc ); + } - if ( rv < 0 ) - return -1; - - SaErrorT err = *(SaErrorT *)params[0]; - - if ( err == SA_OK ) - return DemarshalArray( byte_order, m->m_reply, params, buffer ); - - return rv; + return cc; } Modified: openhpi/trunk/marshal/marshal_hpi.h =================================================================== --- openhpi/trunk/marshal/marshal_hpi.h 2012-08-28 14:32:08 UTC (rev 7509) +++ openhpi/trunk/marshal/marshal_hpi.h 2012-08-31 14:17:43 UTC (rev 7510) @@ -172,6 +172,7 @@ typedef struct { int m_id; + const char *m_name; const cMarshalType **m_request; const cMarshalType **m_reply; // the first param is the result } cHpiMarshal; @@ -180,6 +181,7 @@ #define dHpiMarshalEntry(name) \ { \ eF ## name, \ + #name, \ name ## In, \ name ## Out \ } Modified: openhpi/trunk/marshal/marshal_hpi_types.c =================================================================== --- openhpi/trunk/marshal/marshal_hpi_types.c 2012-08-28 14:32:08 UTC (rev 7509) +++ openhpi/trunk/marshal/marshal_hpi_types.c 2012-08-31 14:17:43 UTC (rev 7510) @@ -27,7 +27,7 @@ // SaHpiTextBuffer -static cMarshalType SaHpiTextBufferDataArray = dArray( SAHPI_MAX_TEXT_BUFFER_LENGTH, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType SaHpiTextBufferDataArray = dArray( "SaHpiTextBufferDataArray", SAHPI_MAX_TEXT_BUFFER_LENGTH, SaHpiUint8T, SaHpiUint8Type ); static cMarshalType SaHpiTextBufferElements[] = { @@ -41,8 +41,8 @@ cMarshalType SaHpiTextBufferType = dStruct( SaHpiTextBufferElements ); // oHpi -static cMarshalType oHpiHandlerConfigParamTypeNameArray = dArray( SAHPI_MAX_TEXT_BUFFER_LENGTH, SaHpiUint8T, SaHpiUint8Type ); -static cMarshalType oHpiHandlerConfigParamTypeValueArray = dArray( SAHPI_MAX_TEXT_BUFFER_LENGTH, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType oHpiHandlerConfigParamTypeNameArray = dArray( "oHpiHandlerConfigParamTypeNameArray", SAHPI_MAX_TEXT_BUFFER_LENGTH, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType oHpiHandlerConfigParamTypeValueArray = dArray( "oHpiHandlerConfigParamTypeValueArray", SAHPI_MAX_TEXT_BUFFER_LENGTH, SaHpiUint8T, SaHpiUint8Type ); static cMarshalType oHpiHandlerConfigParamTypeElements[] = { dStructElement( oHpiHandlerConfigParamT, Name, oHpiHandlerConfigParamTypeNameArray ), @@ -51,7 +51,7 @@ }; cMarshalType oHpiHandlerConfigParamType = dStruct( oHpiHandlerConfigParamTypeElements ); -static cMarshalType HandlerConfigParamsArray = dVarArray( 0, oHpiHandlerConfigParamT, oHpiHandlerConfigParamType ); +static cMarshalType HandlerConfigParamsArray = dVarArray( "HandlerConfigParamsArray", 0, oHpiHandlerConfigParamT, oHpiHandlerConfigParamType ); static cMarshalType oHpiHandlerConfigTypeElements[] = { dStructElement( oHpiHandlerConfigT, NumberOfParams, SaHpiUint8Type ), @@ -71,7 +71,7 @@ cMarshalType SaHpiEntityType = dStruct( SaHpiEntityElements ); // entity path -static cMarshalType SaHpiEntityPathEntryArray = dArray( SAHPI_MAX_ENTITY_PATH, SaHpiEntityT, SaHpiEntityType ); +static cMarshalType SaHpiEntityPathEntryArray = dArray( "SaHpiEntityPathEntryArray", SAHPI_MAX_ENTITY_PATH, SaHpiEntityT, SaHpiEntityType ); static cMarshalType SaHpiEntityPathElements[] = @@ -83,7 +83,7 @@ cMarshalType SaHpiEntityPathType = dStruct( SaHpiEntityPathElements ); // sensors -static cMarshalType SaHpiSensorInterpretedUnionBufferArray = dArray( SAHPI_SENSOR_BUFFER_LENGTH, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType SaHpiSensorInterpretedUnionBufferArray = dArray( "SaHpiSensorInterpretedUnionBufferArray", SAHPI_SENSOR_BUFFER_LENGTH, SaHpiUint8T, SaHpiUint8Type ); static cMarshalType SaHpiSensorReadingUnionElements[] = { @@ -196,7 +196,7 @@ // stream control state -static cMarshalType SaHpiCtrlStateStreamArray = dArray( SAHPI_CTRL_MAX_STREAM_LENGTH, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType SaHpiCtrlStateStreamArray = dArray( "SaHpiCtrlStateStreamArray", SAHPI_CTRL_MAX_STREAM_LENGTH, SaHpiUint8T, SaHpiUint8Type ); static cMarshalType SaHpiCtrlStateStreamElements[] = @@ -224,7 +224,7 @@ // OEM control state -static cMarshalType SaHpiCtrlStateOemBodyArray = dArray( SAHPI_CTRL_MAX_OEM_BODY_LENGTH, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType SaHpiCtrlStateOemBodyArray = dArray( "SaHpiCtrlStateOemBodyArray", SAHPI_CTRL_MAX_OEM_BODY_LENGTH, SaHpiUint8T, SaHpiUint8Type ); static cMarshalType SaHpiCtrlStateOemElements[] = { @@ -314,7 +314,7 @@ cMarshalType SaHpiCtrlRecTextType = dStruct( SaHpiCtrlRecTextElements ); -static cMarshalType SaHpiCtrlRecOemConfigDataArray = dArray( SAHPI_CTRL_OEM_CONFIG_LENGTH, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType SaHpiCtrlRecOemConfigDataArray = dArray( "SaHpiCtrlRecOemConfigDataArray", SAHPI_CTRL_OEM_CONFIG_LENGTH, SaHpiUint8T, SaHpiUint8Type ); static cMarshalType SaHpiCtrlRecOemElements[] = { @@ -452,7 +452,7 @@ // annunciators -static cMarshalType SaHpiNameDataArray = dArray( SA_HPI_MAX_NAME_LENGTH, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType SaHpiNameDataArray = dArray( "SaHpiNameDataArray", SA_HPI_MAX_NAME_LENGTH, SaHpiUint8T, SaHpiUint8Type ); static cMarshalType SaHpiNameElements[] = { @@ -551,7 +551,7 @@ }; cMarshalType SaHpiDimiTestParamValue1Type = dUnion( 1, SaHpiDimiTestParamValue1TypeElements ); -static cMarshalType ParamNameArray = dArray( SAHPI_DIMITEST_PARAM_NAME_LEN, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType ParamNameArray = dArray( "ParamNameArray", SAHPI_DIMITEST_PARAM_NAME_LEN, SaHpiUint8T, SaHpiUint8Type ); static cMarshalType SaHpiDimiTestParamsDefinitionTypeElements[] = { dStructElement( SaHpiDimiTestParamsDefinitionT, ParamName, ParamNameArray ), @@ -572,8 +572,8 @@ }; cMarshalType SaHpiDimiTestAffectedEntityType = dStruct( SaHpiDimiTestAffectedEntityTypeElements ); -static cMarshalType EntitiesImpactedArray = dArray( SAHPI_DIMITEST_MAX_ENTITIESIMPACTED, SaHpiDimiTestAffectedEntityT, SaHpiDimiTestAffectedEntityType ); -static cMarshalType TestParametersArray = dArray( SAHPI_DIMITEST_MAX_PARAMETERS, SaHpiDimiTestParamsDefinitionT, SaHpiDimiTestParamsDefinitionType ); +static cMarshalType EntitiesImpactedArray = dArray( "EntitiesImpactedArray", SAHPI_DIMITEST_MAX_ENTITIESIMPACTED, SaHpiDimiTestAffectedEntityT, SaHpiDimiTestAffectedEntityType ); +static cMarshalType TestParametersArray = dArray( "TestParametersArray", SAHPI_DIMITEST_MAX_PARAMETERS, SaHpiDimiTestParamsDefinitionT, SaHpiDimiTestParamsDefinitionType ); static cMarshalType SaHpiDimiTestTypeElements[] = { dStructElement( SaHpiDimiTestT, TestName, SaHpiTextBufferType ), @@ -609,7 +609,7 @@ }; cMarshalType SaHpiDimiTestVariableParamsType = dStruct( SaHpiDimiTestVariableParamsTypeElements ); -static cMarshalType ParamsListArray = dVarArray( 0, SaHpiDimiTestVariableParamsT, SaHpiDimiTestVariableParamsType ); +static cMarshalType ParamsListArray = dVarArray( "ParamsListArray", 0, SaHpiDimiTestVariableParamsT, SaHpiDimiTestVariableParamsType ); static cMarshalType SaHpiDimiTestVariableParamsListTypeElements[] = { dStructElement( SaHpiDimiTestVariableParamsListT, NumberOfParams, SaHpiUint8Type ), @@ -637,7 +637,7 @@ }; static cMarshalType SaHpiFumiSafDefinedSpecInfoType = dStruct( SaHpiFumiSafDefinedSpecInfoElements ); -static cMarshalType SaHpiFumiOemDefinedSpecInfoBodyArray = dArray( SAHPI_FUMI_MAX_OEM_BODY_LENGTH, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType SaHpiFumiOemDefinedSpecInfoBodyArray = dArray( "SaHpiFumiOemDefinedSpecInfoBodyArray", SAHPI_FUMI_MAX_OEM_BODY_LENGTH, SaHpiUint8T, SaHpiUint8Type ); static cMarshalType SaHpiFumiOemDefinedSpecInfoElements[] = { @@ -665,7 +665,7 @@ dStructElementEnd() }; cMarshalType SaHpiFumiSpecInfoType = dStruct( SaHpiFumiSpecInfoTypeElements ); - + static cMarshalType SaHpiFumiImpactedEntityTypeElements[] = { dStructElement( SaHpiFumiImpactedEntityT, ImpactedEntity, SaHpiEntityPathType ), @@ -674,7 +674,7 @@ }; static cMarshalType SaHpiFumiImpactedEntityType = dStruct( SaHpiFumiImpactedEntityTypeElements ); -static cMarshalType SaHpiFumiServiceImpactDataImpactedEntitiesArray = dArray( SAHPI_FUMI_MAX_ENTITIES_IMPACTED, SaHpiFumiImpactedEntityT, SaHpiFumiImpactedEntityType ); +static cMarshalType SaHpiFumiServiceImpactDataImpactedEntitiesArray = dArray( "SaHpiFumiServiceImpactDataImpactedEntitiesArray", SAHPI_FUMI_MAX_ENTITIES_IMPACTED, SaHpiFumiImpactedEntityT, SaHpiFumiImpactedEntityType ); static cMarshalType SaHpiFumiServiceImpactDataElements[] = { @@ -974,7 +974,7 @@ // resource presence table -static cMarshalType GuidDataArray = dArray( 16, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType GuidDataArray = dArray( "GuidDataArray", 16, SaHpiUint8T, SaHpiUint8Type ); static cMarshalType SaHpiResourceInfoElements[] = { @@ -997,13 +997,13 @@ { dStructElement( SaHpiRptEntryT, EntryId, SaHpiEntryIdType ), dStructElement( SaHpiRptEntryT, ResourceId, SaHpiResourceIdType ), - dStructElement( SaHpiRptEntryT, ResourceInfo, SaHpiResourceInfoType ), + dStructElement( SaHpiRptEntryT, ResourceInfo, SaHpiResourceInfoType ), dStructElement( SaHpiRptEntryT, ResourceEntity, SaHpiEntityPathType ), dStructElement( SaHpiRptEntryT, ResourceCapabilities,SaHpiCapabilitiesType ), dStructElement( SaHpiRptEntryT, HotSwapCapabilities, SaHpiHsCapabilitiesType ), dStructElement( SaHpiRptEntryT, ResourceSeverity, SaHpiSeverityType ), dStructElement( SaHpiRptEntryT, ResourceFailed, SaHpiBoolType ), - dStructElement( SaHpiRptEntryT, ResourceTag, SaHpiTextBufferType ), + dStructElement( SaHpiRptEntryT, ResourceTag, SaHpiTextBufferType ), dStructElementEnd() }; @@ -1099,7 +1099,7 @@ // handler info -static cMarshalType plugin_nameBufferArray = dArray( MAX_PLUGIN_NAME_LENGTH, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType plugin_nameBufferArray = dArray( "plugin_nameBufferArray", MAX_PLUGIN_NAME_LENGTH, SaHpiUint8T, SaHpiUint8Type ); static cMarshalType oHpiHandlerInfoElements[] = { @@ -1114,9 +1114,9 @@ // global param -static cMarshalType GlobalParamPathArray = dArray( OH_PATH_PARAM_MAX_LENGTH, SaHpiUint8T, SaHpiUint8Type ); -static cMarshalType GlobalParamVarPathArray = dArray( OH_PATH_PARAM_MAX_LENGTH, SaHpiUint8T, SaHpiUint8Type ); -static cMarshalType GlobalParamConfArray = dArray( OH_PATH_PARAM_MAX_LENGTH, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType GlobalParamPathArray = dArray( "GlobalParamPathArray", OH_PATH_PARAM_MAX_LENGTH, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType GlobalParamVarPathArray = dArray( "GlobalParamVarPathArray", OH_PATH_PARAM_MAX_LENGTH, SaHpiUint8T, SaHpiUint8Type ); +static cMarshalType GlobalParamConfArray = dArray( "GlobalParamConfArray", OH_PATH_PARAM_MAX_LENGTH, SaHpiUint8T, SaHpiUint8Type ); static cMarshalType oHpiGlobalParamUnionTypeElements[] = { Modified: openhpi/trunk/openhpid/server.cpp =================================================================== --- openhpi/trunk/openhpid/server.cpp 2012-08-28 14:32:08 UTC (rev 7509) +++ openhpi/trunk/openhpid/server.cpp 2012-08-31 14:17:43 UTC (rev 7510) @@ -239,12 +239,12 @@ process_rv = SA_ERR_HPI_UNSUPPORTED_API; } if (process_rv != SA_OK) { - int mr = HpiMarshalReply0(hm, data, &process_rv); - if (mr < 0) { - CRIT("%p Marshal failed.", thrdid); + int cc = HpiMarshalReply0(hm, data, &process_rv); + if (cc < 0) { + CRIT("%p Marshal failed, cc = %d", thrdid, cc); break; } - data_len = (uint32_t)mr; + data_len = (uint32_t)cc; } rc = sock->WriteMsg(eMhMsg, id, data, data_len); if (stop) { @@ -285,19 +285,19 @@ #define DEMARSHAL_RQ(rq_byte_order, hm, data, iparams) \ { \ - int mr = HpiDemarshalRequest(rq_byte_order, hm, data, iparams.array); \ - if (mr < 0) { \ + int cc = HpiDemarshalRequest(rq_byte_order, hm, data, iparams.array); \ + if (cc < 0) { \ return SA_ERR_HPI_INVALID_PARAMS; \ } \ } #define MARSHAL_RP(hm, data, data_len, oparams) \ { \ - int mr = HpiMarshalReply(hm, data, oparams.const_array); \ - if (mr < 0) { \ + int cc = HpiMarshalReply(hm, data, oparams.const_array); \ + if (cc < 0) { \ return SA_ERR_HPI_INTERNAL_ERROR; \ } \ - data_len = (uint32_t)mr; \ + data_len = (uint32_t)cc; \ } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dr_...@us...> - 2012-10-30 17:23:16
|
Revision: 7521 http://openhpi.svn.sourceforge.net/openhpi/?rev=7521&view=rev Author: dr_mohan Date: 2012-10-30 17:23:05 +0000 (Tue, 30 Oct 2012) Log Message: ----------- Fix for #3566478 Modified Paths: -------------- openhpi/trunk/openhpi.spec.in openhpi/trunk/openhpid/conf.c Modified: openhpi/trunk/openhpi.spec.in =================================================================== --- openhpi/trunk/openhpi.spec.in 2012-10-25 20:24:45 UTC (rev 7520) +++ openhpi/trunk/openhpi.spec.in 2012-10-30 17:23:05 UTC (rev 7521) @@ -294,8 +294,8 @@ %{_docdir}/README* %{_docdir}/COPYING %dir %{_sysconfdir}/%{name}/ -%config(noreplace) %attr(0640,root,root) %{_sysconfdir}/%{name}/%{name}.conf -%config(noreplace) %attr(0640,root,root) %{_sysconfdir}/%{name}/simulation.data +%config(noreplace) %attr(0600,root,root) %{_sysconfdir}/%{name}/%{name}.conf +%config(noreplace) %attr(0600,root,root) %{_sysconfdir}/%{name}/simulation.data %dir %{_libdir}/%{name} %dir /var/lib/%{name} %{_libdir}/libopenhpi*.so.* Modified: openhpi/trunk/openhpid/conf.c =================================================================== --- openhpi/trunk/openhpid/conf.c 2012-10-25 20:24:45 UTC (rev 7520) +++ openhpi/trunk/openhpid/conf.c 2012-10-30 17:23:05 UTC (rev 7521) @@ -23,7 +23,15 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <limits.h> +#ifndef _WIN32 +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> +#include <libgen.h> +#endif // _WIN32 + #include <config.h> #include <oh_plugin.h> #include <oh_error.h> @@ -483,10 +491,14 @@ **/ int oh_load_config (char *filename, struct oh_parsed_config *config) { - FILE * fp; - int i; + FILE * fp = NULL; +#ifndef _WIN32 + struct stat fst, dst; + char *dir_name = NULL; + char dup_filename[PATH_MAX]; +#endif GScanner *oh_scanner; - int done = 0; + int i, done = 0; int num_tokens = sizeof(oh_conf_tokens) / sizeof(oh_conf_tokens[0]); if (!filename || !config) { @@ -504,6 +516,62 @@ oh_scanner->msg_handler = scanner_msg_handler; oh_scanner->input_name = filename; +#ifndef _WIN32 + + if (stat (filename, &fst) == -1) { + CRIT("stat of %s failed.", filename); + return -3; + } + + if (fst.st_uid != geteuid()) { + if (fst.st_uid == 0) { + CRIT("%s owner is root (0)!", filename); + CRIT("Run as sudo or create a config with UID=%d.", (int)geteuid()); + return -3; + } else { + CRIT("%s owner(%d) is insecure!", filename, fst.st_uid); + CRIT("Owner UID shall be %d.", (int)geteuid()); + return -3; + } + } + + if (((fst.st_mode & (S_IRWXG | S_IRWXO)) != 0)) { + CRIT("%s permissions are insecure!", filename); + CRIT("Shall not contain bits for group/others."); + return -3; + } + + if ((fst.st_mode & S_IFMT) != S_IFREG) { + CRIT("%s permissions are insecure!", filename); + CRIT("It needs to be a regular file"); + return -3; + } + + /* Now check the directory permissions */ + if (strlen(filename) >= PATH_MAX) { + CRIT("%s is too long",filename); + return -3; + } + strcpy(dup_filename, filename); + dir_name=dirname(dup_filename); + if (stat(dir_name, &dst) == -1) { + CRIT("stat of %s failed.", dir_name); + return -3; + } + + if ((fst.st_uid != dst.st_uid)) { + CRIT("%s directory is insecure", dir_name); + CRIT("Owner UID shall be %d",fst.st_uid); + return -3; + } + if ((dst.st_mode & (S_IWOTH | S_IWGRP)) != 0 ) { + CRIT("%s directory is insecure",dir_name); + CRIT("Shall not be writable by group or others"); + return -3; + } + +#endif // _WIN32 + fp = fopen(filename, "r"); if (!fp) { CRIT("Configuration file '%s' could not be opened.", filename); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <av...@us...> - 2013-03-03 05:27:23
|
Revision: 7525 http://openhpi.svn.sourceforge.net/openhpi/?rev=7525&view=rev Author: avpak Date: 2013-03-03 05:27:14 +0000 (Sun, 03 Mar 2013) Log Message: ----------- Fix for #3606640 Modified Paths: -------------- openhpi/trunk/README openhpi/trunk/clients/Makefile.am openhpi/trunk/clients/hpixml/Makefile.am Modified: openhpi/trunk/README =================================================================== --- openhpi/trunk/README 2013-01-29 23:43:15 UTC (rev 7524) +++ openhpi/trunk/README 2013-03-03 05:27:14 UTC (rev 7525) @@ -106,7 +106,7 @@ FOR SUBVERSION EXTRACTS -svn co https://openhpi.svn.sf.net/svnroot/openhpi/openhpi/trunk mydir +svn co https://openhpi.svn.sourceforge.net/svnroot/openhpi/openhpi/trunk mydir It will extract OpenHPI trunk to mydir. First time after extracting the code: Modified: openhpi/trunk/clients/Makefile.am =================================================================== --- openhpi/trunk/clients/Makefile.am 2013-01-29 23:43:15 UTC (rev 7524) +++ openhpi/trunk/clients/Makefile.am 2013-03-03 05:27:14 UTC (rev 7525) @@ -10,7 +10,7 @@ EXTRA_DIST = Makefile.mingw32 version.rc -COMMONLIBS = $(top_builddir)/baselib/libopenhpi.la +COMMONLIBS = $(top_builddir)/baselib/libopenhpi.la $(top_builddir)/utils/libopenhpiutils.la CLIENTS_SRC = clients.c oh_clients.h Modified: openhpi/trunk/clients/hpixml/Makefile.am =================================================================== --- openhpi/trunk/clients/hpixml/Makefile.am 2013-01-29 23:43:15 UTC (rev 7524) +++ openhpi/trunk/clients/hpixml/Makefile.am 2013-03-03 05:27:14 UTC (rev 7525) @@ -21,9 +21,10 @@ schema.S \ xml_writer.cpp \ xml_writer.h \ - $(top_srcdir)/clients/clients.c + $(top_srcdir)/clients/clients.c \ + $(top_srcdir)/clients/oh_clients.h -hpixml_LDADD = $(top_builddir)/baselib/libopenhpi.la +hpixml_LDADD = $(top_builddir)/baselib/libopenhpi.la $(top_builddir)/utils/libopenhpiutils.la clean-local: rm -f *~ *.o This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dr_...@us...> - 2013-05-28 23:26:24
|
Revision: 7541 http://openhpi.svn.sourceforge.net/openhpi/?rev=7541&view=rev Author: dr_mohan Date: 2013-05-28 23:26:17 +0000 (Tue, 28 May 2013) Log Message: ----------- Fix for 3613753 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 2013-05-24 18:57:58 UTC (rev 7540) +++ openhpi/trunk/openhpid/safhpi.c 2013-05-28 23:26:17 UTC (rev 7541) @@ -601,7 +601,6 @@ saved_res = *rpte; OH_HANDLER_GET(d, ResourceId, h); oh_release_domain(d); - hid = h->id; if (h && h->abi->resource_failed_remove) { OH_CALL_ABI(h, resource_failed_remove, SA_ERR_HPI_INTERNAL_ERROR, error, @@ -609,6 +608,7 @@ oh_release_handler(h); return error; } + hid = h->id; /* If the resource_failed_remove ABI is not defined, then remove the * resource from rptcache */ Modified: openhpi/trunk/utils/sahpi_struct_utils.c =================================================================== --- openhpi/trunk/utils/sahpi_struct_utils.c 2013-05-24 18:57:58 UTC (rev 7540) +++ openhpi/trunk/utils/sahpi_struct_utils.c 2013-05-28 23:26:17 UTC (rev 7541) @@ -3616,12 +3616,13 @@ static SaErrorT oh_build_event_dimi(oh_big_textbuffer *buffer, const SaHpiEventT *event, int offsets) { char str[SAHPI_MAX_TEXT_BUFFER_LENGTH]; - const SaHpiDimiEventT* de = &(event->EventDataUnion.DimiEvent); + const SaHpiDimiEventT* de; if ( !buffer || !event) { DBG("Invalid parameter."); return(SA_ERR_HPI_INVALID_PARAMS); } + de = &(event->EventDataUnion.DimiEvent); oh_append_offset(buffer, offsets); snprintf(str, SAHPI_MAX_TEXT_BUFFER_LENGTH, "DimiEventData:\n"); @@ -3664,12 +3665,13 @@ static SaErrorT oh_build_event_dimi_update(oh_big_textbuffer *buffer, const SaHpiEventT *event, int offsets) { char str[SAHPI_MAX_TEXT_BUFFER_LENGTH]; - const SaHpiDimiUpdateEventT* de = &(event->EventDataUnion.DimiUpdateEvent); + const SaHpiDimiUpdateEventT* de; if ( !buffer || !event) { DBG("Invalid parameter."); return(SA_ERR_HPI_INVALID_PARAMS); } + de = &(event->EventDataUnion.DimiUpdateEvent); oh_append_offset(buffer, offsets); snprintf(str, SAHPI_MAX_TEXT_BUFFER_LENGTH, "DimiUpdateEventData:\n"); @@ -3697,12 +3699,13 @@ static SaErrorT oh_build_event_fumi(oh_big_textbuffer *buffer, const SaHpiEventT *event, int offsets) { char str[SAHPI_MAX_TEXT_BUFFER_LENGTH]; - const SaHpiFumiEventT* fe = &(event->EventDataUnion.FumiEvent); + const SaHpiFumiEventT* fe; if ( !buffer || !event) { DBG("Invalid parameter."); return(SA_ERR_HPI_INVALID_PARAMS); } + fe = &(event->EventDataUnion.FumiEvent); oh_append_offset(buffer, offsets); snprintf(str, SAHPI_MAX_TEXT_BUFFER_LENGTH, "FumiEventData:\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dr_...@us...> - 2013-07-16 18:24:39
|
Revision: 7547 http://sourceforge.net/p/openhpi/code/7547 Author: dr_mohan Date: 2013-07-16 18:24:36 +0000 (Tue, 16 Jul 2013) Log Message: ----------- Fix for #1804 Modified Paths: -------------- openhpi/trunk/Makefile.am openhpi/trunk/marshal/t/marshal_028.c openhpi/trunk/marshal/t/marshal_029.c openhpi/trunk/openhpi.spec.in openhpi/trunk/openhpid/conf.c openhpi/trunk/openhpid/t/ohpi/Makefile.am openhpi/trunk/plugins/simulator/t/Makefile.am openhpi/trunk/plugins/snmp_bc/t/Makefile.am openhpi/trunk/rt-env.sh.in Added Paths: ----------- openhpi/trunk/openhpid/t/ohpi/setup_conf.c openhpi/trunk/plugins/simulator/t/setup_conf.c openhpi/trunk/plugins/snmp_bc/t/setup_conf.c Modified: openhpi/trunk/Makefile.am =================================================================== --- openhpi/trunk/Makefile.am 2013-06-27 22:16:46 UTC (rev 7546) +++ openhpi/trunk/Makefile.am 2013-07-16 18:24:36 UTC (rev 7547) @@ -135,10 +135,10 @@ chmod 777 $(DESTDIR)$(VARPATH) $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/openhpi if test ! -e $(DESTDIR)$(sysconfdir)/openhpi/openhpi.conf; then \ - $(INSTALL_DATA) $(top_srcdir)/openhpi.conf.example $(DESTDIR)$(sysconfdir)/openhpi/openhpi.conf; \ + $(INSTALL) -m 600 $(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; \ + $(INSTALL) -m 600 $(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; \ @@ -164,6 +164,12 @@ mkdir $(top_srcdir)/rpm/INSTALL $(RPM) $(RPMFLAGS) $(PACKAGE_NAME).spec </dev/null; +dist-hook: + $(shell find $(distdir) -name openhpi.conf -exec chmod 600 "{}" ";") + +distcheck-hook: + $(shell find $(distdir) -name openhpi.conf -exec chmod 600 "{}" ";") + documentation: $(MAKE) -C docs Modified: openhpi/trunk/marshal/t/marshal_028.c =================================================================== --- openhpi/trunk/marshal/t/marshal_028.c 2013-06-27 22:16:46 UTC (rev 7546) +++ openhpi/trunk/marshal/t/marshal_028.c 2013-07-16 18:24:36 UTC (rev 7547) @@ -27,7 +27,7 @@ tUint8 m_pad3; } cTest; -cMarshalType TestVarArrayType = dVarArray( 1, SaHpiDimiTestVariableParamsT, SaHpiDimiTestVariableParamsType ); +cMarshalType TestVarArrayType = dVarArray("TestVarArrayType", 1, SaHpiDimiTestVariableParamsT, SaHpiDimiTestVariableParamsType ); cMarshalType StructElements[] = { dStructElement( cTest, m_pad1 , Marshal_Uint8Type ), Modified: openhpi/trunk/marshal/t/marshal_029.c =================================================================== --- openhpi/trunk/marshal/t/marshal_029.c 2013-06-27 22:16:46 UTC (rev 7546) +++ openhpi/trunk/marshal/t/marshal_029.c 2013-07-16 18:24:36 UTC (rev 7547) @@ -33,7 +33,7 @@ tInt8 m_array[dArraySize]; } cTest1; -cMarshalType ArrayType = dArray( dArraySize, tInt8, Marshal_Int8Type ); +cMarshalType ArrayType = dArray("ArrayType", dArraySize, tInt8, Marshal_Int8Type ); cMarshalType Test1Elements[] = { Modified: openhpi/trunk/openhpi.spec.in =================================================================== --- openhpi/trunk/openhpi.spec.in 2013-06-27 22:16:46 UTC (rev 7546) +++ openhpi/trunk/openhpi.spec.in 2013-07-16 18:24:36 UTC (rev 7547) @@ -283,7 +283,7 @@ ################################################### make DESTDIR=%{buildroot} install %{__install} -Dd -m 0755 %{buildroot}%{_sysconfdir}/%{name} %{buildroot}/var/lib/%{name} -%{__install} -m 0644 %{name}.conf.example %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf +%{__install} -m 0600 %{name}.conf.example %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf %post Modified: openhpi/trunk/openhpid/conf.c =================================================================== --- openhpi/trunk/openhpid/conf.c 2013-06-27 22:16:46 UTC (rev 7546) +++ openhpi/trunk/openhpid/conf.c 2013-07-16 18:24:36 UTC (rev 7547) @@ -30,6 +30,7 @@ #include <sys/types.h> #include <unistd.h> #include <libgen.h> +#include <errno.h> #endif // _WIN32 #include <config.h> @@ -496,6 +497,7 @@ struct stat fst, dst; char *dir_name = NULL; char dup_filename[PATH_MAX]; + extern int errno; #endif GScanner *oh_scanner; int i, done = 0; @@ -518,58 +520,62 @@ #ifndef _WIN32 + errno=0; if (stat (filename, &fst) == -1) { - CRIT("stat of %s failed.", filename); - return -3; + if (errno != ENOENT) { + CRIT("stat of %s failed.", filename); + return -3; + } } + if (errno != ENOENT) { + if (fst.st_uid != geteuid()) { + if (fst.st_uid == 0) { + CRIT("%s owner is root (0)!", filename); + CRIT("Run as sudo or create a config with UID=%d.", (int)geteuid()); + return -3; + } else { + CRIT("%s owner(%d) is insecure!", filename, fst.st_uid); + CRIT("Owner UID shall be %d.", (int)geteuid()); + return -3; + } + } - if (fst.st_uid != geteuid()) { - if (fst.st_uid == 0) { - CRIT("%s owner is root (0)!", filename); - CRIT("Run as sudo or create a config with UID=%d.", (int)geteuid()); - return -3; - } else { - CRIT("%s owner(%d) is insecure!", filename, fst.st_uid); - CRIT("Owner UID shall be %d.", (int)geteuid()); - return -3; - } - } + if (((fst.st_mode & (S_IRWXG | S_IRWXO)) != 0)) { + CRIT("%s permissions are insecure!", filename); + CRIT("Shall not contain bits for group/others."); + return -3; + } - if (((fst.st_mode & (S_IRWXG | S_IRWXO)) != 0)) { - CRIT("%s permissions are insecure!", filename); - CRIT("Shall not contain bits for group/others."); - return -3; - } + if ((fst.st_mode & S_IFMT) != S_IFREG) { + CRIT("%s permissions are insecure!", filename); + CRIT("It needs to be a regular file"); + return -3; + } - if ((fst.st_mode & S_IFMT) != S_IFREG) { - CRIT("%s permissions are insecure!", filename); - CRIT("It needs to be a regular file"); - return -3; - } + /* Now check the directory permissions */ + if (strlen(filename) >= PATH_MAX) { + CRIT("%s is too long",filename); + return -3; + } + strcpy(dup_filename, filename); + dir_name=dirname(dup_filename); + if (stat(dir_name, &dst) == -1) { + CRIT("stat of %s failed.", dir_name); + return -3; + } - /* Now check the directory permissions */ - if (strlen(filename) >= PATH_MAX) { - CRIT("%s is too long",filename); - return -3; - } - strcpy(dup_filename, filename); - dir_name=dirname(dup_filename); - if (stat(dir_name, &dst) == -1) { - CRIT("stat of %s failed.", dir_name); - return -3; - } + if ((fst.st_uid != dst.st_uid)) { + CRIT("%s directory is insecure", dir_name); + CRIT("Owner UID shall be %d",fst.st_uid); + return -3; + } + if ((dst.st_mode & (S_IWOTH | S_IWGRP)) != 0 ) { + CRIT("%s directory is insecure",dir_name); + CRIT("Shall not be writable by group or others"); + return -3; + } + } - if ((fst.st_uid != dst.st_uid)) { - CRIT("%s directory is insecure", dir_name); - CRIT("Owner UID shall be %d",fst.st_uid); - return -3; - } - if ((dst.st_mode & (S_IWOTH | S_IWGRP)) != 0 ) { - CRIT("%s directory is insecure",dir_name); - CRIT("Shall not be writable by group or others"); - return -3; - } - #endif // _WIN32 fp = fopen(filename, "r"); Modified: openhpi/trunk/openhpid/t/ohpi/Makefile.am =================================================================== --- openhpi/trunk/openhpid/t/ohpi/Makefile.am 2013-06-27 22:16:46 UTC (rev 7546) +++ openhpi/trunk/openhpid/t/ohpi/Makefile.am 2013-07-16 18:24:36 UTC (rev 7547) @@ -26,6 +26,7 @@ TESTS_ENVIRONMENT += LD_LIBRARY_PATH=$(top_srcdir)/openhpid/.libs:$(top_srcdir)/ssl/.libs:$(top_srcdir)/utils/.libs TESTS = \ + setup_conf \ ohpi_007 \ ohpi_008 \ ohpi_009 \ @@ -51,6 +52,8 @@ check_PROGRAMS = $(TESTS) +setup_conf_SOURCES = setup_conf.c + ohpi_007_SOURCES = ohpi_007.c ohpi_007_LDADD = $(TDEPLIB) ohpi_007_LDFLAGS = -export-dynamic Added: openhpi/trunk/openhpid/t/ohpi/setup_conf.c =================================================================== --- openhpi/trunk/openhpid/t/ohpi/setup_conf.c (rev 0) +++ openhpi/trunk/openhpid/t/ohpi/setup_conf.c 2013-07-16 18:24:36 UTC (rev 7547) @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2013, 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) + * Mohanasundaram Devarajulu (moh...@hp...) + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> +#include <libgen.h> +#include <errno.h> +#include <SaHpi.h> +#include <oHpi.h> +#include <oh_utils.h> + + + +/** + * openhpi.conf in this directory needs to have 600 or 400 permissions + * SVN does not allow to remove read permissions, so set it up now + **/ + + +int main(int argc, char **argv) +{ + struct stat fst; + char filename[30] = "./openhpi.conf"; + char modestr[] = "0600"; + int mode = 0; + mode = strtol(modestr, 0 ,8); + if (stat (filename, &fst) == -1) { + printf("stat of %s failed. Error is %s \n", filename, strerror(errno)); + if (errno == ENOENT) { +#ifdef OPENHPI_CONF + if(stat (OPENHPI_CONF, &fst) == -1) { + printf("stat of %s failed. Quitingi. \n", OPENHPI_CONF); + if (errno == ENOENT) + return 0; + else + return -1; + } + if (chmod(filename,mode) < 0) + { + printf("chmod (%s, %s) failed as %s\n", filename, modestr, strerror(errno)); + return -1; + } +#endif + return 0; + } + else + return -1; + } + if (chmod(filename,mode) < 0) + { + printf("chmod (%s, %s) failed with %d(%s)\n", filename, modestr, errno, strerror(errno)); + return -1; + } + return 0; +} + Modified: openhpi/trunk/plugins/simulator/t/Makefile.am =================================================================== --- openhpi/trunk/plugins/simulator/t/Makefile.am 2013-06-27 22:16:46 UTC (rev 7546) +++ openhpi/trunk/plugins/simulator/t/Makefile.am 2013-07-16 18:24:36 UTC (rev 7547) @@ -25,7 +25,9 @@ TESTS_ENVIRONMENT += OPENHPI_CONF=$(top_srcdir)/plugins/simulator/t/openhpi.conf TESTS_ENVIRONMENT += LD_LIBRARY_PATH=$(top_srcdir)/openhpid/.libs:$(top_srcdir)/ssl/.libs:$(top_srcdir)/utils/.libs -TESTS = sim_sanity_000 \ +TESTS = \ + setup_conf \ + sim_sanity_000 \ sim_sanity_001 \ sim_sanity_002 \ sim_sanity_003 \ @@ -74,6 +76,8 @@ check_PROGRAMS = $(TESTS) +setup_conf_SOURCES = setup_conf.c + sim_sanity_000_SOURCES = sim_sanity_000.c sim_sanity_000_LDADD = $(TDEPLIB) sim_sanity_000_LDFLAGS = -export-dynamic Added: openhpi/trunk/plugins/simulator/t/setup_conf.c =================================================================== --- openhpi/trunk/plugins/simulator/t/setup_conf.c (rev 0) +++ openhpi/trunk/plugins/simulator/t/setup_conf.c 2013-07-16 18:24:36 UTC (rev 7547) @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2013, 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) + * Mohanasundaram Devarajulu (moh...@hp...) + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> +#include <libgen.h> +#include <errno.h> +#include <SaHpi.h> +#include <oHpi.h> +#include <oh_utils.h> + + + +/** + * openhpi.conf in this directory needs to have 600 or 400 permissions + * SVN does not allow to remove read permissions, so set it up now + **/ + + +int main(int argc, char **argv) +{ + struct stat fst; + char filename[30] = "./openhpi.conf"; + char modestr[] = "0600"; + int mode = 0; + mode = strtol(modestr, 0 ,8); + if (stat (filename, &fst) == -1) { + printf("stat of %s failed. Error is %s \n", filename, strerror(errno)); + if (errno == ENOENT) { +#ifdef OPENHPI_CONF + if(stat (OPENHPI_CONF, &fst) == -1) { + printf("stat of %s failed. Quitingi. \n", OPENHPI_CONF); + if (errno == ENOENT) + return 0; + else + return -1; + } + if (chmod(filename,mode) < 0) + { + printf("chmod (%s, %s) failed as %s\n", filename, modestr, strerror(errno)); + return -1; + } +#endif + return 0; + } + else + return -1; + } + if (chmod(filename,mode) < 0) + { + printf("chmod (%s, %s) failed with %d(%s)\n", filename, modestr, errno, strerror(errno)); + return -1; + } + return 0; +} + Modified: openhpi/trunk/plugins/snmp_bc/t/Makefile.am =================================================================== --- openhpi/trunk/plugins/snmp_bc/t/Makefile.am 2013-06-27 22:16:46 UTC (rev 7546) +++ openhpi/trunk/plugins/snmp_bc/t/Makefile.am 2013-07-16 18:24:36 UTC (rev 7547) @@ -102,6 +102,7 @@ TESTS_ENVIRONMENT += OPENHPI_PATH=$(shell pwd) TESTS = \ + setup_conf \ tsim_file \ tevent \ tcontrol_parms \ @@ -180,6 +181,9 @@ check_PROGRAMS = $(TESTS) # Unit test using normal IF calls and simulation library +setup_conf_SOURCES = setup_conf.c + +# 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)/openhpid/libopenhpidaemon.la \ Added: openhpi/trunk/plugins/snmp_bc/t/setup_conf.c =================================================================== --- openhpi/trunk/plugins/snmp_bc/t/setup_conf.c (rev 0) +++ openhpi/trunk/plugins/snmp_bc/t/setup_conf.c 2013-07-16 18:24:36 UTC (rev 7547) @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2013, 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) + * Mohanasundaram Devarajulu (moh...@hp...) + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> +#include <libgen.h> +#include <errno.h> +#include <SaHpi.h> +#include <oHpi.h> +#include <oh_utils.h> + + + +/** + * openhpi.conf in this directory needs to have 600 or 400 permissions + * SVN does not allow to remove read permissions, so set it up now + **/ + + +int main(int argc, char **argv) +{ + struct stat fst; + char filename[30] = "./openhpi.conf"; + char modestr[] = "0600"; + int mode = 0; + mode = strtol(modestr, 0 ,8); + if (stat (filename, &fst) == -1) { + printf("stat of %s failed. Error is %s \n", filename, strerror(errno)); + if (errno == ENOENT) { +#ifdef OPENHPI_CONF + if(stat (OPENHPI_CONF, &fst) == -1) { + printf("stat of %s failed. Quitingi. \n", OPENHPI_CONF); + if (errno == ENOENT) + return 0; + else + return -1; + } + if (chmod(filename,mode) < 0) + { + printf("chmod (%s, %s) failed as %s\n", filename, modestr, strerror(errno)); + return -1; + } +#endif + return 0; + } + else + return -1; + } + if (chmod(filename,mode) < 0) + { + printf("chmod (%s, %s) failed with %d(%s)\n", filename, modestr, errno, strerror(errno)); + return -1; + } + return 0; +} + Modified: openhpi/trunk/rt-env.sh.in =================================================================== --- openhpi/trunk/rt-env.sh.in 2013-06-27 22:16:46 UTC (rev 7546) +++ openhpi/trunk/rt-env.sh.in 2013-07-16 18:24:36 UTC (rev 7547) @@ -14,6 +14,7 @@ if [ ! -f @abs_top_srcdir@/openhpi.conf ]; then cp @abs_top_srcdir@/openhpi.conf.example @abs_top_srcdir@/openhpi.conf + chmod 600 @abs_top_srcdir@/openhpi.conf fi if [ ! -f @abs_top_srcdir@/openhpiclient.conf ]; then This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hem...@us...> - 2013-08-06 22:13:26
|
Revision: 7552 http://sourceforge.net/p/openhpi/code/7552 Author: hemanthreddy Date: 2013-08-06 22:13:22 +0000 (Tue, 06 Aug 2013) Log Message: ----------- Fix for Issue ID #1805 Fix compiler warnings in the build Modified Paths: -------------- openhpi/trunk/marshal/marshal.c openhpi/trunk/openhpid/conf.c 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_event.c openhpi/trunk/plugins/oa_soap/oa_soap_interconnect_event.c openhpi/trunk/plugins/oa_soap/oa_soap_inventory.c openhpi/trunk/plugins/oa_soap/oa_soap_re_discover.c openhpi/trunk/plugins/oa_soap/oa_soap_reset.c openhpi/trunk/plugins/oa_soap/oa_soap_server_event.c Modified: openhpi/trunk/marshal/marshal.c =================================================================== --- openhpi/trunk/marshal/marshal.c 2013-07-18 20:55:23 UTC (rev 7551) +++ openhpi/trunk/marshal/marshal.c 2013-08-06 22:13:22 UTC (rev 7552) @@ -299,7 +299,7 @@ int cc = Marshal( elem, data, buffer ); if ( cc < 0 ) { - CRIT( "Marshal: %s[%d]: failure, cc = %d!", type->m_name, i, cc ); + CRIT( "Marshal: %s[%zd]: failure, cc = %d!", type->m_name, i, cc ); return cc; } @@ -357,7 +357,7 @@ int cc2 = Marshal( elem2, data2, buffer2 ); if ( cc2 < 0 ) { - CRIT( "Marshal: %s:%s[%d]: failure, cc = %d!", + CRIT( "Marshal: %s:%s[%zd]: failure, cc = %d!", type->m_name, elems[i].m_name, i2, cc2 ); return cc2; } @@ -561,7 +561,7 @@ int cc = Demarshal( byte_order, elem, data, buffer ); if ( cc < 0 ) { - CRIT( "Demarshal: %s[%d]: failure, cc = %d!", type->m_name, i, cc ); + CRIT( "Demarshal: %s[%zd]: failure, cc = %d!", type->m_name, i, cc ); return cc; } @@ -633,7 +633,7 @@ int cc2 = Demarshal( byte_order, elem2, data2, buffer2 ); if ( cc2 < 0 ) { - CRIT( "Demarshal: %s:%s[%d]: failure, cc = %d!", + CRIT( "Demarshal: %s:%s[%zd]: failure, cc = %d!", type->m_name, elems[i].m_name, i2, cc2 ); return cc2; } Modified: openhpi/trunk/openhpid/conf.c =================================================================== --- openhpi/trunk/openhpid/conf.c 2013-07-18 20:55:23 UTC (rev 7551) +++ openhpi/trunk/openhpid/conf.c 2013-08-06 22:13:22 UTC (rev 7552) @@ -497,7 +497,6 @@ struct stat fst, dst; char *dir_name = NULL; char dup_filename[PATH_MAX]; - extern int errno; #endif GScanner *oh_scanner; int i, done = 0; Modified: openhpi/trunk/plugins/oa_soap/oa_soap_control.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_control.c 2013-07-18 20:55:23 UTC (rev 7551) +++ openhpi/trunk/plugins/oa_soap/oa_soap_control.c 2013-08-06 22:13:22 UTC (rev 7552) @@ -211,7 +211,6 @@ SaHpiCtrlTypeT type; SaHpiCtrlModeT ctrl_mode; SaHpiCtrlStateT ctrl_state; - SaHpiCtrlRecDigitalT *digital = NULL; SaHpiCtrlRecT *ctrl = NULL; SaHpiCtrlStateDigitalT control_digital_state = 0; SaHpiCtrlStateDiscreteT control_discrete_state = 0; @@ -250,8 +249,6 @@ type = ctrl->Type; ctrl_state.Type = type; - digital = &(ctrl->TypeUnion.Digital); - switch (rdr_num){ case OA_SOAP_PWR_CNTRL: rv = oa_soap_get_pwr_cntrl(handler, resource_id, @@ -414,7 +411,6 @@ { SaErrorT rv = SA_OK; struct oh_handler_state *handler = NULL; - struct oa_soap_handler *oa_handler = NULL; SaHpiRptEntryT *rpt = NULL; SaHpiRdrT *rdr = NULL; SaHpiCtrlRecT *ctrl = NULL; @@ -425,7 +421,6 @@ } handler = (struct oh_handler_state *) oh_handler; - oa_handler = (struct oa_soap_handler *) handler->data; rpt = oh_get_resource_by_id (handler->rptcache, resource_id); if (rpt == NULL) { @@ -1783,7 +1778,6 @@ SaHpiCtrlStateAnalogT control_state) { SaErrorT rv = SA_OK; - struct powerConfigInfo *power_config_info; struct powerCapConfig *power_cap_config; struct oa_soap_handler *oa_handler = NULL; @@ -1793,7 +1787,6 @@ } 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; @@ -1894,7 +1887,6 @@ SaHpiCtrlStateAnalogT control_state) { SaErrorT rv = SA_OK; - struct powerConfigInfo *power_config_info; struct powerCapConfig *power_cap_config; struct oa_soap_handler *oa_handler = NULL; @@ -1904,7 +1896,6 @@ } 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_derated_circuit_cap = control_state; @@ -2006,7 +1997,6 @@ SaHpiCtrlStateAnalogT control_state) { SaErrorT rv = SA_OK; - struct powerConfigInfo *power_config_info; struct powerCapConfig *power_cap_config; struct oa_soap_handler *oa_handler = NULL; @@ -2016,7 +2006,6 @@ } 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_rated_circuit_cap = control_state; Modified: openhpi/trunk/plugins/oa_soap/oa_soap_discover.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_discover.c 2013-07-18 20:55:23 UTC (rev 7551) +++ openhpi/trunk/plugins/oa_soap/oa_soap_discover.c 2013-08-06 22:13:22 UTC (rev 7552) @@ -1693,7 +1693,6 @@ struct getBladeStatus status_request; struct bladeStatus status_response; SaHpiInt32T sensor_status; - SaHpiBoolT event_support = SAHPI_FALSE; enum diagnosticStatus diag_ex_status[OA_SOAP_MAX_DIAG_EX]; if (oh_handler == NULL || con == NULL) { @@ -1738,7 +1737,6 @@ err("Failed to build thermal rdr"); return SA_ERR_HPI_INTERNAL_ERROR; } - event_support = SAHPI_TRUE; /* Build power sensor rdr for server */ OA_SOAP_BUILD_SENSOR_RDR(OA_SOAP_SEN_PWR_STATUS) @@ -3297,7 +3295,6 @@ { SaErrorT rv = SA_OK; SaHpiRdrT rdr; - struct oa_soap_handler *oa_handler = NULL; struct oa_soap_sensor_info *sensor_info = NULL; SaHpiInt32T sensor_status; @@ -3306,8 +3303,6 @@ return SA_ERR_HPI_INVALID_PARAMS; } - oa_handler = (struct oa_soap_handler *) oh_handler->data; - /* Build the fan zone inventory rdr */ rv = oa_soap_build_fz_inv(oh_handler, resource_id, fan_zone); if (rv != SA_OK) { @@ -3953,7 +3948,6 @@ **/ static void oa_soap_push_disc_res(struct oh_handler_state *oh_handler) { - SaErrorT rv = SA_OK; SaHpiRptEntryT *rpt = NULL; struct oh_event event; struct oa_soap_hotswap_state *hotswap_state = NULL; @@ -3970,7 +3964,7 @@ /* Populate the event structure with default values and get the * asserted sensor list */ - rv = oa_soap_populate_event(oh_handler, rpt->ResourceId, &event, + oa_soap_populate_event(oh_handler, rpt->ResourceId, &event, &assert_sensor_list); /* Check whether the resource has hotswap capability */ Modified: openhpi/trunk/plugins/oa_soap/oa_soap_event.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_event.c 2013-07-18 20:55:23 UTC (rev 7551) +++ openhpi/trunk/plugins/oa_soap/oa_soap_event.c 2013-08-06 22:13:22 UTC (rev 7552) @@ -624,7 +624,6 @@ struct oa_info *oa, struct getAllEventsResponse *response) { - SaErrorT rv; SaHpiInt32T loc=0; struct eventInfo event; struct oa_soap_handler *oa_handler = NULL; @@ -689,14 +688,14 @@ case EVENT_FAN_INSERTED: dbg("EVENT_FAN_INSERTED"); - rv = process_fan_insertion_event(oh_handler, + process_fan_insertion_event(oh_handler, oa->event_con2, &event); break; case EVENT_FAN_REMOVED: dbg("EVENT_FAN_REMOVED"); - rv = process_fan_extraction_event(oh_handler, + process_fan_extraction_event(oh_handler, &event); break; @@ -726,14 +725,14 @@ break; case EVENT_PS_INSERTED: dbg("EVENT_PS_INSERTED"); - rv = process_ps_insertion_event(oh_handler, + process_ps_insertion_event(oh_handler, oa->event_con2, &event); break; case EVENT_PS_REMOVED: dbg("EVENT_PS_REMOVED"); - rv = process_ps_extraction_event(oh_handler, + process_ps_extraction_event(oh_handler, &event); break; @@ -772,7 +771,7 @@ case EVENT_INTERCONNECT_RESET: dbg("EVENT_INTERCONNECT_RESET"); - rv = process_interconnect_reset_event( + process_interconnect_reset_event( oh_handler, &event); break; case EVENT_INTERCONNECT_UID: @@ -780,19 +779,19 @@ break; case EVENT_INTERCONNECT_INSERTED: dbg("EVENT_INTERCONNECT_INSERTED"); - rv = process_interconnect_insertion_event( + process_interconnect_insertion_event( oh_handler, oa->event_con2, &event); break; case EVENT_INTERCONNECT_REMOVED: dbg("EVENT_INTERCONNECT_REMOVED"); - rv = process_interconnect_extraction_event( + process_interconnect_extraction_event( oh_handler, &event); break; case EVENT_INTERCONNECT_INFO: dbg("EVENT_INTERCONNECT_INFO"); - rv = process_interconnect_info_event( + process_interconnect_info_event( oh_handler, oa->event_con2, &event); break; case EVENT_INTERCONNECT_HEALTH_LED: @@ -811,7 +810,7 @@ break; case EVENT_INTERCONNECT_POWER: dbg("EVENT_INTERCONNECT_POWER"); - rv = process_interconnect_power_event( + process_interconnect_power_event( oh_handler, &event); break; case EVENT_INTERCONNECT_PORTMAP: @@ -846,7 +845,7 @@ case EVENT_BLADE_REMOVED: dbg("EVENT_BLADE_REMOVED"); - rv = process_server_extraction_event(oh_handler, + process_server_extraction_event(oh_handler, &event); break; @@ -883,12 +882,12 @@ break; case EVENT_BLADE_INFO: dbg("EVENT_BLADE_INFO"); - rv = process_server_info_event(oh_handler, + process_server_info_event(oh_handler, oa->event_con2, &event); break; case EVENT_BLADE_MP_INFO: dbg("EVENT_BLADE_MP_INFO"); - rv = process_server_mp_info_event(oh_handler, + process_server_mp_info_event(oh_handler, oa->event_con2, &event); break; case EVENT_ILO_READY: @@ -1000,19 +999,19 @@ case EVENT_OA_REMOVED: dbg("EVENT_OA_REMOVED"); - rv = process_oa_extraction_event(oh_handler, + process_oa_extraction_event(oh_handler, &event); break; case EVENT_OA_INFO: dbg("EVENT_OA_INFO"); - rv = process_oa_info_event(oh_handler, + process_oa_info_event(oh_handler, oa->event_con2, &event); break; case EVENT_OA_FAILOVER: dbg("EVENT_OA_FAILOVER"); - rv = process_oa_failover_event(oh_handler, oa); + process_oa_failover_event(oh_handler, oa); /* We have done the re-discovery as part of * FAILOVER event processing. Ignore the * events that are recived along with FAILOVER. @@ -1099,7 +1098,7 @@ break; case EVENT_OA_REBOOT: dbg("EVENT_OA_REBOOT"); - rv = process_oa_reboot_event(oh_handler, oa); + process_oa_reboot_event(oh_handler, oa); response->eventInfoArray = NULL; break; case EVENT_OA_LOGOFF_REQUEST: @@ -1270,7 +1269,7 @@ break; case EVENT_BLADE_INSERT_COMPLETED: dbg("EVENT_BLADE_INSERT_COMPLETED"); - rv = process_server_insertion_event(oh_handler, + process_server_insertion_event(oh_handler, oa->event_con2, &event, loc); break; Modified: openhpi/trunk/plugins/oa_soap/oa_soap_interconnect_event.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_interconnect_event.c 2013-07-18 20:55:23 UTC (rev 7551) +++ openhpi/trunk/plugins/oa_soap/oa_soap_interconnect_event.c 2013-08-06 22:13:22 UTC (rev 7552) @@ -779,7 +779,7 @@ SaHpiFloat64T trigger_threshold; struct getThermalInfo thermal_request; struct thermalInfo thermal_response; - struct oa_soap_sensor_info *sensor_info; + struct oa_soap_sensor_info *sensor_info = NULL; SaHpiRdrT *rdr; if (oh_handler == NULL || con== NULL || response == NULL) { Modified: openhpi/trunk/plugins/oa_soap/oa_soap_inventory.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_inventory.c 2013-07-18 20:55:23 UTC (rev 7551) +++ openhpi/trunk/plugins/oa_soap/oa_soap_inventory.c 2013-08-06 22:13:22 UTC (rev 7552) @@ -3611,7 +3611,6 @@ struct oa_soap_handler *oa_handler = NULL; SaHpiResourceIdT resource_id; SaHpiRptEntryT *rpt = NULL; - SaHpiInt32T product_area_success_flag = 0; xmlNode *extra_data=NULL; struct extraDataInfo extra_data_info; @@ -3692,7 +3691,6 @@ * area pointer stored as the head node for area list */ if (add_success_flag != SAHPI_FALSE) { - product_area_success_flag = SAHPI_TRUE; (local_inventory->info.idr_info.NumAreas)++; if (area_count == 0) { head_area = local_inventory->info.area_list; @@ -5330,7 +5328,6 @@ struct fanZone *fan_zone) { SaErrorT rv; - struct oa_soap_handler *oa_handler; struct oa_soap_inventory *inventory = NULL; char *temp, field_data[MAX_BUF_SIZE]; char temp1[MAX_BUF_SIZE] = {'\0'}; @@ -5351,8 +5348,6 @@ return rv; } - oa_handler = (struct oa_soap_handler *) oh_handler->data; - /* Construct the device bays field data*/ /* Set the field_data to 0. This helps the strlen (5 lines down) to get * correct string length Modified: openhpi/trunk/plugins/oa_soap/oa_soap_re_discover.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_re_discover.c 2013-07-18 20:55:23 UTC (rev 7551) +++ openhpi/trunk/plugins/oa_soap/oa_soap_re_discover.c 2013-08-06 22:13:22 UTC (rev 7552) @@ -2404,7 +2404,6 @@ SaHpiInt32T bay_number) { SaErrorT rv = SA_OK; - struct oa_soap_handler *oa_handler = NULL; struct getOaStatus request; struct oaStatus response; struct getOaNetworkInfo nw_info_request; @@ -2415,8 +2414,6 @@ return SA_ERR_HPI_INVALID_PARAMS; } - oa_handler = (struct oa_soap_handler *) oh_handler->data; - request.bayNumber = bay_number; rv = soap_getOaStatus(con, &request, &response); if (rv != SOAP_OK) { Modified: openhpi/trunk/plugins/oa_soap/oa_soap_reset.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_reset.c 2013-07-18 20:55:23 UTC (rev 7551) +++ openhpi/trunk/plugins/oa_soap/oa_soap_reset.c 2013-08-06 22:13:22 UTC (rev 7552) @@ -66,15 +66,12 @@ { SaErrorT rv = SA_OK; SaHpiPowerStateT state; - struct oh_handler_state *handler = NULL; if (oh_handler == NULL || action == NULL) { err("Invalid parameters"); return SA_ERR_HPI_INVALID_PARAMS; } - handler = (struct oh_handler_state *) oh_handler; - /* Get the current power state of the resource */ rv = oa_soap_get_power_state(oh_handler, resource_id, &state); if (rv != SA_OK) { Modified: openhpi/trunk/plugins/oa_soap/oa_soap_server_event.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_server_event.c 2013-07-18 20:55:23 UTC (rev 7551) +++ openhpi/trunk/plugins/oa_soap/oa_soap_server_event.c 2013-08-06 22:13:22 UTC (rev 7552) @@ -161,7 +161,6 @@ SaHpiInt32T bay_number) { SaErrorT rv = SA_OK; - struct oa_soap_handler *oa_handler; struct oa_soap_hotswap_state *hotswap_state = NULL; struct oa_soap_sensor_info *sensor_info=NULL; SaHpiRdrT *rdr = NULL; @@ -172,7 +171,6 @@ return SA_ERR_HPI_INVALID_PARAMS; } - oa_handler = (struct oa_soap_handler *) oh_handler->data; hotswap_state = (struct oa_soap_hotswap_state *) oh_get_resource_data(oh_handler->rptcache, event->resource.ResourceId); @@ -291,7 +289,6 @@ SaErrorT rv = SA_OK; SaHpiRptEntryT *rpt = NULL; struct oa_soap_handler *oa_handler = NULL; - struct oa_soap_hotswap_state hotswap_state; SaHpiInt32T bay_number, loc=1; struct oh_event event; SaHpiResourceIdT resource_id; @@ -381,7 +378,6 @@ /* Currently, OA is not sending the REBOOT event*/ case (POWER_REBOOT): - hotswap_state.currentHsState = SAHPI_HS_STATE_ACTIVE; event.event.EventDataUnion.HotSwapEvent. PreviousHotSwapState = SAHPI_HS_STATE_INSERTION_PENDING; @@ -574,7 +570,6 @@ char *serial_number = NULL; char *name = NULL; char *Name = NULL; - struct bladeInfo *response; SaHpiResourceIdT resource_id; char blade_name[MAX_NAME_LEN]; SaHpiRptEntryT *rpt = NULL; @@ -606,8 +601,7 @@ } name = oa_event->eventData.bladeInfo.name; - response = (struct bladeInfo *)&oa_event->eventData.bladeInfo; - resource_id = oa_handler-> + resource_id = oa_handler-> oa_soap_resources.server.resource_id[bay_number - 1]; if (strcmp(name,"[Unknown]") == 0 ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dr_...@us...> - 2013-08-22 19:09:10
|
Revision: 7553 http://sourceforge.net/p/openhpi/code/7553 Author: dr_mohan Date: 2013-08-22 19:09:02 +0000 (Thu, 22 Aug 2013) Log Message: ----------- Fix for #1808 Modified Paths: -------------- openhpi/trunk/plugins/oa_soap/oa_soap_calls.h openhpi/trunk/plugins/oa_soap/oa_soap_utils.c openhpi/trunk/plugins/oa_soap/oa_soap_utils.h openhpi/trunk/ssl/oh_ssl.c Modified: openhpi/trunk/plugins/oa_soap/oa_soap_calls.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_calls.h 2013-08-06 22:13:22 UTC (rev 7552) +++ openhpi/trunk/plugins/oa_soap/oa_soap_calls.h 2013-08-22 19:09:02 UTC (rev 7553) @@ -1558,6 +1558,14 @@ enum hpoa_boolean dynDnsEnabled; char *macAddress; char *ipAddress; + char ipv6Address0[255]; + char ipv6Address1[255]; + char ipv6Address2[255]; + char ipv6Address3[255]; + char *ipv6AddressType0; + char *ipv6AddressType1; + char *ipv6AddressType2; + char *ipv6AddressType3; char *netmask; char *gateway; xmlNode *dns; /* Items are char *ipAddress */ Modified: openhpi/trunk/plugins/oa_soap/oa_soap_utils.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_utils.c 2013-08-06 22:13:22 UTC (rev 7552) +++ openhpi/trunk/plugins/oa_soap/oa_soap_utils.c 2013-08-22 19:09:02 UTC (rev 7553) @@ -373,10 +373,15 @@ case ACTIVE: active_bay = i; memset(active_ip, 0, MAX_URL_LEN); - strncpy(active_ip, - network_info_response.ipAddress, - strlen(network_info_response. - ipAddress)); + rv = oa_soap_get_oa_ip(server, + network_info_response, + active_ip); + if (rv != SOAP_OK) { + err("Get Active OA IP failed"); + soap_close(hpi_con); + soap_close(event_con); + return SA_ERR_HPI_INTERNAL_ERROR; + } memset(active_fm, 0, MAX_BUF_SIZE); strncpy(active_fm, firmware, strlen(firmware)); @@ -394,10 +399,15 @@ case STANDBY: standby_bay = i; memset(standby_ip, 0, MAX_URL_LEN); - strncpy(standby_ip, - network_info_response.ipAddress, - strlen(network_info_response. - ipAddress)); + rv = oa_soap_get_oa_ip(server, + network_info_response, + standby_ip); + if (rv != SOAP_OK) { + err("Get Standby OA IP failed"); + soap_close(hpi_con); + soap_close(event_con); + return SA_ERR_HPI_INTERNAL_ERROR; + } memset(standby_fm, 0, MAX_BUF_SIZE); strncpy(standby_fm, firmware, strlen(firmware)); @@ -1686,3 +1696,135 @@ return SA_OK; } + +/** + * oa_soap_get_oa_ip + * @server: Pointer to hostname/IP address of the OA + * @network_info_response: Pointer to oaNetworkInfo response structure + * @oa_ip: Pointer to Active/Standby OA IP address + * + * Purpose: + * Gets the active/standby OA IP address + * + * Detailed Description: NA + * + * Return values: + * SA_OK - on success. + * SA_ERR_HPI_INVALID_PARAMS - on wrong parameters + **/ +SaErrorT oa_soap_get_oa_ip(char *server, + struct oaNetworkInfo network_info_response, + char *oa_ip) +{ + int ipv6, local_ipv6; + char *interface_name; + struct extraDataInfo extra_data_info; + xmlNode *extra_data = NULL; + + if (&network_info_response == NULL || server == NULL) { + err("Invalid parameters"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + /* intialize the flags for ipv6 */ + ipv6 = strstr(server, ":") == NULL ? 0 : 1; + local_ipv6 = (strstr(server, "fe80")- server) == 0 ? 1 : 0; + + extra_data = network_info_response.extraData; + while (extra_data) { + soap_getExtraData(extra_data, &extra_data_info); + if ((!(strcmp(extra_data_info.name, "Ipv6Address0"))) + && (extra_data_info.value != NULL)) { + memcpy(network_info_response.ipv6Address0, + extra_data_info.value, + strlen(extra_data_info.value) - + strlen(strchr(extra_data_info.value, '/'))); + } + if ((!(strcmp(extra_data_info.name, "Ipv6Address1"))) + && (extra_data_info.value != NULL)) { + memcpy(network_info_response.ipv6Address1, + extra_data_info.value, + strlen(extra_data_info.value) - + strlen(strchr(extra_data_info.value, '/'))); + } + if ((!(strcmp(extra_data_info.name, "Ipv6Address2"))) + && (extra_data_info.value != NULL)) { + memcpy(network_info_response.ipv6Address2, + extra_data_info.value, + strlen(extra_data_info.value) - + strlen(strchr(extra_data_info.value, '/'))); + } + if ((!(strcmp(extra_data_info.name, "Ipv6Address3"))) + && (extra_data_info.value != NULL)) { + memcpy(network_info_response.ipv6Address3, + extra_data_info.value, + strlen(extra_data_info.value) - + strlen(strchr(extra_data_info.value, '/'))); + } + if ((!(strcmp(extra_data_info.name, "Ipv6AddressType0"))) && + (extra_data_info.value != NULL)) { + network_info_response.ipv6AddressType0 = + extra_data_info.value; + } + if ((!(strcmp(extra_data_info.name, "Ipv6AddressType1"))) && + (extra_data_info.value != NULL)) { + network_info_response.ipv6AddressType1 = + extra_data_info.value; + } + if ((!(strcmp(extra_data_info.name, "Ipv6AddressType2"))) && + (extra_data_info.value != NULL)) { + network_info_response.ipv6AddressType2 = + extra_data_info.value; + } + if ((!(strcmp(extra_data_info.name, "Ipv6AddressType3"))) && + (extra_data_info.value != NULL)) { + network_info_response.ipv6AddressType3 = + extra_data_info.value; + } + extra_data = soap_next_node(extra_data); + } + + if(!ipv6) { + strncpy(oa_ip, network_info_response.ipAddress, + strlen(network_info_response.ipAddress)); + } else if(!local_ipv6) { + if ((!(strcmp(network_info_response.ipv6AddressType0, + "STATIC")))) { + strncpy(oa_ip, network_info_response.ipv6Address0, + strlen(network_info_response.ipv6Address0)); + } else if ((!(strcmp(network_info_response.ipv6AddressType1, + "STATIC")))) { + strncpy(oa_ip, network_info_response.ipv6Address1, + strlen(network_info_response.ipv6Address1)); + } else if ((!(strcmp(network_info_response.ipv6AddressType2, + "STATIC")))) { + strncpy(oa_ip, network_info_response.ipv6Address2, + strlen(network_info_response.ipv6Address2)); + } else if ((!(strcmp(network_info_response.ipv6AddressType3, + "STATIC")))) { + strncpy(oa_ip, network_info_response.ipv6Address3, + strlen(network_info_response.ipv6Address3)); + } + } else { + if ((!(strcmp(network_info_response.ipv6AddressType0, + "LINKLOCAL")))) { + strncpy(oa_ip, network_info_response.ipv6Address0, + strlen(network_info_response.ipv6Address0)); + } else if ((!(strcmp(network_info_response.ipv6AddressType1, + "LINKLOCAL")))) { + strncpy(oa_ip, network_info_response.ipv6Address1, + strlen(network_info_response.ipv6Address1)); + } else if ((!(strcmp(network_info_response.ipv6AddressType2, + "LINKLOCAL")))) { + strncpy(oa_ip, network_info_response.ipv6Address2, + strlen(network_info_response.ipv6Address2)); + } else if ((!(strcmp(network_info_response.ipv6AddressType3, + "LINKLOCAL")))) { + strncpy(oa_ip, network_info_response.ipv6Address3, + strlen(network_info_response.ipv6Address3)); + } + interface_name = strchr(server, '%'); + strcat(oa_ip, interface_name); + } + return SA_OK; +} Modified: openhpi/trunk/plugins/oa_soap/oa_soap_utils.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_utils.h 2013-08-06 22:13:22 UTC (rev 7552) +++ openhpi/trunk/plugins/oa_soap/oa_soap_utils.h 2013-08-22 19:09:02 UTC (rev 7553) @@ -118,4 +118,8 @@ SaErrorT update_oa_fw_version(struct oh_handler_state *oh_handler, struct oaInfo *response, SaHpiResourceIdT resource_id); + +SaErrorT oa_soap_get_oa_ip(char *server, + struct oaNetworkInfo network_info_response, + char *oa_ip); #endif Modified: openhpi/trunk/ssl/oh_ssl.c =================================================================== --- openhpi/trunk/ssl/oh_ssl.c 2013-08-06 22:13:22 UTC (rev 7552) +++ openhpi/trunk/ssl/oh_ssl.c 2013-08-22 19:09:02 UTC (rev 7553) @@ -74,6 +74,11 @@ #include <oh_ssl.h> #include <oh_error.h> +#include <sys/ioctl.h> +#include <sys/socket.h> +#include <sys/types.h> +#include <arpa/inet.h> +#include <netdb.h> /* Data types used by this module */ struct CRYPTO_dynlock_value { @@ -441,12 +446,18 @@ { BIO *bio; SSL *ssl; - fd_set readfds; - fd_set writefds; - struct timeval tv; - int fd; int err; + int len, retval = 0; + int RetVal, socket_desc = 0; + char *Server = NULL; + char *Port = NULL; + struct addrinfo Hints, *AddrInfo = NULL, *ai = NULL; + memset(&Hints, 0, sizeof(Hints)); + Hints.ai_family = AF_UNSPEC; + Hints.ai_socktype = SOCK_STREAM; + len = strlen(hostname); + if (hostname == NULL) { CRIT("NULL hostname in oh_ssl_connect()"); return(NULL); @@ -460,98 +471,88 @@ return(NULL); } - /* Start with a new SSL BIO */ - bio = BIO_new_ssl_connect(ctx); - if (bio == NULL) { - CRIT("BIO_new_ssl_connect() failed"); - return(NULL); + /* Allocate memory to a char pointer "Server" */ + Server = (char *) g_malloc0(sizeof(char) * len); + if (Server == NULL){ + CRIT("out of memory"); + return NULL; } + memset(Server, 0, len); + /* hostname contains "Port" along with "IP Address". As, only + * "IP Address" is needed for some of the below operations, so copy + * "IP Address" from hostname to "Server". + */ + strncpy(Server, hostname, (len - 4)); - /* Set up connection parameters for this BIO */ - BIO_set_conn_hostname(bio, hostname); - BIO_set_nbio(bio, 1); /* Set underlying socket to - * non-blocking mode - */ + /* Allocate memory to a char pointer "Port" */ + Port = (char *) g_malloc0(sizeof(char) * 4); + if (Port == NULL){ + CRIT("out of memory"); + g_free(Server); + return NULL; + } + /* As Port number is needed separately for some of the below + * operations, so copy port number from hostname to "Port". + */ + strncpy(Port, hostname + (len - 3), 3); + + /* Create socket address structure to prepare client socket */ + RetVal = getaddrinfo(Server, Port, &Hints, &AddrInfo); + if (RetVal != 0) { + CRIT("Cannot resolve address [%s] and port [%s]," + " error %d: %s", + Server, Port, RetVal, gai_strerror(RetVal)); + g_free(Server); + g_free(Port); + return NULL; + } + + ai = AddrInfo; + /* Create a socket point */ + socket_desc = socket(ai->ai_family, ai->ai_socktype, + ai->ai_protocol); + if (socket_desc == -1) { + CRIT("Socket failed with error: %s", + strerror(errno)); + g_free(Server); + g_free(Port); + return NULL; + } - /* Set up SSL session parameters */ - BIO_get_ssl(bio, &ssl); - if (ssl == NULL) { - CRIT("BIO_get_ssl() failed"); - BIO_free_all(bio); - return(NULL); + /* Now connect to target IP Address */ + retval = connect(socket_desc, ai->ai_addr, ai->ai_addrlen); + if (retval != 0) { + CRIT("Socket connect failed with error: %s", + strerror(errno)); + g_free(Server); + g_free(Port); + return NULL; } - SSL_set_mode(ssl, SSL_MODE_ENABLE_PARTIAL_WRITE); - /* Ready to open the connection. Note that this call will probably - * take a while, so we need to retry it, watching for a timeout. - */ - while (1) { - if (BIO_do_connect(bio) == 1) { - break; /* Connection established */ - } - if (! BIO_should_retry(bio)) { /* Hard error? */ - CRIT("BIO_do_connect() failed"); - CRIT("SSL error: %s", - ERR_reason_error_string(ERR_get_error())); - BIO_free_all(bio); - return(NULL); - } + /* Create new SSL structure for connection */ + ssl = SSL_new(ctx); - /* Wait until there's a change in the socket's status or until - * the timeout period. - * - * Get underlying file descriptor, needed for the select call. - */ - fd = BIO_get_fd(bio, NULL); - if (fd == -1) { - CRIT("BIO isn't initialized in oh_ssl_connect()"); - BIO_free_all(bio); - return(NULL); - } + /* Connect ssl object with a socket descriptor */ + SSL_set_fd(ssl, socket_desc); - FD_ZERO(&readfds); - FD_ZERO(&writefds); - if (BIO_should_read(bio)) { - FD_SET(fd, &readfds); - } - else if (BIO_should_write(bio)) { - FD_SET(fd, &writefds); - } - else { /* This is BIO_should_io_special(). - * Not sure what "special" needs to - * wait for, but both read and write - * seems to work without unnecessary - * retries. - */ - FD_SET(fd, &readfds); - FD_SET(fd, &writefds); - } - if (timeout) { - tv.tv_sec = timeout; - tv.tv_usec = 0; - err = select(fd + 1, &readfds, &writefds, NULL, &tv); - } - else { /* No timeout */ - err = select(fd + 1, &readfds, &writefds, NULL, NULL); - } - - /* Evaluate select() return code */ - if (err < 0) { - CRIT("error during select()"); - BIO_free_all(bio); - return(NULL); - } - if (err == 0) { - CRIT("connection timeout to %s", hostname); - BIO_free_all(bio); - return(NULL); /* Timeout */ - } + /* Initiate SSL connection */ + err = SSL_connect(ssl); + if (err != 1) { + CRIT("SSL connection failed"); + g_free(Server); + g_free(Port); + return (NULL); } + bio = BIO_new(BIO_f_ssl()); /* create an ssl BIO */ + BIO_set_ssl(bio, ssl, BIO_CLOSE); /* assign the ssl BIO to SSL */ + /* TODO: Do I need to set the client or server mode here? I don't * think so. */ + g_free(Server); + g_free(Port); return(bio); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dr_...@us...> - 2013-09-06 18:40:36
|
Revision: 7556 http://sourceforge.net/p/openhpi/code/7556 Author: dr_mohan Date: 2013-09-06 18:40:30 +0000 (Fri, 06 Sep 2013) Log Message: ----------- Fix for bug #1759 (old #3564813) Modified Paths: -------------- openhpi/trunk/README openhpi/trunk/clients/Makefile.am openhpi/trunk/configure.ac openhpi/trunk/docs/man/Makefile.am openhpi/trunk/openhpi.spec.in openhpi/trunk/openhpid/Makefile.am openhpi/trunk/openhpid/conf.c openhpi/trunk/openhpid/openhpid-posix.cpp openhpi/trunk/rt-env.sh.in openhpi/trunk/utils/Makefile.am openhpi/trunk/utils/oh_utils.h Added Paths: ----------- openhpi/trunk/clients/hpicrypt.c openhpi/trunk/docs/man/hpicrypt.1.pod openhpi/trunk/utils/sahpi_gcrypt_utils.c openhpi/trunk/utils/sahpi_gcrypt_utils.h Modified: openhpi/trunk/README =================================================================== --- openhpi/trunk/README 2013-08-23 23:17:02 UTC (rev 7555) +++ openhpi/trunk/README 2013-09-06 18:40:30 UTC (rev 7556) @@ -34,6 +34,7 @@ automake >= 1.8 gcc >= 3.2.0 glib2 >= 2.12 +gcrypt >= 1.4 pkgconfig (may be called pkg-config depending on distro) The follow libraries are needed to build certain plugins @@ -169,6 +170,8 @@ The following client programs are provided: hpialarms - show Alarm Control management instruments. +hpicrypt - Encrypt or decrypt a file. Back up the file to a secure + location before encrypting the file. hpidomain - show information about domains or set the domain tag. hpiel - displays HPI event log entries hpievents - polls for events @@ -184,7 +187,7 @@ hpithres - display sensor thresholds and sensor info. hpitop - display highlevel topology for a managed openHPI complex. hpitree - show in details the resources (rpt's) and resources' - manamegement instruments (rdr's) data structures + management instruments (rdr's) data structures hpiwdt - read and enables the watchdog timer. hpixml - display system view in XML Modified: openhpi/trunk/clients/Makefile.am =================================================================== --- openhpi/trunk/clients/Makefile.am 2013-08-23 23:17:02 UTC (rev 7555) +++ openhpi/trunk/clients/Makefile.am 2013-09-06 18:40:30 UTC (rev 7556) @@ -1,7 +1,8 @@ MAINTAINERCLEANFILES = Makefile.in MOSTLYCLEANFILES = @TEST_CLEAN@ -AM_CPPFLAGS = -DG_LOG_DOMAIN=\"client\" +AM_CPPFLAGS = -DG_LOG_DOMAIN=\"client\" @CRYPT_FLAG@ +AM_CFLAGS = @CRYPT_FLAG@ INCLUDES = @OPENHPI_INCLUDES@ @@ -27,6 +28,7 @@ hpialarms \ hpireset \ hpiwdt \ + $(HPICRYPT) \ hpithres \ hpitop \ hpisettime \ @@ -35,6 +37,8 @@ ohhandler \ ohparam +EXTRA_PROGRAMS = hpicrypt + include_HEADERS = hpialarms_SOURCES = hpialarms.c $(CLIENTS_SRC) @@ -67,6 +71,9 @@ hpiwdt_SOURCES = hpiwdt.c $(CLIENTS_SRC) hpiwdt_LDADD = $(COMMONLIBS) +hpicrypt_SOURCES = hpicrypt.c $(CLIENTS_SRC) +hpicrypt_LDADD = $(COMMONLIBS) + hpiinv_SOURCES = hpiinv.c $(CLIENTS_SRC) hpiinv_LDADD = $(COMMONLIBS) Added: openhpi/trunk/clients/hpicrypt.c =================================================================== --- openhpi/trunk/clients/hpicrypt.c (rev 0) +++ openhpi/trunk/clients/hpicrypt.c 2013-09-06 18:40:30 UTC (rev 7556) @@ -0,0 +1,127 @@ +/* + * + * Copyright (C) 2013, 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) + * Mohan Devarajulu <mo...@fc...> + */ + +#include <oh_clients.h> +#define OH_SVN_REV "$Revision: 1.3 $" + +/************************************************************ + * Globals here + ***********************************************************/ +static int hpicrypt_usage(char* program_name) +{ + printf("Usage:\n"); + printf("%s [-d] -c config file\n",program_name); + printf("-d for decrypting\n"); + printf("-c config file to encrypt or decrypt\n"); + printf("backup the file before encrypting\n"); + printf("\n"); + return(0); +} + +int main(int argc, char *argv[]) +{ + + char *file_path = NULL; + char *file_contents = NULL; + char *program = argv[0]; + int crypt_type = OHPI_ENCRYPT; + + while ((argc > 1) && (argv[1][0] == '-')) + { + switch (argv[1][1]) + { + case 'd': + crypt_type = OHPI_DECRYPT; + break; + + case 'c': + ++argv; + --argc; + file_path=argv[1]; + break; + + default: + printf("Wrong Argument: %s\n", argv[1]); + hpicrypt_usage(program); + return(1); + } + + ++argv; + --argc; + } + + if ((argc > 1) || (file_path == NULL)) + { + hpicrypt_usage(program); + return(1); + } + + /* + * Right now all the file handling is done in oh_crypt function. + * The file_contents could be used to move the file handling here. + */ + + if ( crypt_type ==OHPI_ENCRYPT ) { + file_contents=oh_crypt(file_path, crypt_type); + if (file_contents == NULL) { + CRIT("The encryption of %s failed\n",file_path); + return(1); + } + printf("File was encrypted and overwritten. If you like a backup,\n"); + printf("please decrypt with hpicrypt -d and save the text file securely\n"); + g_free(file_contents); + file_contents=NULL; + return(0); + } else if ( crypt_type == OHPI_DECRYPT ) { + file_contents = oh_crypt(file_path, crypt_type); + if (file_contents == NULL) { + CRIT("The decryption of %s failed\n",file_path); + return(1); + } + printf("%s",file_contents); + printf("# Redirect above contents to a file to add/remove/edit handlers.\n"); + printf("# Last two comment lines could be removed before saving.\n"); + g_free(file_contents); + file_contents=NULL; + return(0); + } + else { + printf("Unknown crypt type %d. %d and %d are only valid\n",crypt_type, OHPI_ENCRYPT, OHPI_DECRYPT); + return(1); + } + return(0); + + +} Modified: openhpi/trunk/configure.ac =================================================================== --- openhpi/trunk/configure.ac 2013-08-23 23:17:02 UTC (rev 7555) +++ openhpi/trunk/configure.ac 2013-09-06 18:40:30 UTC (rev 7556) @@ -163,6 +163,10 @@ AC_CHECK_LIB([uuid], [uuid_generate], [have_uuid=yes]) +dnl gcrypt is used for encrypting the conf file +AC_CHECK_LIB([gcrypt],[gcry_control],[have_gcrypt_lib=yes],[have_gcrypt_lib=no]) +AC_CHECK_HEADERS([gcrypt.h],[have_gcrypt=yes],[have_gcrypt=no]) + dnl ssl is used for md2/md5 authentification in ipmidirect dnl and for SSL-based communication in ilo2_ribcl and oa_soap AC_CHECK_LIB([crypto],[MD5_Init],[CRYPTO_LIB=-lcrypto],[CRYPTO_LIB=]) @@ -416,6 +420,41 @@ fi ]) +# configure argument for enabling file encryption +AC_ARG_ENABLE([encryption], + [ --enable-encryption Enable File Encryption [[default=yes if libgcrypt and gcrypt.h exist]]], + [if test "x$enableval" = "xyes"; then + if test "x$have_gcrypt" = "xyes"; then + if test "x$have_gcrypt_lib" = "xyes"; then + AC_SUBST(HPICRYPT,hpicrypt) + AC_SUBST(HPICRYPT_POD,hpicrypt.1.pod) + AC_SUBST(HPICRYPT_MAN,hpicrypt.1) + CRYPT_FLAG="-DHAVE_ENCRYPT" + AC_SUBST(CRYPT_FLAG) + GCRYPT_LIB="-lgcrypt" + AC_SUBST(GCRYPT_LIB) + else + OH_CHECK_FAIL(libgcrypt,libgcrypt,, + Can not enable encryption without gcrypt library) + fi + else + OH_CHECK_FAIL(libgcrypt-devel,libgcrypt-devel,, + Can not enable encryption without gcrypt headers) + fi + fi], + [if test "x$have_gcrypt" = "xyes"; then + if test "x$have_gcrypt_lib" = "xyes"; then + AC_SUBST(HPICRYPT,hpicrypt) + AC_SUBST(HPICRYPT_POD,hpicrypt.1.pod) + AC_SUBST(HPICRYPT_MAN,hpicrypt.1) + CRYPT_FLAG="-DHAVE_ENCRYPT" + AC_SUBST(CRYPT_FLAG) + GCRYPT_LIB="-lgcrypt" + AC_SUBST(GCRYPT_LIB) + fi + fi + ]) + # configure argument for the slave plugin AC_ARG_ENABLE([slave], [ --enable-slave build slave plugin [[default=yes]]], Modified: openhpi/trunk/docs/man/Makefile.am =================================================================== --- openhpi/trunk/docs/man/Makefile.am 2013-08-23 23:17:02 UTC (rev 7555) +++ openhpi/trunk/docs/man/Makefile.am 2013-09-06 18:40:30 UTC (rev 7556) @@ -38,7 +38,7 @@ hpievents.1.pod hpionIBMblade.1.pod \ hpisensor.1.pod hpitop.1.pod \ hpidomain.1.pod hpigensimdata.1.pod \ - hpixml.1.pod \ + hpixml.1.pod $(HPICRYPT_POD) \ ohhandler.1.pod ohparam.1.pod \ ohdomainlist.1.pod \ hpi_shell.1.pod @@ -60,7 +60,7 @@ hpievents.1 hpionIBMblade.1 \ hpisensor.1 hpitop.1 \ hpidomain.1 hpigensimdata.1 \ - hpixml.1 \ + hpixml.1 $(HPICRYPT_MAN) \ ohhandler.1 ohparam.1 \ ohdomainlist.1 \ hpi_shell.1 Added: openhpi/trunk/docs/man/hpicrypt.1.pod =================================================================== --- openhpi/trunk/docs/man/hpicrypt.1.pod (rev 0) +++ openhpi/trunk/docs/man/hpicrypt.1.pod 2013-09-06 18:40:30 UTC (rev 7556) @@ -0,0 +1,43 @@ +=head1 NAME + +hpigcrypt - An openhpi helper application that encrypts and decrypts a config file. + +=head1 SYNOPSIS + + hpicrypt [-d ] -c config_file + +=head1 DESCRIPTION + +hpicrypt is an optional helper application that encrypts or decrypts config_file. + +The encryption key is machine specific. File encrypted on one machine may not decrypt on some other machine. +Please have a backup copy of the file before encrypting. + +=head1 OPTIONS + +=head2 Application Options: + +=over 2 + +=item B<-d> + +Decrypt the config_file and output the text to screen with helpful message + +=back + +=head1 SEE ALSO + + hpi_shell + hpialarms hpigensimdata hpireset hpitop + hpidomain hpiinv hpisensor hpitree + hpievents hpionIBMblade hpisettime hpiwdt + hpifan hpipower hpithres + ohdomainlist ohhandler ohparam + + +=head1 AUTHORS + +Authors of this man page: + + Mohan Devarajulu (mohan@fc.hp..com) + Modified: openhpi/trunk/openhpi.spec.in =================================================================== --- openhpi/trunk/openhpi.spec.in 2013-08-23 23:17:02 UTC (rev 7555) +++ openhpi/trunk/openhpi.spec.in 2013-09-06 18:40:30 UTC (rev 7556) @@ -49,6 +49,10 @@ %define with_test_agent 1 %endif +%if "x@HPICRYPT@" == "xhpicrypt" +%define with_gcrypt 1 +%endif + Name: @HPI_PKG@ Version: @VERSION@ Release: 1 @@ -69,10 +73,16 @@ %if 0%{?with_openssl} BuildRequires: openssl-devel %endif +%if 0%{?with_gcrypt} +BuildRequires: libgcrypt-devel +%endif Requires: glib2 libstdc++ %if 0%{?with_openssl} Requires: openssl %endif +%if 0%{?with_gcrypt} +Requires: libgcrypt +%endif %package devel Summary: OpenHPI and SAF header files Modified: openhpi/trunk/openhpid/Makefile.am =================================================================== --- openhpi/trunk/openhpid/Makefile.am 2013-08-23 23:17:02 UTC (rev 7555) +++ openhpi/trunk/openhpid/Makefile.am 2013-09-06 18:40:30 UTC (rev 7556) @@ -17,7 +17,8 @@ MAINTAINERCLEANFILES = Makefile.in *~ -AM_CPPFLAGS = -DG_LOG_DOMAIN=\"openhpid\" +AM_CPPFLAGS = -DG_LOG_DOMAIN=\"openhpid\" @CRYPT_FLAG@ +AM_CFLAGS = @CRYPT_FLAG@ INCLUDES = \ @OPENHPI_INCLUDES@ -I$(top_srcdir)/transport -I$(top_srcdir)/marshal @OH_SSL_INCLUDES@ Modified: openhpi/trunk/openhpid/conf.c =================================================================== --- openhpi/trunk/openhpid/conf.c 2013-08-23 23:17:02 UTC (rev 7555) +++ openhpi/trunk/openhpid/conf.c 2013-09-06 18:40:30 UTC (rev 7556) @@ -497,7 +497,13 @@ struct stat fst, dst; char *dir_name = NULL; char dup_filename[PATH_MAX]; -#endif +#ifdef HAVE_ENCRYPT + SaHpiUint32T type = OHPI_DECRYPT; + gchar *confile_txt = NULL; +#endif /* HAVE_ENCRYPT */ +#endif /* _WIN32 */ + gchar * gcrypt_str = NULL; + gboolean g_decrypt = SAHPI_FALSE; GScanner *oh_scanner; int i, done = 0; int num_tokens = sizeof(oh_conf_tokens) / sizeof(oh_conf_tokens[0]); @@ -523,6 +529,7 @@ if (stat (filename, &fst) == -1) { if (errno != ENOENT) { CRIT("stat of %s failed.", filename); + g_scanner_destroy(oh_scanner); return -3; } } @@ -531,10 +538,12 @@ if (fst.st_uid == 0) { CRIT("%s owner is root (0)!", filename); CRIT("Run as sudo or create a config with UID=%d.", (int)geteuid()); + g_scanner_destroy(oh_scanner); return -3; } else { CRIT("%s owner(%d) is insecure!", filename, fst.st_uid); CRIT("Owner UID shall be %d.", (int)geteuid()); + g_scanner_destroy(oh_scanner); return -3; } } @@ -542,52 +551,86 @@ if (((fst.st_mode & (S_IRWXG | S_IRWXO)) != 0)) { CRIT("%s permissions are insecure!", filename); CRIT("Shall not contain bits for group/others."); + g_scanner_destroy(oh_scanner); return -3; } if ((fst.st_mode & S_IFMT) != S_IFREG) { CRIT("%s permissions are insecure!", filename); CRIT("It needs to be a regular file"); + g_scanner_destroy(oh_scanner); return -3; } /* Now check the directory permissions */ if (strlen(filename) >= PATH_MAX) { - CRIT("%s is too long",filename); - return -3; + CRIT("%s is too long",filename); + g_scanner_destroy(oh_scanner); + return -3; } strcpy(dup_filename, filename); dir_name=dirname(dup_filename); if (stat(dir_name, &dst) == -1) { CRIT("stat of %s failed.", dir_name); + g_scanner_destroy(oh_scanner); return -3; } if ((fst.st_uid != dst.st_uid)) { CRIT("%s directory is insecure", dir_name); CRIT("Owner UID shall be %d",fst.st_uid); + g_scanner_destroy(oh_scanner); return -3; } if ((dst.st_mode & (S_IWOTH | S_IWGRP)) != 0 ) { CRIT("%s directory is insecure",dir_name); CRIT("Shall not be writable by group or others"); + g_scanner_destroy(oh_scanner); return -3; } } #endif // _WIN32 - fp = fopen(filename, "r"); - if (!fp) { - CRIT("Configuration file '%s' could not be opened.", filename); - g_scanner_destroy(oh_scanner); + gcrypt_str = getenv("OPENHPI_GCRYPT"); + if(gcrypt_str) + g_decrypt = atoi((const char *)gcrypt_str); + if(g_decrypt) { +#ifndef _WIN32 +#ifdef HAVE_ENCRYPT + confile_txt = oh_crypt(filename, type); + if(!confile_txt) { + CRIT("Unable to decrypt %s\n",filename); + g_scanner_destroy(oh_scanner); + return -3; + } + + g_scanner_input_text(oh_scanner, confile_txt, fst.st_size); +#else + CRIT("gcrypt asked for but not compiled with. Internal Error"); return -4; +#endif /* HAVE_ENCRYPT */ + + +#else + WARN("Encrypting %s not supported",filename); + WARN("Assuming plain file"); +#endif + } else { + fp = fopen(filename, "r"); + if (!fp) { + CRIT("Configuration file '%s' could not be opened.", filename); + g_scanner_destroy(oh_scanner); + return -4; + } } #ifdef _WIN32 g_scanner_input_file(oh_scanner, _fileno(fp)); #else - g_scanner_input_file(oh_scanner, fileno(fp)); + if(!g_decrypt) { + g_scanner_input_file(oh_scanner, fileno(fp)); + } #endif for (i = 0; i < num_tokens; i++) { @@ -623,16 +666,22 @@ read_globals_from_env(1); - fclose(fp); + if (fp) + fclose(fp); done = oh_scanner->parse_errors; g_scanner_destroy(oh_scanner); + DBG("Done processing conf file. Parse errors: %d", done); config->handler_configs = handler_configs; +#ifdef HAVE_ENCRYPT + free(confile_txt); +#endif + handler_configs = NULL; return 0; Modified: openhpi/trunk/openhpid/openhpid-posix.cpp =================================================================== --- openhpi/trunk/openhpid/openhpid-posix.cpp 2013-08-23 23:17:02 UTC (rev 7555) +++ openhpi/trunk/openhpid/openhpid-posix.cpp 2013-09-06 18:40:30 UTC (rev 7556) @@ -61,6 +61,11 @@ static gboolean enableIPv4 = FALSE; static gboolean enableIPv6 = FALSE; +#ifdef HAVE_ENCRYPT +static gboolean g_decrypt = FALSE; +static gchar * gcrypt_str = NULL; +#endif + static GOptionEntry daemon_options[] = { { "cfg", 'c', 0, G_OPTION_ARG_FILENAME, &cfgfile, "Sets path/name of the configuration file.\n" @@ -85,6 +90,9 @@ { "nondaemon", 'n', 0, G_OPTION_ARG_NONE, &runasforeground, "Forces the code to run as a foreground process\n" " and NOT as a daemon. The default is to run as\n" " a daemon. The option is optional.", NULL }, +#ifdef HAVE_ENCRYPT + { "decrypt", 'd', 0, G_OPTION_ARG_NONE, &g_decrypt, "Config file encrypted with hpicrypt. Decrypt and read", NULL }, +#endif { "ipv6", '6', 0, G_OPTION_ARG_NONE, &enableIPv6, "The daemon will try to bind IPv6 socket.", NULL }, { "ipv4", '4', 0, G_OPTION_ARG_NONE, &enableIPv4, "The daemon will try to bind IPv4 socket (default).\n" " IPv6 option takes precedence over IPv6 option.", NULL }, @@ -132,6 +140,9 @@ printf(" -n, --nondaemon Forces the code to run as a foreground process\n"); printf(" and NOT as a daemon. The default is to run as\n"); printf(" a daemon. The option is optional.\n"); +#ifdef HAVE_ENCRYPT + printf(" -d, --decrypt Configuration file is encrypted. Decrypt and read.\n"); +#endif printf(" -6, --ipv6 The daemon will try to bind IPv6 socket.\n"); printf(" -4, --ipv4 The daemon will try to bind IPv4 socket (default).\n"); printf(" IPv6 option takes precedence over IPv6 option.\n\n"); @@ -349,6 +360,15 @@ if (portstr) { port = atoi(portstr); } + +#ifdef HAVE_ENCRYPT + if (g_decrypt) { + setenv("OPENHPI_GCRYPT", "1", 1); + } else { + gcrypt_str = getenv("OPENHPI_GCRYPT"); + } +#endif + ipvflags = ( enableIPv6 == TRUE ) ? FlagIPv6 : FlagIPv4; if (optpidfile) { pidfile = g_strdup(optpidfile); @@ -362,7 +382,7 @@ // see if we have a valid configuration file if ((!cfgfile) || (!g_file_test(cfgfile, G_FILE_TEST_EXISTS))) { - CRIT("Cannot find configuration file. Exiting."); + CRIT("Cannot find configuration file %s. Exiting.",cfgfile); display_help(); exit(-1); } Modified: openhpi/trunk/rt-env.sh.in =================================================================== --- openhpi/trunk/rt-env.sh.in 2013-08-23 23:17:02 UTC (rev 7555) +++ openhpi/trunk/rt-env.sh.in 2013-09-06 18:40:30 UTC (rev 7556) @@ -11,6 +11,7 @@ # the following entries are for the hpi daemon and client OPENHPI_DAEMON_HOST=localhost OPENHPI_DAEMON_PORT=4743 +OPENHPI_GCRYPT=0 if [ ! -f @abs_top_srcdir@/openhpi.conf ]; then cp @abs_top_srcdir@/openhpi.conf.example @abs_top_srcdir@/openhpi.conf @@ -22,4 +23,4 @@ fi export OPENHPI_DEBUG OPENHPI_DEBUG_TRACE OPENHPI_UID_MAP OPENHPI_CONF OPENHPI_PATH OPENHPICLIENT_CONF -export OPENHPI_DAEMON_HOST OPENHPI_DAEMON_PORT +export OPENHPI_DAEMON_HOST OPENHPI_DAEMON_PORT OPENHPI_GCRYPT Modified: openhpi/trunk/utils/Makefile.am =================================================================== --- openhpi/trunk/utils/Makefile.am 2013-08-23 23:17:02 UTC (rev 7555) +++ openhpi/trunk/utils/Makefile.am 2013-09-06 18:40:30 UTC (rev 7556) @@ -31,8 +31,10 @@ MAINTAINERCLEANFILES = Makefile.in -AM_CPPFLAGS = -DG_LOG_DOMAIN=\"utils\" +AM_CPPFLAGS = -DG_LOG_DOMAIN=\"utils\" @CRYPT_FLAG@ +AM_CFLAGS = @CRYPT_FLAG@ + GENERATED_HEADER_FILES = \ sahpi_enum_utils.h \ sahpixtca_enum_utils.h \ @@ -84,11 +86,13 @@ sahpi_struct_utils.h \ sahpi_time_utils.c \ sahpi_time_utils.h \ + sahpi_gcrypt_utils.c \ + sahpi_gcrypt_utils.h \ uid_utils.c \ uid_utils.h libopenhpiutils_la_LDFLAGS = -version-info @HPI_LIB_VERSION@ -libopenhpiutils_la_LIBADD = +libopenhpiutils_la_LIBADD = @GCRYPT_LIB@ # 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/oh_utils.h =================================================================== --- openhpi/trunk/utils/oh_utils.h 2013-08-23 23:17:02 UTC (rev 7555) +++ openhpi/trunk/utils/oh_utils.h 2013-09-06 18:40:30 UTC (rev 7556) @@ -33,5 +33,6 @@ #include <sahpixtca_enum_utils.h> #include <sahpiatca_enum_utils.h> #include <uid_utils.h> +#include <sahpi_gcrypt_utils.h> #endif Added: openhpi/trunk/utils/sahpi_gcrypt_utils.c =================================================================== --- openhpi/trunk/utils/sahpi_gcrypt_utils.c (rev 0) +++ openhpi/trunk/utils/sahpi_gcrypt_utils.c 2013-09-06 18:40:30 UTC (rev 7556) @@ -0,0 +1,343 @@ +/* + * + * Copyright (C) 2013, 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) + * Mohan Devarajulu <mo...@fc...> + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <time.h> +#include <fcntl.h> +#include <sys/stat.h> +#include <unistd.h> + +#include <glib.h> + +#include <SaHpi.h> +#include <oh_utils.h> +#include <oh_error.h> + +#ifdef HAVE_ENCRYPT + +SaErrorT oh_initialize_gcrypt(gcry_cipher_hd_t *h1, gcry_cipher_hd_t *h2, gchar *key) +{ + static int initialized = 0; + + if (initialized == 1) + return(0); + + if ((!gcry_check_version ( NULL )) || + (gcry_control( GCRYCTL_DISABLE_SECMEM_WARN )) || + (gcry_control( GCRYCTL_INIT_SECMEM, 16384, 0 )) || + (gcry_cipher_open( h1, GCRY_CIPHER_ARCFOUR,GCRY_CIPHER_MODE_STREAM,0 )) || + (gcry_cipher_open( h2, GCRY_CIPHER_ARCFOUR,GCRY_CIPHER_MODE_STREAM,0 )) || + (gcry_cipher_setkey ( *h1, key, strlen(key) )) || + (gcry_cipher_setkey ( *h2, key, strlen(key) ))) { + CRIT("Something went wrong with gcrypt calls"); + return(1); + } else { + initialized = 1; + return(0); + } +} + + + + +/****************************************************************************** + * gchar *oh_crypt(gchar *file_path, SaHpiUint32T type) + * + * Function to encrypt or decrypt given file. The encrypted + * or decrypted text is returned to the caller. The caller needs to free the + * memory. + * While encrypting the file, encrypted file is saved to the original file + * location after a check and the encrypted text is sent to the caller. While + * decrypting, the decrypted text is sent to the caller, but the original file + * is left intact. + * + * file_path - File name to be encrypted or decrypted. When the file is + * encrypted, the original file is overwritten, when it is decrypted it is left + * as it is + * type - Encrypt or Decrypt. + * + * Return: gchar * + * Encrypted or Decrypted string + * + *****************************************************************************/ +gchar * oh_crypt(gchar *file_path, SaHpiUint32T type) +{ + gcry_cipher_hd_t handle1, handle2; + int ret = 0, err=0, cwd_fd = 0; + struct stat buf, keybuf; + char * plain_text = NULL; + char * ptr_substr = NULL; + char * out = NULL; + char * key = NULL; + char * deout = NULL; + long int file_size = 0, en_file_size=0; + char file_path_ck[PATH_MAX]; + char file_path_en[PATH_MAX]; + char cwd[PATH_MAX]; + FILE *fconf = NULL, *fpuuid = NULL; + + /* If you can not stat then you can not access the file */ + + if (getcwd(cwd, sizeof(cwd)) != NULL) + cwd_fd = open(cwd, O_DIRECTORY, S_IWUSR); + + ret = faccessat(cwd_fd, file_path, R_OK, AT_EACCESS ); + if (ret != 0 ) + { + CRIT("Can not access file %s",file_path); + return(NULL); + } else { + ret = stat(file_path, &buf); + /* Really stat call should not fail here */ + if (ret != 0 ) + { + CRIT("Can not stat file %s",file_path); + return(NULL); + } + } + + file_size = buf.st_size; + if ((file_size > 1000000000) || + (strlen(file_path)+10 > PATH_MAX)) { + CRIT("%s path is long or too big",file_path); + return(NULL); + } + + plain_text = ( char * ) g_malloc0 + ( sizeof ( char ) * ( file_size + 1) ); + fconf = fopen(file_path,"r"); + if (fconf == NULL) { + CRIT("Unable to open %s",file_path); + return(NULL); + } + fread(plain_text, 1, file_size, fconf); + fclose(fconf); + + ret = faccessat(0, PUUID_PATH, R_OK, AT_EACCESS ); + if ( ret != 0 ) { + if (geteuid() == 0) { + WARN("Could not find %s",PUUID_PATH); + WARN("Using the SAHPI_DEFKEY. If the above file is created"); + WARN("ever, move the file away to decrypt"); + } + key = ( char * ) g_malloc0 ( sizeof ( char ) * ( strlen(SAHPI_DEFKEY)+1) ); + strcpy(key,SAHPI_DEFKEY); + } else { + ret = stat(PUUID_PATH, &keybuf); + /* Really stat call should not fail here */ + if (ret != 0 ) + { + CRIT("Can not stat file %s",PUUID_PATH); + return(NULL); + } + fpuuid=fopen(PUUID_PATH, "r"); + if (fpuuid == NULL) { + if (geteuid() == 0) + CRIT("Unable to open %s",PUUID_PATH); + else + CRIT("Unable to open %s, Use sudo", PUUID_PATH); + return(NULL); + } + key = ( char * ) g_malloc0 ( sizeof ( char ) * ( keybuf.st_size + 1) ); + ret=fread(key, 1, keybuf.st_size, fpuuid); + fclose(fpuuid); + } + + if(oh_initialize_gcrypt(&handle1, &handle2, key)) { + CRIT("Could not initialize gcrypt libraries"); + g_free(key); + return(NULL); + } + + if ( type == OHPI_ENCRYPT ) { + ptr_substr=strstr(plain_text,"handler"); + if (!ptr_substr) { + CRIT("Looks like the %s does not have a handler",file_path); + CRIT("It is either already encrypted or no plugins defined"); + g_free(plain_text); + g_free(key); + return(NULL); + } + out = ( char * ) g_malloc0 ( sizeof ( char ) * ( file_size + 1 ) ); + err = gcry_cipher_encrypt ( handle1, ( unsigned char * ) out, file_size, + ( const unsigned char * ) plain_text, file_size ); + if ( err ) + { + CRIT("Failure: %s/%s", gcry_strsource ( err ), gcry_strerror ( err ) ); + g_free(plain_text); + g_free(out); + g_free(key); + return(NULL); + + } + + strcpy(file_path_en, file_path); + strcat(file_path_en,".temp_en"); + if (access (file_path_en, F_OK) != -1 ) { + CRIT("Trying to use %s for temporary_file",file_path_en); + CRIT("That file already exists. Remove it and restart again"); + g_free(plain_text); + g_free(out); + g_free(key); + return(NULL); + } + fconf = fopen(file_path_en,"w"); + if (fconf == NULL) { + CRIT("Unable to open the file for writing"); + g_free(plain_text); + g_free(out); + g_free(key); + return(NULL); + } + err = fwrite(out, 1, file_size, fconf); + if (err != file_size ) { + CRIT("Wrote %d, but expected to write %ld",err, file_size); + g_free(plain_text); + g_free(out); + g_free(key); + return(NULL); + } + err = 0; + fclose(fconf); + ret = chmod(file_path_en, buf.st_mode); /* Setting mode to original file mode */ + ret = stat(file_path_en, &buf); + en_file_size = buf.st_size; + if (file_size != en_file_size) { + CRIT("original file size %ld, encrypted %ld", file_size, en_file_size); + g_free(plain_text); + g_free(out); + g_free(key); + return(NULL); + } + memset(out,0,file_size); + fconf = fopen(file_path_en,"r"); + fread(out,1,file_size,fconf); + fclose(fconf); + deout = ( char * ) g_malloc0 ( sizeof ( char ) * ( file_size + 1 ) ); + err = gcry_cipher_decrypt ( handle2, ( unsigned char * ) deout, file_size, + ( const unsigned char * ) out, file_size ); + if (strcmp(deout, plain_text) != 0 || (err)) { + CRIT("Unable to encrypt and decrypt"); + if(err) + CRIT("decrypt call failed"); + remove(file_path_en); + if (strlen(file_path)+10 < 1024) { + strcpy(file_path_ck, file_path); + strcat(file_path_ck,".check"); + } + fconf = fopen(file_path_ck,"w"); + err = fwrite(deout, 1, file_size, fconf); + if (err != file_size ) { + CRIT("Wrote %d, but expected to write %ld",err, file_size); + } + CRIT("compare %s and %s. Encryption failed",file_path,file_path_ck); + g_free(plain_text); + g_free(out); + g_free(deout); + g_free(key); + return(NULL); + } + /* At this point everything is ok. Able to encrypt and save into a file. + * the same file is read and the contents decrypted. Original and decryption + * match. So move the encrypted file to the original location */ + g_free(plain_text); + g_free(deout); + err = 0; + err = rename(file_path_en, file_path); + if ( err != 0 ) { + CRIT("%s is not moved to %s",file_path_en,file_path); + g_free(out); + g_free(key); + return(NULL); + } + g_free(key); + return(out); + } else if(type == OHPI_DECRYPT) { + ptr_substr=strstr(plain_text,"handler"); + if (ptr_substr) { + CRIT("Looks like the %s is a plain file",file_path); + CRIT("It was not encrypted?. Please check"); + g_free(plain_text); + g_free(key); + return(NULL); + } + + out = ( char * ) g_malloc0 ( sizeof ( char ) * ( file_size + 1 ) ); + err = gcry_cipher_decrypt ( handle2, ( unsigned char * ) out, file_size, + ( const unsigned char * ) plain_text, file_size ); + if ( err ) + { + CRIT("Failure: %s/%s", gcry_strsource ( err ), gcry_strerror ( err ) ); + g_free(plain_text); + g_free(out); + g_free(key); + return(NULL); + } else { + g_free(plain_text); + ptr_substr = NULL; + ptr_substr=strstr(out,"handler"); + if ((!ptr_substr) && (geteuid() == 0)) { + CRIT("Looks like the decrypted texts does not have a handler"); + CRIT("Decryption might have failed."); + if(!strcmp(key,SAHPI_DEFKEY)) + INFO("Check if %s exists",PUUID_PATH); + else { + INFO("Try to decrypt it as a normal user/no sudo"); + INFO("if that fails recover from backup. Sorry"); + } + } else if (!ptr_substr) { + CRIT("Looks like the decrypted text does not have a handler"); + CRIT("Decryption might have failed."); + if(!strcmp(key,SAHPI_DEFKEY)) + INFO("If file is bad, Recover from backup or try sudo."); + else + INFO("If file is bad, Recover from backup."); + } + g_free(key); + return(out); + } + } else { + CRIT("Unknown Type %d",type); + g_free(plain_text); + g_free(key); + return(NULL); + } + g_free(key); + return(NULL); +} + +#endif Added: openhpi/trunk/utils/sahpi_gcrypt_utils.h =================================================================== --- openhpi/trunk/utils/sahpi_gcrypt_utils.h (rev 0) +++ openhpi/trunk/utils/sahpi_gcrypt_utils.h 2013-09-06 18:40:30 UTC (rev 7556) @@ -0,0 +1,65 @@ +/* + * + * Copyright (C) 2013, 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) + * Mohan Devarajulu <mo...@fc...> + */ + +#ifndef __SAHPI_GCRYPT_UTILS_H +#define __SAHPI_GCRYPT_UTILS_H + +#ifndef __OH_UTILS_H +#warning *** Include oh_utils.h instead of individual utility header files *** +#endif + +#ifdef HAVE_ENCRYPT +#include <gcrypt.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define OHPI_ENCRYPT 1 +#define OHPI_DECRYPT 2 + +/* The following one needs to be changed if the location changes *Sigh* */ +#define PUUID_PATH "/sys/devices/virtual/dmi/id/product_uuid" +#define SAHPI_DEFKEY "20030116" + +SaErrorT oh_initialize_gcrypt(gcry_cipher_hd_t *h1, gcry_cipher_hd_t *h2, gchar *key); +gchar * oh_crypt(gchar *file_path, SaHpiUint32T type); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* HAVE_ENCRYPT */ +#endif /* __SAHPI_GCRYPT_UTILS_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dr_...@us...> - 2013-10-31 05:13:45
|
Revision: 7561 http://sourceforge.net/p/openhpi/code/7561 Author: dr_mohan Date: 2013-10-31 05:13:42 +0000 (Thu, 31 Oct 2013) Log Message: ----------- Moving trunk version up for 3.4.0 release Modified Paths: -------------- openhpi/trunk/Makefile.mingw32.def openhpi/trunk/baselibs/csharp/openhpi_baselib/AssemblyInfo.cs openhpi/trunk/baselibs/java/openhpi_baselib/manifest.txt openhpi/trunk/baselibs/python/openhpi_baselib/OhpiVersion.py openhpi/trunk/configure.ac Modified: openhpi/trunk/Makefile.mingw32.def =================================================================== --- openhpi/trunk/Makefile.mingw32.def 2013-10-31 04:17:38 UTC (rev 7560) +++ openhpi/trunk/Makefile.mingw32.def 2013-10-31 05:13:42 UTC (rev 7561) @@ -2,9 +2,9 @@ ARCH := x86 #ARCH := amd64 -VERSION := 3.3.0 +VERSION := 3.4.0 # This is for resource compiler -BINARY_VERSION := 3,3,0,0 +BINARY_VERSION := 3,4,0,0 ############################################################################ TOOLCHAIN_PATH := /home/avpak/usr/cross/mingw32 Modified: openhpi/trunk/baselibs/csharp/openhpi_baselib/AssemblyInfo.cs =================================================================== --- openhpi/trunk/baselibs/csharp/openhpi_baselib/AssemblyInfo.cs 2013-10-31 04:17:38 UTC (rev 7560) +++ openhpi/trunk/baselibs/csharp/openhpi_baselib/AssemblyInfo.cs 2013-10-31 05:13:42 UTC (rev 7561) @@ -24,6 +24,6 @@ [assembly: AssemblyTitle( "OpenHPI Base Library For .NET" )] [assembly: AssemblyDescription( "OpenHPI Base Library For .NET" )] [assembly: AssemblyProduct( "OpenHPI" )] -[assembly: AssemblyVersion( "3.3.0.0" )] +[assembly: AssemblyVersion( "3.4.0.0" )] [assembly: AssemblyCulture( "" )] Modified: openhpi/trunk/baselibs/java/openhpi_baselib/manifest.txt =================================================================== --- openhpi/trunk/baselibs/java/openhpi_baselib/manifest.txt 2013-10-31 04:17:38 UTC (rev 7560) +++ openhpi/trunk/baselibs/java/openhpi_baselib/manifest.txt 2013-10-31 05:13:42 UTC (rev 7561) @@ -3,5 +3,5 @@ Implementation-Title: OpenHPI Base Library For Java Implementation-Vendor: openhpi.org Implementation-URL: http://openhpi.org -Implementation-Version: 3.3.0 +Implementation-Version: 3.4.0 Modified: openhpi/trunk/baselibs/python/openhpi_baselib/OhpiVersion.py =================================================================== --- openhpi/trunk/baselibs/python/openhpi_baselib/OhpiVersion.py 2013-10-31 04:17:38 UTC (rev 7560) +++ openhpi/trunk/baselibs/python/openhpi_baselib/OhpiVersion.py 2013-10-31 05:13:42 UTC (rev 7561) @@ -14,5 +14,5 @@ # Anton Pak <ant...@pi...> # -__version_info__ = ( 3, 3, 0 ) +__version_info__ = ( 3, 4, 0 ) Modified: openhpi/trunk/configure.ac =================================================================== --- openhpi/trunk/configure.ac 2013-10-31 04:17:38 UTC (rev 7560) +++ openhpi/trunk/configure.ac 2013-10-31 05:13:42 UTC (rev 7561) @@ -5,7 +5,7 @@ AC_PREREQ(2.57) -AC_INIT(openhpi, 3.3.0) +AC_INIT(openhpi, 3.4.0) AC_CONFIG_SRCDIR(openhpi.spec.in) AM_INIT_AUTOMAKE([1.8]) @@ -23,7 +23,7 @@ # minor version: 11 = 11 # patch version: 4 = 4 # -HPI_LIB_VERSION=6:0:3 +HPI_LIB_VERSION=7:0:4 HPI_PKG=$PACKAGE_NAME HPI_UTIL_PKG=${PACKAGE_NAME}utils HPI_CLIENT_PKG=${PACKAGE_NAME}client This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dr_...@us...> - 2013-11-09 20:27:25
|
Revision: 7566 http://sourceforge.net/p/openhpi/code/7566 Author: dr_mohan Date: 2013-11-09 20:27:22 +0000 (Sat, 09 Nov 2013) Log Message: ----------- Incrementing version on trunk Modified Paths: -------------- openhpi/trunk/Makefile.mingw32.def openhpi/trunk/baselibs/csharp/openhpi_baselib/AssemblyInfo.cs openhpi/trunk/baselibs/java/openhpi_baselib/manifest.txt openhpi/trunk/baselibs/python/openhpi_baselib/OhpiVersion.py openhpi/trunk/configure.ac Modified: openhpi/trunk/Makefile.mingw32.def =================================================================== --- openhpi/trunk/Makefile.mingw32.def 2013-11-09 20:12:50 UTC (rev 7565) +++ openhpi/trunk/Makefile.mingw32.def 2013-11-09 20:27:22 UTC (rev 7566) @@ -2,9 +2,9 @@ ARCH := x86 #ARCH := amd64 -VERSION := 3.4.0 +VERSION := 3.5.0 # This is for resource compiler -BINARY_VERSION := 3,4,0,0 +BINARY_VERSION := 3,5,0,0 ############################################################################ TOOLCHAIN_PATH := /home/avpak/usr/cross/mingw32 Modified: openhpi/trunk/baselibs/csharp/openhpi_baselib/AssemblyInfo.cs =================================================================== --- openhpi/trunk/baselibs/csharp/openhpi_baselib/AssemblyInfo.cs 2013-11-09 20:12:50 UTC (rev 7565) +++ openhpi/trunk/baselibs/csharp/openhpi_baselib/AssemblyInfo.cs 2013-11-09 20:27:22 UTC (rev 7566) @@ -24,6 +24,6 @@ [assembly: AssemblyTitle( "OpenHPI Base Library For .NET" )] [assembly: AssemblyDescription( "OpenHPI Base Library For .NET" )] [assembly: AssemblyProduct( "OpenHPI" )] -[assembly: AssemblyVersion( "3.4.0.0" )] +[assembly: AssemblyVersion( "3.5.0.0" )] [assembly: AssemblyCulture( "" )] Modified: openhpi/trunk/baselibs/java/openhpi_baselib/manifest.txt =================================================================== --- openhpi/trunk/baselibs/java/openhpi_baselib/manifest.txt 2013-11-09 20:12:50 UTC (rev 7565) +++ openhpi/trunk/baselibs/java/openhpi_baselib/manifest.txt 2013-11-09 20:27:22 UTC (rev 7566) @@ -3,5 +3,5 @@ Implementation-Title: OpenHPI Base Library For Java Implementation-Vendor: openhpi.org Implementation-URL: http://openhpi.org -Implementation-Version: 3.4.0 +Implementation-Version: 3.5.0 Modified: openhpi/trunk/baselibs/python/openhpi_baselib/OhpiVersion.py =================================================================== --- openhpi/trunk/baselibs/python/openhpi_baselib/OhpiVersion.py 2013-11-09 20:12:50 UTC (rev 7565) +++ openhpi/trunk/baselibs/python/openhpi_baselib/OhpiVersion.py 2013-11-09 20:27:22 UTC (rev 7566) @@ -14,5 +14,5 @@ # Anton Pak <ant...@pi...> # -__version_info__ = ( 3, 4, 0 ) +__version_info__ = ( 3, 5, 0 ) Modified: openhpi/trunk/configure.ac =================================================================== --- openhpi/trunk/configure.ac 2013-11-09 20:12:50 UTC (rev 7565) +++ openhpi/trunk/configure.ac 2013-11-09 20:27:22 UTC (rev 7566) @@ -5,7 +5,7 @@ AC_PREREQ(2.57) -AC_INIT(openhpi, 3.4.0) +AC_INIT(openhpi, 3.5.0) AC_CONFIG_SRCDIR(openhpi.spec.in) AM_INIT_AUTOMAKE([1.8]) @@ -23,7 +23,7 @@ # minor version: 11 = 11 # patch version: 4 = 4 # -HPI_LIB_VERSION=7:0:4 +HPI_LIB_VERSION=8:0:5 HPI_PKG=$PACKAGE_NAME HPI_UTIL_PKG=${PACKAGE_NAME}utils HPI_CLIENT_PKG=${PACKAGE_NAME}client This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dr_...@us...> - 2014-07-08 17:38:12
|
Revision: 7583 http://sourceforge.net/p/openhpi/code/7583 Author: dr_mohan Date: 2014-07-08 17:38:09 +0000 (Tue, 08 Jul 2014) Log Message: ----------- Fix for #1838 Add ChangeLog to openhpi Modified Paths: -------------- openhpi/trunk/Makefile.am openhpi/trunk/openhpi.spec.in Added Paths: ----------- openhpi/trunk/ChangeLog Added: openhpi/trunk/ChangeLog =================================================================== --- openhpi/trunk/ChangeLog (rev 0) +++ openhpi/trunk/ChangeLog 2014-07-08 17:38:09 UTC (rev 7583) @@ -0,0 +1,2049 @@ +Changelog for 3.4.0 (11/14/2013) + New Features + + OpenHPI Daemon + + OLD 3562300 NEW 697 Checkin 7556 - Clear text authentication credentials is a security problem + + Fixed Bugs + + OpenHPI base library + + 1806 Checkin 7558 - uid_map created as world writable - a security risk + + Marshal Library + + 1805 Checkin 7552 - Fix compiler warnings in the build + + HP c-Class Plugin + + 1808 Checkin 7553 Checkin 7554 - oa_soap does not work with IPV6 addresses + + 1809 Checkin 7555 - Get Powercapconfig fails sometimes + + 1801 Checkin 7557 - Pulling network cable from Active OA creates OA link status sensor event that never clears + + OLD 3564813 NEW 1759 Checkin 7556 - OA_SOAP and ilo2_ribcl plugins require plain text passwords + + 1813 Checkin 7559 - Replace getAllEvents with getAllEventsEx call + + 1812 Checkin 7560 - SIGINT(15) is not processed for a long time + + 1815 Checkin 7563 - mutex not unlocked when there is a memory problem + + 1810 Checkin 7564 - RPT is missing when event arrives + +Changelog for 3.2.1 (07/18/2013) + + New Features + + Transport Library + + OLD 3590103 NEW 698 Checkin 7522 - Improve error message in case of unsupported protocol + + Marshal Library + + OLD 3519485 NEW 673 Checkin 7510 - Rework assertions in marshal code + + HP c-Class Plugin + + OLD 3613747 NEW 699 Checkin 7542 - Handler for EVENT_NETWORK_INFO_CHANGED + + Fixed Bugs + + Build System + + OLD 3566330 NEW 1763 Checkin 7513 - host-specific PKG_CONFIG_PATH in case of cross-compile + + OLD 3564447 NEW 1758 Checkin 7512 - Missed build files for hpi_shell(Windows) + + OLD 3562465 NEW 1755 Checkin 7509 - Not all README* files included in dist tarball + + NEW BUG 1804 Checkin 7547 - Fix the make distcheck failures + + Documentation + + NEW BUG 1803 Checkin 7548 - Readme.windows needs to info on header file processing + + OpenHPI Daemon + + OLD 3613546 NEW 1790 Checkin 7532 - Make oh_get_global_param() in openhpid/conf.c more robust + + OLD 3566478 NEW 1764 Checkin 7521 - Daemon needs to check config file security + + OpenHPI base library + + OLD 3613753 NEW 1791 Checkin 7541 - Fix another set of references before checks + + NEW BUG 1800 Checkin 7545 - Error in 3.2.x\baselibs\csharp\README + + HPI Clients + + OLD 3606640 NEW 1774 Checkin 7525 - Issues with initial svn snapshot builds + + OLD 3425850 NEW 1673 Checkin 7527 - hpipower command is misleading the user + + HP c-Class Plugin + + OLD 3613757 NEW 1794 Checkin 7538 - Fix typo in oa_soap_proc_server_status() + + OLD 3613756 NEW 1793 Checkin 7540 - potential double free() in oa_soap_event_thread() + + OLD 3613545 NEW 1789 Checkin 7531 - remove_interconnect() in oa_soap_plugins code bug + + OLD 3613544 NEW 1788 Checkin 7536 - build_interconnect_inv_rdr() is missing some ret value assig + + OLD 3613536 NEW 1787 Checkin 7535 - oa_soap_re_discover_resources() arguments checks need fixing + + OLD 3613534 NEW 1786 Checkin 7534 - wrong interconnectTrayPortNumber + + OLD 3613532 NEW 1784 Checkin 7543 - Should not free(foo)when asprintf(foo ...fails) + + OLD 3612225 NEW 1782 Checkin 7529 - saHpiResourceResetStateSet doesn't implement true COLD_RESET + + OLD 3610943 NEW 1777 Checkin 7537 - openhpi OA switchover issues + + OLD 3607674 NEW 1776 Checkin 7528 - Insert Procurve 6120 switch sets and doesn't clear alarms + + OLD 3578345 NEW 1770 Checkin 7523 - Wrong OA FW Version is displayed by openhpi clients + + OLD 3572505 NEW 1768 Checkin 7518 - PSU alarms lost if the active OA restarts + + OLD 3571330 NEW 1766 Checkin 7519 - openhpid cannot re-connect to OA after network failures + + OLD 3566304 NEW 1762 Checkin 7524 - EVENT_STANDBY_FLASH_BOOTED event is not processed + + OLD 3564814 NEW 1760 Checkin 7514 - Unknown Board casues openhpid to fail discovery + + OLD 3562666 NEW 1756 Checkin 7511 - segfaults when retrieving thermal info + + NEW BUG 1799 Checkin 7546 - oa_soap NULL dereference code paths + + HP Proliant plugin + + OLD 3613758 NEW 1795 Checkin 7539 - Fix typo in ir_xml_record_fandata() + + OLD 3613533 NEW 1785 Checkin 7533 - ilo2 wrong free() + + OLD 3603349 NEW 1773 Checkin 7530 - Thresholds for Temp sensors are not showing and state is wrong + + IPMI Direct plugin + + OLD 3580161 NEW 1772 Checkin 7520 - Several sensor bugs with Intel baseboards + + OLD 3562924 NEW 1757 Checkin 7517 - BIOS sensors and events are not handled + +Changelog for 3.2.0 (08/27/2012) + + New Features + + Build System + + 3533215 - Enable test_agent plug-in by default + + 3533216 - Enable slave plug-in by default + + HPI Shell + + 3523023 - hpi_shell for Windows + + None + + 3531917 - Assign more telling names to new IPMI-2.0 entities + + OpenHPI C# base library + + 3530528 - C#: implement oHpi Handler API + + 3540087 - Add SaHpiAtca.h and SaHpiXtca.h stuff to C# baselib + + 3530524 - C#: implement convenient HPI iterators + + OpenHPI Java base library + + 3540086 - Add SaHpiAtca.h and SaHpiXtca.h stuff to java baselib + + 3530525 - Java#: implement convenient HPI iterators + + 3530529 - Java: implement oHpi Handler API + + OpenHPI Python base library + + 3532764 - More consistent names for HpiIterators and OhpiIterators + + 3540085 - Add SaHpiAtca.h and SaHpiXtca.h stuff to python baselib + + 3530526 - Python: implement oHpi Handler API + + Sysfs Plugin + + 3534266 - Add configuration example in openhpi.conf + + Test Agent plugin + + 3530531 - FUMI support for Test Agent plugin + + 3530530 - DIMI support for Test Agent plugin + + 3530522 - Resource Event Log support for Test Agent plugin + + 3530146 - Watchdog support for Test Agent plugin + + Transport Library + + 3544208 - Make RPC header cross-platform + + Fixed Bugs + + Build System + + 3538699 - Test Agent plugin has no rpm package + + Documentation + + 3161758 - openhpi.conf.example should have all plugins + + HP ProLiant plugin + + 3554945 - Combined iLO4 problems needs to be addressed + + HP c-Class Plugin + + 3562201 - session ID could have undesirable characters + + 3559102 - Segfault in Power Supply Removal and Reinsertion + + 3559096 - Segfault in EVENT_INTERCONNECT_INFO event handler + + 3552248 - Add PRODUCT_NAME field to power supply + + 3545368 - EVENT_BLADE_MP_INFO event needs to be handled + + 3522592 - Segfualt After Active OA Reset with two Enclosure configured + + 3539516 - Core during OA firmware upgrade + + 3546395 - Double free when a Resource removed + + 3521752 - Server Blade name is shown as [Unknown] + + 3425872 - With Active OA cable unplugged Openhpid getting crashed + + 3526603 - openhpid core with SIGTERM + + 3520845 - Seg fault is seen after switchover after running hpib test + + 3509438 - Analog ctrl default is less than the min value + + 3522915 - Messages are seen when openhpid is run on c3000 enclosure + + HPI Clients + + 3522912 - hpixml fails if there is a resource without rdrs + + HPI Shell + + 3547194 - gcc-4.7 warnings when building hpi_shell + + 3536627 - hpi_shell: incorrect watchdog timer action can be specified + + 3531947 - hpi_shell on quit:"saHpiEventGet failed with error<-1014>" + + Marshal Library + + 3529744 - Remove unnecessary oHpi.h, oh_utils.h from marshal header + + None + + 3529766 - Fix clang compilation warnings + + 3530559 - oHpi.h: inaccurate data types for some structs + + 3534444 - oHpiHandlerGetNext(): incomplete description of return codes + + OpenHPI C# base library + + 3558493 - C#: SaHpiDimiTestParamValueT is (de)marshalled incorrectly + + OpenHPI Daemon + + 3547203 - gcc-4.7/mingw warning when building openhpid + + 3534897 - oHpiHandlerInfo polling causes slow initial discovery + + 3540184 - daemon can crash if there is a failed handler + + 3523021 - auto-insertion timeout limitations in openhpi.conf + + 3522913 - compilation warning in openhpid/plugin.c + + OpenHPI Java base library + + 3558494 - Java: SaHpiDimiTestParamValueT is (de)marshalled incorrectly + + OpenHPI Python base library + + 3558495 - Py: SaHpiDimiTestParamValueT is (de)marshalled incorrectly + + OpenHPI base library + + 3536844 - saHpiFinalize() call can produce segfault + + 3530655 - oHpiHandlerInfo fills handler info entity root incorectly + + OpenIPMI plugin + + 3538125 - long delay at startup in openhpi daemon + + Test Agent plugin + + 3530154 - TestAgent: hpitest Events/saHpiEventGet/RptEntryAndRdr fails + + 3530761 - Test Agent: second handler is not operational + + Transport Library + + 3522916 - Remove "connect failed" messages for IPv6 + +Changelog for 3.1.0 (05/01/2012) + + New Features + + HP c-Class Plugin + + 3117718 - Report cpu blade Mezznine card, and memory details + + 3519995 - Add support for c3000 enclosures + + None + + 3438302 - Add oHPI API descriptions in oHpi.h + + 3436658 - Windows: default config file location shall be in %APPDATA% + + OpenHPI C# base library + + 3497553 - Implement baselib for C# + + OpenHPI Daemon + + 3475539 - openhpid: better handling of --ipv4 --ipv6 options + + OpenHPI Java base library + + 3497552 - Implement baselib for Java + + OpenHPI Python base library + + 3505194 - Add convenient helper functions for RPT/RDRs... iteration + + 3497551 - Implement baselib for Python + + Fixed Bugs + + Build System + + 3487840 - acinclude.m4: remove gcc aux ver check + + 3437013 - RPM: remove tcp_wrappers dependency + + HP ProLiant plugin + + 3522116 - Compiler warning seen in 3.1 + + HP c-Class Plugin + + 3520830 - Error message is seen for one of the interconnects + + 3522644 - Mismatched area count while discovering in C3000 enclosure + + 3520000 - Update oa_soap plugin documentation + + 3324288 - IDR custom field types needs to be visible + + 3025938 - clients hang during/after a OA switchover + + 3285693 - Generate thermal events + + 3388695 - OA soap plugin exits on Switchover - C-7000 with storage + + 3519664 - Some of the thermal sensors are missing + + HPI Shell + + 3454319 - hpi_shell: reopen hungs in case of openhpid restart + + 3475530 - hpi_shell: using wrong enumeration for TimerAction field + + 3470221 - time2str does not handle relative timestamps correctly + + 3428181 - hpi_shell: entity for first event printed wrong + + HPI Utils + + 3519126 - Manufacturer ID for Cisco System Switches showing as unknown + + 3457592 - oh_decode_time() decodes relative times as"invalid time" + + 3497633 - drop executable stack flag from hpixml + + None + + 3471920 - Windows build shall include SaHpiXtca.h header + + OpenHPI Daemon + + 3414200 - saHpiMyEntityPathGet impl not flexible enough + + 3461148 - OpenHPI daemon crashes if receives unknown request + + 3434608 - Move libuuid dependency from OpenHPI core to snmpbc plugin + + OpenHPI base library + + 3431428 - Add entity_root domain parameter info in openhpiclient.conf + + Simulator plugin + + 3434607 - Remove libuuid dependency from simulator plugin + + Watchdog plugin + + 3434606 - Remove libuuid dependency from watchdog plugin + +Changelog for 3.0.0 (10/17/2011) + + New Features + + Documentation + + 3411347 - Remove outdated docs/hld subdirectory + + HP c-Class Plugin + + 3196244 - Have a field to display aggregate status of the enclosure + + OpenHPI Daemon + + 3406760 - openhpid: report client connection address in log + + Fixed Bugs + + Documentation + + 3411893 - Fix formatting of option descriptions in man pages + + Dynamic Simulator plugin + + 3414205 - Bad lock release in dynamic simulator + + HP ProLiant plugin + + 3423245 - Remove compiler warnings from ilo2_ribcl plugin + + 3416584 - ilo2_ribcl: FreeBSD compilation issue + + 3407032 - ilo2 plugin has problem reading temperature sensor values + + 3109793 - Populate temperature sensors + + 3394069 - duplicate definition of ILO2_RIBCL_DISCOVER_RESP_MAX + + HP c-Class Plugin + + 3356142 - Resource Tag displaying as Unknown for some of the blades + + 3025936 - SWITCH_BLADE generates too many events + + 3264695 - Report blade MAC addresses (NICs) information + + 2791727 - serial number goes unknown after extraction and re-insertion + + 2967121 - Incorrect serial number reported + + 3400203 - OA Redundancy is not set properly when standy OA is pulled + + 3403514 - Good Interconnect severity goes to CRITICAL after switchover + + 3374358 - OA Soap plugin need to allow access to operators too + + HPI Clients + + 3405673 - client -N "IPv6 address" doesn't work + + 3324287 - hpitree needs verbose output + + 3362952 - hpixml processes failed resources incorrectly + + HPI Shell + + 3414470 - hpi_shell: DIMI commands print trailing garbage + + HPI Utils + + 3362979 - Incorrect displaying of OEM sensor type + + IPMI Direct plugin + + 3414203 - Hang during discovery in ipmidirect plugin + + None + + 3416581 - various FreeBSD compilation issues + + OpenHPI base library + + 3327878 - saHpiDimiTestStatusGet returns wrong percentage + +Changelog for 2.17.0 (06/20/2011) + + New Features + + Build System + + 3141155 - Move to newer version of glib2 + + HPI Clients + + 3129972 - change -n and OPENHPI_DAEMON_HOST semantics + + 3130030 - client for providing system view in XML form + + 1493787 - Update clients to use long options and uniform format + + HPI Shell + + 2431334 - Proposal to change prompt in hpi_shell + + 3235117 - hpi_shell: running DIMI test with parameters + + None + + 3315211 - FreeBSD support + + 3138629 - get rid of many error/debug messages + + 3141721 - oHpi.h shall not depend on oh_utils.h + + 3031797 - Windows version of OpenHPI base library + + 3129960 - Refactoring: baselib, transport, daemon + + 3129977 - Transport: IPv6 support + + OpenHPI Daemon + + 2220356 - Supporting the graceful shutdown for openhpi daemon + + 3094859 - Add a possibility to listen only specified network interface + + 3129962 - migration from libltdl to glib + + 3129975 - Generic code to remove destroyed handler resources + + 3143658 - Remove static plug-in feature + + 3153081 - WIndows version of OpenHPI daemon + + 3160127 - Make using uid_map file optional + + OpenHPI base library + + 3098224 - Add entity_root parameter to domain configuration + + 1531430 - Upgrade error messaging to use glib\\\\\\\\\\\\\\\'s api + + 1884816 - Finish using OH_CALL_ABI macro throughout safhpi.c + + 3137336 - Implement saHpiInitialize and saHpiFinalize + + Slave plugin + + 3136828 - Slave: use g_new instead of g_malloc + + 3139353 - Slave: migration to gmodule + + Test Agent plugin + + 3307756 - New plug-in for runtime simulation + + Fixed Bugs + + Build System + + 2012381 - make using of -Werror configurable + + Dynamic Simulator plugin + + 3304257 - FUMI - Not supported + + 3304214 - Parsing of DIMI data fails + + 3296552 - simulation.data typo Unknwon should be Unknown + + 3267873 - Dynamic Simulator doesn't parse negative Sensor values + + 3267973 - Dynamic Simulator: Crash for invalid character in text buffe + + HP ProLiant plugin + + 3019167 - ilo2_ribcl plugin fails with iLO3 firmware ver 1.0 + + 3183680 - gcc 4.5 warning in ilo plugin + + HP c-Class Plugin + + 3300931 - Active OA Reset Leads to Segmentation Fault in Openhpid + + 3276450 - hpigensimdata on oa_soap plugin creates invalid character + + 3117681 - Extract romVersion value from bladeStatus to populate it in + + 3152855 - Sensor RDRs missing for the fan resource + + 3167851 - Compilation warnings in OA_SOAP plug-in + + 3203038 - Remove the usage of the"poisoned"snprintf from OA SOAP plu + + HPI Clients + + 3304218 - hpigensimdata - wrong FUMI entries + + 3167843 - gcc-4.6 warnings in clients + + 3183692 - clients should use CRIT/DBG macros consistently + + 3198689 - hpiinv displays binary fields as a non-printing data + + 3167842 - strnlen function is not cross-platform + + HPI Shell + + 3152879 - user can mix up default ctrl mode and current control mode + + 3183665 - gcc 4.5 warnings in hpi_shell + + IPMI Direct plugin + + 3183666 - gcc 4.5 warning in ipmidirect + + Marshal Library + + 3141723 - oHpiGlobalParamUnionT is marshalled incorrectly + + None + + 2717565 - -Werror produces many 'unused variable' errors + + 3167845 - gcc-4.6 warnings in baselib, marshal, utils, transport + + OpenHPI Daemon + + 3314876 - saHpiGetIdByEntityPath returns non-existent resource ids + + 3308411 - saHpiIdrAreaAddById incorrectly check for duplicates + + 2948127 - saHpiHotSwapStateGet() should check SAHPI_CAPABILITY_FRU + + 2798408 - auto-insertion timeout cannot be configured + + 2900765 - saHpiResourceIdGet produces errors in the /var/log/messages + + 3141433 - Deadlock in daemon initialization code + + OpenHPI base library + + 3310802 - Race condition in session layer + + 3129991 - Baselib: thread issues + + 3159052 - Typo in openhpiclient.conf.example + + 3220499 - hpib-test"Control/saHpiControlGet/NullParams"failure + +Changelog for 2.16.0 (02/23/2011) + + New Features + + Dynamic Simulator plugin + + 3187136 - Add documentation to rpms + + OpenHPI base library + + 3095642 - Using base library with redundant OpenHPI daemons + + Fixed Bugs + + Documentation + + 3141567 - README files are outdated + +Changelog for 2.15.1 (12/13/2010) + + New Features + + Build System + + 3073298 - Configure option to specify net-snmp-config + + Dynamic Simulator plugin + + 3064210 - wtd ->wdt for dynamic_simulator plug-in + + HPI Clients + + 3032998 - New client for domain information + + HPI Shell + + 3102198 - hpi_shell: tune "domain" cmd semantics, introduce "drt" cmd + + 3097473 - Add -D option to hpi_shell to select startup domain id + + 3064208 - wtd ->wdt in hpi_shell + + 3074871 - support for oHpiDomainAdd and oHpiDomainAddById in hpi_shell + + HPI Utils + + 3028899 - remove libopenhpiutils dependency on libuuid + + Marshal Library + + 3118484 - Marshalling code refactoring + + None + + 3074880 - Extend oHpiHandlerInfo for handler params + + 3084837 - A new plug-in for working with slave OpenHPI daemon + + 3120814 - refine include/oh_error.h + + 3121221 - make code working with time routines more cross-platform + + OpenHPI Daemon + + 3052337 - Add a way to remove RDR without removing the Resource + + 3060625 - Allow resource/hotswap events without RPT entry attached + + OpenHPI Daemon Client + + 3085861 - Provide Clients using oHpi functions + + OpenHPI base library + + 3125482 - Additional function oHpiDomainEntryGetById + + 3094865 - Use TCP Keep Alive feature + + 3025777 - Support for domain discovery + + 3061872 - Baselib refactoring + + 3064532 - Add a way to configure domains dynamically + + Fixed Bugs + + Build System + + 3105150 - update LD_LIBRARY_PATH in the test-suite + + 2964276 - openhpi.spec is incorrect + + 2964278 - conditional dependency on SSL in openhpi.spec + + 3101569 - "make rpm" is broken now + + Documentation + + 3032617 - openhpi.conf.example uncomplete + + Dynamic Simulator plugin + + 3123650 - Dyn Sim: incorrect reading of control state + + 3123648 - Dyn Sim: garbage in text buffer data + + HP c-Class Plugin + + 3029670 - OA_SOAP: missed B.02 saHpiEventLogCapabilitiesGet support + + HPI Clients + + 3102111 - printf should use %d and %u consistently + + 2964284 - hpifan does not set fan correctly + + HPI Shell + + 3018067 - wtdget should be wdtget? + + 3026001 - Typo in help + + 3074867 - hpi_shell -c key processed in a not right way + + HPI Utils + + 3030239 - using of uint type is no good + + 3032021 - make usage of strftime cross-platform + + 3108407 - utils: malloc/free is mixed up with g_malloc/g_free + + 3108416 - Windows: open() does not support S_IRGRP flag + + 3119772 - Windows: check for _WIN32 macro instead of MINGW32 + + IPMI Direct plugin + + 3118246 - saHpiIdrFieldSet in ipmidirect always returns read only + + 3105154 - fix build with gcc 4.5 + + Marshal Library + + 3124648 - OpenHPI transport only reads single packages + + 3108399 - Marshalling of var arrays + + None + + 3028889 - some oversights in function declarations in SaHpi.h + + 3031568 - Fix unpunctual usage of extern "C" and inclusion guards + + 3031574 - sid data member is cstrmsock class is not used + + 3044446 - oHpiParamGet and oHpiParamSet marshalling error + + 3029657 - make check&make distcheck failed + + OpenHPI Daemon + + 3023354 - Some eventlog hpib tests failed + + 3093009 - Daemon does not deliver event of SAHPI_ET_HPI_SW type + + 3108401 - openhpid: malloc/free is mixed up with g_malloc/g_free + + 3078699 - oHpi functions don't free hash tables + + 3074876 - oHpiHandlerCreate crashes daemon + + 2936381 - use dbg instead of printf in marshal/strmsock.cpp + + OpenHPI base library + + 3125484 - oh_getnext_domainid not threadsafe + + 2986517 - oHPI API does drawback in multi-domain configuration + + 2936377 - libuuid moved from e2fsprogs + + 3031579 - oHpi* functions are not declared correct + + 3108398 - Baselib: malloc/free is mixed up with g_malloc/g_free + + 3118202 - Parameter Checks in oHpiXXX functions + + 3078684 - oHpi functions should use SAHPI_API etc. consistently + + 3031605 - port parameter is cstrmsock::Open shall be unsigned short + + OpenIPMI plugin + + 3032995 - disable ipmi plugin by default + + Simulator plugin + + 3042194 - When inventory RDR created first, cant dump data + + 3101609 - Simulator: does not remove resources on handler destroy + + Slave plugin + + 3122116 - Slave: compilation issues + +Changelog for 2.15.0 (06/30/2010) + + New Features + + Build System + + 2953031 - source tree restructuring + + 3005259 - Split marshal and transport code + + OpenHPI Clients + + 2933010 - SAHPI_HS_CAPABILITY_AUTOINSERT_IMMEDIATE support in hpishell + + 2942405 - Bring hpi_shell into accord with HPI-B.03.02 spec + + 2950604 - Add hex representation of Manufacturer Id in hpi_shell + + 3011456 - Domain Support for Clients + + 3015970 - hpi_shell is missing man page + + HP c-Class Plugin + + 2982733 - Add power mgmt controls to oa_soap plugin + + 2984110 - Add dynamic power cap control support for OA firmare 3.0 + + 2991532 - Add oa_soap unit tests for new power management features + + 2999565 - Enhance oa_soap plugin documentation for pwr management + + New Dynamic Simulator Plugin + + 3014476 - Merge dynamic simulator into trunk branch + + OpenHPI Infrastructure + + 2964252 - SAIM-HPI-B.03.02-xTCA support in core + + 3005255 - Drop UDP transport + + 3004865 - make endian code simplier + + 3013282 - Implement saHpiRdrUpdateCounterGet() + + 3014655 - Disable daemon until openhpi.conf is configured + + Fixed Bugs + + OpenHPI Infrastructure + + 2907441 - mutex is unlocked in inproper place + + 2932689 - SaHpi.h - inconsistency in the FUMI Logical Bank State Flags + + 2932973 - sahpi_enum_utils.{c,h} do not correspond to SaHpi.h + + 2963277 - wrong comparison of textbuffer.data + + 2969326 - In function SensorThresholdsSet wrong values are checked + + 2973314 - saHpiGetChildEntityPath incorrectly handles root entity + + 2973401 - IdrFieldAddById isn't allowed for FIRST_ENTRY + + 2986453 - Timeout in saHpiEventGet written to error log + + 2986511 - oHpi API returns error + + 2992258 - theoretical memory overflow at writing logfiles + + 3007844 - Confusion with init script + + 3013166 - saHpiInitialize and version compatibility + + 3015981 - Fix misc. spelling errors in source files + + 3016085 - Garbage after printing ResourceTag + + 3016093 - Company Name Change + + 3017744 - Dimi and Fumi should be displayed as DIMI and FUMI + + 3020172 - rdr command does not show Default field for Text/OEM ctrls + + Build System + + 2936377 - libuuid moved from e2fsprogs + + 3009912 - remove auto-generated Makefile + + 3014969 - make distcheck failed on svn trunk + + OpenHPI Clients + + 2907427 - hpi_shell displays oem control rdr incompletely + + 2932998 - hpi_shell does not print CauseOfStateChange in HS event + + 2948577 - hpitree and hpitop show wrong behavior for resourceId 255 + + 2950586 - wrong resource GUID displaying in hpi_shell + + 2992226 - hpitop doesn't show fumi and dimi data + + 3005318 - Resource Tag displaying is not ok in hpiinv and hpipower + + 3014386 - hpisettime input parameter check + + 3014897 - DIMI and FUMI options do not work hpitop + + HP c-Class Plugin + + 2979598 - DataLength of IDR Field should not include trailing blanks + + 3015283 - Misc. compile warnings in oa_soap plug-in + + New Dynamic Simulator Plugin + + 3015282 - Misc. compile warnings in new simulator + +Changelog for 2.14.1 (11/23/2009) + + New Features + + HP ProLiant plugin + + 2902655 - HP ProLiant Development Guide needs updates + + 2880239 - ilo2_ribcl: Add support for DL380 G6 Server + + Build System + + 2878436 - Allow builds on systems with 64 bit integers + + 2546669 - Fix a configure problem with glib on Solaris + + IPMI Direct plugin + + 2793974 - Add support to the IPMI Direct Plugin for Sun servers + + OpenHPI base library + + 2543954 - Fix a compile problem with sprintf on Solaris + + Fixed Bugs + + OpenHPI base library + + 2890776 - superfluous g_static_rec_mutex_unlock + + 2880409 - issues with saHpiGetIdByEntityPath() + + 2796891 - Error in SaHpi.h + + HP c-Class Plugin + + 2884312 - oa_soap: Switchover removes and re-inserts resources + + 2794368 - hot swap event(s) missing after extraction and re-insertion + + 2723870 - OA Soap - saHpiResourcePowerStateSet() sometimes leaves system off after SAHPI_POWER_CYCLE + + HPI Clients + + 2883356 - hpitop produces trailing garbage output + + 2800731 - hpiinv stops if saHpiIdrAreaHeaderGet errors + + 2795463 - hpitree produces garbage output + + HP ProLiant plugin + + 2873686 - ilo2_ribcl_getfile() doesn't close file before return + + SNMP Client plugin + + 2812037 - array index out of bounds. + + HPI Shell + + 2799537 - hpi_shell does not print '\n' when displaying error message + + 2798414 - hpi_shell shows "No alarms in DAT" even if there is alarms + + 2798412 - hpi_shell does not correctly obtains sensor thresholds + + 2798402 - HpiBoolT is displayed in differrent ways when show inventory + + 2561038 - Incorrect displaying of Text Buffers + + OpenHPI Daemon + + 2782786 - alarm is not removed from DAT + + OpenHPI Daemon Client + + 2779881 - Routine get_next_good_token() will skip the "port" token + +Changelog for 2.14.0 (04/16/2009) + + Fixed Bugs + + Build System + + 2726771 - issue with SSL build (Mandriva) + + 2726767 - RPM build issue: watchdog, ilo2_ribcl, simulator, ipmidirect + + 2726740 - Mandriva build: openhpid depends on marshal lib + + 2717570 - -Werror produces many 'unused variable' errors + + 2638458 - 2.13.3 - rpm build fails + + HP c-Class Plugin + + 2723789 - Daemon crash - oa_soap plug-in tries to free null pointer + + 2711991 - Critical events are marked informational + + HPI Clients + + 2737084 - useless memset with wrong buffer size + + 2668530 - garbage trailing characters when displaying SaHpiTextBufferT + + HPI Shell + + 2737908 - hpi_shell: cannot input rdr type in rdr/showrdr command + + 2726719 - Incorrect working with saHpiEventGet + + 2726684 - Text buffers of 1 char length are not displayed + + 2726678 - Incorrect displaying of sensor reading of BUFFER type + + 2726620 - Proposal to improve displaying of timeout value in hpi_shell + + 2726589 - hpi_shell -n option doesn't work + + 2726553 - No space between two text blocks when displaying domain info + + 2726546 - Typo in displaying paging state + + 2726539 - Cannot set TIMEOUT_BLOCK in hpi_shell + + OpenHPI base library + + 2737502 - wrong usage of memcmp in oh_compare_sensor reading + + 2737059 - wrong buffer size used fo memcmp in oh_compare_sensorreading + + 2726887 - issue with marshalling of control state(saHpiControlGet) + + 2726800 - incorrect validation of sensor thresholds + + 2726734 - incorrect macro definitions in SaHpiAtca.h + + OpenHPI Daemon Client + + 2717641 - Events added by saHpiEventLogEntryAdd gets different Language + +Changelog for 2.13.3 (02/24/2009) + + New Features + + HP c-Class Plugin + + 2540102 - Supporting the graceful shutdown for OA SOAP plugin + + OpenHPI Daemon + + 2526862 - HPI-B.03.01 support + + Fixed Bugs + + HP ProLiant plugin + + 2526494 - saHpiResourcePowerStateSet() fails with ilo2-ribcl Plugin + + HP c-Class Plugin + + 2567977 - Memory leak in event thread for not reachable OA + + 2567974 - Memory leak in sensor event generation in OA SOAP plugin + + 2543767 - Potential race condition during startup. + + 2529314 - Hotswap event severity is wrong + + 2527902 - SEG FAULT encountered during the blade event processing + + 2515275 - User's Guide needs to be updated + + 2496073 - saHpiResourcePowerStateSet() fails with HP c-Class Plugin + + HPI Shell + + 2530818 - incorrect severity when adding announcement to annunciator + + IPMI Direct plugin + + 2390475 - saHpiIdrAreaHeaderGet(), saHpiIdrFieldGet() dont handle type + + OpenHPI Daemon + + 1804273 - Hysteresis values are not validated correctly + + OpenHPI base library + + 2564289 - gcc 4.4 - shadowed global variable + + 2564015 - gcc 4.4 - warning/error in safhpi.c + + 2518985 - SIGSEGV in tsensorget013 + + Test Suites + + 2568358 - buffer overflows in sahpi_struct_utils_test + +Changelog for 2.13.2 (01/16/2009) + + New Features + + HP c-Class Plugin + + 2056128 - Requesting support for additional temperature sensors + + 2259905 - Add SOAP calls, to allow additional plug-in functionality + + 2420921 - Supporting hardware failure events in OA SOAP plug-in + + HPI Shell + + 2141354 - Resolve compile problem on systems without strnlen() + + 1878034 - hpi_shell command to obtain HPI and OpenHPI version + + Fixed Bugs + + HP c-Class Plugin + + 2496251 - Missing"const"declaration causes compile error + + 2493467 - Partial info is stored in custom fan inventory field + + 2493343 - Thermal sensor's setting on few resources incorrect + + 2447057 - Wrong hotswap events raised for IO and storage blades + + 2431211 - Uninitialized parameters when connecting to OA + + 2315536 - Enum parsing issues within SOAP support routine + + HPI Utils + + 2435736 - oh_decode functions do not set the DataLength correctly + + IPMI Direct plugin + + 2414621 - ipmidirect seg faults when a short pkt is received + + OpenHPI Daemon + + 2448141 - Incorrect alarms added to DAT + + OpenHPI base library + + 2220086 - New ABI for saHpiResourceFailedRemove() SAF HPI API + + Python bindings + + 2435118 - Some decode functions are missing from the python interface + +Changelog for 2.13.1 (11/19/2008) + + New Features + + Documentation + + 2042355 - Missing man pages for most of the client applications + + HP c-Class Plugin + + 2175525 - Add underpinnings for additional management functions + + Fixed Bugs + + Build System + + 2191513 - openhpid initscript is not installed + + HPI Shell + + 2182034 - Incorrect displaying of SaHpiTextBufferT in hpi_shell + + 2171901 - HPI session is not closed after quit + + OpenHPI Daemon Client + + 2230986 - DomainId issues with the new multi-domain implementation. + + OpenHPI base library + + 2211619 - Typo in type for session + + 2188639 - saHpiResourceFailedRemove() fails if only FRU cap is set + + 2187132 - Incorrect error returned by saHpiSensorThresholdsSet() + +Changelog for 2.13.0 (10/10/2008) + + New Features + + Build System + + 2144764 - Create new development branch openhpi-2.13.0 + + 2022257 - Bump release version to 2.13.0 in trunk + + HP c-Class Plugin + + 2091594 - HP c-class-Enhancement to add IO and Storage blade support + + OpenHPI base library + + 1945076 - Enable redundant domains with multiple daemon connections + + Simulator Plugin + + 2037638 - Add saHpiEventLogCapabilitiesGet to simulator plugin + + Fixed Bugs + + Build System + + 2041977 - Add entry for pdf document in Makefile.am + + HP c-Class Plugin + + 2099686 - Support chage in the OA switchover behaviour + + 2027062 - OpenHpi fails on call to saHpiIdrAreaHeaderGet() + + OpenHPI Daemon Client + + 2067672 - OPENHPI_DAEMON_PORT env var + + OpenHPI base library + + 2122670 - Too many timeout error messages in syslog by hpi_shell + +Changelog for 2.12.0 (07/25/2008) + + New Features + + Build System + + 2021928 - Bump openhpi version number in configure.ac before branching + + 1816198 - Build the watchdog plugin only if linux/watchdog.h exists + + Documentation + + 2020974 - Add documentation for new ilo2_ribcl and oa_soap plugins + + HP ProLiant plugin + + 1955880 - Make use of common SSL code + + HP c-Class Plugin + + 1976961 - saHpiIdrFieldGet() enhancement to support product version + + Fixed Bugs + + Build System + + 2013946 - Build fails (make rpm) if docbook utilities not present + + 1963765 - fix compiler warnings for ignored return values + + HP c-Class Plugin + + 2021749 - Correct plugin return values for [In]ActiveSet, PolicyCancel + + OpenHPI Daemon + + 1823713 - Memory leak noticed in the daemon + + OpenHPI Daemon Client + + 2027371 - Use OH_DEFAULT_DOMAIN_ID as default domain id + + 2027043 - Allow for DomainID == 0 in internal functions. + + 2019614 - openhpi client library crashes on wrong session id + + OpenHPI base library + + 2016272 - Segfaulted with hpitest Control/saHpiControlSet/IgnoreState + +Changelog for 2.11.3 (06/25/2008) + + New Features + + Simulator plugin + + 1977471 - Add Dimis and Fumis to Simulator plugin + + Fixed Bugs + + IPMI Direct plugin + + 1930512 - Invalid handling of ATCA Led Controls in Manual Mode + +Changelog for 2.11.2 (05/26/2008) + + New Features + + HP c-Class Plugin + + 1954038 - Support OA firmware version 2.20 + + 1954014 - Compliance to SAF HPI B.02.01 spec + + HPI Shell + + 1878030 - arg for hpi_shell to point HPI server address + + OpenHPI base library + + 1945160 - Add further support routines to SSL support library + + Fixed Bugs + + Build System + + 1912737 - incorrect determination of basic types sizes for cross build + + 1963761 - sim_dimi.h and sim_fumi.h are not distributed + + 1952049 - Check for MD5_Init() in libcrypto not in libssl + + 1949449 - update LD_LIBRARY_PATH for the built-in tests + + 1954205 - headers for the RTAS plugin are not distributed + + 1954212 - cannot configure with --enable-rtas + + HP c-Class Plugin + + 1964263 - Discovery of unstabilized OA, crashes the OA SOAP plugin + + 1964261 - Core dumps on stdby OA removal and insertion while discovery + + 1951474 - Re-Discovery hangs on inserting Standby OA + + 1954008 - oa_soap_get_power_state should return proper error code + + 1951466 - Improperly provisioned Power Supply crashes OA SOAP plugin + + 1951470 - Re-Discovery hangs on inserting OA which was removed earlier + + 1932974 - Memory allocated to IDR is not released in error scenario + + 1933089 - Re-discovery may show old FRU inventory details for new FRU + + 1933099 - ManufacturerId missing in resource RPT discovered by OA SOAP + + 1933112 - Multiple events for a state change during OA switchover + + 1933124 - Sensor event not listing correct asserted events in CRITICAL + + 1933109 - Push the resource discovery event after complete discovery + + OpenHPI Daemon + + 1939812 - openhpid doesnt work correctly for non-existent machine + + OpenHPI base library + + 1794430 - Avoid blank alarms from entering from persisted DAT + + 1944549 - Build fails with --disable-thread --disable-ipmidirect + + 1949719 - move HAVE_OPENSSL from CFLAGS into config.h + +Changelog for 2.11.1 (04/22/2008) + + New Features + + Build System + + 1922399 - Request addition of HP BladeSystem c-Class plugin + + OpenHPI Daemon + + 1888910 - Include LSB Init Script section in daemon start-up script + + OpenHPI base library + + 1945161 - Create separate SSL support library for future modularity + + 1947016 - Connect to multiple daemons from one client + + 1944141 - Add OpenSSL library initialization to infrastructure + + Fixed Bugs + + Blade Center Plugin + + 1934806 - sessionid uninitialized in snmp_bc tests + + Build System + + 1939985 - AM_CFLAGS usage cleanup + + 1925236 - cannot run"make check"in chrooted build environment + + 1856208 - The --mandir configure option is ignored + + 1911396 - configure wrongly thinks libxml2 is installed in system + + HPI Shell + + 1919651 - missed Description field printing for FUMI Source Info + + 1877422 - rdr/showrdr command issue + + 1877421 - incorrent prompt when entering ann,ctrl,sen,wtd block + + HPI Utils + + 1923111 - rpt_diff should return error code + + OpenHPI Daemon + + 1933558 - marshal_028 test fails with gcc 4.3 + + 1884615 - Inconsistent use of oh_get_domain() and OH_GET_DOMAIN() + + 1884616 - Inconsisten use of oh_get_hanlder() and OH_GET_HANDLER() + + 1884619 - domain lock is held during dbg() print activity + + 1924661 - force-reload: not a valid identifier + + OpenHPI Daemon Client + + 1937234 - oHpiHandlerCreate should only call the daemon once + + OpenHPI base library + + 1916910 - wrong source state handling in saHpiFumiTargetVerifyStart + + 1925544 - SaHpiNameT uses unsigned char instead of SaHpiUint8T + + Test Suites + + 1923446 - RPT Test cases 79,80,81 using bad rdr member + +Changelog for 2.11.0 (03/03/2008) + + New Features + + Build System + + 1904823 - Add gdb specific debugging symbols to --enable-debuggable + + HPI Clients + + 1807275 - Update clients to show OpenHPI and SAF HPI version numbers + + HPI Shell + + 1878098 - show single inventory area + + 1878043 - hpi_shell command to reopen session + + 1810225 - Remove hpi_cmd bash script. hpi_shell is sufficient + + 1810177 - Merge hpi_ui_libi into hpi_shell for simplicity + + IPMI Direct plugin + + 1840237 - Replace sprintf() by snprintf() + + iLO2 RIBCL plug-in + + 1841151 - New iLO2 RIBCL plug-in for HP ProLiant Rack Mounts + + OpenHPI Daemon + + 1904829 - Enable gentoo output in openhpid init.d script + + Fixed Bugs + + IPMI Direct plugin + + 1862080 - Type qualifiers ignored on function return type + + 1853460 - ipmidirect parenthesis warning + + OpenHPI base library + + 1804512 - Debug output occurring during normal operation + + 1839926 - open calls need mode macros in glibc 2.7 + + 1804510 - Current dbg() and trace() macros have confusing names + +Changelog for 2.10.2 (03/03/2008) + + New Features + + Build System + + 1818149 - Remove -Wcast-qual and -Wwrite-strings on Solaris + + IPMI Direct plugin + + 1893197 - Fix compile problem on Debian/SPARC (tv.usec size) + + 1789782 - Make plugins/ipmidirect/thread.cpp more portable + + 1855506 - Uninitialized variable warnings on Solaris + + OpenHPI Daemon + + 1785223 - Make the marshalling code more portable + + Fixed Bugs + + Build System + + 1907201 - Remove docbook and popt requires from rpm spec file + + 1831717 - openhpid manual is not in openhpi.spec + + 1904849 - Some makefile definitions are not including cpp files + + Documentation + + 1853115 - Enable/Disable docs based on docbook-utils presence + + HPI Clients + + 1843714 - hpievents and hpi_shell do not print the entity path + + 1840685 - hpipower discriminates on entity type + + HPI Shell + + 1878076 - Only upper case should be allowed when entering hex data + + 1878066 - Cannot set BLOCK timeout in hpi_shell + + 1878002 - typo in invetory block subcommands help + + 1765584 - Overflow in set AutoInsert/AutoExtract Timeout + + HPI Utils + + 1907179 - oh_uid_initialize should not fail if already called + + 1893972 - oh_lookup_sensortype() does not support some sensor types + + IPMI Direct plugin + + 1840241 - Bogus"0"is appended to compact sensors RDR IdString + + 1833028 - Hot swap sensors may trigger events on the wrong resource + + 1833026 - IPMC detection logic does not work on MicroTCA + + OpenHPI Daemon + + 1878114 - ai_timeout cannot be set to negative value in config + + 1873903 - missing CauseOfStateChange in marshaling of HotSwap Event + + 1826377 - Change include order to prevent compile error on Solaris + + OpenHPI base library + + 1849426 - marshalling problems with saHpiDimiTestStart + + 1867746 - Wrong marshalling of SaHpiFumiBankInfoT + + 1841864 - Improve DIMI and FUMI support + + 1884612 - saHpiControlSet() fails to release handler in an error leg + + 1877606 - saHpiControlSet(): incorrect digital Control state check + + 1849418 - marshalling of SaHpiDimiTestParamsDefinitionT type + + 1827895 - cast-align compile failures on SPARC from g_array_index() + + 1840681 - saHpiGetChildEntityPath: array index is above array bounds + + 1876339 - wrong source state handling in saHpiFumiInstallStart + + OpenIPMI plugin + + 1677380 - Port parameter value is not quoted in openhpi.conf.example + +Changelog for 2.10.1 (11/02/2007) + + Fixed Bugs + + Build System + + 1820302 - openhpi.spec.in has obsolete sysfs dependency + + 1824897 - gcc version check does not work with gcc 4.2 + + 1803219 - Tarball has files that are not in tree after distclean + + HPI Clients + + 1804367 - hpiel coredumps if run without openhpid running + + IPMI Direct plugin + + 1808859 - More header files are needed in ipmi_con_smi.cpp on Solaris + + OpenHPI Daemon + + 1807689 - Misaligned reads in marshal/marshal.c:DemarshalSimpleTypes() + + 1809894 - A cast is needed in connection.c to compile on Solaris + + 1802968 - Use mkinstalldirs in openhpid/Makefile.am + + OpenHPI base library + + 1799966 - saHpiGetIdByEntityPath does not return InstrumentId + + OpenIPMI plugin + + 1799550 - Cause of State Change stored in the wrong event data byte + +Changelog for 2.10 (09/20/2007) + + New Features + + HPI Shell + + 1798472 - Modifiy the hpi_shell code for Solaris + + HPI Utils + + 1799449 - Add more manufacturer definitions from IANA numbers + + IPMI Direct plugin + + 1793588 - Make plugins/ipmidirect/ipmi_con_lan.cpp more portable + + 1789375 - Add basic support for MicroTCA + + OpenHPI Daemon + + 1783020 - compile problem in marshal/strmsock.cpp on Solaris + + OpenHPI base library + + 1800862 - Add saHpiFumiActivate() base implementation + + 1800861 - Add saHpiFumiRollback() base implementation + + 1800860 - Add saHpiFumiUpgradeCancel() base implementation + + 1800859 - Add saHpiFumiTargetVerifyStart() base implementation + + 1800858 - Add saHpiFumiUpgradeStatusGet() base implementation + + 1800850 - Add saHpiFumiInstallStart() base implementation + + 1800849 - Add saHpiFumiBankCopyStart() base implementation + + 1800848 - Add saHpiFumiBankBootOrderSet() base implementation + + 1800847 - Add saHpiFumiBackupStart() base implementation + + 1800846 - Add saHpiFumiTargetInfoGet() base implementation + + 1800845 - Add saHpiFumiSourceInfoGet() base implementation + + 1800844 - Add saHpiFumiSourceInfoValidateStart() base implementation + + 1800842 - Add saHpiFumiSourceSet() base implementation + + 1800841 - Add saHpiDimiTestResultsGet() base implementation + + 1800840 - Add saHpiDimiTestStatusGet() base implementation + + 1800839 - Add saHpiDimiTestCancel() base implementation + + 1800838 - Add saHpiDimiTestStart() base implementation + + 1800835 - Add saHpiDimiTestReadinessGet() base implementation + + 1782284 - Add saHpiDimiTestInfoGet() base implementation + + Fixed Bugs + + Documentation + + 1723186 - Problem building docs with newer docbook packages + + HPI Shell + + 1775387 - SAHPI_SENSOR_READING_TYPE_BUFFER displayed as string + + 1765599 - control/sensor number is not RDR NUM + + IPMI Direct plugin + + 1796990 - Communication lost (M7) state is not properly handled + + OpenHPI Daemon + + 1789834 - OpenHPI daemon seg fault when a plugin get_event is null + + OpenHPI base library + + 1794862 - Check for ResourceFailed is missing in some API calls + + 1791669 - FRU resources cannot be signaled as failed + + Sysfs plugin + + 1788986 - Sysfs plugin does not compile with libsysfs 2.0 + + Watchdog plugin + + 1792701 - watchdog open and close return without free + + +Changelog for 2.9.3 (08/27/2007) + + New Features + + HPI Utils + + 1765556 - request to add PICMG into the list of known manufacturers + + OpenHPI base library + + 1782277 - Add saHpiDimiInfoGet() base implementation + + 1742902 - Return Code changes from HPI B2 - Phase 2 + + 1782276 - Create macro for calling plugin abi + + Simulator Plugin + + 1780759 - Add fan analog control to simulator + + Fixed Bugs + + Build System + + 1768864 - Compile errors on cpp wrappers + + Documentation + + 1765550 - out-of-date MultipleDomains and DomainTag settings + + HPI Clients + + 1780746 - Reinstate hpifan + + HPI Shell + + 1777643 - Entity may be missed when Event Log Entry is displayed + + 1765547 - settag command always set empty resource tag + + OpenHPI Daemon + + 1777675 - alignment error in the MarshalSimpleTypes() function + + 1756621 - Bind new B2 APIs to the daemon - Phase 1 + + OpenHPI base library + + 1715462 - sensorEventMasksSet does not properly check INVALID_DATA + + 1699146 - Thresholds order is not always verified + + OpenIPMI plugin + + 1768890 - OEM LED color code problems + + 1768881 - OEM LED control length wrong + +Changelog for 2.9.2 (06/25/2007) + + New Features + + Blade Center Plugin + + 1720882 - Enable snmp_bc to use alternate host + + HPI Utils + + 1737345 - Change utils function name get_rdr_uid to have proper prefix + + OpenHPI base library + + 1714703 - Enable default domain configuration + + 1740725 - Add saHpiIdrAreaAddById API from HPI B.02.01 + + 1740726 - Add saHpiIdrFieldAddById API from HPI B.02.01 + + 1740089 - Add saHpiEventLogCapabilitiesGet() API from HPI B.02.01 + + 1740013 - Add saHpiResourceFailedRemove API from HPI B.02.01 + + 1737375 - Add saHpiGetChildEntityPath API from HPI B.02.01 + + 1737353 - Add saHpiGetIdByEntityPath API from HPI B.02.01 + + 1737351 - Add saHpiResourceLoadIdGet/Set API from HPI B.02.01 + + 1712088 - Upgrade SaHpi.h header file to B2 level + + Fixed Bugs + + Blade Center Plugin + + 1719431 - Enhance snmp_bc timeout on AMM Resource discovery + +Changelog for 2.9.1 (05/04/2007) + + New Features + + OpenHPI Daemon + + 1546774 - Adapt daemon readme into manpage for openhpid + + Blade Center Plugin + + 1715383 - Add resource firmware inventory data as Product Info + + OpenHPI base library + + 1714702 - Return Code changes from HPI B2 - Phase 1 + + Fixed Bugs + + Documentation + + 1684816 - Add distribution text to copyright of SaHpi files + + OpenHPI base library + + 1684814 - Discovery being called on a failed plugin + + 1713582 - Remove alarms on sensor enable change events + + Blade Center Plugin + + 1715743 - gcc warning: mixed declarations/code in snmp_bc_inventory + + 1710895 - Handle zero length, and un-initialized snmp object + +Changelog for 2.8.1 (02/26/2007) + + Fixed Bugs + + Blade Center Plugin + + 1664628 - Adjust for new Daylight Saving Time (DST) + + 1650719 - Hotswap state for Managed Hotswap Resource + + 1649993 - Correct handling of SlotStateSensor for Hotswap-Removal + + 1649101 - Fix mem leaks in snmp_bc plugin + + 1648035 - Use SA_ERR_HPI_OUT_OF_MEMORY + + Build System + + 1655375 - spec file has problems on older rpm versions and 64bit archs + + HPI Clients + + 1654229 - Enhance IBMblade specific client + + HPI Utils + + 1649789 - entity path memory leak + + OpenHPI base library + + 1649796 - daemon shuts down if no plugins loaded + + OpenIPMI plugin + + 1649797 - array subscript is above array bounds + +Changelog for 2.8.0 (01/26/2007) + + New Features + + Build System + + 1583198 - Break plugins into separate rpms with right prereqs + + Fixed Bugs + + Blade Center Plugin + + 1593676 - Limit the range of blade center EventLog time + + 1628056 - Set initial state of MM Redundancy sensor properly + + 1631640 - Initialize variables to remove compiler warning + + 1642688 - Use sinfo->cur_state for SLOT_SENSOR state + + 1644001 - Properly initialize eventstate of SENSOR_NUM_MGMNT_STANDBY + + Build System + + 1636141 - build warning on opensuse 10.x + + 1636159 - Test for the existence of lsvpd for rtas plugin + + Documentation + + 1636104 - openhpid readme should be merged into README.daemon + + 1643672 - Documentation building error: docbook dtd problem with sgml + + HPI Clients + + 1638923 - Use oHpiHandlerFind() and oHpiHandlerInfo() utilities + + 1644008 - Add option to also display Sensor Event State + + IPMI Direct plugin + + 1643407 - Plugin crashes at startup with latest infra event changes + + 1643858 - IPMIDirect compile error: extra qualification + + OpenHPI Daemon Client + + 1643804 - Segfault when using oHpi functions and no daemon is running + + OpenHPI base library + + 1637958 - oHpiHandlerInfo() in daemon does not work correctly. + + 1643669 - uninitialized variable warning in event.c + + 1643757 - HandlerRetry and HandlerFind do not check for initialization + + 1645731 - saHpiEventAdd adds to DEL even though it is disabled + + 1645733 - Don\'t timestamp events unless they have unspecified time + + 1645736 - ALL_SEVERITIES should not be allowed in EventLogEntryAdd() + + 1645774 - Domain and User events are not being processed + + Sysfs plugin + + 1643661 - sysfs plugin possible overflow on property read + + Modified: openhpi/trunk/Makefile.am =================================================================== --- openhpi/trunk/Makefile.am 2014-06-23 22:13:47 UTC (rev 7582) +++ openhpi/trunk/Makefile.am 2014-07-08 17:38:09 UTC (rev 7583) @@ -118,7 +118,7 @@ $(top_srcdir)/clients/oh_clients.h docsdir=$(datadir)/doc/$(PACKAGE_NAME)-$(VERSION) -docs_DATA = README README.daemon COPYING +docs_DATA = README README.daemon COPYING ChangeLog $(top_srcdir)/utils/sahpi_enum_utils.h: make -C $(top_builddir)/utils sahpi_enum_utils.h Modified: openhpi/trunk/openhpi.spec.in =================================================================== --- openhpi/trunk/openhpi.spec.in 2014-06-23 22:13:47 UTC (rev 7582) +++ openhpi/trunk/openhpi.spec.in 2014-07-08 17:38:09 UTC (rev 7583) @@ -303,6 +303,7 @@ %defattr(-,root,root) %{_docdir}/README* %{_docdir}/COPYING +%{_docdir}/ChangeLog %dir %{_sysconfdir}/%{name}/ %config(noreplace) %attr(0600,root,root) %{_sysconfdir}/%{name}/%{name}.conf %config(noreplace) %attr(0600,root,root) %{_sysconfdir}/%{name}/simulation.data This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hem...@us...> - 2014-08-26 22:04:13
|
Revision: 7588 http://sourceforge.net/p/openhpi/code/7588 Author: hemanthreddy Date: 2014-08-26 22:04:04 +0000 (Tue, 26 Aug 2014) Log Message: ----------- Fix for the Bug #1834 - accept() failed in openhpi daemon Modified Paths: -------------- openhpi/trunk/openhpid/server.cpp openhpi/trunk/transport/strmsock.cpp Modified: openhpi/trunk/openhpid/server.cpp =================================================================== --- openhpi/trunk/openhpid/server.cpp 2014-07-30 23:23:29 UTC (rev 7587) +++ openhpi/trunk/openhpid/server.cpp 2014-08-26 22:04:04 UTC (rev 7588) @@ -158,16 +158,34 @@ GThreadPool *pool; pool = g_thread_pool_new(service_thread, 0, max_threads, FALSE, 0); + cStreamSock::eWaitCc wc; // wait for a connection and then service the connection while (!stop) { + if ( ( wc = ssock->Wait() ) == cStreamSock::eWaitError ) { + if (stop) { + break; + } + g_usleep( 1000000 ); // in case the problem is persistent + CRIT( "Waiting on server socket failed" ); + continue; + } + + if ( wc == cStreamSock::eWaitTimeout ) { + continue; + } + cStreamSock * sock = ssock->Accept(); - if (stop) { - break; - } + if (!sock) { CRIT("Error accepting server socket."); + g_usleep( 1000000 ); // in case the problem is persistent + continue; + } + + if (stop) { break; } + LogIp( sock ); add_socket_to_list( sock ); DBG("### Spawning thread to handle connection. ###"); @@ -224,7 +242,10 @@ break; } if (!rc) { - CRIT("%p Error or Timeout while reading socket.", thrdid); + // The following error message need not be there as the + // ReadMsg captures the error when it returns false and + // one of the false return is not a real error + // CRIT("%p Error or Timeout while reading socket.", thrdid); break; } else if (type != eMhMsg) { CRIT("%p Unsupported message type. Discarding.", thrdid); Modified: openhpi/trunk/transport/strmsock.cpp =================================================================== --- openhpi/trunk/transport/strmsock.cpp 2014-07-30 23:23:29 UTC (rev 7587) +++ openhpi/trunk/transport/strmsock.cpp 2014-08-26 22:04:04 UTC (rev 7588) @@ -186,7 +186,8 @@ while ( got < need ) { ssize_t len = recv( m_sockfd, dst + got, need - got, 0 ); if ( len < 0 ) { - CRIT( "error while reading message." ); + CRIT( "error while reading message in thread %p.", + g_thread_self() ); return false; } else if ( len == 0 ) { //CRIT( "peer closed connection." ); @@ -318,7 +319,7 @@ if ( cc == 0 ) { // timeout return eWaitTimeout; } else if ( cc != 1 ) { - CRIT( "select failed" ); + // CRIT( "select failed" ); return eWaitError; } else if ( FD_ISSET( m_sockfd, &fds ) == 0 ) { CRIT( "unexpected select behaviour" ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dr_...@us...> - 2014-08-29 16:24:36
|
Revision: 7589 http://sourceforge.net/p/openhpi/code/7589 Author: dr_mohan Date: 2014-08-29 16:24:32 +0000 (Fri, 29 Aug 2014) Log Message: ----------- Fix for #1850 man page fixes Modified Paths: -------------- openhpi/trunk/clients/clients.c openhpi/trunk/clients/ohhandler.c openhpi/trunk/clients/ohparam.c openhpi/trunk/docs/man/hpi_shell.1.pod openhpi/trunk/docs/man/hpialarms.1.pod openhpi/trunk/docs/man/hpidomain.1.pod openhpi/trunk/docs/man/hpiel.1.pod openhpi/trunk/docs/man/hpievents.1.pod openhpi/trunk/docs/man/hpifan.1.pod openhpi/trunk/docs/man/hpigensimdata.1.pod openhpi/trunk/docs/man/hpiinv.1.pod openhpi/trunk/docs/man/hpionIBMblade.1.pod openhpi/trunk/docs/man/hpipower.1.pod openhpi/trunk/docs/man/hpireset.1.pod openhpi/trunk/docs/man/hpisensor.1.pod openhpi/trunk/docs/man/hpisettime.1.pod openhpi/trunk/docs/man/hpithres.1.pod openhpi/trunk/docs/man/hpitop.1.pod openhpi/trunk/docs/man/hpitree.1.pod openhpi/trunk/docs/man/hpiwdt.1.pod openhpi/trunk/docs/man/hpixml.1.pod openhpi/trunk/docs/man/ohdomainlist.1.pod openhpi/trunk/docs/man/ohhandler.1.pod openhpi/trunk/docs/man/ohparam.1.pod openhpi/trunk/docs/man/openhpid.8.pod openhpi/trunk/openhpid/openhpid-posix.cpp openhpi/trunk/openhpid/openhpid-win32.cpp Modified: openhpi/trunk/clients/clients.c =================================================================== --- openhpi/trunk/clients/clients.c 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/clients/clients.c 2014-08-29 16:24:32 UTC (rev 7589) @@ -67,7 +67,7 @@ static GOptionEntry clientconf_option[] = { { "cfgfile", 'C', 0, G_OPTION_ARG_FILENAME, &optcfgfile, "Use passed file as client configuration file\n" -" This option overrides the OPENHPICLIENT_CONf\n" +" This option overrides the OPENHPICLIENT_CONF\n" " environment variable.", "\"file\"" }, { NULL } }; Modified: openhpi/trunk/clients/ohhandler.c =================================================================== --- openhpi/trunk/clients/ohhandler.c 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/clients/ohhandler.c 2014-08-29 16:24:32 UTC (rev 7589) @@ -187,7 +187,7 @@ printf(" This option overrides the OPENHPI_DAEMON_HOST and \n"); printf(" OPENHPI_DAEMON_PORT environment variables. \n"); printf(" -C, --cfgfile=\"file\" Use passed file as client configuration file \n"); - printf(" This option overrides the OPENHPICLIENT_CONf \n"); + printf(" This option overrides the OPENHPICLIENT_CONF \n"); printf(" environment variable. \n\n"); return 1; } Modified: openhpi/trunk/clients/ohparam.c =================================================================== --- openhpi/trunk/clients/ohparam.c 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/clients/ohparam.c 2014-08-29 16:24:32 UTC (rev 7589) @@ -150,7 +150,7 @@ printf(" This option overrides the OPENHPI_DAEMON_HOST and \n"); printf(" OPENHPI_DAEMON_PORT environment variables. \n"); printf(" -C, --cfgfile=\"file\" Use passed file as client configuration file \n"); - printf(" This option overrides the OPENHPICLIENT_CONf \n"); + printf(" This option overrides the OPENHPICLIENT_CONF \n"); printf(" environment variable. \n\n"); return 1; } Modified: openhpi/trunk/docs/man/hpi_shell.1.pod =================================================================== --- openhpi/trunk/docs/man/hpi_shell.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpi_shell.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -59,7 +59,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpialarms.1.pod =================================================================== --- openhpi/trunk/docs/man/hpialarms.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpialarms.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -85,7 +85,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpidomain.1.pod =================================================================== --- openhpi/trunk/docs/man/hpidomain.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpidomain.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -57,7 +57,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpiel.1.pod =================================================================== --- openhpi/trunk/docs/man/hpiel.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpiel.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -4,9 +4,9 @@ =head1 SYNOPSIS - hpiel [-D nn] [-N host[:port]] [-C <cfgfile>] [-d] [-e entitypath] [-c -p -r -X -h ] - hpiel [--Domain=nn] [--host=host[:port]] [--cfgfile=file] - [--del] [--entitypath="entitypath"] [--clear --resource --rdr --xml --debug --help] + hpiel [-D nn] [-N host[:port]] [-C <cfgfile>] [-d] [-E entity-path] [-c -p -r -X -h ] + hpiel [--domain=nn] [--host=host[:port]] [--cfgfile=file] + [--del] [--entity-path="entitypath"] [--clear --resource --rdr --debug --help] =head1 DESCRIPTION @@ -68,7 +68,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpievents.1.pod =================================================================== --- openhpi/trunk/docs/man/hpievents.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpievents.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -56,7 +56,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpifan.1.pod =================================================================== --- openhpi/trunk/docs/man/hpifan.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpifan.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -53,7 +53,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpigensimdata.1.pod =================================================================== --- openhpi/trunk/docs/man/hpigensimdata.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpigensimdata.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -66,7 +66,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpiinv.1.pod =================================================================== --- openhpi/trunk/docs/man/hpiinv.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpiinv.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -55,7 +55,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpionIBMblade.1.pod =================================================================== --- openhpi/trunk/docs/man/hpionIBMblade.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpionIBMblade.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -57,7 +57,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpipower.1.pod =================================================================== --- openhpi/trunk/docs/man/hpipower.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpipower.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -68,7 +68,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpireset.1.pod =================================================================== --- openhpi/trunk/docs/man/hpireset.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpireset.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -56,7 +56,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpisensor.1.pod =================================================================== --- openhpi/trunk/docs/man/hpisensor.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpisensor.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -65,7 +65,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpisettime.1.pod =================================================================== --- openhpi/trunk/docs/man/hpisettime.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpisettime.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -55,7 +55,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpithres.1.pod =================================================================== --- openhpi/trunk/docs/man/hpithres.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpithres.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -47,7 +47,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpitop.1.pod =================================================================== --- openhpi/trunk/docs/man/hpitop.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpitop.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -88,7 +88,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpitree.1.pod =================================================================== --- openhpi/trunk/docs/man/hpitree.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpitree.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -5,7 +5,7 @@ =head1 SYNOPSIS - hpitree [-D nn] [-N host[:port]] [-C <cfgfile>] [-acdiorsw ] [-n nn] [-x] [-h] + hpitree [-D nn] [-N host[:port]] [-C <cfgfile>] [-acdiorsw ] [-n nn] [-X] [-h] hpitree [--domain=nn] [--host=host[:port]] [--cfgfile=file] [--all] [--controls] [--rdrs] [--inventories] [--rpts] [--sensors] [--watchdogs] [--overview] [--resource=nn] [--debug] [--help] @@ -87,7 +87,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpiwdt.1.pod =================================================================== --- openhpi/trunk/docs/man/hpiwdt.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpiwdt.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -4,9 +4,9 @@ =head1 SYNOPSIS - hpiwdt [-D nn] [-N host[:port]] [-C <cfgfile>] [-der -t sec] [-X] [-h] + hpiwdt [-D nn] [-N host[:port]] [-C <cfgfile>] [-t sec] [-X] [-h] hpiwdt [--domain=nn] [--host=host[:port]] [--cfgfile=file] - [--disable][--enable][--reset][--timout n] [--debug] [--help] + [--disable][--enable][--reset][--timeout n] [--debug] [--help] =head1 DESCRIPTION @@ -65,7 +65,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/hpixml.1.pod =================================================================== --- openhpi/trunk/docs/man/hpixml.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/hpixml.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -56,7 +56,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/ohdomainlist.1.pod =================================================================== --- openhpi/trunk/docs/man/ohdomainlist.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/ohdomainlist.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -38,6 +38,10 @@ =over 2 +=item B<-D>, B<--domain>=I<nn> + +Select domain id nn + =item B<-X>, B<--debug> Display debug messages @@ -46,6 +50,18 @@ Verbose mode +=item B<-N>, B<--host>=I<"host[:port]"> + +Open session to the domain served by the daemon +at the specified URL (host:port). +This option overrides the OPENHPI_DAEMON_HOST and +OPENHPI_DAEMON_PORT environment variables. + +=item B<-C>, B<--cfgfile>=I<"file"> + +Use passed file as client configuration file. +This option overrides the OPENHPICLIENT_CONF environment variable. + =back =head1 SEE ALSO Modified: openhpi/trunk/docs/man/ohhandler.1.pod =================================================================== --- openhpi/trunk/docs/man/ohhandler.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/ohhandler.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -7,13 +7,13 @@ ohhandler [-D nn] [-N host[:port]] [-C <cfgfile>] [-X] command <specific arguments> ohhandler [--domain nn] [--host=host[:port]] [--cfgfile=file] [--debug] command <specific arguments> - ohhandler [-D nn] [-x] list - ohhandler [-D nn] [-x] info <handler-id> - ohhandler [-D nn] [-x] destroy <handler-id> - ohhandler [-D nn] [-x] getnext <handler-id> - ohhandler [-D nn] [-x] find <resource-id> - ohhandler [-D nn] [-x] retry <handler-id> - ohhandler [-D nn] [-x] create plugin <plugin-name> <configuration-parameters> + ohhandler [-D nn] [-X] list + ohhandler [-D nn] [-X] info <handler-id> + ohhandler [-D nn] [-X] destroy <handler-id> + ohhandler [-D nn] [-X] getnext <handler-id> + ohhandler [-D nn] [-X] find <resource-id> + ohhandler [-D nn] [-X] retry <handler-id> + ohhandler [-D nn] [-X] create plugin <plugin-name> <configuration-parameters> =head1 DESCRIPTION @@ -72,7 +72,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/ohparam.1.pod =================================================================== --- openhpi/trunk/docs/man/ohparam.1.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/ohparam.1.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -70,7 +70,7 @@ =item B<-C> I<"file">, B<--cfgfile>=I<"file"> Use passed file as client configuration file. -This option overrides the OPENHPICLIENT_CONf environment variable. +This option overrides the OPENHPICLIENT_CONF environment variable. =back Modified: openhpi/trunk/docs/man/openhpid.8.pod =================================================================== --- openhpi/trunk/docs/man/openhpid.8.pod 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/docs/man/openhpid.8.pod 2014-08-29 16:24:32 UTC (rev 7589) @@ -38,38 +38,60 @@ =over 4 -=item B<-f> I<pidfile> +=item B<-c>, B<--cfg>=I<conf_file> -This overrides the default location of the pidfile. +Sets path/name of the configuration file. +This option is required unless the environment +variable OPENHPI_CONF has been set to a valid configuration file. -=item B<-n> +=item B<-v>, B<--verbose> -This forces the daemon to run in the foreground. +This option causes the daemon to display verbose +messages. This option is optional. -=item B<-p> I<port> +=item B<-b>, B<--bind>=I<bind_address> -This is used to override the port to listen on by the daemon. +Bind address for the daemon socket. +Also bind address can be specified with +OPENHPI_DAEMON_BIND_ADDRESS environment variable. +No bind address is used by default. -=item B<-s> I<seconds> +=item B<-p>, B<--port>=I<port> -Read timeout used by the daemon sockets. Default is unlimited. +Overrides the default listening port (4743) of the daemon. +The option is optional. -=item B<-t> I<threads> +=item B<-f>, B<--pidfile>=I<pidfile> -Sets the maximum number of connection threads. Default is unlimited. +Overrides the default path/name for the daemon pid file. +The option is optional. -=item B<-v> +=item B<-s>, B<--timeout>=I<seconds> -Display verbose messages +Overrides the default socket read timeout of 30 minutes. +The option is optional. -=item B<-4> +=item B<-t>, B<--threads>=I<threads> -The daemon will try to bind IPv4 socket. +Sets the maximum number of connection threads. +The default is umlimited. +The option is optional. -=item B<-6> +=item B<-n>, B<--nondaemon> +Forces the code to run as a foreground process and NOT as a daemon. +The default is to run as a daemon. +The option is optional. + +=item B<-6>, B<--ipv6> + The daemon will try to bind IPv6 socket. +=item B<-4>, B<--ipv4> + +The daemon will try to bind IPv4 socket (default). +IPv6 option takes precedence over IPv4 option. + =item B<-4 -6> The daemon will try to bind IPv4 or IPv6 socket. Modified: openhpi/trunk/openhpid/openhpid-posix.cpp =================================================================== --- openhpi/trunk/openhpid/openhpid-posix.cpp 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/openhpid/openhpid-posix.cpp 2014-08-29 16:24:32 UTC (rev 7589) @@ -95,7 +95,7 @@ #endif { "ipv6", '6', 0, G_OPTION_ARG_NONE, &enableIPv6, "The daemon will try to bind IPv6 socket.", NULL }, { "ipv4", '4', 0, G_OPTION_ARG_NONE, &enableIPv4, "The daemon will try to bind IPv4 socket (default).\n" - " IPv6 option takes precedence over IPv6 option.", NULL }, + " IPv6 option takes precedence over IPv4 option.", NULL }, { NULL } }; @@ -145,7 +145,7 @@ #endif printf(" -6, --ipv6 The daemon will try to bind IPv6 socket.\n"); printf(" -4, --ipv4 The daemon will try to bind IPv4 socket (default).\n"); - printf(" IPv6 option takes precedence over IPv6 option.\n\n"); + printf(" IPv6 option takes precedence over IPv4 option.\n\n"); } /*--------------------------------------------------------------------*/ Modified: openhpi/trunk/openhpid/openhpid-win32.cpp =================================================================== --- openhpi/trunk/openhpid/openhpid-win32.cpp 2014-08-26 22:04:04 UTC (rev 7588) +++ openhpi/trunk/openhpid/openhpid-win32.cpp 2014-08-29 16:24:32 UTC (rev 7589) @@ -68,7 +68,7 @@ // " a daemon. The option is optional.", NULL }, { "ipv6", '6', 0, G_OPTION_ARG_NONE, &enableIPv6, "The daemon will try to bind IPv6 socket.", NULL }, { "ipv4", '4', 0, G_OPTION_ARG_NONE, &enableIPv4, "The daemon will try to bind IPv4 socket (default).\n" - " IPv6 option takes precedence over IPv6 option.", NULL }, + " IPv6 option takes precedence over IPv4 option.", NULL }, { NULL } }; @@ -112,7 +112,7 @@ // printf(" a daemon. The option is optional.\n"); printf(" -6, --ipv6 The daemon will try to bind IPv6 socket.\n"); printf(" -4, --ipv4 The daemon will try to bind IPv4 socket (default).\n"); - printf(" IPv6 option takes precedence over IPv6 option.\n\n"); + printf(" IPv6 option takes precedence over IPv4 option.\n\n"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dr_...@us...> - 2014-09-24 18:32:26
|
Revision: 7590 http://sourceforge.net/p/openhpi/code/7590 Author: dr_mohan Date: 2014-09-24 18:32:14 +0000 (Wed, 24 Sep 2014) Log Message: ----------- Fix for #1842 Create an event for memory errors Modified Paths: -------------- openhpi/trunk/include/SaHpiOaSoap.h openhpi/trunk/plugins/oa_soap/oa_soap_discover.c openhpi/trunk/plugins/oa_soap/oa_soap_re_discover.c 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 2014-08-29 16:24:32 UTC (rev 7589) +++ openhpi/trunk/include/SaHpiOaSoap.h 2014-09-24 18:32:14 UTC (rev 7590) @@ -267,6 +267,8 @@ #define OA_SOAP_SEN_BLADE_POWER_SUPPLY_ZONE7 (SaHpiSensorNumT) 0x068 /* Server Blade Power Supply zone8 */ #define OA_SOAP_SEN_BLADE_POWER_SUPPLY_ZONE8 (SaHpiSensorNumT) 0x069 +/* Main Memory Errors sensor */ +#define OA_SOAP_SEN_MAIN_MEMORY_ERRORS (SaHpiSensorNumT) 0x06a /* 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/oa_soap_discover.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_discover.c 2014-08-29 16:24:32 UTC (rev 7589) +++ openhpi/trunk/plugins/oa_soap/oa_soap_discover.c 2014-09-24 18:32:14 UTC (rev 7590) @@ -137,6 +137,8 @@ */ #include "oa_soap_discover.h" +/* Global Variables */ +SaHpiInt32T memErrRecFlag[16] = {0}; /* Forward declaration for static functions */ static SaErrorT oa_soap_build_enc_info(struct oh_handler_state *oh_handler, @@ -154,6 +156,8 @@ 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); +static SaErrorT oa_soap_server_mem_evt_discover(struct oh_handler_state + *oh_handler, SaHpiRptEntryT *rpt); /** * oa_soap_discover_resources @@ -1739,7 +1743,7 @@ status_request.bayNumber = bay_number; rv = soap_getBladeStatus(con, &status_request, &status_response); if (rv != SOAP_OK) { - err("Get thermalInfo failed for enclosure"); + err("Get Blade status failed"); return SA_ERR_HPI_INTERNAL_ERROR; } @@ -4001,6 +4005,10 @@ assert_sensor_list); /* Initialize the assert sensor list to NULL */ assert_sensor_list = NULL; + /* Server memory error processing. This workaround + ignores the return value */ + oa_soap_server_mem_evt_discover(oh_handler, rpt); + } /* Get the next resource */ @@ -4374,5 +4382,126 @@ return SA_OK; } +/** + * oa_soap_server_mem_evt_discover: + * @oh_handler : Pointer to openhpi handler + * @rpt : Pointer to rpt structure + * + * Purpose: Generate the memory event errors if they are present in + * extra_data of the blades. + * + * Detailed Description: + * - This is an work around for not having DIMM memory sensor + * - When the DIMM has an error, extra_data field of status responses + * has a field to indicate which DIMM is at fault + * - Single line may have many DIMM modules, seperate them + * - Process an event for each DIMM + * + * Return values: + * SA_OK - on success + * SA_ERR_HPI_INTERNAL_ERROR - on failure + **/ +SaErrorT oa_soap_server_mem_evt_discover(struct oh_handler_state *oh_handler, + SaHpiRptEntryT *rpt) +{ + struct oa_soap_handler *oa_handler = NULL; + SaErrorT rv = SA_OK; + SaHpiInt32T i = 0, j = 0, len = 0; + struct getBladeStatus status_request; + struct bladeStatus status_response; + xmlNode *extra_data = NULL; + struct extraDataInfo extra_data_info; + char *mainMemoryError = NULL, *memoryError = NULL, *subStr = NULL; + + if (oh_handler == NULL || rpt == NULL) { + return SA_ERR_HPI_INTERNAL_ERROR; + } + + if (rpt->ResourceEntity.Entry[0].EntityType != SAHPI_ENT_SYSTEM_BLADE) { + return rv; + } + + oa_handler = (struct oa_soap_handler *) oh_handler->data; + status_request.bayNumber = rpt->ResourceEntity.Entry[0].EntityLocation; + i = status_request.bayNumber; + rv = soap_getBladeStatus(oa_handler->active_con, + &status_request, + &status_response); + if (rv != SOAP_OK) { + err("Get Blade status failed"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + extra_data = status_response.extraData; + while (extra_data) { + soap_getExtraData(extra_data, &extra_data_info); + if (!(strcmp(extra_data_info.name, + "mainMemoryErrors"))) { + err("openhpid[%d]: Blade (id=%d) at %d has " + "Memory Error: %s", getpid(), + rpt->ResourceId, i, extra_data_info.value); + memErrRecFlag[i] = 1; + + /* This MEMORY event is created just to let the + user know which memory module is generating + an error */ + mainMemoryError = extra_data_info.value; + + for(j = 0; ; j++) { + subStr = strstr(mainMemoryError, ";"); + if (subStr == NULL) { + /* Raise the HPI sensor event */ + rv = oa_soap_proc_mem_evt(oh_handler, + rpt->ResourceId, + OA_SOAP_SEN_MAIN_MEMORY_ERRORS, + mainMemoryError, + SAHPI_CRITICAL); + if (rv != SA_OK) { + err("processing the memory " + "event for sensor %x has " + "failed", + OA_SOAP_SEN_MAIN_MEMORY_ERRORS); + return rv; + } + break; + } + memoryError = (char *)g_malloc0 + (sizeof(char) * SAHPI_SENSOR_BUFFER_LENGTH); + memset(memoryError, 0, + SAHPI_SENSOR_BUFFER_LENGTH); + len = strlen(mainMemoryError) - + strlen(subStr); + strncpy(memoryError, mainMemoryError, len); + memoryError[len] = '\0'; + + /* Raise the HPI sensor event */ + rv = oa_soap_proc_mem_evt(oh_handler, + rpt->ResourceId, + OA_SOAP_SEN_MAIN_MEMORY_ERRORS, + memoryError, + SAHPI_CRITICAL); + if (rv != SA_OK) { + err("processing the memory " + "event for sensor %x has " + "failed", + OA_SOAP_SEN_MAIN_MEMORY_ERRORS); + g_free(memoryError); + return rv; + } + g_free(memoryError); + strcpy(mainMemoryError, subStr + 2); + if (j == 99) { + err("Too many memory errors, getting out"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + } + break; + } + extra_data = soap_next_node(extra_data); + } + return rv; + +} + void * oh_discover_resources (void *) __attribute__ ((weak, alias("oa_soap_discover_resources"))); Modified: openhpi/trunk/plugins/oa_soap/oa_soap_re_discover.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_re_discover.c 2014-08-29 16:24:32 UTC (rev 7589) +++ openhpi/trunk/plugins/oa_soap/oa_soap_re_discover.c 2014-09-24 18:32:14 UTC (rev 7590) @@ -2478,7 +2478,7 @@ request.bayNumber = bay_number; rv = soap_getBladeStatus(con, &request, &response); if (rv != SOAP_OK) { - err("Get OA status SOAP call failed"); + err("Get Blade status SOAP call failed"); return SA_ERR_HPI_INTERNAL_ERROR; } Modified: openhpi/trunk/plugins/oa_soap/oa_soap_sensor.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_sensor.c 2014-08-29 16:24:32 UTC (rev 7589) +++ openhpi/trunk/plugins/oa_soap/oa_soap_sensor.c 2014-09-24 18:32:14 UTC (rev 7590) @@ -2161,6 +2161,101 @@ } /** + * oa_soap_proc_mem_evt + * @oh_handler: Pointer to openhpi handler + * @resource_id: Resource Id + * @sensor_num: Sensor number + * @trigger_reading: mainMemoryErros sensor reading + * @severity: Event severity + * + * Purpose: + * Processes and raises the memory event + * + * Detailed Description: + * - Raises the memory event when there is/are DIMM failure/s + * + * Return values: + * SA_OK - on success. + * SA_ERR_HPI_INVALID_PARAMS - on wrong parameters + * SA_ERR_HPI_INTERNAL_ERROR - oa_soap plugin has encountered an internal + * error. + **/ +SaErrorT oa_soap_proc_mem_evt(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiSensorNumT sensor_num, + char *trigger_reading, + SaHpiSeverityT severity) +{ + SaHpiRptEntryT *rpt = NULL; + struct oh_event event; + int len = 0; + + if (oh_handler == NULL) { + err("wrong parameters passed"); + return SA_ERR_HPI_INVALID_PARAMS; + } + + /* Get the rpt entry of the resource */ + rpt = oh_get_resource_by_id(oh_handler->rptcache, resource_id); + if (rpt == NULL) { + err("resource RPT is NULL"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + /* Update the event structure */ + memset(&event, 0, sizeof(struct oh_event)); + event.event.EventType = SAHPI_ET_SENSOR; + memcpy(&(event.resource), rpt, sizeof(SaHpiRptEntryT)); + event.event.Source = event.resource.ResourceId; + event.hid = oh_handler->hid; + event.event.EventDataUnion.SensorEvent.SensorNum = + OA_SOAP_SEN_MAIN_MEMORY_ERRORS; + event.event.EventDataUnion.SensorEvent.SensorType = SAHPI_MEMORY; + event.event.EventDataUnion.SensorEvent.EventCategory = + SAHPI_EC_PRED_FAIL; + event.event.EventDataUnion.SensorEvent.OptionalDataPresent = + SAHPI_SOD_TRIGGER_READING; + event.event.EventDataUnion.SensorEvent.TriggerReading.Type = + SAHPI_SENSOR_READING_TYPE_BUFFER; + event.event.EventDataUnion.SensorEvent.TriggerReading.IsSupported = + SAHPI_TRUE; + oh_gettimeofday(&(event.event.Timestamp)); + + switch (severity) { + case SAHPI_CRITICAL: + event.event.EventDataUnion.SensorEvent.Assertion = + SAHPI_TRUE; + event.event.EventDataUnion.SensorEvent.EventState = + SAHPI_ES_PRED_FAILURE_ASSERT; + event.event.Severity = SAHPI_CRITICAL; + break; + + case SAHPI_OK: + event.event.EventDataUnion.SensorEvent.Assertion = + SAHPI_FALSE; + event.event.EventDataUnion.SensorEvent.EventState = + SAHPI_ES_PRED_FAILURE_DEASSERT; + event.event.Severity = SAHPI_OK; + break; + + default: + err("unknown severity"); + return SA_ERR_HPI_INTERNAL_ERROR; + } + + len = strlen(trigger_reading); + if (len >= SAHPI_SENSOR_BUFFER_LENGTH) + len = SAHPI_SENSOR_BUFFER_LENGTH - 1; + + strncpy((char *)&event.event.EventDataUnion.SensorEvent.TriggerReading. + Value.SensorBuffer, trigger_reading, len); + + oh_evt_queue_push(oh_handler->eventq, copy_oa_soap_event(&event)); + + return SA_OK; +} + +/** * oa_soap_map_thresh_resp * @rdr: Pointer to the sensor rdr * @oa_soap_threshold_sensor: Structure containing the threshold reading Modified: openhpi/trunk/plugins/oa_soap/oa_soap_sensor.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_sensor.h 2014-08-29 16:24:32 UTC (rev 7589) +++ openhpi/trunk/plugins/oa_soap/oa_soap_sensor.h 2014-09-24 18:32:14 UTC (rev 7590) @@ -108,6 +108,7 @@ } \ } + /* Maximum number of enum values for healthStatus field in extraData structure */ #define OA_SOAP_MAX_HEALTH_ENUM 8 @@ -360,6 +361,12 @@ SaHpiFloat64T trigger_reading, SaHpiFloat64T trigger_threshold); +SaErrorT oa_soap_proc_mem_evt(struct oh_handler_state *oh_handler, + SaHpiResourceIdT resource_id, + SaHpiSensorNumT sen_num, + char *trigger_reading, + SaHpiSeverityT severity); + SaErrorT oa_soap_map_thresh_resp(SaHpiRdrT *rdr, void *response, SaHpiBoolT event_support, Modified: openhpi/trunk/plugins/oa_soap/oa_soap_server_event.c =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_server_event.c 2014-08-29 16:24:32 UTC (rev 7589) +++ openhpi/trunk/plugins/oa_soap/oa_soap_server_event.c 2014-09-24 18:32:14 UTC (rev 7590) @@ -51,6 +51,9 @@ * build_inserted_server_rpt() - Builds the rpt entry for inserted * server * + * oa_soap_parse_memory_sensor_reading() - Get the memory error from + * extra_data field + * * oa_soap_proc_server_status() - Processes the server status event * * oa_soap_serv_post_comp () - Processes the blade post complete @@ -63,6 +66,7 @@ #include "oa_soap_server_event.h" #include "oa_soap_discover.h" /* for build_server_rpt() prototype */ extern time_t server_insert_timer[]; +extern SaHpiInt32T memErrRecFlag[]; /** * process_server_power_off_event @@ -839,6 +843,45 @@ } /** + * oa_soap_parse_memory_sensor_reading + * @memoryErrors : Pointer to mainMemoryErros sensor reading + * + * Purpose: + * Parses main memory sensor reading + * + * Detailed Description: NA + * + * Return values: + * Pointer - on success. + * NULL - on error. + **/ +SaHpiUint8T *oa_soap_parse_memory_sensor_reading(char *memoryErrors) +{ + char *subStr = NULL, *sensor_reading = NULL; + int len = 0; + if (memoryErrors == NULL) { + err("Invalid parameters"); + return NULL; + } + + sensor_reading = (char *)g_malloc0 + (sizeof(char) * SAHPI_SENSOR_BUFFER_LENGTH); + memset(sensor_reading, 0, SAHPI_SENSOR_BUFFER_LENGTH); + subStr = strstr(memoryErrors, ";"); + if (subStr) + len = strlen(memoryErrors) - strlen(subStr); + else + len = strlen(memoryErrors); + + if (len >= SAHPI_SENSOR_BUFFER_LENGTH) + len = SAHPI_SENSOR_BUFFER_LENGTH - 1; + strncpy(sensor_reading, memoryErrors, len); + sensor_reading[len] = '\0'; + + return (SaHpiUint8T *)sensor_reading; +} + +/** * oa_soap_proc_server_status * @oh_handler : Pointer to openhpi handler structure * @con : Pointer to soap con @@ -866,6 +909,9 @@ struct bladeThermalInfoArrayResponse thermal_response; xmlNode *extra_data = NULL; struct extraDataInfo extra_data_info; + char *mainMemoryError = NULL; + SaHpiInt32T sensor_status, memErrFlag[16] = {0}; + SaHpiInt32T sensor_class, sensor_value, sensor_num; if (oh_handler == NULL || con == NULL || status == NULL) { err("Invalid parameters"); @@ -895,10 +941,69 @@ if (!(strcmp(extra_data_info.name, "mainMemoryErrors"))) { err("openhpid[%d]: Blade (id=%d) at %d has Memory Error: %s", getpid(), resource_id, bay, extra_data_info.value); + memErrFlag[bay] = 1; + memErrRecFlag[bay] = 1; + break; } extra_data = soap_next_node(extra_data); } + if(memErrRecFlag[bay]) { + /* This MEMORY event is created just to let the user + know whether all memory modules are fine, if not, + which memory module is generating an error */ + if (memErrFlag[bay]) { + mainMemoryError = (char *) + oa_soap_parse_memory_sensor_reading(extra_data_info.value); + rv = oa_soap_proc_mem_evt(oh_handler, resource_id, + OA_SOAP_SEN_MAIN_MEMORY_ERRORS, + mainMemoryError, SAHPI_CRITICAL); + if (rv != SA_OK) { + err("processing the memory event for sensor %x has" + " failed", OA_SOAP_SEN_MAIN_MEMORY_ERRORS); + g_free(mainMemoryError); + return; + } + g_free(mainMemoryError); + memErrFlag[bay] = 0; + } else { + /* Get the sensor value */ + sensor_num = OA_SOAP_SEN_PRED_FAIL; + sensor_class = oa_soap_sen_arr[sensor_num].sensor_class; + sensor_value = status->operationalStatus; + + /* Check whether the sensor value is supported or not */ + if (oa_soap_sen_val_map_arr[sensor_class][sensor_value] + == -1) { + err("Not supported sensor value %d detected.", + sensor_value); + return; + } + + /* Get the assert state of the predictive failure sensor */ + sensor_status = + oa_soap_sen_assert_map_arr[sensor_class][sensor_value]; + + /* Check whether predictive failure gets de-asserted */ + if (sensor_status == OA_SOAP_SEN_ASSERT_FALSE) { + /* Now predictive failure is de-asserted and + there are no memory module errors, so send + an event with "All Memory Modules are Ok" */ + mainMemoryError = "All Memory Modules are Ok"; + rv = oa_soap_proc_mem_evt(oh_handler, resource_id, + OA_SOAP_SEN_MAIN_MEMORY_ERRORS, + mainMemoryError, SAHPI_OK); + if (rv != SA_OK) { + err("processing the memory event for " + "sensor %x has failed", + OA_SOAP_SEN_MAIN_MEMORY_ERRORS); + return; + } + memErrRecFlag[bay] = 0; + } + } + } + /* Process operational status sensor */ OA_SOAP_PROCESS_SENSOR_EVENT(OA_SOAP_SEN_OPER_STATUS, status->operationalStatus, 0, 0) Modified: openhpi/trunk/plugins/oa_soap/oa_soap_server_event.h =================================================================== --- openhpi/trunk/plugins/oa_soap/oa_soap_server_event.h 2014-08-29 16:24:32 UTC (rev 7589) +++ openhpi/trunk/plugins/oa_soap/oa_soap_server_event.h 2014-09-24 18:32:14 UTC (rev 7590) @@ -77,6 +77,8 @@ struct bladeInfo *response, SaHpiRptEntryT *rpt); +SaHpiUint8T *oa_soap_parse_memory_sensor_reading(char *memoryErrors); + void oa_soap_proc_server_status(struct oh_handler_state *oh_handler, SOAP_CON *con, struct bladeStatus *status); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dr_...@us...> - 2014-09-26 21:38:14
|
Revision: 7592 http://sourceforge.net/p/openhpi/code/7592 Author: dr_mohan Date: 2014-09-26 21:38:03 +0000 (Fri, 26 Sep 2014) Log Message: ----------- Fix for #1853 gcc 4.7 compiler warning in infrastructure code Modified Paths: -------------- openhpi/trunk/baselib/init.cpp openhpi/trunk/baselib/lock.c openhpi/trunk/baselib/session.cpp openhpi/trunk/hpi_shell/session.c openhpi/trunk/include/oh_domain.h openhpi/trunk/include/oh_plugin.h openhpi/trunk/include/oh_session.h openhpi/trunk/openhpid/conf.c openhpi/trunk/openhpid/domain.c openhpi/trunk/openhpid/init.c openhpi/trunk/openhpid/lock.c openhpi/trunk/openhpid/plugin.c openhpi/trunk/openhpid/server.cpp openhpi/trunk/openhpid/session.c openhpi/trunk/openhpid/threaded.c openhpi/trunk/ssl/oh_ssl.c openhpi/trunk/utils/Makefile.am Added Paths: ----------- openhpi/trunk/utils/sahpi_wrappers.c openhpi/trunk/utils/sahpi_wrappers.h Modified: openhpi/trunk/baselib/init.cpp =================================================================== --- openhpi/trunk/baselib/init.cpp 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/baselib/init.cpp 2014-09-26 21:38:03 UTC (rev 7592) @@ -26,6 +26,7 @@ #include "conf.h" #include "init.h" #include "session.h" +#include "sahpi_wrappers.h" SaErrorT ohc_init(void) @@ -39,7 +40,7 @@ // Initialize GLIB thread engine if (g_thread_supported() == FALSE) { - g_thread_init(0); + wrap_g_thread_init(0); } ohc_conf_init(); Modified: openhpi/trunk/baselib/lock.c =================================================================== --- openhpi/trunk/baselib/lock.c 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/baselib/lock.c 2014-09-26 21:38:03 UTC (rev 7592) @@ -17,17 +17,21 @@ #include <glib.h> #include "lock.h" +#include "sahpi_wrappers.h" - +#if GLIB_CHECK_VERSION (2, 32, 0) +static GRecMutex ohc_main_lock; +#else static GStaticRecMutex ohc_main_lock = G_STATIC_REC_MUTEX_INIT; +#endif void ohc_lock( void ) { - g_static_rec_mutex_lock(&ohc_main_lock); + wrap_g_static_rec_mutex_lock(&ohc_main_lock); } void ohc_unlock( void ) { - g_static_rec_mutex_unlock(&ohc_main_lock); + wrap_g_static_rec_mutex_unlock(&ohc_main_lock); } Modified: openhpi/trunk/baselib/session.cpp =================================================================== --- openhpi/trunk/baselib/session.cpp 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/baselib/session.cpp 2014-09-26 21:38:03 UTC (rev 7592) @@ -30,6 +30,7 @@ #include "init.h" #include "lock.h" #include "session.h" +#include <sahpi_wrappers.h> /*************************************************************** @@ -102,7 +103,14 @@ SaHpiDomainIdT m_did; SaHpiSessionIdT m_sid; SaHpiSessionIdT m_remote_sid; +#if GLIB_CHECK_VERSION (2, 32, 0) + /* TODO Below variable type needs to be changed with + * GPrivate from glib version > 2.31.0. + */ GStaticPrivate m_sockets; +#else + GStaticPrivate m_sockets; +#endif }; @@ -112,12 +120,12 @@ m_sid( 0 ), m_remote_sid( 0 ) { - g_static_private_init( &m_sockets ); + wrap_g_static_private_init( &m_sockets ); } cSession::~cSession() { - g_static_private_free( &m_sockets ); + wrap_g_static_private_free( &m_sockets ); } SaErrorT cSession::GetEntityRoot( SaHpiEntityPathT& entity_root ) const @@ -204,7 +212,7 @@ } } - g_static_private_set( &m_sockets, 0, 0 ); // close socket + wrap_g_static_private_set( &m_sockets, 0, 0 ); // close socket g_usleep( NEXT_RPC_ATTEMPT_TIMEOUT ); } if ( !rc ) { @@ -227,7 +235,7 @@ SaErrorT cSession::GetSock( cClientStreamSock * & sock ) { - gpointer ptr = g_static_private_get( &m_sockets ); + gpointer ptr = wrap_g_static_private_get( &m_sockets ); if ( ptr ) { sock = reinterpret_cast<cClientStreamSock *>(ptr); } else { @@ -253,7 +261,7 @@ /* keepalive_intvl */ 1, /* keepalive_probes */ 3 ); - g_static_private_set( &m_sockets, sock, DeleteSock ); + wrap_g_static_private_set( &m_sockets, sock, DeleteSock ); } return SA_OK; Modified: openhpi/trunk/hpi_shell/session.c =================================================================== --- openhpi/trunk/hpi_shell/session.c 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/hpi_shell/session.c 2014-09-26 21:38:03 UTC (rev 7592) @@ -26,6 +26,7 @@ #include <oh_utils.h> #include "hpi_cmd.h" +#include <sahpi_wrappers.h> static GThread *ge_thread; static GThread *prog_thread; @@ -61,7 +62,7 @@ fflush(stdout); g_get_current_time(&time); g_time_val_add(&time, G_USEC_PER_SEC / 10); - g_cond_timed_wait(thread_wait, thread_mutex, &time); + wrap_g_cond_timed_wait(thread_wait, thread_mutex, &time); if (i < (PROGRESS_BUF_SIZE - mes_len - 1)) i++; t++; }; @@ -76,7 +77,7 @@ { progress_mes = mes; in_progress = 1; - prog_thread = g_thread_create(progress_bar, 0, FALSE, 0); + prog_thread = wrap_g_thread_create_new("progress_bar",progress_bar, 0, FALSE, 0); } /* This function deletes thread for progress bar. */ @@ -266,10 +267,10 @@ Domain_t *par_domain; if (!g_thread_supported()) { - g_thread_init(NULL); + wrap_g_thread_init(NULL); }; - thread_wait = g_cond_new(); - thread_mutex = g_mutex_new(); + thread_wait = wrap_g_cond_new_init(); + thread_mutex = wrap_g_mutex_new_init(); par_domain = (Domain_t *)malloc(sizeof(Domain_t)); memset(par_domain, 0, sizeof(Domain_t)); par_domain->domainId = domainId; @@ -280,7 +281,7 @@ if (eflag) { show_event_short = 1; prt_flag = 1; - ge_thread = g_thread_create(get_event, 0, FALSE, 0); + ge_thread = wrap_g_thread_create_new("get_event",get_event, 0, FALSE, 0); }; // add main domain to the domain list if (add_domain(par_domain) != SA_OK) return(-1); @@ -289,7 +290,7 @@ printf("\tEnter a command or \"help\" for list of commands\n"); if (! eflag) - ge_thread = g_thread_create(get_event, 0, FALSE, 0); + ge_thread = wrap_g_thread_create_new("get_event",get_event, 0, FALSE, 0); return 0; } Modified: openhpi/trunk/include/oh_domain.h =================================================================== --- openhpi/trunk/include/oh_domain.h 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/include/oh_domain.h 2014-09-26 21:38:03 UTC (rev 7592) @@ -32,7 +32,11 @@ struct oh_domain_table { GHashTable *table; GList *list; +#if GLIB_CHECK_VERSION (2, 32, 0) + GRecMutex lock; +#else GStaticRecMutex lock; +#endif }; #define OH_DOMAIN_SINGLE (SaHpiUint8T)0x00 @@ -83,9 +87,14 @@ oh_el *del; /* Synchronization - used internally by domain interfaces */ +#if GLIB_CHECK_VERSION (2, 32, 0) + GRecMutex lock; + GRecMutex refcount_lock; +#else GStaticRecMutex lock; + GStaticRecMutex refcount_lock; +#endif int refcount; - GStaticRecMutex refcount_lock; }; SaErrorT oh_create_domain(SaHpiDomainIdT id, Modified: openhpi/trunk/include/oh_plugin.h =================================================================== --- openhpi/trunk/include/oh_plugin.h 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/include/oh_plugin.h 2014-09-26 21:38:03 UTC (rev 7592) @@ -31,7 +31,11 @@ */ struct oh_plugins { GSList *list; +#if GLIB_CHECK_VERSION (2, 32, 0) + GRecMutex lock; +#else GStaticRecMutex lock; +#endif }; struct oh_plugin { char *name; /* Name of plugin preceded by 'lib' (e.g. "libdummy"). */ @@ -41,12 +45,20 @@ int handler_count; /* How many handlers use this plugin */ /* Synchronization - used internally by plugin interfaces below. */ +#if GLIB_CHECK_VERSION (2, 32, 0) + GRecMutex lock; /* Exclusive lock for working with plugin */ + /* These are used to keep the plugin from being unloaded while it + * is being referenced. + */ + GRecMutex refcount_lock; +#else GStaticRecMutex lock; /* Exclusive lock for working with plugin */ /* These are used to keep the plugin from being unloaded while it * is being referenced. */ + GStaticRecMutex refcount_lock; +#endif int refcount; - GStaticRecMutex refcount_lock; }; extern struct oh_plugins oh_plugins; @@ -56,7 +68,11 @@ struct oh_handlers { GHashTable *table; GSList *list; +#if GLIB_CHECK_VERSION (2, 32, 0) + GRecMutex lock; +#else GStaticRecMutex lock; +#endif }; struct oh_handler { unsigned int id; /* id of handler */ @@ -70,12 +86,20 @@ void *hnd; /* Synchronization - used internally by handler interfaces below. */ +#if GLIB_CHECK_VERSION (2, 32, 0) + GRecMutex lock; /* Exclusive lock for working with handler */ + /* These are used to keep the handler from being destroyed while it + * is being referenced. + */ + GRecMutex refcount_lock; +#else GStaticRecMutex lock; /* Exclusive lock for working with handler */ /* These are used to keep the handler from being destroyed while it * is being referenced. */ + GStaticRecMutex refcount_lock; +#endif int refcount; - GStaticRecMutex refcount_lock; }; extern struct oh_handlers oh_handlers; Modified: openhpi/trunk/include/oh_session.h =================================================================== --- openhpi/trunk/include/oh_session.h 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/include/oh_session.h 2014-09-26 21:38:03 UTC (rev 7592) @@ -36,7 +36,11 @@ struct oh_session_table { GHashTable *table; GSList *list; +#if GLIB_CHECK_VERSION (2, 32, 0) + GRecMutex lock; +#else GStaticRecMutex lock; +#endif }; extern struct oh_session_table oh_sessions; Modified: openhpi/trunk/openhpid/conf.c =================================================================== --- openhpi/trunk/openhpid/conf.c 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/openhpid/conf.c 2014-09-26 21:38:03 UTC (rev 7592) @@ -39,6 +39,7 @@ #include "conf.h" #include "lock.h" +#include "sahpi_wrappers.h" /* * Global Parameters @@ -178,7 +179,7 @@ static void process_global_param(const char *name, char *value) { - g_static_rec_mutex_lock(&global_params.lock); + wrap_g_static_rec_mutex_lock((void *)&global_params.lock); if (!strcmp("OPENHPI_LOG_ON_SEV", name)) { SaHpiTextBufferT buffer; @@ -240,7 +241,7 @@ CRIT("Invalid global parameter %s in config file.", name); } - g_static_rec_mutex_unlock(&global_params.lock); + wrap_g_static_rec_mutex_unlock(&global_params.lock); } static void read_globals_from_env(int force) @@ -250,7 +251,7 @@ if (!force && global_params.read_env) return; - g_static_rec_mutex_lock(&global_params.lock); + wrap_g_static_rec_mutex_lock(&global_params.lock); for (i = 0; known_globals[i]; i++) { if ((tmp_env_str = getenv(known_globals[i])) != NULL) { @@ -260,7 +261,7 @@ } global_params.read_env = 1; - g_static_rec_mutex_unlock(&global_params.lock); + wrap_g_static_rec_mutex_unlock(&global_params.lock); } /** @@ -755,7 +756,7 @@ read_globals_from_env(0); - g_static_rec_mutex_lock(&global_params.lock); + wrap_g_static_rec_mutex_lock(&global_params.lock); switch (param->type) { case OPENHPI_LOG_ON_SEV: param->u.log_on_sev = global_params.log_on_sev; @@ -803,11 +804,11 @@ param->u.ai_timeout_readonly = global_params.ai_timeout_readonly; break; default: - g_static_rec_mutex_unlock(&global_params.lock); + wrap_g_static_rec_mutex_unlock(&global_params.lock); CRIT("Invalid global parameter %d!", param->type); return -2; } - g_static_rec_mutex_unlock(&global_params.lock); + wrap_g_static_rec_mutex_unlock(&global_params.lock); return 0; } @@ -845,7 +846,7 @@ read_globals_from_env(0); - g_static_rec_mutex_lock(&global_params.lock); + wrap_g_static_rec_mutex_lock(&global_params.lock); switch (param->type) { case OPENHPI_LOG_ON_SEV: global_params.log_on_sev = param->u.log_on_sev; @@ -896,11 +897,11 @@ global_params.ai_timeout_readonly = param->u.ai_timeout_readonly; break; default: - g_static_rec_mutex_unlock(&global_params.lock); + wrap_g_static_rec_mutex_unlock(&global_params.lock); CRIT("Invalid global parameter %d!", param->type); return -2; } - g_static_rec_mutex_unlock(&global_params.lock); + wrap_g_static_rec_mutex_unlock(&global_params.lock); return 0; } Modified: openhpi/trunk/openhpid/domain.c =================================================================== --- openhpi/trunk/openhpid/domain.c 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/openhpid/domain.c 2014-09-26 21:38:03 UTC (rev 7592) @@ -27,30 +27,33 @@ #include "alarm.h" #include "conf.h" #include "event.h" +#include "sahpi_wrappers.h" -#define domains_lock() g_static_rec_mutex_lock(&oh_domains.lock) -#define domains_unlock() g_static_rec_mutex_unlock(&oh_domains.lock) +#define domains_lock() wrap_g_static_rec_mutex_lock(&oh_domains.lock) +#define domains_unlock() wrap_g_static_rec_mutex_unlock(&oh_domains.lock) struct oh_domain_table oh_domains = { .table = NULL, +#if !GLIB_CHECK_VERSION (2, 32, 0) .lock = G_STATIC_REC_MUTEX_INIT, +#endif }; static void __inc_domain_refcount(struct oh_domain *d) { - g_static_rec_mutex_lock(&d->refcount_lock); + wrap_g_static_rec_mutex_lock(&d->refcount_lock); d->refcount++; - g_static_rec_mutex_unlock(&d->refcount_lock); + wrap_g_static_rec_mutex_unlock(&d->refcount_lock); return; } static void __dec_domain_refcount(struct oh_domain *d) { - g_static_rec_mutex_lock(&d->refcount_lock); + wrap_g_static_rec_mutex_lock(&d->refcount_lock); d->refcount--; - g_static_rec_mutex_unlock(&d->refcount_lock); + wrap_g_static_rec_mutex_unlock(&d->refcount_lock); return; } @@ -73,8 +76,8 @@ oh_el_close(d->del); oh_close_alarmtable(d); __free_drt_list(d->drt.list); - g_static_rec_mutex_free(&d->lock); - g_static_rec_mutex_free(&d->refcount_lock); + wrap_g_static_rec_mutex_free_clear(&d->lock); + wrap_g_static_rec_mutex_free_clear(&d->refcount_lock); g_free(d); } #if 0 @@ -116,7 +119,7 @@ /* Unlock domain table */ domains_unlock(); /* Wait to get domain lock */ - g_static_rec_mutex_lock(&domain->lock); + wrap_g_static_rec_mutex_lock(&domain->lock); return node; } @@ -396,8 +399,8 @@ return SA_ERR_HPI_ERROR; } - g_static_rec_mutex_init(&domain->lock); - g_static_rec_mutex_init(&domain->refcount_lock); + wrap_g_static_rec_mutex_init(&domain->lock); + wrap_g_static_rec_mutex_init(&domain->refcount_lock); /* Get option for saving domain event log or not */ param.type = OPENHPI_DEL_SAVE; @@ -593,7 +596,7 @@ if (domain->refcount < 0) __delete_domain(domain); else - g_static_rec_mutex_unlock(&domain->lock); + wrap_g_static_rec_mutex_unlock(&domain->lock); return SA_OK; } Modified: openhpi/trunk/openhpid/init.c =================================================================== --- openhpi/trunk/openhpid/init.c 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/openhpid/init.c 2014-09-26 21:38:03 UTC (rev 7592) @@ -39,6 +39,7 @@ #include "init.h" #include "lock.h" #include "threaded.h" +#include "sahpi_wrappers.h" /** * oh_init @@ -53,7 +54,7 @@ SaErrorT rval; if (g_thread_supported() == FALSE) { - g_thread_init(0); + wrap_g_thread_init(0); } data_access_lock(); Modified: openhpi/trunk/openhpid/lock.c =================================================================== --- openhpi/trunk/openhpid/lock.c 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/openhpid/lock.c 2014-09-26 21:38:03 UTC (rev 7592) @@ -17,16 +17,19 @@ #include <glib.h> #include "lock.h" - +#include "sahpi_wrappers.h" +#if GLIB_CHECK_VERSION (2, 32, 0) +static GRecMutex oh_main_lock; +#else static GStaticRecMutex oh_main_lock = G_STATIC_REC_MUTEX_INIT; - +#endif void data_access_lock(void) { - g_static_rec_mutex_lock(&oh_main_lock); + wrap_g_static_rec_mutex_lock(&oh_main_lock); } void data_access_unlock(void) { - g_static_rec_mutex_unlock(&oh_main_lock); + wrap_g_static_rec_mutex_unlock(&oh_main_lock); } Modified: openhpi/trunk/openhpid/plugin.c =================================================================== --- openhpi/trunk/openhpid/plugin.c 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/openhpid/plugin.c 2014-09-26 21:38:03 UTC (rev 7592) @@ -35,22 +35,26 @@ #include "conf.h" #include "event.h" #include "lock.h" +#include "sahpi_wrappers.h" /* * Structure containing global list of plugins (oh_plugin). */ struct oh_plugins oh_plugins = { .list = NULL, - .lock = G_STATIC_REC_MUTEX_INIT +#if !GLIB_CHECK_VERSION (2, 32, 0) + .lock = G_STATIC_REC_MUTEX_INIT +#endif }; - /* * Structure containing global table of handlers (oh_handler). */ struct oh_handlers oh_handlers = { .table = NULL, .list = NULL, +#if !GLIB_CHECK_VERSION (2, 32, 0) .lock = G_STATIC_REC_MUTEX_INIT +#endif }; /** @@ -68,9 +72,9 @@ struct oh_handler *h = NULL; GSList *node = NULL; - g_static_rec_mutex_lock(&oh_handlers.lock); + wrap_g_static_rec_mutex_lock(&oh_handlers.lock); if (oh_handlers.list == NULL) { - g_static_rec_mutex_unlock(&oh_handlers.lock); + wrap_g_static_rec_mutex_unlock(&oh_handlers.lock); return; } @@ -82,21 +86,21 @@ } } } - g_static_rec_mutex_unlock(&oh_handlers.lock); + wrap_g_static_rec_mutex_unlock(&oh_handlers.lock); } static void __inc_plugin_refcount(struct oh_plugin *p) { - g_static_rec_mutex_lock(&p->refcount_lock); + wrap_g_static_rec_mutex_lock(&p->refcount_lock); p->refcount++; - g_static_rec_mutex_unlock(&p->refcount_lock); + wrap_g_static_rec_mutex_unlock(&p->refcount_lock); } static void __dec_plugin_refcount(struct oh_plugin *p) { - g_static_rec_mutex_lock(&p->refcount_lock); + wrap_g_static_rec_mutex_lock(&p->refcount_lock); p->refcount--; - g_static_rec_mutex_unlock(&p->refcount_lock); + wrap_g_static_rec_mutex_unlock(&p->refcount_lock); } static void __delete_plugin(struct oh_plugin *p) @@ -104,8 +108,8 @@ if (!p) return; g_free(p->name); - g_static_rec_mutex_free(&p->lock); - g_static_rec_mutex_free(&p->refcount_lock); + wrap_g_static_rec_mutex_free_clear(&p->lock); + wrap_g_static_rec_mutex_free_clear(&p->refcount_lock); g_free(p->abi); if (p->dl_handle) { g_module_close(p->dl_handle); @@ -133,18 +137,18 @@ return NULL; } - g_static_rec_mutex_lock(&oh_plugins.lock); + wrap_g_static_rec_mutex_lock(&oh_plugins.lock); for (node = oh_plugins.list; node; node = node->next) { struct oh_plugin *p = (struct oh_plugin *)(node->data); if (strcmp(p->name, plugin_name) == 0) { __inc_plugin_refcount(p); - g_static_rec_mutex_unlock(&oh_plugins.lock); - g_static_rec_mutex_lock(&p->lock); + wrap_g_static_rec_mutex_unlock(&oh_plugins.lock); + wrap_g_static_rec_mutex_lock(&p->lock); plugin = p; return plugin; } } - g_static_rec_mutex_unlock(&oh_plugins.lock); + wrap_g_static_rec_mutex_unlock(&oh_plugins.lock); return plugin; } @@ -168,7 +172,7 @@ if (plugin->refcount < 0) __delete_plugin(plugin); else - g_static_rec_mutex_unlock(&plugin->lock); + wrap_g_static_rec_mutex_unlock(&plugin->lock); } /** @@ -192,33 +196,33 @@ memset(next_plugin_name, '\0', size); if (!plugin_name) { - g_static_rec_mutex_lock(&oh_plugins.lock); + wrap_g_static_rec_mutex_lock(&oh_plugins.lock); if (oh_plugins.list) { struct oh_plugin *plugin = oh_plugins.list->data; strncpy(next_plugin_name, plugin->name, size); - g_static_rec_mutex_unlock(&oh_plugins.lock); + wrap_g_static_rec_mutex_unlock(&oh_plugins.lock); return 0; } else { - g_static_rec_mutex_unlock(&oh_plugins.lock); + wrap_g_static_rec_mutex_unlock(&oh_plugins.lock); DBG("No plugins have been loaded yet."); return -1; } } else { - g_static_rec_mutex_lock(&oh_plugins.lock); + wrap_g_static_rec_mutex_lock(&oh_plugins.lock); for (node = oh_plugins.list; node; node = node->next) { struct oh_plugin *p = node->data; if (strcmp(p->name, plugin_name) == 0) { if (node->next) { p = node->next->data; strncpy(next_plugin_name, p->name, size); - g_static_rec_mutex_unlock(&oh_plugins.lock); + wrap_g_static_rec_mutex_unlock(&oh_plugins.lock); return 0; } else { break; } } } - g_static_rec_mutex_unlock(&oh_plugins.lock); + wrap_g_static_rec_mutex_unlock(&oh_plugins.lock); } return -1; @@ -263,8 +267,8 @@ plugin->name = g_strdup(plugin_name); plugin->handler_count = 0; plugin->refcount = 0; - g_static_rec_mutex_init(&plugin->lock); - g_static_rec_mutex_init(&plugin->refcount_lock); + wrap_g_static_rec_mutex_init(&plugin->lock); + wrap_g_static_rec_mutex_init(&plugin->refcount_lock); #ifdef _WIN32 plugin->dl_handle = g_module_open(plugin->name, G_MODULE_BIND_LOCAL); @@ -299,9 +303,9 @@ CRIT("Can not get ABI"); goto cleanup_and_quit; } - g_static_rec_mutex_lock(&oh_plugins.lock); + wrap_g_static_rec_mutex_lock(&oh_plugins.lock); oh_plugins.list = g_slist_append(oh_plugins.list, plugin); - g_static_rec_mutex_unlock(&oh_plugins.lock); + wrap_g_static_rec_mutex_unlock(&oh_plugins.lock); return 0; cleanup_and_quit: @@ -336,9 +340,9 @@ return -3; } - g_static_rec_mutex_lock(&oh_plugins.lock); + wrap_g_static_rec_mutex_lock(&oh_plugins.lock); oh_plugins.list = g_slist_remove(oh_plugins.list, plugin); - g_static_rec_mutex_unlock(&oh_plugins.lock); + wrap_g_static_rec_mutex_unlock(&oh_plugins.lock); __dec_plugin_refcount(plugin); if (plugin->refcount < 1) @@ -351,16 +355,16 @@ static void __inc_handler_refcount(struct oh_handler *h) { - g_static_rec_mutex_lock(&h->refcount_lock); + wrap_g_static_rec_mutex_lock(&h->refcount_lock); h->refcount++; - g_static_rec_mutex_unlock(&h->refcount_lock); + wrap_g_static_rec_mutex_unlock(&h->refcount_lock); } static void __dec_handler_refcount(struct oh_handler *h) { - g_static_rec_mutex_lock(&h->refcount_lock); + wrap_g_static_rec_mutex_lock(&h->refcount_lock); h->refcount--; - g_static_rec_mutex_unlock(&h->refcount_lock); + wrap_g_static_rec_mutex_unlock(&h->refcount_lock); } static void __delete_handler(struct oh_handler *h) @@ -381,8 +385,8 @@ /* Free the oh_handler members first, then the handler. */ g_hash_table_destroy(h->config); - g_static_rec_mutex_free(&h->lock); - g_static_rec_mutex_free(&h->refcount_lock); + wrap_g_static_rec_mutex_free_clear(&h->lock); + wrap_g_static_rec_mutex_free_clear(&h->refcount_lock); g_free(h); } @@ -397,17 +401,17 @@ GSList *node = NULL; struct oh_handler *handler = NULL; - g_static_rec_mutex_lock(&oh_handlers.lock); + wrap_g_static_rec_mutex_lock(&oh_handlers.lock); node = g_hash_table_lookup(oh_handlers.table, &hid); handler = node ? node->data : NULL; if (!handler) { - g_static_rec_mutex_unlock(&oh_handlers.lock); + wrap_g_static_rec_mutex_unlock(&oh_handlers.lock); CRIT("Error - Handler %d was not found", hid); return NULL; } __inc_handler_refcount(handler); - g_static_rec_mutex_unlock(&oh_handlers.lock); - g_static_rec_mutex_lock(&handler->lock); + wrap_g_static_rec_mutex_unlock(&oh_handlers.lock); + wrap_g_static_rec_mutex_lock(&handler->lock); return handler; } @@ -430,7 +434,7 @@ if (handler->refcount < 0) __delete_handler(handler); else - g_static_rec_mutex_unlock(&handler->lock); + wrap_g_static_rec_mutex_unlock(&handler->lock); } /** @@ -454,27 +458,27 @@ *next_hid = 0; if (!hid) { /* Return first handler id in the list */ - g_static_rec_mutex_lock(&oh_handlers.lock); + wrap_g_static_rec_mutex_lock(&oh_handlers.lock); if (oh_handlers.list) { h = oh_handlers.list->data; *next_hid = h->id; - g_static_rec_mutex_unlock(&oh_handlers.lock); + wrap_g_static_rec_mutex_unlock(&oh_handlers.lock); return 0; } else { - g_static_rec_mutex_unlock(&oh_handlers.lock); + wrap_g_static_rec_mutex_unlock(&oh_handlers.lock); CRIT("Warning - no handlers"); return -1; } } else { /* Return handler id coming after hid in the list */ - g_static_rec_mutex_lock(&oh_handlers.lock); + wrap_g_static_rec_mutex_lock(&oh_handlers.lock); node = g_hash_table_lookup(oh_handlers.table, &hid); if (node && node->next && node->next->data) { h = node->next->data; *next_hid = h->id; - g_static_rec_mutex_unlock(&oh_handlers.lock); + wrap_g_static_rec_mutex_unlock(&oh_handlers.lock); return 0; } - g_static_rec_mutex_unlock(&oh_handlers.lock); + wrap_g_static_rec_mutex_unlock(&oh_handlers.lock); } return -1; @@ -526,9 +530,9 @@ handler->abi = plugin->abi; plugin->handler_count++; /* Increment # of handlers using the plugin */ oh_release_plugin(plugin); - g_static_rec_mutex_lock(&oh_handlers.lock); + wrap_g_static_rec_mutex_lock(&oh_handlers.lock); handler->id = handler_id++; - g_static_rec_mutex_unlock(&oh_handlers.lock); + wrap_g_static_rec_mutex_unlock(&oh_handlers.lock); handler->plugin_name = g_strdup(g_hash_table_lookup(handler_config, "plugin")); //copy config in a new hash table newconfig = g_hash_table_new_full ( @@ -536,8 +540,8 @@ g_hash_table_foreach(handler_config,copy_hashed_new_config,newconfig); handler->config = newconfig; handler->refcount = 0; - g_static_rec_mutex_init(&handler->lock); - g_static_rec_mutex_init(&handler->refcount_lock); + wrap_g_static_rec_mutex_init(&handler->lock); + wrap_g_static_rec_mutex_init(&handler->refcount_lock); return handler; cleanexit: @@ -570,7 +574,7 @@ if (!handler) return SA_ERR_HPI_ERROR; *hid = handler->id; - g_static_rec_mutex_lock(&oh_handlers.lock); + wrap_g_static_rec_mutex_lock(&oh_handlers.lock); oh_handlers.list = g_slist_append(oh_handlers.list, handler); g_hash_table_insert(oh_handlers.table, &(handler->id), @@ -582,7 +586,7 @@ if (!handler->hnd) { CRIT("A handler #%d on the %s plugin could not be opened.", handler->id, handler->plugin_name); - g_static_rec_mutex_unlock(&oh_handlers.lock); + wrap_g_static_rec_mutex_unlock(&oh_handlers.lock); return SA_ERR_HPI_INTERNAL_ERROR; } @@ -604,7 +608,7 @@ } } - g_static_rec_mutex_unlock(&oh_handlers.lock); + wrap_g_static_rec_mutex_unlock(&oh_handlers.lock); return SA_OK; } @@ -636,10 +640,10 @@ } } - g_static_rec_mutex_lock(&oh_handlers.lock); + wrap_g_static_rec_mutex_lock(&oh_handlers.lock); g_hash_table_remove(oh_handlers.table, &handler->id); oh_handlers.list = g_slist_remove(oh_handlers.list, &(handler->id)); - g_static_rec_mutex_unlock(&oh_handlers.lock); + wrap_g_static_rec_mutex_unlock(&oh_handlers.lock); __dec_handler_refcount(handler); if (handler->refcount < 1) @@ -671,11 +675,11 @@ return SA_ERR_HPI_INVALID_PARAMS; } - g_static_rec_mutex_lock(&oh_handlers.lock); + wrap_g_static_rec_mutex_lock(&oh_handlers.lock); node = g_hash_table_lookup(oh_handlers.table, &hid); h = node ? (struct oh_handler *)(node->data) : NULL; if (!h) { - g_static_rec_mutex_unlock(&oh_handlers.lock); + wrap_g_static_rec_mutex_unlock(&oh_handlers.lock); return SA_ERR_HPI_NOT_PRESENT; } @@ -698,7 +702,7 @@ g_strdup("password"), g_strdup("********")); - g_static_rec_mutex_unlock(&oh_handlers.lock); + wrap_g_static_rec_mutex_unlock(&oh_handlers.lock); return SA_OK; } Modified: openhpi/trunk/openhpid/server.cpp =================================================================== --- openhpi/trunk/openhpid/server.cpp 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/openhpid/server.cpp 2014-09-26 21:38:03 UTC (rev 7592) @@ -32,6 +32,7 @@ #include <oh_error.h> #include <oh_rpc_params.h> #include <strmsock.h> +#include <sahpi_wrappers.h> /*--------------------------------------------------------------------*/ @@ -49,38 +50,40 @@ /*--------------------------------------------------------------------*/ /* Local Definitions */ /*--------------------------------------------------------------------*/ - +#if GLIB_CHECK_VERSION (2, 32, 0) +static GRecMutex lock; +#else static GStaticRecMutex lock = G_STATIC_REC_MUTEX_INIT; +#endif static volatile bool stop = false; static GList * sockets = 0; - /*--------------------------------------------------------------------*/ /* Socket List */ /*--------------------------------------------------------------------*/ static void add_socket_to_list( cStreamSock * sock ) { - g_static_rec_mutex_lock(&lock); + wrap_g_static_rec_mutex_lock(&lock); sockets = g_list_prepend( sockets, sock ); - g_static_rec_mutex_unlock(&lock); + wrap_g_static_rec_mutex_unlock(&lock); } static void remove_socket_from_list( const cStreamSock * sock ) { - g_static_rec_mutex_lock(&lock); + wrap_g_static_rec_mutex_lock(&lock); sockets = g_list_remove( sockets, sock ); - g_static_rec_mutex_unlock(&lock); + wrap_g_static_rec_mutex_unlock(&lock); } static void close_sockets_in_list( void ) { - g_static_rec_mutex_lock(&lock); + wrap_g_static_rec_mutex_lock(&lock); for ( GList * iter = sockets; iter != 0; iter = g_list_next( iter ) ) { cStreamSock * sock = reinterpret_cast<cStreamSock *>(iter->data); sock->Close(); } - g_static_rec_mutex_unlock(&lock); + wrap_g_static_rec_mutex_unlock(&lock); } @@ -361,6 +364,7 @@ RpcParams iparams(&did); DEMARSHAL_RQ(rq_byte_order, hm, data, iparams); + CRIT("\n\n\n\n OpenHPID calling the saHpiSessionOpen \n \n\n\n\n"); rv = saHpiSessionOpen(OH_DEFAULT_DOMAIN_ID, &sid, security); if (rv == SA_OK) { changed_sid = sid; Modified: openhpi/trunk/openhpid/session.c =================================================================== --- openhpi/trunk/openhpid/session.c 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/openhpid/session.c 2014-09-26 21:38:03 UTC (rev 7592) @@ -26,10 +26,13 @@ #include "conf.h" #include "event.h" #include "lock.h" +#include <sahpi_wrappers.h> struct oh_session_table oh_sessions = { .table = NULL, +#if !GLIB_CHECK_VERSION (2, 32, 0) .lock = G_STATIC_REC_MUTEX_INIT +#endif }; @@ -64,11 +67,11 @@ g_free(session); return 0; } - g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ + wrap_g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ session->id = id++; g_hash_table_insert(oh_sessions.table, &(session->id), session); oh_sessions.list = g_slist_append(oh_sessions.list, session); - g_static_rec_mutex_unlock(&oh_sessions.lock); /* Unlocked session table */ + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); /* Unlocked session table */ oh_release_domain(domain); return session->id; @@ -90,15 +93,15 @@ if (sid < 1) return SAHPI_UNSPECIFIED_DOMAIN_ID; - g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ + wrap_g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ session = g_hash_table_lookup(oh_sessions.table, &sid); if (!session) { - g_static_rec_mutex_unlock(&oh_sessions.lock); + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); return SAHPI_UNSPECIFIED_DOMAIN_ID; } did = session->did; - g_static_rec_mutex_unlock(&oh_sessions.lock); /* Unlocked session table */ + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); /* Unlocked session table */ return did; @@ -128,13 +131,13 @@ session_ids = g_array_new(FALSE, TRUE, sizeof(SaHpiSessionIdT)); - g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ + wrap_g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ for (node = oh_sessions.list; node; node = node->next) { struct oh_session *s = node->data; if (s->did != did) continue; g_array_append_val(session_ids, s->id); } - g_static_rec_mutex_unlock(&oh_sessions.lock); /* Unlocked session table */ + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); /* Unlocked session table */ oh_release_domain(domain); return session_ids; @@ -163,14 +166,14 @@ if (oh_sessions.table == NULL) return SA_ERR_HPI_INTERNAL_ERROR; - g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ + wrap_g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ session = g_hash_table_lookup(oh_sessions.table, &sid); if (!session) { - g_static_rec_mutex_unlock(&oh_sessions.lock); + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); return SA_ERR_HPI_INVALID_SESSION; } *state = session->subscribed; - g_static_rec_mutex_unlock(&oh_sessions.lock); /* Unlocked session table */ + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); /* Unlocked session table */ return SA_OK; } @@ -192,15 +195,15 @@ if (sid < 1) return SA_ERR_HPI_INVALID_PARAMS; - g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ + wrap_g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ session = g_hash_table_lookup(oh_sessions.table, &sid); if (!session) { - g_static_rec_mutex_unlock(&oh_sessions.lock); + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); return SA_ERR_HPI_INVALID_SESSION; } session->subscribed = state; - g_static_rec_mutex_unlock(&oh_sessions.lock); /* Unlocked session table */ + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); /* Unlocked session table */ /* Flush session's event queue */ if (state == SAHPI_FALSE) { @@ -241,10 +244,10 @@ nolimit = SAHPI_TRUE; } - g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ + wrap_g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ session = g_hash_table_lookup(oh_sessions.table, &sid); if (!session) { - g_static_rec_mutex_unlock(&oh_sessions.lock); + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); oh_event_free(qevent, FALSE); return SA_ERR_HPI_INVALID_SESSION; } @@ -256,7 +259,7 @@ if (qlength > 0 && qlength >= param.u.evt_queue_limit) { /* Don't proceed with event push if queue is overflowed */ session->eventq_status = SAHPI_EVT_QUEUE_OVERFLOW; - g_static_rec_mutex_unlock(&oh_sessions.lock); + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); oh_event_free(qevent, FALSE); CRIT("Session %d's queue is out of space; " "# of events is %d; Max is %d", @@ -266,7 +269,7 @@ } g_async_queue_push(session->eventq, qevent); - g_static_rec_mutex_unlock(&oh_sessions.lock); /* Unlocked session table */ + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); /* Unlocked session table */ return SA_OK; } @@ -295,10 +298,10 @@ if (sid < 1 || (event == NULL)) return SA_ERR_HPI_INVALID_PARAMS; - g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ + wrap_g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ session = g_hash_table_lookup(oh_sessions.table, &sid); if (!session) { - g_static_rec_mutex_unlock(&oh_sessions.lock); + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); return SA_ERR_HPI_INVALID_SESSION; } @@ -308,7 +311,7 @@ session->eventq_status = 0; eventq = session->eventq; g_async_queue_ref(eventq); - g_static_rec_mutex_unlock(&oh_sessions.lock); + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); if (timeout == SAHPI_TIMEOUT_IMMEDIATE) { devent = g_async_queue_try_pop(eventq); @@ -317,7 +320,7 @@ g_get_current_time(&gfinaltime); g_time_val_add(&gfinaltime, 5000000L); devent = - g_async_queue_timed_pop(eventq, &gfinaltime); + wrap_g_async_queue_timed_pop(eventq, &gfinaltime); /* compliance with spec page 63 */ invalid = oh_get_session_subscription(sid, &subscribed); @@ -332,7 +335,7 @@ } else { g_get_current_time(&gfinaltime); g_time_val_add(&gfinaltime, (glong) (timeout / 1000)); - devent = g_async_queue_timed_pop(eventq, &gfinaltime); + devent = wrap_g_async_queue_timed_pop(eventq, &gfinaltime); invalid = oh_get_session_subscription(sid, &subscribed); if (invalid || !subscribed) { g_async_queue_unref(eventq); @@ -377,15 +380,15 @@ if (sid < 1) return SA_ERR_HPI_INVALID_PARAMS; - g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ + wrap_g_static_rec_mutex_lock(&oh_sessions.lock); /* Locked session table */ session = g_hash_table_lookup(oh_sessions.table, &sid); if (!session) { - g_static_rec_mutex_unlock(&oh_sessions.lock); + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); return SA_ERR_HPI_INVALID_SESSION; } oh_sessions.list = g_slist_remove(oh_sessions.list, session); g_hash_table_remove(oh_sessions.table, &(session->id)); - g_static_rec_mutex_unlock(&oh_sessions.lock); /* Unlocked session table */ + wrap_g_static_rec_mutex_unlock(&oh_sessions.lock); /* Unlocked session table */ /* Finalize session */ len = g_async_queue_length(session->eventq); Modified: openhpi/trunk/openhpid/threaded.c =================================================================== --- openhpi/trunk/openhpid/threaded.c 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/openhpid/threaded.c 2014-09-26 21:38:03 UTC (rev 7592) @@ -19,6 +19,7 @@ #include "event.h" #include "threaded.h" +#include "sahpi_wrappers.h" static const glong OH_DISCOVERY_THREAD_SLEEP_TIME = 180 * G_USEC_PER_SEC; @@ -57,7 +58,7 @@ GTimeVal time; g_get_current_time(&time); g_time_val_add(&time, OH_DISCOVERY_THREAD_SLEEP_TIME); - g_cond_timed_wait(discovery_cond, discovery_lock, &time); + wrap_g_cond_timed_wait(discovery_cond, discovery_lock, &time); } /* Let oh_wake_discovery_thread know this thread is done */ g_cond_broadcast(discovery_cond); @@ -87,7 +88,7 @@ GTimeVal time; g_get_current_time(&time); g_time_val_add(&time, OH_EVTGET_THREAD_SLEEP_TIME); - g_cond_timed_wait(evtget_cond, evtget_lock, &time); + wrap_g_cond_timed_wait(evtget_cond, evtget_lock, &time); } g_mutex_unlock(evtget_lock); @@ -123,22 +124,22 @@ } if (g_thread_supported() == FALSE) { - g_thread_init(0); + wrap_g_thread_init(0); } stop = FALSE; DBG("Starting discovery thread."); - discovery_cond = g_cond_new(); - discovery_lock = g_mutex_new(); - discovery_thread = g_thread_create(discovery_func, 0, TRUE, 0); + discovery_cond = wrap_g_cond_new_init(); + discovery_lock = wrap_g_mutex_new_init(); + discovery_thread = wrap_g_thread_create_new("DiscoveryThread",discovery_func, 0, TRUE, 0); DBG("Starting event threads."); - evtget_cond = g_cond_new(); - evtget_lock = g_mutex_new(); - evtget_thread = g_thread_create(evtget_func, 0, TRUE, 0); + evtget_cond = wrap_g_cond_new_init(); + evtget_lock = wrap_g_mutex_new_init(); + evtget_thread = wrap_g_thread_create_new("EventGet",evtget_func, 0, TRUE, 0); - evtpop_thread = g_thread_create(evtpop_func, 0, TRUE, 0); + evtpop_thread = wrap_g_thread_create_new("EventPop",evtpop_func, 0, TRUE, 0); started = TRUE; @@ -160,8 +161,8 @@ g_cond_broadcast(evtget_cond); g_mutex_unlock(evtget_lock); g_thread_join(evtget_thread); - g_mutex_free(evtget_lock); - g_cond_free(evtget_cond); + wrap_g_mutex_free_clear(evtget_lock); + wrap_g_cond_free(evtget_cond); evtget_cond = 0; evtget_thread = 0; evtget_lock = 0; @@ -170,8 +171,8 @@ g_cond_broadcast(discovery_cond); g_mutex_unlock(discovery_lock); g_thread_join(discovery_thread); - g_mutex_free(discovery_lock); - g_cond_free(discovery_cond); + wrap_g_mutex_free_clear(discovery_lock); + wrap_g_cond_free(discovery_cond); discovery_cond = 0; discovery_thread = 0; discovery_lock = 0; Modified: openhpi/trunk/ssl/oh_ssl.c =================================================================== --- openhpi/trunk/ssl/oh_ssl.c 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/ssl/oh_ssl.c 2014-09-26 21:38:03 UTC (rev 7592) @@ -79,6 +79,7 @@ #include <sys/types.h> #include <arpa/inet.h> #include <netdb.h> +#include <sahpi_wrappers.h> /* Data types used by this module */ struct CRYPTO_dynlock_value { @@ -88,10 +89,13 @@ /* Global (static) data for this module */ static int oh_ssl_init_done = 0; /* Will be set true when done */ -static GMutex **mutexes = NULL; /* Holds array of SSL mutexes */ +static GMutex **mutexes = NULL; /* Holds array of SSL mutexes */ +#if GLIB_CHECK_VERSION (2, 32, 0) +static GMutex ssl_mutexes; /* Lock for above */ +#else static GStaticMutex ssl_mutexes = G_STATIC_MUTEX_INIT; /* Lock for above */ +#endif - /* Local (static) functions, used by this module. Note that these aren't * necessary if we aren't compiling as a threaded implementation, so we * skip them in that case. @@ -135,27 +139,27 @@ /* Do we have an array of mutex pointers yet? */ if (! mutexes) { /* Messing with this requires the static lock */ - g_static_mutex_lock(&ssl_mutexes); + wrap_g_static_mutex_lock(&ssl_mutexes); if (! mutexes) { /* Need to check again */ mutexes = (GMutex **)g_malloc0(CRYPTO_num_locks() * sizeof(GMutex *)); if (! mutexes) { CRIT("out of memory"); - g_static_mutex_unlock(&ssl_mutexes); + wrap_g_static_mutex_unlock(&ssl_mutexes); return; } } - g_static_mutex_unlock(&ssl_mutexes); + wrap_g_static_mutex_unlock(&ssl_mutexes); } /* Have we initialized this particular mutex? */ if (! mutexes[type]) { /* Same firedrill as above */ - g_static_mutex_lock(&ssl_mutexes); + wrap_g_static_mutex_lock(&ssl_mutexes); if (! mutexes[type]) { - mutexes[type] = g_mutex_new(); + mutexes[type] = wrap_g_mutex_new_init(); } - g_static_mutex_unlock(&ssl_mutexes); + wrap_g_static_mutex_unlock(&ssl_mutexes); } /* Finally, go ahead and lock or unlock it */ @@ -184,7 +188,7 @@ if ((value = (struct CRYPTO_dynlock_value *) g_malloc(sizeof(struct CRYPTO_dynlock_value)))) { - value->mutex = g_mutex_new(); + value->mutex = wrap_g_mutex_new_init(); } else { CRIT("out of memory"); @@ -231,7 +235,7 @@ static void dyn_destroy_function(struct CRYPTO_dynlock_value *l, const char *file, int line) { - g_mutex_free(l->mutex); + wrap_g_mutex_free_clear(l->mutex); g_free(l); } @@ -278,17 +282,17 @@ CRYPTO_set_dynlock_destroy_callback(NULL); /* Clean up and destroy mutexes, if we have any */ - g_static_mutex_lock(&ssl_mutexes); + wrap_g_static_mutex_lock(&ssl_mutexes); if (mutexes) { for (i = 0; i < CRYPTO_num_locks(); i++) { if (mutexes[i]) { - g_mutex_free(mutexes[i]); + wrap_g_mutex_free_clear(mutexes[i]); } } g_free(mutexes); mutexes = NULL; } - g_static_mutex_free(&ssl_mutexes); + wrap_g_static_mutex_free_clear(&ssl_mutexes); return(0); /* No errors */ } Modified: openhpi/trunk/utils/Makefile.am =================================================================== --- openhpi/trunk/utils/Makefile.am 2014-09-25 23:39:20 UTC (rev 7591) +++ openhpi/trunk/utils/Makefile.am 2014-09-26 21:38:03 UTC (rev 7592) @@ -88,6 +88,8 @@ sahpi_time_utils.h \ sahpi_gcrypt_utils.c \ sahpi_gcrypt_utils.h \ + sahpi_wrappers.c \ + sahpi_wrappers.h \ uid_utils.c \ uid_utils.h Added: openhpi/trunk/utils/sahpi_wrappers.c =================================================================== --- openhpi/trunk/utils/sahpi_wrappers.c (rev 0) +++ openhpi/trunk/utils/sahpi_wrappers.c 2014-09-26 21:38:03 UTC (rev 7592) @@ -0,0 +1,295 @@ +/* + * + * Copyright (C) 2014, 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) + * Mohan Devarajulu <mo...@fc...> + */ + +#include <glib.h> +#include <oh_error.h> +#include "sahpi_wrappers.h" + + + +GThread *wrap_g_thread_create_new(const gchar *name, GThreadFunc func, + gpointer data, gboolean joinable, GError **error) +{ + GThread *thrd = NULL; + #if GLIB_CHECK_VERSION (2, 32, 0) + thrd = g_thread_new(name, func, data); + #else + thrd = g_thread_create(func, data, joinable, error); + #endif + return(thrd); +} + +/** + * wrap_g_mutex_new_init() + * + * Purpose: + * Wrapper function to get a mutex structure allocated and initialized + * + * Detailed Description: NA + * Call g_mutex_init(GMutex *) if the glib version is > 2.31.0 + * OR + * Call g_mutex_new() if the glib version is > 2.31.0 + * + * Return Values: + * Gmutex pointer is returned. It could be NULL if memory is not allocated + * + **/ +GMutex* wrap_g_mutex_new_init() +{ + GMutex *mutx = NULL; + #if GLIB_CHECK_VERSION (2, 32, 0) + mutx = (GMutex*)g_malloc0(sizeof(GMutex)); + if (mutx == NULL) { + err("GMutex allocation failed. Continuing"); + return NULL; + } + g_mutex_init(mutx); + #else + mutx = g_mutex_new(); + #endif + return mutx; +} + +void wrap_g_mutex_free_clear(GMutex *mutex) +{ + + #if GLIB_CHECK_VERSION (2, 32, 0) + g_mutex_clear(mutex); + #else + g_mutex_free(mutex); + #endif +} + + +void wrap_g_mutex_lock(GMutex *mutex) +{ + g_mutex_lock(mutex); +} + +gboolean wrap_g_mutex_trylock(GMutex *mutex) +{ + return(g_mutex_trylock(mutex)); +} + + +void wrap_g_mutex_unlock(GMutex *mutex) +{ + g_mutex_unlock(mutex); +} + +void wrap_g_thread_init(gpointer nul) +{ + + #if GLIB_CHECK_VERSION (2, 32, 0) + dbg("g_thread_init not needed in glib>2.31)"); + #else + g_thread_init(nul); + #endif +} + +void wrap_g_static_rec_mutex_lock(void *mutex) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + g_rec_mutex_lock ((GRecMutex *)mutex); + #else + g_static_rec_mutex_lock((GStaticRecMutex *)mutex); + #endif +} + +gboolean wrap_g_static_rec_mutex_trylock(void *mutex) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + return(g_rec_mutex_trylock ((GRecMutex *)mutex)); + #else + return(g_static_rec_mutex_trylock ((GStaticRecMutex *)mutex)); + #endif +} + +void wrap_g_static_rec_mutex_unlock ( void *mutex) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + g_rec_mutex_unlock ((GRecMutex *)mutex); + #else + g_static_rec_mutex_unlock((GStaticRecMutex *)mutex); + #endif +} + +void wrap_g_static_private_init(void *key) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + ; + #else + g_static_private_init((GStaticPrivate *)key); + #endif +} + +void wrap_g_static_private_free(void * key) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + ; + #else + g_static_private_free((GStaticPrivate*) key); + #endif +} + +void wrap_g_static_private_set(void * key, gpointer value, GDestroyNotify notify) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + /* TODO Below call needs to be replaced with + * g_private_set() call for glib version > 2.31.0. + * */ + g_static_private_set((GStaticPrivate*) key, value, notify); + #else + g_static_private_set((GStaticPrivate*) key, value, notify); + #endif +} + +gpointer wrap_g_static_private_get(void *key) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + /* TODO Below call needs to be replaced with + * g_private_get() call for glib version > 2.31.0. + * */ + return g_static_private_get((GStaticPrivate *)key); + #else + return g_static_private_get((GStaticPrivate *)key); + #endif +} + +void wrap_g_static_rec_mutex_init(void *mutex) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + g_rec_mutex_init((GRecMutex *)mutex); + #else + g_static_rec_mutex_init((GStaticRecMutex *)mutex); + #endif +} + +void wrap_g_static_rec_mutex_free_clear(void *mutex) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + g_rec_mutex_clear((GRecMutex *)mutex); + #else + g_static_rec_mutex_free((GStaticRecMutex *)mutex); + #endif +} + +gpointer wrap_g_async_queue_timed_pop(GAsyncQueue *queue, GTimeVal *end_time) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + /* The actual function for this is the following. But + the argument has to be different. Use it when the source + is modified + g_async_queue_timeout_pop (*queue, (guint64) *end_time); + */ + return(g_async_queue_timeout_pop(queue, (guint64)end_time->tv_usec)); + #else + return(g_async_queue_timed_pop(queue, end_time)); + #endif +} + +gboolean wrap_g_cond_timed_wait (GCond *cond, GMutex *mutex, GTimeVal *abs_time) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + /* The actual function for this is the following. But + the argument has to be different. Use it when the source + is modified + g_cond_wait_until (cond, mutex, (gint64) *abs_time); + */ + //return(g_cond_wait_until (cond, mutex, (gint64)abs_time->tv_usec)); + return(g_cond_timed_wait (cond, mutex, abs_time)); + #else + return(g_cond_timed_wait (cond, mutex, abs_time)); + #endif +} + +GCond* wrap_g_cond_new_init() +{ + GCond *cond; + #if GLIB_CHECK_VERSION (2, 32, 0) + cond = g_malloc(sizeof(GCond)); + g_cond_init(cond); + #else + cond=g_cond_new(); + #endif + return cond; +} + +void wrap_g_cond_free (GCond *cond) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + g_free(cond); + cond=NULL; + #else + g_cond_free(cond); + #endif +} + + +void wrap_g_static_mutex_init (void *mutex) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + g_mutex_init((GMutex *)mutex); + #else + g_static_mutex_init((GStaticMutex *)mutex); + #endif +} + +void wrap_g_static_mutex_free_clear(void *mutex) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + g_mutex_clear((GMutex*)mutex); + #else + g_static_mutex_free((GStaticMutex*)mutex); + #endif +} +void wrap_g_static_mutex_unlock(void *mutex) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + g_mutex_unlock((GMutex*)mutex); + #else + g_static_mutex_unlock((GStaticMutex*)mutex); + #endif +} +void wrap_g_static_mutex_lock(void *mutex) +{ + #if GLIB_CHECK_VERSION (2, 32, 0) + g_mutex_lock((GMutex*)mutex); + #else + g_static_mutex_lock((GStaticMutex*)mutex); + #endif +} + + Added: openhpi/trunk/utils/sahpi_wrappers.h =================================================================== --- openhpi/trunk/utils/sahpi_wrappers.h (rev 0) +++ openhpi/trunk/utils/sahpi_wrappers.h 2014-09-26 21:38:03 UTC (rev 7592) @@ -0,0 +1,76 @@ +/* + * + * Copyright (C) 2013, 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) + * Mohan Devarajulu <mo...@fc...> + */ + +#ifndef __SAHPI_WRAPPERS_H +#define __SAHPI_WRAPPERS_H + +#include <glib.h> +#ifdef __cplusplus... [truncated message content] |