Ack from me if the comment below is fixed.

/AndersBj

Anders Bjornerstedt wrote:
> REview comments on API/library patch for NO_DANGLING.
>
> Zoran Milinkovic wrote:
>>  osaf/libs/agents/saf/imma/imma_om_api.c |  64 
>> +++++++++++++++++++++++++++-----
>>  osaf/libs/saf/include/saImmOm_A_2_13.h  |  13 ++++++
>>  2 files changed, 66 insertions(+), 11 deletions(-)
>>
>>
>> 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
>> @@ -6027,6 +6027,7 @@ SaAisErrorT saImmOmSearchInitialize_2(Sa
>>      uint32_t proc_rc = NCSCC_RC_SUCCESS;
>>      bool locked = true;
>>      bool isAccGetConfigAttrs = false;
>> +    bool isNoDanglingSearch = searchOptions & 
>> SA_IMM_SEARCH_NO_DANGLING_DEPENDENTS;
>>      IMMA_CB *cb = &imma_cb;
>>      IMMSV_EVT evt;
>>      IMMSV_EVT *out_evt = NULL;
>> @@ -6059,8 +6060,9 @@ SaAisErrorT saImmOmSearchInitialize_2(Sa
>>          return SA_AIS_ERR_INVALID_PARAM;
>>      }
>>  
>> -    if ((searchParam) && ((searchParam->searchOneAttr.attrName == 
>> NULL) && -        (searchParam->searchOneAttr.attrValue != NULL))) {
>> +    if ((searchParam) && !isNoDanglingSearch &&
>> +            ((searchParam->searchOneAttr.attrName == NULL) &&
>> +            (searchParam->searchOneAttr.attrValue != NULL))) {
>>          TRACE_2("ERR_INVALID_PARAM: attrName is NULL but attrValue 
>> is not NULL");
>>          TRACE_LEAVE();
>>          return SA_AIS_ERR_INVALID_PARAM;
>> @@ -6132,6 +6134,40 @@ SaAisErrorT saImmOmSearchInitialize_2(Sa
>>          goto release_lock;
>>      }
>>  
>> +    if (isNoDanglingSearch) {
>> +        if(!cl_node->isImmA2d) {
>> +            TRACE("ERR_VERSION: search option 
>> SA_IMM_SEARCH_NO_DANGLING_DEPENDENTS "
>> +                    "requires IMM version A.02.13 or higher");
>> +            rc = SA_AIS_ERR_VERSION;
>> +            goto release_lock;
>> +        }
>> +        if(scope == SA_IMM_ONE) {
>> +            TRACE("ERR_INVALID_PARAM: 
>> SA_IMM_SEARCH_NO_DANGLING_DEPENDENTS "
>> +                    "flag cannot be used with SA_IMM_ONE scope");
>> +            rc = SA_AIS_ERR_INVALID_PARAM;
>> +            goto release_lock;
>>   
> The scope of SA_IMM_ONE is not allowed at all (according to the A.2.x 
> spec) to be used in saImmOmSearchInitialize.
> So this check should be generalized and moved up out of the scope of 
> the if(isNoDanglingSearch)..
>
> /AndersBj
>> +        }
>> +        if(!searchParam || !searchParam->searchOneAttr.attrValue) {
>> +            TRACE("ERR_INVALID_PARAM: DN of an object must be 
>> specified "
>> +                    "when SA_IMM_SEARCH_NO_DANGLING_DEPENDENTS flag 
>> is used");
>> +            rc = SA_AIS_ERR_INVALID_PARAM;
>> +            goto release_lock;
>> +        }
>> +        if(searchParam->searchOneAttr.attrName) {
>> +            TRACE("ERR_INVALID_PARAM: attrName must be NULL "
>> +                    "when SA_IMM_SEARCH_NO_DANGLING_DEPENDENTS flag 
>> is used");
>> +            rc = SA_AIS_ERR_INVALID_PARAM;
>> +            goto release_lock;
>> +        }
>> +        if(searchParam->searchOneAttr.attrValueType != 
>> SA_IMM_ATTR_SANAMET
>> +                && searchParam->searchOneAttr.attrValueType != 
>> SA_IMM_ATTR_SASTRINGT) {
>> +            TRACE("ERR_INVALID_PARAM: attrValueType must be 
>> SA_IMM_ATTR_SANAMET or "
>> +                    "SA_IMM_ATTR_SASTRINGT when 
>> SA_IMM_SEARCH_NO_DANGLING_DEPENDENTS flag is used");
>> +            rc = SA_AIS_ERR_INVALID_PARAM;
>> +            goto release_lock;
>> +        }
>> +    }
>> +
>>      /*Create search-node & handle   */
>>      search_node = (IMMA_SEARCH_NODE *)
>>          calloc(1, sizeof(IMMA_SEARCH_NODE));
>> @@ -6188,18 +6224,24 @@ SaAisErrorT saImmOmSearchInitialize_2(Sa
>>  
>>      req->scope = scope;
>>      req->searchOptions = searchOptions;
>> -    if (!searchParam || (!searchParam->searchOneAttr.attrName)) {
>> +    if (!searchParam || (!searchParam->searchOneAttr.attrName && 
>> !isNoDanglingSearch)) {
>>          req->searchParam.present = ImmOmSearchParameter_PR_NOTHING;
>>      } else {
>>          req->searchParam.present = 
>> ImmOmSearchParameter_PR_oneAttrParam;
>> -        req->searchParam.choice.oneAttrParam.attrName.size = 
>> strlen(searchParam->searchOneAttr.attrName) + 1;
>> -        req->searchParam.choice.oneAttrParam.attrName.buf =    
>> /*alloc-2 */
>> -            malloc(req->searchParam.choice.oneAttrParam.attrName.size);
>> -        strncpy(req->searchParam.choice.oneAttrParam.attrName.buf,
>> -            (char *)searchParam->searchOneAttr.attrName,
>> -            
>> (size_t)req->searchParam.choice.oneAttrParam.attrName.size);
>> -        
>> req->searchParam.choice.oneAttrParam.attrName.buf[req->searchParam.choice.oneAttrParam.attrName.size
>>  
>> -
>> -                                  1] = 0;
>> +
>> +        if(searchParam->searchOneAttr.attrName) {
>> +            req->searchParam.choice.oneAttrParam.attrName.size = 
>> strlen(searchParam->searchOneAttr.attrName) + 1;
>> +            req->searchParam.choice.oneAttrParam.attrName.buf =     
>> /*alloc-2 */
>> +                    
>> malloc(req->searchParam.choice.oneAttrParam.attrName.size);
>> +            strncpy(req->searchParam.choice.oneAttrParam.attrName.buf,
>> +                    (char *)searchParam->searchOneAttr.attrName,
>> +                    
>> (size_t)req->searchParam.choice.oneAttrParam.attrName.size);
>> +            
>> req->searchParam.choice.oneAttrParam.attrName.buf[req->searchParam.choice.oneAttrParam.attrName.size
>>  
>> - 1] = 0;
>> +        } else {
>> +            req->searchParam.choice.oneAttrParam.attrName.size = 0;
>> +            req->searchParam.choice.oneAttrParam.attrName.buf = NULL;
>> +        }
>> +
>>          if (searchParam->searchOneAttr.attrValue) {
>>              req->searchParam.choice.oneAttrParam.attrValueType = 
>> searchParam->searchOneAttr.attrValueType;
>>              /*alloc-3 */
>> diff --git a/osaf/libs/saf/include/saImmOm_A_2_13.h 
>> b/osaf/libs/saf/include/saImmOm_A_2_13.h
>> --- a/osaf/libs/saf/include/saImmOm_A_2_13.h
>> +++ b/osaf/libs/saf/include/saImmOm_A_2_13.h
>> @@ -53,6 +53,19 @@ extern "C" {
>>  #define SA_IMM_ATTR_NO_DANGLING   0x0000000004000000    /* See: 
>> https://sourceforge.net/p/opensaf/tickets/49/ */
>>  
>>  
>> +    /* 4.2.12 SaImmSearchOptionsT */
>> +    /*
>> +#define SA_IMM_SEARCH_ONE_ATTR       0x0001
>> +#define SA_IMM_SEARCH_GET_ALL_ATTR   0x0100
>> +#define SA_IMM_SEARCH_GET_NO_ATTR    0x0200
>> +#define SA_IMM_SEARCH_GET_SOME_ATTR  0x0400
>> +#define SA_IMM_SEARCH_GET_CONFIG_ATTR 0x0000000000010000   / * See: 
>> http://devel.opensaf.org/ticket/1897
>> +                          Supported in OpenSaf 4.3 * /
>> +    */
>> +#define SA_IMM_SEARCH_NO_DANGLING_DEPENDENTS  0x0000000100000000    
>> /* See: https://sourceforge.net/p/opensaf/tickets/50/
>> +                                                                       
>> Supported in OpenSaf 4.4 */
>> +
>> +
>>  #ifdef  __cplusplus
>>  }
>>  #endif
>>
>> ------------------------------------------------------------------------------
>>  
>>
>> Rapidly troubleshoot problems before they affect your business. Most 
>> IT organizations don't have a clear picture of how application 
>> performance affects their revenue. With AppDynamics, you get 100% 
>> visibility into your Java,.NET, & PHP application. Start your 15-day 
>> FREE TRIAL of AppDynamics Pro!
>> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk 
>>
>> _______________________________________________
>> Opensaf-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/opensaf-devel
>>   
>
>


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to