Ok, I can see that it's included at end of saImmOm.h

Thanks'
Lennart

> -----Original Message-----
> From: Anders Björnerstedt
> Sent: den 8 oktober 2013 16:46
> To: Lennart Lund; mathi.naic...@oracle.com; Hans Feldt
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: RE: [PATCH 1 of 1] logsv: Add support for admin op result strings
> [#576]
> 
> Hi Lennart.
> 
> You should not need to explicitly include  saImmOm_A_2_11.h
> 
> /AndersBj
> 
> -----Original Message-----
> From: Lennart Lund
> Sent: den 8 oktober 2013 16:41
> To: mathi.naic...@oracle.com; Hans Feldt; Anders Björnerstedt
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 1] logsv: Add support for admin op result strings [#576]
> 
>  osaf/services/saf/logsv/lgs/lgs_imm.c |  61
> ++++++++++++++++++++++++++++------
>  tests/logsv/saflogtest.c              |  13 ++++++-
>  2 files changed, 61 insertions(+), 13 deletions(-)
> 
> 
> - Replace saImmOiAdminOperationResult() with
> saImmOiAdminOperationResult_o2()
>   Remove LOG_ER. Reuse error messages.
> - For test purpose, add possibility to create log stream with runtime IMM
>   object and keep it open in test tool saflogtest. See ...test/logsv.
>   For more info use saflogtest -h
> 
> diff --git a/osaf/services/saf/logsv/lgs/lgs_imm.c
> b/osaf/services/saf/logsv/lgs/lgs_imm.c
> --- a/osaf/services/saf/logsv/lgs/lgs_imm.c
> +++ b/osaf/services/saf/logsv/lgs/lgs_imm.c
> @@ -35,6 +35,7 @@
> 
>  #include <saImmOm.h>
>  #include <saImmOi.h>
> +#include <saImmOm_A_2_11.h>
> 
>  #include "immutil.h"
>  #include "lgs.h"
> @@ -272,6 +273,16 @@ static void adminOperationCallback(SaImm
>       SaUint32T severityFilter;
>       const SaImmAdminOperationParamsT_2 *param = params[0];
>       log_stream_t *stream;
> +
> +     char ao_err_string[256];
> +     SaStringT p_ao_err_string = ao_err_string;
> +     SaImmAdminOperationParamsT_2 ao_err_param = {
> +     SA_IMM_PARAM_ADMOP_ERROR,
> +     SA_IMM_ATTR_SASTRINGT,
> +     &p_ao_err_string };
> +     const SaImmAdminOperationParamsT_2 *ao_err_params[2] = {
> +     &ao_err_param,
> +     NULL };
> 
>       TRACE_ENTER2("%s", objectName->value);
> 
> @@ -281,36 +292,56 @@ static void adminOperationCallback(SaImm
>       }
> 
>       if ((stream = log_stream_get_by_name((char *)objectName-
> >value)) == NULL) {
> -             LOG_ER("Stream %s not found", objectName->value);
> -
>       (void)immutil_saImmOiAdminOperationResult(immOiHandle,
> invocation, SA_AIS_ERR_INVALID_PARAM);
> +             TRACE("Stream %s not found", objectName->value);
> +             (void) snprintf(ao_err_string, 256,
> +                             "Stream %s not found", objectName->value);
> +             (void) saImmOiAdminOperationResult_o2(immOiHandle,
> invocation,
> +                        SA_AIS_ERR_INVALID_PARAM,
> +                        ao_err_params);
>               goto done;
>       }
> 
>       if (opId == SA_LOG_ADMIN_CHANGE_FILTER) {
>               /* Only allowed to update runtime objects (application
> streams) */
>               if (stream->streamType != STREAM_TYPE_APPLICATION) {
> -                     LOG_ER("Admin op change filter for non app
> stream");
> -
>       (void)immutil_saImmOiAdminOperationResult(immOiHandle,
> invocation, SA_AIS_ERR_INVALID_PARAM);
> +                     TRACE("Admin op change filter for non app stream");
> +                     (void) snprintf(ao_err_string, 256,
> +                                     "Admin op change filter for non app
> stream");
> +                     (void)
> saImmOiAdminOperationResult_o2(immOiHandle, invocation,
> +                                SA_AIS_ERR_INVALID_PARAM,
> +                                ao_err_params);
>                       goto done;
>               }
> 
>               if (strcmp(param->paramName, "saLogStreamSeverityFilter")
> != 0) {
> -                     LOG_ER("Admin op change filter, invalid param
> name");
> -
>       (void)immutil_saImmOiAdminOperationResult(immOiHandle,
> invocation, SA_AIS_ERR_INVALID_PARAM);
> +                     TRACE("Admin op change filter, invalid param
> name");
> +                     (void) snprintf(ao_err_string, 256,
> +                                     "Admin op change filter, invalid
> param name");
> +                     (void)
> saImmOiAdminOperationResult_o2(immOiHandle, invocation,
> +                                SA_AIS_ERR_INVALID_PARAM,
> +                                ao_err_params);
>                       goto done;
>               }
> 
>               if (param->paramType != SA_IMM_ATTR_SAUINT32T) {
> -                     LOG_ER("Admin op change filter: invalid parameter
> type");
> -
>       (void)immutil_saImmOiAdminOperationResult(immOiHandle,
> invocation, SA_AIS_ERR_INVALID_PARAM);
> +                     TRACE("Admin op change filter: invalid parameter
> type");
> +                     (void) snprintf(ao_err_string, 256,
> +                                     "Admin op change filter: invalid
> parameter type");
> +                     (void)
> saImmOiAdminOperationResult_o2(immOiHandle, invocation,
> +                                SA_AIS_ERR_INVALID_PARAM,
> +                                ao_err_params);
>                       goto done;
>               }
> 
>               severityFilter = *((SaUint32T *)param->paramBuffer);
> 
>               if (severityFilter > 0x7f) {    /* not a level, a bitmap */
> -                     LOG_ER("Admin op change filter: invalid severity");
> -
>       (void)immutil_saImmOiAdminOperationResult(immOiHandle,
> invocation, SA_AIS_ERR_INVALID_PARAM);
> +                     TRACE("Admin op change filter: invalid severity");
> +                     (void) snprintf(ao_err_string, 256,
> +                                     "Admin op change filter: invalid
> severity");
> +                     (void)
> saImmOiAdminOperationResult_o2(immOiHandle, invocation,
> +                                SA_AIS_ERR_INVALID_PARAM,
> +                                ao_err_params);
>                       goto done;
>               }
> 
> @@ -331,8 +362,14 @@ static void adminOperationCallback(SaImm
>               /* Checkpoint to standby LOG server */
>               ckpt_stream(stream);
>       } else {
> -             LOG_ER("Invalid operation ID, should be %d (one) for change
> filter", SA_LOG_ADMIN_CHANGE_FILTER);
> -
>       (void)immutil_saImmOiAdminOperationResult(immOiHandle,
> invocation, SA_AIS_ERR_INVALID_PARAM);
> +             TRACE("Invalid operation ID, should be %d (one) for change
> filter",
> +                             SA_LOG_ADMIN_CHANGE_FILTER);
> +             (void) snprintf(ao_err_string, 256,
> +                             "Invalid operation ID, should be %d (one) for
> change filter",
> +                             SA_LOG_ADMIN_CHANGE_FILTER);
> +             (void) saImmOiAdminOperationResult_o2(immOiHandle,
> invocation,
> +                        SA_AIS_ERR_INVALID_PARAM,
> +                        ao_err_params);
>       }
>   done:
>       TRACE_LEAVE();
> diff --git a/tests/logsv/saflogtest.c b/tests/logsv/saflogtest.c
> --- a/tests/logsv/saflogtest.c
> +++ b/tests/logsv/saflogtest.c
> @@ -99,6 +99,7 @@ static void usage(void)
>       printf("  -i INT or --interval=INT       write with interval INT us 
> (only
> with --count, default 0us)\n");
>       printf("  -c CNT or --count=CNT          write CNT number of times, -1
> forever (with interval INT) \n");
>       printf("      valid severity names: emerg, alert, crit, error, warn, 
> notice,
> info\n");
> +     printf("  -o Open log stream and wait forever. Exit on any key\n");
>  }
> 
>  static void logWriteLogCallbackT(SaInvocationT invocation, SaAisErrorT error)
> @@ -222,6 +223,7 @@ static SaLogSeverityT get_severity(char
> 
>  int main(int argc, char *argv[])
>  {
> +     bool do_not_exit_f = false;
>       int c, i;
>       SaNameT logStreamName = {.length = 0 };
>       SaLogFileCreateAttributesT_2 *logFileCreateAttributes = NULL; @@ -
> 280,11 +282,14 @@ int main(int argc, char *argv[])
>       appLogFileCreateAttributes.logFileFmt =
> DEFAULT_FORMAT_EXPRESSION;
> 
>       while (1) {
> -             c = getopt_long(argc, argv, "hklnya:b:s:i:c:", long_options,
> NULL);
> +             c = getopt_long(argc, argv, "ohklnya:b:s:i:c:", long_options,
> NULL);
>               if (c == -1) {
>                       break;
>               }
>               switch (c) {
> +             case 'o': /* Open log stream and wait forever. Exit on Enter
> key */
> +                     do_not_exit_f = true;
> +                     break;
>               case 'c':
>                       write_count = atoi(optarg);
>                       break;
> @@ -377,6 +382,12 @@ int main(int argc, char *argv[])
>                       usleep(interval);
>       }
> 
> +     /* Open log stream and wait forever. Exit on any key */
> +     if (do_not_exit_f == true) {
> +             (void) getchar();
> +             do_not_exit_f = false;
> +     }
> +
>       error = saLogStreamClose(logStreamHandle);
>       if (SA_AIS_OK != error) {
>               fprintf(stderr, "saLogStreamClose FAILED: %u\n", error);

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to