I think that checks that are trivial to express are ok to have 
redundantly in the library.
Some of these checks in the library ensure that an error results in a 
clear return code from the library
instead of a crash lower down in the library.
The server logic must be bulletproof though. That is the serverlogic 
must not assume that
any particular check has been done by the library.

We should not in general "optimize" error handling.
But should we "anti-optimkize" error handling in the library.

/AndersBj

Hans Feldt wrote:
> Aren't the checks in imma redundant? The same ones seems to be done in the 
> server.
> /Hans
>
>   
>> -----Original Message-----
>> From: Zoran Milinkovic [mailto:zoran.milinko...@ericsson.com]
>> Sent: den 5 december 2013 16:05
>> To: reddy.neelaka...@oracle.com
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: [devel] [PATCH 1 of 3] IMM: API support for NO_DANGLING flag [#49]
>>
>>  osaf/libs/agents/saf/imma/imma_om_api.c       |  36 +++++++++++++--
>>  osaf/libs/common/immsv/include/immpbe_dump.hh |   2 +-
>>  osaf/libs/common/immsv/include/immsv_api.h    |   9 ++++
>>  osaf/libs/saf/include/Makefile.am             |   3 +-
>>  osaf/libs/saf/include/saImmOm_A_2_12.h        |   2 +
>>  osaf/libs/saf/include/saImmOm_A_2_13.h        |  60 
>> +++++++++++++++++++++++++++
>>  osaf/libs/saf/libSaImm/Makefile.am            |   2 +-
>>  7 files changed, 106 insertions(+), 8 deletions(-)
>>
>>
>> IMM API support for reference integrity (NO_DANGLING flag)
>>
>> diff --git a/osaf/libs/agents/saf/imma/imma_om_api.c 
>> b/osaf/libs/agents/saf/imma/imma_om_api.c
>> --- a/osaf/libs/agents/saf/imma/imma_om_api.c
>> +++ b/osaf/libs/agents/saf/imma/imma_om_api.c
>> @@ -4173,7 +4173,7 @@ SaAisErrorT saImmOmClassCreate_2(SaImmHa
>>      for (i = 0; attr != 0; attr = attrDefinitions[++i]) {
>>              if (attr->attrName == NULL)  {
>>                      TRACE("NULL attrName , not allowed.");
>> -                    TRACE_LEAVE();
>> +                    TRACE_LEAVE();
>>                      return SA_AIS_ERR_INVALID_PARAM;
>>              }
>>
>> @@ -4181,21 +4181,47 @@ SaAisErrorT saImmOmClassCreate_2(SaImmHa
>>                      if(((attr->attrValueType != SA_IMM_ATTR_SANAMET ) &&
>>                                              (attr->attrValueType != 
>> SA_IMM_ATTR_SASTRINGT))) {
>>                              TRACE("ERR_INVALID_PARAM: RDN '%s' must be of 
>> type SaNameT or SaStringT", attr->attrName);
>> -                            TRACE_LEAVE();
>> +                            TRACE_LEAVE();
>>                              return SA_AIS_ERR_INVALID_PARAM;
>>                      }
>>
>>                      if(attr->attrFlags & SA_IMM_ATTR_MULTI_VALUE) {
>>                              TRACE("ERR_INVALID_PARAM: RDN '%s' can not be 
>> multivalued", attr->attrName);
>>                              TRACE_LEAVE();
>> -                                     return SA_AIS_ERR_INVALID_PARAM;
>> -                            }
>> +                            return SA_AIS_ERR_INVALID_PARAM;
>> +                    }
>> +
>> +                    if(attr->attrFlags & SA_IMM_ATTR_NO_DANGLING) {
>> +                            TRACE("ERR_INVALID_PARAM: RDN '%s' can not have 
>> NO_DANGLING flag", attr->attrName);
>> +                            TRACE_LEAVE();
>> +                            return SA_AIS_ERR_INVALID_PARAM;
>> +                    }
>> +            }
>> +
>> +            if(attr->attrFlags & SA_IMM_ATTR_NO_DANGLING) {
>> +                    if(classCategory == SA_IMM_CLASS_RUNTIME) {
>> +                            TRACE("ERR_INVALID_PARAM: NO_DANGLING attribute 
>> '%s' cannot be defined for runtime class",
>> attr->attrName);
>> +                            TRACE_LEAVE();
>> +                            return SA_AIS_ERR_INVALID_PARAM;
>> +                    }
>> +
>> +                    if(attr->attrValueType != SA_IMM_ATTR_SANAMET) {
>> +                            TRACE("ERR_INVALID_PARAM: Attribute '%s' is 
>> flagged NO_DANGLING, must be of type SaNameT",
>> attr->attrName);
>> +                            TRACE_LEAVE();
>> +                            return SA_AIS_ERR_INVALID_PARAM;
>> +                    }
>> +
>> +                    if(attr->attrFlags & SA_IMM_ATTR_RUNTIME) {
>> +                            TRACE("ERR_INVALID_PARAM: Runtime attribute 
>> '%s' cannot have NO_DANGLING flag", attr-
>>     
>>> attrName);
>>>       
>> +                            TRACE_LEAVE();
>> +                            return SA_AIS_ERR_INVALID_PARAM;
>> +                    }
>>              }
>>      }
>>
>>      if (cb->is_immnd_up == false) {
>>              TRACE_2("ERR_TRY_AGAIN: IMMND is DOWN");
>> -                TRACE_LEAVE();
>> +            TRACE_LEAVE();
>>              return SA_AIS_ERR_TRY_AGAIN;
>>      }
>>
>> diff --git a/osaf/libs/common/immsv/include/immpbe_dump.hh 
>> b/osaf/libs/common/immsv/include/immpbe_dump.hh
>> --- a/osaf/libs/common/immsv/include/immpbe_dump.hh
>> +++ b/osaf/libs/common/immsv/include/immpbe_dump.hh
>> @@ -31,7 +31,7 @@
>>
>>  #define RELEASE_CODE 'A'
>>  #define MAJOR_VERSION 2
>> -#define MINOR_VERSION 12
>> +#define MINOR_VERSION 13
>>
>>  /* Prototypes */
>>  typedef std::map<std::string, SaImmAttrFlagsT> AttrMap;
>> diff --git a/osaf/libs/common/immsv/include/immsv_api.h 
>> b/osaf/libs/common/immsv/include/immsv_api.h
>> --- a/osaf/libs/common/immsv/include/immsv_api.h
>> +++ b/osaf/libs/common/immsv/include/immsv_api.h
>> @@ -76,6 +76,15 @@ extern "C" {
>>  #define OPENSAF_IMM_REPL_B_NAME "@OpenSafImmReplicatorB"
>>
>>  /* Used internally in the SaImmCcbFlagsT space to indicate that
>> +   a ccb currently contains at lest one operation that either
>> +   a) creates an object with no dangling attribute(s) (that is/are not 
>> empty).
>> +   b) deletes an object that has no dangling attribute(s) (that are not 
>> empty).
>> +   c) modifies a NO_DANGLING attribute,
>> +   d) deletes an object that is referred to by some NO_DANGLING attribute.
>> +*/
>> +#define OPENSAF_IMM_CCB_NO_DANGLING_MUTATE 0x40000000
>> +
>> +/* Used internally in the SaImmCcbFlagsT space to indicate that
>>     a ccb currently contains at least one create or at least one
>>     modify on an object that has SA_IMM_ATTR_NOTIFY set on one of
>>     its attributes and special applier is involved. This means that
>> diff --git a/osaf/libs/saf/include/Makefile.am 
>> b/osaf/libs/saf/include/Makefile.am
>> --- a/osaf/libs/saf/include/Makefile.am
>> +++ b/osaf/libs/saf/include/Makefile.am
>> @@ -35,6 +35,7 @@ include_HEADERS = \
>>      saSmf.h \
>>      saImmOi_A_2_11.h \
>>      saImmOm_A_2_11.h \
>> -    saImmOm_A_2_12.h
>> +    saImmOm_A_2_12.h \
>> +    saImmOm_A_2_13.h
>>
>>
>> diff --git a/osaf/libs/saf/include/saImmOm_A_2_12.h 
>> b/osaf/libs/saf/include/saImmOm_A_2_12.h
>> --- a/osaf/libs/saf/include/saImmOm_A_2_12.h
>> +++ b/osaf/libs/saf/include/saImmOm_A_2_12.h
>> @@ -73,4 +73,6 @@ extern "C" {
>>  }
>>  #endif
>>
>> +#include <saImmOm_A_2_13.h>
>> +
>>  #endif   /* _SA_IMM_OM_A_2_12_H */
>> diff --git a/osaf/libs/saf/include/saImmOm_A_2_13.h 
>> b/osaf/libs/saf/include/saImmOm_A_2_13.h
>> new file mode 100644
>> --- /dev/null
>> +++ b/osaf/libs/saf/include/saImmOm_A_2_13.h
>> @@ -0,0 +1,60 @@
>> +/*      -*- OpenSAF  -*-
>> + *
>> + * (C) Copyright 2013 The OpenSAF Foundation
>> + *
>> + * This program is distributed in the hope that it will be useful, but
>> + * WITHOUT ANY WARRANTY; without even the implied warranty of 
>> MERCHANTABILITY
>> + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
>> + * under the GNU Lesser General Public License Version 2.1, February 1999.
>> + * The complete license can be accessed from the following location:
>> + * http://opensource.org/licenses/lgpl-license.php
>> + * See the Copying file included with the OpenSAF distribution for full
>> + * licensing terms.
>> + *
>> + * Author(s): Ericsson AB
>> + */
>> +
>> +/*
>> + * DESCRIPTION:
>> + *   This file provides the suggested additions to the C language binding 
>> for
>> + *   the Service Availability(TM) Forum Information Model Management 
>> Service (IMM).
>> + *   It contains only the prototypes and type definitions that are part of 
>> this
>> + *   proposed addition.
>> + *   These additions are currently NON STANDARD. But the intention is to 
>> get these
>> + *   additions approved formally by SAF in the future.
>> + *
>> + *   For detailed explanation of the new API, see 
>> osaf/services/saf/immsv/README.
>> + */
>> +
>> +
>> +#ifndef _SA_IMM_OM_A_2_13_H
>> +#define _SA_IMM_OM_A_2_13_H
>> +
>> +#ifdef  __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +
>> +    /* 4.2.5 SaImmAttrFlagsT */
>> +    /*
>> +#define SA_IMM_ATTR_MULTI_VALUE   0x00000001
>> +#define SA_IMM_ATTR_RDN           0x00000002
>> +#define SA_IMM_ATTR_CONFIG        0x00000100
>> +#define SA_IMM_ATTR_WRITABLE      0x00000200
>> +#define SA_IMM_ATTR_INITIALIZED   0x00000400
>> +#define SA_IMM_ATTR_RUNTIME       0x00010000
>> +#define SA_IMM_ATTR_PERSISTENT    0x00020000
>> +#define SA_IMM_ATTR_CACHED        0x00040000
>> +#define SA_IMM_ATTR_NO_DUPLICATES 0x0000000001000000 / * See: 
>> http://devel.opensaf.org/ticket/1545
>> +                                                    Not yet supported. * /
>> +#define SA_IMM_ATTR_NOTIFY        0x0000000002000000 / * See: 
>> http://devel.opensaf.org/ticket/2883
>> +                                                    Not yet supported. * /
>> +    */
>> +#define SA_IMM_ATTR_NO_DANGLING   0x0000000004000000    /* See: 
>> https://sourceforge.net/p/opensaf/tickets/49/ */
>> +
>> +
>> +#ifdef  __cplusplus
>> +}
>> +#endif
>> +
>> +#endif   /* _SA_IMM_OM_A_2_13_H */
>> diff --git a/osaf/libs/saf/libSaImm/Makefile.am 
>> b/osaf/libs/saf/libSaImm/Makefile.am
>> --- a/osaf/libs/saf/libSaImm/Makefile.am
>> +++ b/osaf/libs/saf/libSaImm/Makefile.am
>> @@ -21,7 +21,7 @@ MAINTAINERCLEANFILES = Makefile.in
>>  EXTRA_DIST = libSaImmOi.map libSaImmOm.map
>>
>>  OILIB_VERSION = 0:3:0
>> -OMLIB_VERSION = 0:3:0
>> +OMLIB_VERSION = 0:4:0
>>
>>  SUBDIRS = pkgconfig
>>
>>
>> ------------------------------------------------------------------------------
>> Sponsored by Intel(R) XDK
>> Develop, test and display web and hybrid apps with a single code base.
>> Download it for free now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Opensaf-devel mailing list
>> Opensaf-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/opensaf-devel
>>     
>
> ------------------------------------------------------------------------------
> Sponsored by Intel(R) XDK 
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
> _______________________________________________
> Opensaf-devel mailing list
> Opensaf-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensaf-devel
>   


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&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