[devel] [PATCH 0 of 1] Review Request for log: Fix incorrect type conversion in fileclose_hdl [#923]

2014-05-23 Thread Lennart Lund
Summary: log: Fix possible thread race on timeout in file api
Review request for Trac Ticket(s): #923
Peer Reviewer(s): anders.wid...@ericsson.com, mathi.naic...@oracle.com
Pull request to: <>
Affected branch(es): 4.4, 4.5
Development branch: <>


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesy
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-
 <>

changeset ff4fb648508a86e423d075c41bdb9672b69c5f60
Author: Lennart Lund 
Date:   Fri, 23 May 2014 17:02:38 +0200

log: Fix incorrect type conversion in fileclose_hdl [#923]

change fd = *(char *) indata; to fd = *(int *) indata;


Complete diffstat:
--
 osaf/services/saf/logsv/lgs/lgs_filehdl.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Testing Commands:
-
logtest


Testing, Expected Results:
--
All pass


Conditions of Submission:
-
 <>


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  n  n
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.


--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] log: Fix incorrect type conversion in fileclose_hdl [#923]

2014-05-23 Thread Lennart Lund
 osaf/services/saf/logsv/lgs/lgs_filehdl.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


change fd = *(char *) indata; to fd = *(int *) indata;

diff --git a/osaf/services/saf/logsv/lgs/lgs_filehdl.c 
b/osaf/services/saf/logsv/lgs/lgs_filehdl.c
--- a/osaf/services/saf/logsv/lgs/lgs_filehdl.c
+++ b/osaf/services/saf/logsv/lgs/lgs_filehdl.c
@@ -479,7 +479,7 @@ int fileclose_hdl(void *indata, void *ou
int rc = 0;
int fd;

-   fd = *(char *) indata;
+   fd = *(int *) indata;
TRACE_ENTER2("fd=%d", fd);
 
rc = close(fd);

--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] log: Fix possible thread race on timeout in file api [#919]

2014-05-23 Thread Lennart Lund
 osaf/services/saf/logsv/lgs/lgs_file.c |  7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)


Fix:
- Accept answer from file thread if answer is created if timeout
- Prepare for handling new request also if timeout

diff --git a/osaf/services/saf/logsv/lgs/lgs_file.c 
b/osaf/services/saf/logsv/lgs/lgs_file.c
--- a/osaf/services/saf/logsv/lgs/lgs_file.c
+++ b/osaf/services/saf/logsv/lgs/lgs_file.c
@@ -338,12 +338,12 @@ lgsf_retcode_t log_file_api(lgsf_apipar_
while (lgs_com_data.answer_f == false) {
rc = pthread_cond_timedwait(
&answer_cv, &lgs_ftcom_mutex, &timeout_time); 
/* -> UNLOCK -> LOCK */
-   if (rc == ETIMEDOUT) {
+   if ((rc == ETIMEDOUT) && (lgs_com_data.answer_f == false)) {
TRACE("Timed out before answer");
api_rc = LGSF_TIMEOUT;
lgs_com_data.timeout_f = true; /* Inform thread about 
timeout */
-   goto api_exit;
-   } else if (rc != 0) {
+   goto api_timeout;
+   } else if ((rc != 0) && (rc != ETIMEDOUT)) {
TRACE("pthread wait Failed - %s",strerror(rc));
osaf_abort(rc);
}
@@ -358,6 +358,7 @@ lgsf_retcode_t log_file_api(lgsf_apipar_
apipar_in->hdl_ret_code_out = lgs_com_data.return_code;
memcpy(apipar_in->data_out, lgs_com_data.outdata_ptr, 
lgs_com_data.outdata_size);
 
+api_timeout:
/* Prepare to take a new answer */
lgs_com_data.answer_f = false;
lgs_com_data.return_code = LGSF_NORETC;

--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 0 of 1] Review Request for log: Fix possible thread race on timeout in file api [#919]

2014-05-23 Thread Lennart Lund
Summary: log: Fix possible thread race on timeout in file api
Review request for Trac Ticket(s): #919
Peer Reviewer(s): anders.wid...@ericsson.com, mathi.naic...@oracle.com
Pull request to: <>
Affected branch(es): 4.4, 4.5
Development branch: <>


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesy
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-
 <>

changeset 8f3b9635b1e65c45eafedeb8e97e71d9c863a06c
Author: Lennart Lund 
Date:   Fri, 23 May 2014 16:41:02 +0200

log: Fix possible thread race on timeout in file api [#919]

Fix:
- Accept answer from file thread if answer is created if timeout
- Prepare for handling new request also if timeout


Complete diffstat:
--
 osaf/services/saf/logsv/lgs/lgs_file.c |  7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)


Testing Commands:
-
logtest


Testing, Expected Results:
--
All pass


Conditions of Submission:
-
 <>


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  n  n
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.


--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: create SI to store ckpt:ed dep_state [#926]

2014-05-23 Thread Hans Feldt
Yes agree

Skickat från min Sony Xperia™-smartphone


 praveen malviya skrev 


On 23-May-14 6:40 PM, Hans Feldt wrote:
>> -Original Message-
>> From: praveen malviya [mailto:praveen.malv...@oracle.com]
>> Sent: den 23 maj 2014 15:06
>> To: Hans Feldt
>> Cc: nagendr...@oracle.com; opensaf-devel@lists.sourceforge.net
>> Subject: Re: [PATCH 1 of 1] amfd: create SI to store ckpt:ed dep_state [#926]
>>
>>
>> On 23-May-14 4:53 PM, Hans Feldt wrote:
>>>osaf/services/saf/amf/amfd/ckpt_dec.cc  |  7 +--
>>>osaf/services/saf/amf/amfd/include/si.h |  1 +
>>>osaf/services/saf/amf/amfd/si.cc|  2 +-
>>>3 files changed, 7 insertions(+), 3 deletions(-)
>>>
>>>
>>> abort in standby amfd with back trace:
>>>
>>> #0  0x7f71264bcb35 in raise () from /lib64/libc.so.6
>>> No symbol table info available.
>>> #1  0x7f71264be111 in abort () from /lib64/libc.so.6
>>> No symbol table info available.
>>> #2  0x7f7127d51e07 in __osafassert_fail (__file=, 
>>> __line=, __func=,
>> __assertion=)
>>>   at sysf_def.c:401
>>> No locals.
>>> #3  0x004103e7 in dec_si_dep_state (cb=0x69c980, dec=>> out>) at avd_ckpt_dec.c:2042
>>>   si_struct = 0x0
>>>
>>> When an SI dependency is created on the active amfd it checkpoints the 
>>> dep_state. When
>>> this reach the standby amfd it has not yet created the SI so it cannot 
>>> store the state.
>>> The reason is the well-known race problem of standby amfd being applier.
>>>
>>> We fix this in standby amfd by creating the SI if it does not exist, this 
>>> in context of
>>> the xcheck point handling.
>>>
>>> diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
>>> b/osaf/services/saf/amf/amfd/ckpt_dec.cc
>>> --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
>>> +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
>>> @@ -2040,8 +2040,11 @@ static uint32_t dec_si_dep_state(AVD_CL_
>>>
>>>  osafassert(status == NCSCC_RC_SUCCESS);
>>>
>>> -   if (NULL == (si_struct = avd_si_get(&si_ptr_dec->name)))
>>> -   osafassert(0);
>>> +   if (NULL == (si_struct = avd_si_get(&si_ptr_dec->name))) {
>>> +   si_struct = avd_si_new(&si_ptr_dec->name);
>>> +   osafassert(si_struct != NULL);
>>> +   si_add_to_model(si_struct);
>> I think there is not need to add si to model, as si_dep_state is can be
>> updated after creating the SI.
> [Hans] you are right, instead of si_add_to_model , avd_si_db_add() should be 
> called. Same as for SU checkpointing of oper state.
I think  final patch can be concluded as:

diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc
b/osaf/services/saf/amf/amfd/ckpt_dec.cc
--- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
+++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
@@ -2040,8 +2040,11 @@ static uint32_t dec_si_dep_state(AVD_CL_

 osafassert(status == NCSCC_RC_SUCCESS);

-   if (NULL == (si_struct = avd_si_get(&si_ptr_dec->name)))
-   osafassert(0);
+   if (NULL == (si_struct = avd_si_get(&si_ptr_dec->name))) {
+   si_struct = avd_si_new(&si_ptr_dec->name);
+   osafassert(si_struct != NULL);
+   avd_si_db_add(si_struct);
+   }

 /* Update the fields received in this checkpoint message */
avd_sidep_si_dep_state_set(si_struct,si_ptr_dec->si_dep_state);

What do you think?

Thanks,
Praveen
>> In si_add_to_model(), other SI attributes are accessed which may also be
>> in pending state of  creation.
>>
>>
>> Thanks,
>> Praveen.
>>> +   }
>>>
>>>  /* Update the fields received in this checkpoint message */
>>>  avd_sidep_si_dep_state_set(si_struct,si_ptr_dec->si_dep_state);
>>> diff --git a/osaf/services/saf/amf/amfd/include/si.h 
>>> b/osaf/services/saf/amf/amfd/include/si.h
>>> --- a/osaf/services/saf/amf/amfd/include/si.h
>>> +++ b/osaf/services/saf/amf/amfd/include/si.h
>>> @@ -153,6 +153,7 @@ extern AVD_SI *avd_si_get(const SaNameT
>>>extern AVD_SI *avd_si_getnext(const SaNameT *si_name);
>>>extern SaAisErrorT avd_si_config_get(struct avd_app_tag *app);
>>>extern void avd_si_constructor(void);
>>> +void si_add_to_model(AVD_SI *si);
>>>
>>>extern AVD_SVC_TYPE *avd_svctype_get(const SaNameT *dn);
>>>extern SaAisErrorT avd_svctype_config_get(void);
>>> diff --git a/osaf/services/saf/amf/amfd/si.cc 
>>> b/osaf/services/saf/amf/amfd/si.cc
>>> --- a/osaf/services/saf/amf/amfd/si.cc
>>> +++ b/osaf/services/saf/amf/amfd/si.cc
>>> @@ -466,7 +466,7 @@ AVD_SI *avd_si_getnext(const SaNameT *dn
>>>  return (AVD_SI *)ncs_patricia_tree_getnext(&si_db, (uint8_t *)&tmp);
>>>}
>>>
>>> -static void si_add_to_model(AVD_SI *si)
>>> +void si_add_to_model(AVD_SI *si)
>>>{
>>>  SaNameT dn;
>>>

--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing

Re: [devel] [PATCH 0 of 3] Review Request for Extended Name Type [#191]

2014-05-23 Thread Anders Widell
Hi!

See replies inline.

/ Anders Widell

On 05/23/2014 01:12 PM, Mathivanan Naickan Palanivelu wrote:
> Hi Anders,
>
> Good work.
>
> Please find some comments(we have already discussed couple of them)
>
> 1) Iam thinking if we can make the **Lend and **Borrow to somehow (optimally) 
> be included
> as a part of all service libraries.
> This would mean, the extended length handling(tunneling) is initialized as a 
> part of
> saInitialize().

I think what I meant when we discussed this was that instead of putting 
the lend and borrow functions in just libSaImmOm, we could put them in 
all SAF libraries as weak symbols. This way, the application will get 
access to them no matter what SAF librar(ies) it is linked with. Is that 
what you are referring to? This is possible to implement, and I can take 
a look at how to add it to the patches.
>
> This way, the sa**Lend and sa**Borrow that is being proposed here would not 
> be necessary
> as everything is implicitly handled when that service user calls 
> saInitialize().
The borrow and lend functions would still be needed, no matter if they 
are in all libraries or just in libSaImmOm.
>
> 2) I am also thinking whether we should check and see if we can avoid setting 
> the environment variable
> SA_ENABLE_EXTENDED_NAMES before starting the application.
>
>   I mean, on top of turning on the build option, the additional environment 
> variable sounds
> a crude approach! You might have thought/considered this, but still.
Yes I have considered adding something that gets inserted / executed 
automatically when the preprocessor macro is defined. I think it may be 
techincally possible to do, but would depend on some sophisticated 
trick. It is not trivial, but I think it would be possible. I can take a 
look at it again, but I am a bit sceptical to doing too much magic. The 
environment variable solution is very simple.
>
> 3) We had discussed about fixing a upper limit for the extended length. 
> Otherwise, it would
> be a security vulnerability.
These patches contain a constant defining the upper limit to 2048, but 
the utility functions do not check the limit themselves. It is intended 
to be done by the agent code, but yes I can consider if the utility 
functions should also contain such a validation.

>
>
> I used the prototype and things did come up. Things also looked to work 
> properly.
> I will try to write from scratch an application and get back.
>
> Cheers,
> Mathi.
>
>
>> -Original Message-
>> From: Anders Widell [mailto:anders.wid...@ericsson.com]
>> Sent: Friday, May 02, 2014 4:21 PM
>> To: Mathivanan Naickan Palanivelu; anders.bjornerst...@ericsson.com
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: [PATCH 0 of 3] Review Request for Extended Name Type [#191]
>>
>> Summary: Extended Name Type [#191]
>> Review request for Trac Ticket(s): 191
>> Peer Reviewer(s): Mathi, AndersBj
>> Pull request to:
>> Affected branch(es): default(4.5)
>> Development branch: default
>>
>> 
>> Impacted area   Impact y/n
>> 
>> Docsy
>> Build systemn
>> RPM/packaging   n
>> Configuration files n
>> Startup scripts n
>> SAF servicesy
>> OpenSAF servicesn
>> Core libraries  y
>> Samples n
>> Tests   n
>> Other   n
>>
>>
>> Comments (indicate scope for each "y" above):
>> -
>> These patches add new AIS API functions and definitions for the extended
>> SaNameT format, used to tunnel NUL-terminated strings through SaNameT.
>> They also add support library functions to be used in agent libraries.
>>
>> changeset f3cf7ffb53b9a4dd6026cf58c262a46eac8bca3a
>> Author:  Anders Widell 
>> Date:Fri, 02 May 2014 12:44:08 +0200
>>
>>  osaf: Add saAisNameLend() and saAisNameBorrow() [#191]
>>
>>  Add declarations of saAisNameLend() and saAisNameBorrow() to
>> saAis.h. Update
>>  00-README.conf with description of how to enable the extended
>> SaNameT type.
>>
>> changeset 84def835e0192244ba98eb6c80f192d2db26cd7d
>> Author:  Anders Widell 
>> Date:Fri, 02 May 2014 12:44:12 +0200
>>
>>  osaf: Add library functions for handling the extended SaNameT format
>> [#191]
>>
>>  These library functions are primarily intended to be used in agent
>>  libraries, to handle the old SAF APIs that still are using the SaNameT
>> type.
>>
>> changeset 99143446a43030c140d0ae95192546108b7639e2
>> Author:  Anders Widell 
>> Date:Fri, 02 May 2014 12:44:16 +0200
>>
>>  imm: Add implementations of saAisNameLend and saAisNameBorrow
>> [#191]
>>
>>  The functions saAisNameLend() and saAisNameBorrow() are defined
>> in
>>  saAis_B_5_14.h, but their implementation is placed in libSaImmOm
>> since there
>>  is no libSaAis library.
>>
>>
>> Complete diffstat:
>> --
>> 00-README

[devel] [PATCH 1 of 1] log: Fix thread communication buffer initiation [#922]

2014-05-23 Thread Lennart Lund
 osaf/services/saf/logsv/lgs/lgs_file.c |  11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)


Initiate out-buffer by writing 0 to first byte.
Set pointers to NULL after free

diff --git a/osaf/services/saf/logsv/lgs/lgs_file.c 
b/osaf/services/saf/logsv/lgs/lgs_file.c
--- a/osaf/services/saf/logsv/lgs/lgs_file.c
+++ b/osaf/services/saf/logsv/lgs/lgs_file.c
@@ -289,8 +289,14 @@ lgsf_retcode_t log_file_api(lgsf_apipar_
}

/* Free request data before allocating new memeory */
-   if (lgs_com_data.indata_ptr != NULL) free(lgs_com_data.indata_ptr);
-   if (lgs_com_data.outdata_ptr != NULL) free(lgs_com_data.outdata_ptr);
+   if (lgs_com_data.indata_ptr != NULL) {
+   free(lgs_com_data.indata_ptr);
+   lgs_com_data.indata_ptr = NULL;
+   }
+   if (lgs_com_data.outdata_ptr != NULL) {
+   free(lgs_com_data.outdata_ptr);
+   lgs_com_data.indata_ptr = NULL;
+   }
 
/* Allocate memory and enter data for a request */
lgs_com_data.request_code = apipar_in->req_code_in;
@@ -313,6 +319,7 @@ lgsf_retcode_t log_file_api(lgsf_apipar_
api_rc = LGSF_FAIL;
goto api_exit;
}
+   *(char *) lgs_com_data.outdata_ptr = '\0';
} else {
lgs_com_data.outdata_ptr = NULL;
}

--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 0 of 1] Review Request for log: Fix thread communication buffer initiation [#922]

2014-05-23 Thread Lennart Lund
Summary: log: Fix thread communication buffer initiation
Review request for Trac Ticket(s): #922
Peer Reviewer(s): mathi.naic...@oracle.com, anders.wid...@ericsson.com
Pull request to: <>
Affected branch(es): <>
Development branch: <>


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesy
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-
 <>

changeset b215b9eff3be460b3ca337478ae3301c47e0f037
Author: Lennart Lund 
Date:   Fri, 23 May 2014 15:29:38 +0200

log: Fix thread communication buffer initiation [#922]

Initiate out-buffer by writing 0 to first byte. Set pointers to NULL 
after
free


Complete diffstat:
--
 osaf/services/saf/logsv/lgs/lgs_file.c |  11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)


Testing Commands:
-
logtest


Testing, Expected Results:
--
All test cases pass


Conditions of Submission:
-
 <>


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  n  n
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.


--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 4 of 4] amfd: use db_template to replace patricia tree in AVD_CTCS_TYPE [#713]

2014-05-23 Thread Hans Nordebäck
Ack, code review only./BR HansN
On 05/23/14 11:15, praveen.malv...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/compcstype.cc  |   4 +-
>   osaf/services/saf/amf/amfd/ctcstype.cc|  37 
> +++---
>   osaf/services/saf/amf/amfd/include/comp.h |   5 ++-
>   osaf/services/saf/amf/amfd/util.cc|   2 +-
>   4 files changed, 15 insertions(+), 33 deletions(-)
>
>
> diff --git a/osaf/services/saf/amf/amfd/compcstype.cc 
> b/osaf/services/saf/amf/amfd/compcstype.cc
> --- a/osaf/services/saf/amf/amfd/compcstype.cc
> +++ b/osaf/services/saf/amf/amfd/compcstype.cc
> @@ -206,7 +206,7 @@ static int is_config_valid(const SaNameT
>   
>   ctcstype_name.length = sprintf((char*)ctcstype_name.value, "%s,%s", 
> cstype_name, comptype_name->value);
>   
> - if (avd_ctcstype_get(&ctcstype_name) == NULL) {
> + if (ctcstype_db->find(&ctcstype_name) == NULL) {
>   if (opdata == NULL) {
>   report_ccb_validation_error(opdata, "'%s' does not 
> exist in model", ctcstype_name.value);
>   goto free_cstype_name;
> @@ -258,7 +258,7 @@ static AVD_COMPCS_TYPE *compcstype_creat
>   ctcstype_name.length = sprintf((char*)ctcstype_name.value,
>   "%s,%s", cstype_name, comp->comp_type->name.value);
>   
> - ctcstype = avd_ctcstype_get(&ctcstype_name);
> + ctcstype = ctcstype_db->find(&ctcstype_name);
>   
>   if 
> (immutil_getAttr(const_cast("saAmfCompNumMaxActiveCSIs"), 
> attributes, 0,
>   &num_max_act_csi) != SA_AIS_OK) {
> diff --git a/osaf/services/saf/amf/amfd/ctcstype.cc 
> b/osaf/services/saf/amf/amfd/ctcstype.cc
> --- a/osaf/services/saf/amf/amfd/ctcstype.cc
> +++ b/osaf/services/saf/amf/amfd/ctcstype.cc
> @@ -23,11 +23,11 @@
>   #include 
>   #include 
>   
> -static NCS_PATRICIA_TREE ctcstype_db;
> +AmfDb *ctcstype_db = NULL;
>   
>   static void ctcstype_db_add(AVD_CTCS_TYPE *ctcstype)
>   {
> - unsigned int rc = ncs_patricia_tree_add(&ctcstype_db, 
> &ctcstype->tree_node);
> + unsigned int rc = ctcstype_db->insert(ctcstype);
>   osafassert(rc == NCSCC_RC_SUCCESS);
>   }
>   
> @@ -74,7 +74,6 @@ static AVD_CTCS_TYPE *ctcstype_create(co
>   
>   memcpy(ctcstype->name.value, dn->value, dn->length);
>   ctcstype->name.length = dn->length;
> - ctcstype->tree_node.key_info = (uint8_t *)&(ctcstype->name);
>   
>   error = 
> immutil_getAttr(const_cast("saAmfCtCompCapability"), 
> attributes, 0, &ctcstype->saAmfCtCompCapability);
>   osafassert(error == SA_AIS_OK);
> @@ -96,25 +95,6 @@ static AVD_CTCS_TYPE *ctcstype_create(co
>   return ctcstype;
>   }
>   
> -static void ctcstype_delete(AVD_CTCS_TYPE *ctcstype)
> -{
> - unsigned int rc;
> -
> - rc = ncs_patricia_tree_del(&ctcstype_db, &ctcstype->tree_node);
> - osafassert(rc == NCSCC_RC_SUCCESS);
> - delete ctcstype;
> -}
> -
> -AVD_CTCS_TYPE *avd_ctcstype_get(const SaNameT *dn)
> -{
> - SaNameT tmp = {0};
> -
> - tmp.length = dn->length;
> - memcpy(tmp.value, dn->value, tmp.length);
> -
> - return (AVD_CTCS_TYPE *)ncs_patricia_tree_get(&ctcstype_db, (uint8_t 
> *)&tmp);
> -}
> -
>   SaAisErrorT avd_ctcstype_config_get(const SaNameT *comp_type_dn, 
> AVD_COMP_TYPE *comp_type)
>   {
>   SaAisErrorT error = SA_AIS_ERR_FAILED_OPERATION;
> @@ -143,7 +123,7 @@ SaAisErrorT avd_ctcstype_config_get(cons
>   if (!is_config_valid(&dn, attributes, NULL))
>   goto done2;
>   
> - if ((ctcstype = avd_ctcstype_get(&dn)) == NULL ) {
> + if ((ctcstype = ctcstype_db->find(&dn)) == NULL ) {
>   if ((ctcstype = ctcstype_create(&dn, attributes)) == 
> NULL)
>   goto done2;
>   
> @@ -199,8 +179,11 @@ static void ctcstype_ccb_apply_cb(CcbUti
>   ctcstype_db_add(ctcstype);
>   break;
>   case CCBUTIL_DELETE:
> - ctcstype = avd_ctcstype_get(&opdata->objectName);
> - ctcstype_delete(ctcstype);
> + ctcstype = ctcstype_db->find(&opdata->objectName);
> + if (ctcstype != NULL) {
> + ctcstype_db->erase(ctcstype);
> + delete ctcstype;
> + }
>   break;
>   default:
>   osafassert(0);
> @@ -212,10 +195,8 @@ static void ctcstype_ccb_apply_cb(CcbUti
>   
>   void avd_ctcstype_constructor(void)
>   {
> - NCS_PATRICIA_PARAMS patricia_params;
> + ctcstype_db = new AmfDb;
>   
> - patricia_params.key_size = sizeof(SaNameT);
> - osafassert(ncs_patricia_tree_init(&ctcstype_db, &patricia_params) == 
> NCSCC_RC_SUCCESS);
>   avd_class_impl_set("SaAmfCtCsType", NULL, NULL,
>   ctcstype_ccb_completed_cb, ctcstype_ccb_apply_cb);
>   }
> diff --git a/osaf/services/saf/amf/amfd/include/comp.h 
> b/osaf/services/saf/amf/amfd/include/comp.h
> --- a/osaf/services/saf/amf/amfd/include/comp.h
> +++ b/osaf/services/saf/amf/amf

Re: [devel] [PATCH 3 of 4] amfd: use db_template to replace patricia tree in avd_cstype_t [#713]

2014-05-23 Thread Hans Nordebäck
Ack, code review only. /BR HansN
On 05/23/14 11:15, praveen.malv...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/csi.cc|   8 +++---
>   osaf/services/saf/amf/amfd/cstype.cc |  35 
> +--
>   osaf/services/saf/amf/amfd/include/csi.h |   3 +-
>   3 files changed, 12 insertions(+), 34 deletions(-)
>
>
> diff --git a/osaf/services/saf/amf/amfd/csi.cc 
> b/osaf/services/saf/amf/amfd/csi.cc
> --- a/osaf/services/saf/amf/amfd/csi.cc
> +++ b/osaf/services/saf/amf/amfd/csi.cc
> @@ -117,7 +117,7 @@ static int is_config_valid(const SaNameT
>   rc = immutil_getAttr(const_cast("saAmfCSType"), 
> attributes, 0, &aname);
>   osafassert(rc == SA_AIS_OK);
>   
> - if (avd_cstype_get(&aname) == NULL) {
> + if (cstype_db->find(&aname) == NULL) {
>   /* CS type does not exist in current model, check CCB if passed 
> as param */
>   if (opdata == NULL) {
>   report_ccb_validation_error(opdata, "'%s' does not 
> exist in model", aname.value);
> @@ -331,7 +331,7 @@ static void csi_get_attr_and_add_to_mode
>   TRACE_ENTER2("DEP not configured, marking rank 1. Csi'%s', 
> Rank'%u'",csi->name.value,csi->rank);
>   }
>   
> - csi->cstype = avd_cstype_get(&csi->saAmfCSType);
> + csi->cstype = cstype_db->find(&csi->saAmfCSType);
>   csi->si = avd_si_get(si_name);
>   
>   avd_cstype_add_csi(csi);
> @@ -546,7 +546,7 @@ static SaAisErrorT csi_ccb_completed_mod
>   rc = SA_AIS_ERR_BAD_OPERATION;
>   goto done;
>   }
> - if (avd_cstype_get(&cstype_name) == NULL) {
> + if (cstype_db->find(&cstype_name) == NULL) {
>   report_ccb_validation_error(opdata, "CS Type 
> not found '%s'", cstype_name.value);
>   rc = SA_AIS_ERR_BAD_OPERATION;
>   goto done;
> @@ -778,7 +778,7 @@ static void csi_ccb_apply_modify_hdlr(st
>   SaNameT cstype_name = *(SaNameT*) 
> attr_mod->modAttr.attrValues[0];
>   TRACE("saAmfCSType modified from '%s' to '%s' for 
> Csi'%s'", csi->saAmfCSType.value,
>   cstype_name.value, csi->name.value);
> - csi_type = avd_cstype_get(&cstype_name);
> + csi_type = cstype_db->find(&cstype_name);
>   avd_cstype_remove_csi(csi);
>   csi->saAmfCSType = cstype_name;
>   csi->cstype = csi_type;
> diff --git a/osaf/services/saf/amf/amfd/cstype.cc 
> b/osaf/services/saf/amf/amfd/cstype.cc
> --- a/osaf/services/saf/amf/amfd/cstype.cc
> +++ b/osaf/services/saf/amf/amfd/cstype.cc
> @@ -22,7 +22,7 @@
>   #include 
>   #include 
>   
> -static NCS_PATRICIA_TREE cstype_db;
> +AmfDb *cstype_db = NULL;
>   
>   //
>   // TODO(HANO) Temporary use this function instead of strdup which uses 
> malloc.
> @@ -37,7 +37,7 @@ static char *StrDup(const char *s)
>   
>   static void cstype_add_to_model(avd_cstype_t *cst)
>   {
> - unsigned int rc = ncs_patricia_tree_add(&cstype_db, &cst->tree_node);
> + uint32_t rc = cstype_db->insert(cst);
>   osafassert(rc == NCSCC_RC_SUCCESS);
>   }
>   
> @@ -52,7 +52,6 @@ static avd_cstype_t *cstype_create(const
>   
>   memcpy(cst->name.value, dn->value, dn->length);
>   cst->name.length = dn->length;
> - cst->tree_node.key_info = (uint8_t *)&cst->name;
>   
>   if 
> ((immutil_getAttrValuesNumber(const_cast("saAmfCSAttrName"), 
> attributes, &values_number) == SA_AIS_OK) &&
>   (values_number > 0)) {
> @@ -72,39 +71,20 @@ static avd_cstype_t *cstype_create(const
>*/
>   static void cstype_delete(avd_cstype_t *cst)
>   {
> - unsigned int rc;
>   char *p;
>   int i = 0;
>   
> - rc = ncs_patricia_tree_del(&cstype_db, &cst->tree_node);
> - osafassert(rc == NCSCC_RC_SUCCESS);
> + cstype_db->erase(cst);
>   
>   if (cst->saAmfCSAttrName != NULL) {
>   while ((p = cst->saAmfCSAttrName[i++]) != NULL) {
>   delete [] p;
>   }
>   }
> -
>   delete [] cst->saAmfCSAttrName;
>   delete cst;
>   }
>   
> -/**
> - * Lookup object using name in DB
> - * @param dn
> - *
> - * @return avd_cstype_t*
> - */
> -avd_cstype_t *avd_cstype_get(const SaNameT *dn)
> -{
> - SaNameT tmp = {0};
> -
> - tmp.length = dn->length;
> - memcpy(tmp.value, dn->value, tmp.length);
> -
> - return (avd_cstype_t *)ncs_patricia_tree_get(&cstype_db, (uint8_t 
> *)&tmp);
> -}
> -
>   void avd_cstype_add_csi(AVD_CSI *csi)
>   {
>   csi->csi_list_cs_type_next = csi->cstype->list_of_csi;
> @@ -190,7 +170,7 @@ SaAisErrorT avd_cstype_config_get(void)
>   if (!is_config_valid(&dn, NULL))
>   goto done2;
>   
> - if ((cst = avd_cstype_get(&dn)) == NULL){
> + if ((cst = 

Re: [devel] [PATCH 2 of 4] amfd: use db_template to replace patricia tree in AVD_SVC_TYPE [#713]

2014-05-23 Thread Hans Nordebäck
Ack, code review only/Regards HansN
On 05/23/14 11:15, praveen.malv...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/include/si.h |   2 +-
>   osaf/services/saf/amf/amfd/si.cc|   4 ++--
>   osaf/services/saf/amf/amfd/svctype.cc   |  27 ++-
>   3 files changed, 9 insertions(+), 24 deletions(-)
>
>
> diff --git a/osaf/services/saf/amf/amfd/include/si.h 
> b/osaf/services/saf/amf/amfd/include/si.h
> --- a/osaf/services/saf/amf/amfd/include/si.h
> +++ b/osaf/services/saf/amf/amfd/include/si.h
> @@ -132,6 +132,7 @@ typedef struct {
>   
>   extern AmfDb *si_db;
>   extern AmfDb *svctypecstypes_db;
> +extern AmfDb *svctype_db;
>   #define AVD_SI_NULL ((AVD_SI *)0)
>   #define m_AVD_SI_ACTV_MAX_SU(l_si) (l_si)->saAmfSIPrefActiveAssignments
>   #define m_AVD_SI_ACTV_CURR_SU(l_si) (l_si)->saAmfSINumCurrActiveAssignments
> @@ -153,7 +154,6 @@ extern AVD_SI *avd_si_get(const SaNameT
>   extern SaAisErrorT avd_si_config_get(struct avd_app_tag *app);
>   extern void avd_si_constructor(void);
>   
> -extern AVD_SVC_TYPE *avd_svctype_get(const SaNameT *dn);
>   extern SaAisErrorT avd_svctype_config_get(void);
>   extern void avd_svctype_add_si(AVD_SI *si);
>   extern void avd_svctype_remove_si(AVD_SI *si);
> diff --git a/osaf/services/saf/amf/amfd/si.cc 
> b/osaf/services/saf/amf/amfd/si.cc
> --- a/osaf/services/saf/amf/amfd/si.cc
> +++ b/osaf/services/saf/amf/amfd/si.cc
> @@ -469,7 +469,7 @@ static void si_add_to_model(AVD_SI *si)
>   
>   avd_si_db_add(si);
>   
> - si->svc_type = avd_svctype_get(&si->saAmfSvcType);
> + si->svc_type = svctype_db->find(&si->saAmfSvcType);
>   
>   if (si->saAmfSIProtectedbySG.length > 0)
>   si->sg_of_si = avd_sg_get(&si->saAmfSIProtectedbySG);
> @@ -511,7 +511,7 @@ static int is_config_valid(const SaNameT
>   rc = immutil_getAttr(const_cast("saAmfSvcType"), 
> attributes, 0, &aname);
>   osafassert(rc == SA_AIS_OK);
>   
> - if (avd_svctype_get(&aname) == NULL) {
> + if (svctype_db->find(&aname) == NULL) {
>   /* SVC type does not exist in current model, check CCB if 
> passed as param */
>   if (opdata == NULL) {
>   report_ccb_validation_error(opdata, "'%s' does not 
> exist in model", aname.value);
> diff --git a/osaf/services/saf/amf/amfd/svctype.cc 
> b/osaf/services/saf/amf/amfd/svctype.cc
> --- a/osaf/services/saf/amf/amfd/svctype.cc
> +++ b/osaf/services/saf/amf/amfd/svctype.cc
> @@ -28,7 +28,7 @@
>   #include 
>   #include 
>   
> -static NCS_PATRICIA_TREE svctype_db;
> +AmfDb *svctype_db = NULL;
>   
>   //
>   // TODO(HANO) Temporary use this function instead of strdup which uses 
> malloc.
> @@ -43,24 +43,14 @@ static char *StrDup(const char *s)
>   
>   static void svctype_db_add(AVD_SVC_TYPE *svct)
>   {
> - unsigned int rc = ncs_patricia_tree_add(&svctype_db, &svct->tree_node);
> + unsigned int rc = svctype_db->insert(svct);
>   osafassert (rc == NCSCC_RC_SUCCESS);
>   }
>   
> -AVD_SVC_TYPE *avd_svctype_get(const SaNameT *dn)
> -{
> - SaNameT tmp = {0};
> -
> - tmp.length = dn->length;
> - memcpy(tmp.value, dn->value, tmp.length);
> -
> - return (AVD_SVC_TYPE *)ncs_patricia_tree_get(&svctype_db, (uint8_t 
> *)&tmp);
> -}
>   
>   static void svctype_delete(AVD_SVC_TYPE *svc_type)
>   {
> - unsigned int rc = ncs_patricia_tree_del(&svctype_db, 
> &svc_type->tree_node);
> - osafassert(rc == NCSCC_RC_SUCCESS);
> + svctype_db->erase(svc_type);
>   
>   if (svc_type->saAmfSvcDefActiveWeight != NULL) {
>   unsigned int i = 0;
> @@ -94,7 +84,6 @@ static AVD_SVC_TYPE *svctype_create(cons
>   
>   memcpy(svct->name.value, dn->value, dn->length);
>   svct->name.length = dn->length;
> - svct->tree_node.key_info = (uint8_t *)&svct->name;
>   svct->saAmfSvcDefActiveWeight = NULL;
>   svct->saAmfSvcDefStandbyWeight = NULL;
>   
> @@ -159,7 +148,7 @@ static SaAisErrorT svctype_ccb_completed
>   report_ccb_validation_error(opdata, "Modification of 
> SaAmfSvcType not supported");
>   break;
>   case CCBUTIL_DELETE:
> - svc_type = avd_svctype_get(&opdata->objectName);
> + svc_type = svctype_db->find(&opdata->objectName);
>   if (NULL != svc_type->list_of_si) {
>   /* check whether there exists a delete operation for
>* each of the SI in the svc_type list in the current 
> CCB
> @@ -250,7 +239,7 @@ SaAisErrorT avd_svctype_config_get(void)
>   if (!is_config_valid(&dn, attributes, NULL))
>   goto done2;
>   
> - if ((svc_type = avd_svctype_get(&dn))==NULL) {
> + if ((svc_type = svctype_db->find(&dn)) == NULL) {
>   if ((svc_type = svctype_create(&dn, attributes)) == 
> NULL)
>   goto done2;
>   
> @@ -308,11 +297,7 @@ void avd_svctype_remove_si(AVD_SI *si)
>   
>   void avd_svctype_cons

Re: [devel] [PATCH 1 of 4] amfd: use db_template to replace patricia tree in AVD_SVC_TYPE_CS_TYPE [#713]

2014-05-23 Thread Hans Nordebäck
Ack, code review only./Regards HansN
On 05/23/14 11:15, praveen.malv...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/include/si.h  |   4 +--
>   osaf/services/saf/amf/amfd/si.cc |   1 -
>   osaf/services/saf/amf/amfd/svctypecstypes.cc |  40 
> +++
>   3 files changed, 12 insertions(+), 33 deletions(-)
>
>
> diff --git a/osaf/services/saf/amf/amfd/include/si.h 
> b/osaf/services/saf/amf/amfd/include/si.h
> --- a/osaf/services/saf/amf/amfd/include/si.h
> +++ b/osaf/services/saf/amf/amfd/include/si.h
> @@ -69,7 +69,6 @@ typedef struct avd_sirankedsu {
>*/
>   typedef struct avd_si_tag {
>   
> - NCS_PATRICIA_NODE tree_node;/* key will be the SI name */
>   SaNameT name;
>   
>   / B.04 model 
> */
> @@ -121,7 +120,6 @@ typedef struct avd_amf_svc_type_tag {
>   } AVD_SVC_TYPE;
>   
>   typedef struct {
> - NCS_PATRICIA_NODE tree_node;/* key is name */
>   SaNameT name;
>   SaUint32T saAmfSvctMaxNumCSIs;
>   
> @@ -133,6 +131,7 @@ typedef struct {
>   } AVD_SVC_TYPE_CS_TYPE;
>   
>   extern AmfDb *si_db;
> +extern AmfDb *svctypecstypes_db;
>   #define AVD_SI_NULL ((AVD_SI *)0)
>   #define m_AVD_SI_ACTV_MAX_SU(l_si) (l_si)->saAmfSIPrefActiveAssignments
>   #define m_AVD_SI_ACTV_CURR_SU(l_si) (l_si)->saAmfSINumCurrActiveAssignments
> @@ -161,7 +160,6 @@ extern void avd_svctype_remove_si(AVD_SI
>   extern void avd_svctype_constructor(void);
>   
>   extern SaAisErrorT avd_svctypecstypes_config_get(SaNameT *svctype_name);
> -extern AVD_SVC_TYPE_CS_TYPE *avd_svctypecstypes_get(const SaNameT 
> *svctypecstypes_name);
>   extern void avd_svctypecstypes_constructor(void);
>   extern void avd_si_inc_curr_act_ass(AVD_SI *si);
>   extern void avd_si_dec_curr_act_ass(AVD_SI *si);
> diff --git a/osaf/services/saf/amf/amfd/si.cc 
> b/osaf/services/saf/amf/amfd/si.cc
> --- a/osaf/services/saf/amf/amfd/si.cc
> +++ b/osaf/services/saf/amf/amfd/si.cc
> @@ -331,7 +331,6 @@ AVD_SI *avd_si_new(const SaNameT *dn)
>   
>   memcpy(si->name.value, dn->value, dn->length);
>   si->name.length = dn->length;
> - si->tree_node.key_info = (uint8_t *)&si->name;
>   si->si_switch = AVSV_SI_TOGGLE_STABLE;
>   si->saAmfSIAdminState = SA_AMF_ADMIN_UNLOCKED;
>   si->si_dep_state = AVD_SI_NO_DEPENDENCY;
> diff --git a/osaf/services/saf/amf/amfd/svctypecstypes.cc 
> b/osaf/services/saf/amf/amfd/svctypecstypes.cc
> --- a/osaf/services/saf/amf/amfd/svctypecstypes.cc
> +++ b/osaf/services/saf/amf/amfd/svctypecstypes.cc
> @@ -20,11 +20,11 @@
>   #include 
>   #include 
>   
> -static NCS_PATRICIA_TREE svctypecstypes_db;
>   
> +AmfDb *svctypecstypes_db = NULL;
>   static void svctypecstype_db_add(AVD_SVC_TYPE_CS_TYPE *svctypecstype)
>   {
> - unsigned int rc = ncs_patricia_tree_add(&svctypecstypes_db, 
> &svctypecstype->tree_node);
> + uint32_t rc = svctypecstypes_db->insert(svctypecstype);
>   osafassert(rc == NCSCC_RC_SUCCESS);
>   }
>   
> @@ -39,7 +39,6 @@ static AVD_SVC_TYPE_CS_TYPE *svctypecsty
>   
>   memcpy(svctypecstype->name.value, dn->value, dn->length);
>   svctypecstype->name.length = dn->length;
> - svctypecstype->tree_node.key_info = (uint8_t *)&(svctypecstype->name);
>   
>   if (immutil_getAttr(const_cast("saAmfSvctMaxNumCSIs"), 
> attributes, 0, &svctypecstype->saAmfSvctMaxNumCSIs) != SA_AIS_OK)
>   svctypecstype->saAmfSvctMaxNumCSIs = -1; /* no limit */
> @@ -47,25 +46,6 @@ static AVD_SVC_TYPE_CS_TYPE *svctypecsty
>   return svctypecstype;
>   }
>   
> -static void svctypecstypes_delete(AVD_SVC_TYPE_CS_TYPE *svctypecstype)
> -{
> - uint32_t rc;
> -
> - rc = ncs_patricia_tree_del(&svctypecstypes_db, 
> &svctypecstype->tree_node);
> - osafassert(rc == NCSCC_RC_SUCCESS);
> - delete svctypecstype;
> -}
> -
> -AVD_SVC_TYPE_CS_TYPE *avd_svctypecstypes_get(const SaNameT *dn)
> -{
> - SaNameT tmp = {0};
> -
> - tmp.length = dn->length;
> - memcpy(tmp.value, dn->value, tmp.length);
> -
> - return (AVD_SVC_TYPE_CS_TYPE*)ncs_patricia_tree_get(&svctypecstypes_db, 
> (uint8_t *)&tmp);
> -}
> -
>   /**
>* Get configuration for all SaAmfSvcTypeCSTypes objects from
>* IMM and create AVD internal objects.
> @@ -100,7 +80,7 @@ SaAisErrorT avd_svctypecstypes_config_ge
>   
>   while (immutil_saImmOmSearchNext_2(searchHandle, &dn, 
> (SaImmAttrValuesT_2 ***)&attributes) == SA_AIS_OK) {
>   
> - if ((svctypecstype = avd_svctypecstypes_get(&dn))== NULL) {
> + if ((svctypecstype = svctypecstypes_db->find(&dn))== NULL) {
>   if ((svctypecstype = svctypecstypes_create(&dn, 
> attributes)) == NULL) {
>   error = SA_AIS_ERR_FAILED_OPERATION;
>   goto done2;
> @@ -138,7 +118,7 @@ static SaAisErrorT svctypecstypes_ccb_co
>   report_ccb_validation_error(opdata, "Modification of 
> SaAmfSvcTypeCSTyp

Re: [devel] [PATCH 1 of 1] amfd: create SI to store ckpt:ed dep_state [#926]

2014-05-23 Thread praveen malviya

On 23-May-14 6:40 PM, Hans Feldt wrote:
>> -Original Message-
>> From: praveen malviya [mailto:praveen.malv...@oracle.com]
>> Sent: den 23 maj 2014 15:06
>> To: Hans Feldt
>> Cc: nagendr...@oracle.com; opensaf-devel@lists.sourceforge.net
>> Subject: Re: [PATCH 1 of 1] amfd: create SI to store ckpt:ed dep_state [#926]
>>
>>
>> On 23-May-14 4:53 PM, Hans Feldt wrote:
>>>osaf/services/saf/amf/amfd/ckpt_dec.cc  |  7 +--
>>>osaf/services/saf/amf/amfd/include/si.h |  1 +
>>>osaf/services/saf/amf/amfd/si.cc|  2 +-
>>>3 files changed, 7 insertions(+), 3 deletions(-)
>>>
>>>
>>> abort in standby amfd with back trace:
>>>
>>> #0  0x7f71264bcb35 in raise () from /lib64/libc.so.6
>>> No symbol table info available.
>>> #1  0x7f71264be111 in abort () from /lib64/libc.so.6
>>> No symbol table info available.
>>> #2  0x7f7127d51e07 in __osafassert_fail (__file=, 
>>> __line=, __func=,
>> __assertion=)
>>>   at sysf_def.c:401
>>> No locals.
>>> #3  0x004103e7 in dec_si_dep_state (cb=0x69c980, dec=>> out>) at avd_ckpt_dec.c:2042
>>>   si_struct = 0x0
>>>
>>> When an SI dependency is created on the active amfd it checkpoints the 
>>> dep_state. When
>>> this reach the standby amfd it has not yet created the SI so it cannot 
>>> store the state.
>>> The reason is the well-known race problem of standby amfd being applier.
>>>
>>> We fix this in standby amfd by creating the SI if it does not exist, this 
>>> in context of
>>> the xcheck point handling.
>>>
>>> diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
>>> b/osaf/services/saf/amf/amfd/ckpt_dec.cc
>>> --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
>>> +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
>>> @@ -2040,8 +2040,11 @@ static uint32_t dec_si_dep_state(AVD_CL_
>>>
>>> osafassert(status == NCSCC_RC_SUCCESS);
>>>
>>> -   if (NULL == (si_struct = avd_si_get(&si_ptr_dec->name)))
>>> -   osafassert(0);
>>> +   if (NULL == (si_struct = avd_si_get(&si_ptr_dec->name))) {
>>> +   si_struct = avd_si_new(&si_ptr_dec->name);
>>> +   osafassert(si_struct != NULL);
>>> +   si_add_to_model(si_struct);
>> I think there is not need to add si to model, as si_dep_state is can be
>> updated after creating the SI.
> [Hans] you are right, instead of si_add_to_model , avd_si_db_add() should be 
> called. Same as for SU checkpointing of oper state.
I think  final patch can be concluded as:

diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
b/osaf/services/saf/amf/amfd/ckpt_dec.cc
--- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
+++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
@@ -2040,8 +2040,11 @@ static uint32_t dec_si_dep_state(AVD_CL_

 osafassert(status == NCSCC_RC_SUCCESS);

-   if (NULL == (si_struct = avd_si_get(&si_ptr_dec->name)))
-   osafassert(0);
+   if (NULL == (si_struct = avd_si_get(&si_ptr_dec->name))) {
+   si_struct = avd_si_new(&si_ptr_dec->name);
+   osafassert(si_struct != NULL);
+   avd_si_db_add(si_struct);
+   }

 /* Update the fields received in this checkpoint message */
avd_sidep_si_dep_state_set(si_struct,si_ptr_dec->si_dep_state);

What do you think?

Thanks,
Praveen
>> In si_add_to_model(), other SI attributes are accessed which may also be
>> in pending state of  creation.
>>
>>
>> Thanks,
>> Praveen.
>>> +   }
>>>
>>> /* Update the fields received in this checkpoint message */
>>> avd_sidep_si_dep_state_set(si_struct,si_ptr_dec->si_dep_state);
>>> diff --git a/osaf/services/saf/amf/amfd/include/si.h 
>>> b/osaf/services/saf/amf/amfd/include/si.h
>>> --- a/osaf/services/saf/amf/amfd/include/si.h
>>> +++ b/osaf/services/saf/amf/amfd/include/si.h
>>> @@ -153,6 +153,7 @@ extern AVD_SI *avd_si_get(const SaNameT
>>>extern AVD_SI *avd_si_getnext(const SaNameT *si_name);
>>>extern SaAisErrorT avd_si_config_get(struct avd_app_tag *app);
>>>extern void avd_si_constructor(void);
>>> +void si_add_to_model(AVD_SI *si);
>>>
>>>extern AVD_SVC_TYPE *avd_svctype_get(const SaNameT *dn);
>>>extern SaAisErrorT avd_svctype_config_get(void);
>>> diff --git a/osaf/services/saf/amf/amfd/si.cc 
>>> b/osaf/services/saf/amf/amfd/si.cc
>>> --- a/osaf/services/saf/amf/amfd/si.cc
>>> +++ b/osaf/services/saf/amf/amfd/si.cc
>>> @@ -466,7 +466,7 @@ AVD_SI *avd_si_getnext(const SaNameT *dn
>>> return (AVD_SI *)ncs_patricia_tree_getnext(&si_db, (uint8_t *)&tmp);
>>>}
>>>
>>> -static void si_add_to_model(AVD_SI *si)
>>> +void si_add_to_model(AVD_SI *si)
>>>{
>>> SaNameT dn;
>>>


--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs

Re: [devel] [PATCH 1 of 1] amfd: create SI to store ckpt:ed dep_state [#926]

2014-05-23 Thread Hans Feldt

> -Original Message-
> From: praveen malviya [mailto:praveen.malv...@oracle.com]
> Sent: den 23 maj 2014 15:06
> To: Hans Feldt
> Cc: nagendr...@oracle.com; opensaf-devel@lists.sourceforge.net
> Subject: Re: [PATCH 1 of 1] amfd: create SI to store ckpt:ed dep_state [#926]
> 
> 
> On 23-May-14 4:53 PM, Hans Feldt wrote:
> >   osaf/services/saf/amf/amfd/ckpt_dec.cc  |  7 +--
> >   osaf/services/saf/amf/amfd/include/si.h |  1 +
> >   osaf/services/saf/amf/amfd/si.cc|  2 +-
> >   3 files changed, 7 insertions(+), 3 deletions(-)
> >
> >
> > abort in standby amfd with back trace:
> >
> > #0  0x7f71264bcb35 in raise () from /lib64/libc.so.6
> > No symbol table info available.
> > #1  0x7f71264be111 in abort () from /lib64/libc.so.6
> > No symbol table info available.
> > #2  0x7f7127d51e07 in __osafassert_fail (__file=, 
> > __line=, __func=,
> __assertion=)
> >  at sysf_def.c:401
> > No locals.
> > #3  0x004103e7 in dec_si_dep_state (cb=0x69c980, dec= > out>) at avd_ckpt_dec.c:2042
> >  si_struct = 0x0
> >
> > When an SI dependency is created on the active amfd it checkpoints the 
> > dep_state. When
> > this reach the standby amfd it has not yet created the SI so it cannot 
> > store the state.
> > The reason is the well-known race problem of standby amfd being applier.
> >
> > We fix this in standby amfd by creating the SI if it does not exist, this 
> > in context of
> > the xcheck point handling.
> >
> > diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
> > b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > @@ -2040,8 +2040,11 @@ static uint32_t dec_si_dep_state(AVD_CL_
> >
> > osafassert(status == NCSCC_RC_SUCCESS);
> >
> > -   if (NULL == (si_struct = avd_si_get(&si_ptr_dec->name)))
> > -   osafassert(0);
> > +   if (NULL == (si_struct = avd_si_get(&si_ptr_dec->name))) {
> > +   si_struct = avd_si_new(&si_ptr_dec->name);
> > +   osafassert(si_struct != NULL);
> > +   si_add_to_model(si_struct);
> I think there is not need to add si to model, as si_dep_state is can be
> updated after creating the SI.
[Hans] you are right, instead of si_add_to_model , avd_si_db_add() should be 
called. Same as for SU checkpointing of oper state.

> In si_add_to_model(), other SI attributes are accessed which may also be
> in pending state of  creation.
> 
> 
> Thanks,
> Praveen.
> > +   }
> >
> > /* Update the fields received in this checkpoint message */
> > avd_sidep_si_dep_state_set(si_struct,si_ptr_dec->si_dep_state);
> > diff --git a/osaf/services/saf/amf/amfd/include/si.h 
> > b/osaf/services/saf/amf/amfd/include/si.h
> > --- a/osaf/services/saf/amf/amfd/include/si.h
> > +++ b/osaf/services/saf/amf/amfd/include/si.h
> > @@ -153,6 +153,7 @@ extern AVD_SI *avd_si_get(const SaNameT
> >   extern AVD_SI *avd_si_getnext(const SaNameT *si_name);
> >   extern SaAisErrorT avd_si_config_get(struct avd_app_tag *app);
> >   extern void avd_si_constructor(void);
> > +void si_add_to_model(AVD_SI *si);
> >
> >   extern AVD_SVC_TYPE *avd_svctype_get(const SaNameT *dn);
> >   extern SaAisErrorT avd_svctype_config_get(void);
> > diff --git a/osaf/services/saf/amf/amfd/si.cc 
> > b/osaf/services/saf/amf/amfd/si.cc
> > --- a/osaf/services/saf/amf/amfd/si.cc
> > +++ b/osaf/services/saf/amf/amfd/si.cc
> > @@ -466,7 +466,7 @@ AVD_SI *avd_si_getnext(const SaNameT *dn
> > return (AVD_SI *)ncs_patricia_tree_getnext(&si_db, (uint8_t *)&tmp);
> >   }
> >
> > -static void si_add_to_model(AVD_SI *si)
> > +void si_add_to_model(AVD_SI *si)
> >   {
> > SaNameT dn;
> >


--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] amfd: create SI to store ckpt:ed dep_state [#926]

2014-05-23 Thread praveen malviya

On 23-May-14 4:53 PM, Hans Feldt wrote:
>   osaf/services/saf/amf/amfd/ckpt_dec.cc  |  7 +--
>   osaf/services/saf/amf/amfd/include/si.h |  1 +
>   osaf/services/saf/amf/amfd/si.cc|  2 +-
>   3 files changed, 7 insertions(+), 3 deletions(-)
>
>
> abort in standby amfd with back trace:
>
> #0  0x7f71264bcb35 in raise () from /lib64/libc.so.6
> No symbol table info available.
> #1  0x7f71264be111 in abort () from /lib64/libc.so.6
> No symbol table info available.
> #2  0x7f7127d51e07 in __osafassert_fail (__file=, 
> __line=, __func=, __assertion=)
>  at sysf_def.c:401
> No locals.
> #3  0x004103e7 in dec_si_dep_state (cb=0x69c980, dec=) 
> at avd_ckpt_dec.c:2042
>  si_struct = 0x0
>
> When an SI dependency is created on the active amfd it checkpoints the 
> dep_state. When
> this reach the standby amfd it has not yet created the SI so it cannot store 
> the state.
> The reason is the well-known race problem of standby amfd being applier.
>
> We fix this in standby amfd by creating the SI if it does not exist, this in 
> context of
> the xcheck point handling.
>
> diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
> b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
> +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> @@ -2040,8 +2040,11 @@ static uint32_t dec_si_dep_state(AVD_CL_
>   
>   osafassert(status == NCSCC_RC_SUCCESS);
>   
> - if (NULL == (si_struct = avd_si_get(&si_ptr_dec->name)))
> - osafassert(0);
> + if (NULL == (si_struct = avd_si_get(&si_ptr_dec->name))) {
> + si_struct = avd_si_new(&si_ptr_dec->name);
> + osafassert(si_struct != NULL);
> + si_add_to_model(si_struct);
I think there is not need to add si to model, as si_dep_state is can be 
updated after creating the SI.
In si_add_to_model(), other SI attributes are accessed which may also be 
in pending state of  creation.


Thanks,
Praveen.
> + }
>   
>   /* Update the fields received in this checkpoint message */
>   avd_sidep_si_dep_state_set(si_struct,si_ptr_dec->si_dep_state);
> diff --git a/osaf/services/saf/amf/amfd/include/si.h 
> b/osaf/services/saf/amf/amfd/include/si.h
> --- a/osaf/services/saf/amf/amfd/include/si.h
> +++ b/osaf/services/saf/amf/amfd/include/si.h
> @@ -153,6 +153,7 @@ extern AVD_SI *avd_si_get(const SaNameT
>   extern AVD_SI *avd_si_getnext(const SaNameT *si_name);
>   extern SaAisErrorT avd_si_config_get(struct avd_app_tag *app);
>   extern void avd_si_constructor(void);
> +void si_add_to_model(AVD_SI *si);
>   
>   extern AVD_SVC_TYPE *avd_svctype_get(const SaNameT *dn);
>   extern SaAisErrorT avd_svctype_config_get(void);
> diff --git a/osaf/services/saf/amf/amfd/si.cc 
> b/osaf/services/saf/amf/amfd/si.cc
> --- a/osaf/services/saf/amf/amfd/si.cc
> +++ b/osaf/services/saf/amf/amfd/si.cc
> @@ -466,7 +466,7 @@ AVD_SI *avd_si_getnext(const SaNameT *dn
>   return (AVD_SI *)ncs_patricia_tree_getnext(&si_db, (uint8_t *)&tmp);
>   }
>   
> -static void si_add_to_model(AVD_SI *si)
> +void si_add_to_model(AVD_SI *si)
>   {
>   SaNameT dn;
>   


--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 0 of 3] Review Request for Extended Name Type [#191]

2014-05-23 Thread Anders Björnerstedt
 I should also say that many ask: Why do we do both, i.e. both SaNameT 
tunneling and a
new SaStringT based API?  

The first answer is that it is too much to do a big bang change where all 
SAF services provide new SaStringT based APIs in the same release. 
The IMM service has to go first. The old APIS must still be supported (for 
backwards compatibility)
so long DNs may pop up in old APIS anyway.

Second, addapting other services or applications for long DNs may in one sense 
be simpler
Using the old IMM API and tunneling. The reason is that the tunneling is a 
pureily local change when assigning or reading the SaNameT value. Such
Assigning and reading of SaNameT values is of course done all over the place.
Altering the code from directly accessing the memers of SaNameT to use lend
and borrow should be trivial.

Third, whatever the pretty planning is, there may pop up surprises where we 
realize
That we have to deal with long DNs in places we did not anticipate. The 
tunneling
API allows for quick fixes of this sort. 

Of course using SaStringT is even more trivial if that is the starting point.
But converting an application or SAF service to elimiate SaNameT usage may be a
non trivial step.
Particualrly when the appliactio/service uses some services that still have 
SaNameT and some
that dont. Adding an SaStringT based API is not very hard but also not very 
cheap if you
Consider docuemntation and function test addaptions.

/AndersBj

-Original Message-
From: Anders Björnerstedt [mailto:anders.bjornerst...@ericsson.com] 
Sent: den 23 maj 2014 14:20
To: Mathivanan Naickan Palanivelu; Anders Widell
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [devel] [PATCH 0 of 3] Review Request for Extended Name Type [#191]

Hi Mathi

I dont quite follow what you mean on point (1).
The lend/borrow is a used for tunneling long DNs through the SaNameT type when 
exisitin APIs SaNameT based APIs are being used. It works of course even if the 
dn happens to be shorter than 256 bytes.

So any application that is to support long DNs and is using an old SaNameT 
based SAF API will need them.
Of course the old SANameT API has to be of a version that explisitly support 
long DNs. 
It soulds like you have some idea for more transparent handling for this. 
But could you give an example then :-)

2) The application only needs to set the SA_ENABLE_EXTENDED_NAMES if it is not 
sattisifed with the default.
The basic idea is that the default should be 0 (long names not allowed) for old 
SaNameT based APIs and that The default should be 1 (long names allowed) for 
new APIs where SaNameT has been replaced by SaStringT and SaConstStringT. I 
suppose that at some point in the future, if the old SaNameT based API is still 
being used for some service that has still not provided any SaStringT based 
API, then one could consider switching the default for SA_ENABLE_EXTENDED_NAME 
for that old SaName based api at that time.

But during this transaition period I think we need to be conservative and 
backwards compatible with Applications users that are not interrested in long 
DNs yet are interested in other new features Provied by some new API version. 

3) Yes we will have a sanity check (at least in the server) for long DNs at I 
believe 2048 bytes
(2047 excluding null termination).

/AndersBj


-Original Message-
From: Mathivanan Naickan Palanivelu [mailto:mathi.naic...@oracle.com]
Sent: den 23 maj 2014 13:13
To: Anders Widell; Anders Björnerstedt
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 0 of 3] Review Request for Extended Name Type [#191]

Hi Anders,

Good work.

Please find some comments(we have already discussed couple of them)

1) Iam thinking if we can make the **Lend and **Borrow to somehow (optimally) 
be included as a part of all service libraries. 
This would mean, the extended length handling(tunneling) is initialized as a 
part of saInitialize().

This way, the sa**Lend and sa**Borrow that is being proposed here would not be 
necessary as everything is implicitly handled when that service user calls 
saInitialize().

2) I am also thinking whether we should check and see if we can avoid setting 
the environment variable SA_ENABLE_EXTENDED_NAMES before starting the 
application.

 I mean, on top of turning on the build option, the additional environment 
variable sounds a crude approach! You might have thought/considered this, but 
still.

3) We had discussed about fixing a upper limit for the extended length. 
Otherwise, it would be a security vulnerability.


I used the prototype and things did come up. Things also looked to work 
properly.
I will try to write from scratch an application and get back.

Cheers,
Mathi.


>-Original Message-
>From: Anders Widell [mailto:anders.wid...@ericsson.com]
>Sent: Friday, May 02, 2014 4:21 PM
>To: Mathivanan Naickan Palanivelu; anders.bjornerst...@ericsson.com
>Cc: opensaf-devel@lists.sourceforge.net
>Subject: [PATCH 0 of 3] Review Request fo

Re: [devel] [PATCH 0 of 3] Review Request for Extended Name Type [#191]

2014-05-23 Thread Anders Björnerstedt
Hi Mathi

I dont quite follow what you mean on point (1).
The lend/borrow is a used for tunneling long DNs through the SaNameT type when 
exisitin APIs
SaNameT based APIs are being used. It works of course even if the dn happens to 
be shorter than 256 bytes.

So any application that is to support long DNs and is using an old SaNameT 
based SAF API will need them.
Of course the old SANameT API has to be of a version that explisitly support 
long DNs. 
It soulds like you have some idea for more transparent handling for this. 
But could you give an example then :-)

2) The application only needs to set the SA_ENABLE_EXTENDED_NAMES if it is not 
sattisifed with the default.
The basic idea is that the default should be 0 (long names not allowed) for old 
SaNameT based APIs and that
The default should be 1 (long names allowed) for new APIs where SaNameT has 
been replaced by SaStringT and
SaConstStringT. I suppose that at some point in the future, if the old SaNameT 
based API is still being
used for some service that has still not provided any SaStringT based API, then 
one could consider 
switching the default for SA_ENABLE_EXTENDED_NAME for that old SaName based api 
at that time.

But during this transaition period I think we need to be conservative and 
backwards compatible with
Applications users that are not interrested in long DNs yet are interested in 
other new features
Provied by some new API version. 

3) Yes we will have a sanity check (at least in the server) for long DNs at I 
believe 2048 bytes
(2047 excluding null termination).

/AndersBj


-Original Message-
From: Mathivanan Naickan Palanivelu [mailto:mathi.naic...@oracle.com] 
Sent: den 23 maj 2014 13:13
To: Anders Widell; Anders Björnerstedt
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 0 of 3] Review Request for Extended Name Type [#191]

Hi Anders,

Good work.

Please find some comments(we have already discussed couple of them)

1) Iam thinking if we can make the **Lend and **Borrow to somehow (optimally) 
be included as a part of all service libraries. 
This would mean, the extended length handling(tunneling) is initialized as a 
part of saInitialize().

This way, the sa**Lend and sa**Borrow that is being proposed here would not be 
necessary as everything is implicitly handled when that service user calls 
saInitialize().

2) I am also thinking whether we should check and see if we can avoid setting 
the environment variable SA_ENABLE_EXTENDED_NAMES before starting the 
application.

 I mean, on top of turning on the build option, the additional environment 
variable sounds a crude approach! You might have thought/considered this, but 
still.

3) We had discussed about fixing a upper limit for the extended length. 
Otherwise, it would be a security vulnerability.


I used the prototype and things did come up. Things also looked to work 
properly.
I will try to write from scratch an application and get back.

Cheers,
Mathi.


>-Original Message-
>From: Anders Widell [mailto:anders.wid...@ericsson.com]
>Sent: Friday, May 02, 2014 4:21 PM
>To: Mathivanan Naickan Palanivelu; anders.bjornerst...@ericsson.com
>Cc: opensaf-devel@lists.sourceforge.net
>Subject: [PATCH 0 of 3] Review Request for Extended Name Type [#191]
>
>Summary: Extended Name Type [#191]
>Review request for Trac Ticket(s): 191
>Peer Reviewer(s): Mathi, AndersBj
>Pull request to:
>Affected branch(es): default(4.5)
>Development branch: default
>
>
>Impacted area   Impact y/n
>
> Docsy
> Build systemn
> RPM/packaging   n
> Configuration files n
> Startup scripts n
> SAF servicesy
> OpenSAF servicesn
> Core libraries  y
> Samples n
> Tests   n
> Other   n
>
>
>Comments (indicate scope for each "y" above):
>-
>These patches add new AIS API functions and definitions for the 
>extended SaNameT format, used to tunnel NUL-terminated strings through SaNameT.
>They also add support library functions to be used in agent libraries.
>
>changeset f3cf7ffb53b9a4dd6026cf58c262a46eac8bca3a
>Author:Anders Widell 
>Date:  Fri, 02 May 2014 12:44:08 +0200
>
>   osaf: Add saAisNameLend() and saAisNameBorrow() [#191]
>
>   Add declarations of saAisNameLend() and saAisNameBorrow() to saAis.h. 
>Update
>   00-README.conf with description of how to enable the extended SaNameT 
>type.
>
>changeset 84def835e0192244ba98eb6c80f192d2db26cd7d
>Author:Anders Widell 
>Date:  Fri, 02 May 2014 12:44:12 +0200
>
>   osaf: Add library functions for handling the extended SaNameT format 
>[#191]
>
>   These library functions are primarily intended to be used in agent
>   libraries, to handle the old SAF APIs that still are using the SaNameT 
>type.
>
>changeset 99143446a43030c140d0ae95192546108b7639e2
>Author:   

Re: [devel] [PATCH 1 of 1] amfd: replace patricia tree with stl::maps in nodegroup [#713]

2014-05-23 Thread Hans Nordebäck
Ack, code review only, two questions ,
1)  why is tree_node kept?
2) why is the ++it not in the for loop body at:

for (std::map::const_iterator it = 
nodegroup_db->begin();
+   it != nodegroup_db->end(); ) {


/Regards HansN

On 05/23/14 10:45, nagendr...@oracle.com wrote:
>   osaf/services/saf/amf/amfd/include/node.h |   2 +-
>   osaf/services/saf/amf/amfd/nodegroup.cc   |  76 
> --
>   2 files changed, 22 insertions(+), 56 deletions(-)
>
>
> diff --git a/osaf/services/saf/amf/amfd/include/node.h 
> b/osaf/services/saf/amf/amfd/include/node.h
> --- a/osaf/services/saf/amf/amfd/include/node.h
> +++ b/osaf/services/saf/amf/amfd/include/node.h
> @@ -147,7 +147,7 @@ typedef struct avd_avnd_tag {
>   typedef struct avd_ng_tag {
>   
>   NCS_PATRICIA_NODE tree_node;/* key will be AMF  node group name */
> - SaNameT ng_name;
> + SaNameT name;
>   uint32_t number_nodes;  /* number of element in saAmfNGNodeList */
>   SaNameT *saAmfNGNodeList;   /* array of node names in group */
>   
> diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc 
> b/osaf/services/saf/amf/amfd/nodegroup.cc
> --- a/osaf/services/saf/amf/amfd/nodegroup.cc
> +++ b/osaf/services/saf/amf/amfd/nodegroup.cc
> @@ -23,17 +23,7 @@
>   #include 
>   #include 
>   
> -static NCS_PATRICIA_TREE nodegroup_db;
> -
> -/**
> - * Add a node group object to the db.
> - * @param ng
> - */
> -static void ng_db_add(AVD_AMF_NG *ng)
> -{
> - unsigned int rc = ncs_patricia_tree_add(&nodegroup_db, &ng->tree_node);
> - osafassert(rc == NCSCC_RC_SUCCESS);
> -}
> +AmfDb *nodegroup_db = 0;
>   
>   /**
>* Lookup object in db using dn
> @@ -43,28 +33,7 @@ static void ng_db_add(AVD_AMF_NG *ng)
>*/
>   AVD_AMF_NG *avd_ng_get(const SaNameT *dn)
>   {
> - SaNameT tmp = {0};
> -
> - tmp.length = dn->length;
> - memcpy(tmp.value, dn->value, tmp.length);
> -
> - return (AVD_AMF_NG *)ncs_patricia_tree_get(&nodegroup_db, (uint8_t 
> *)&tmp);
> -}
> -
> -/**
> - * Get next object from db using dn
> - * @param dn
> - *
> - * @return AVD_AMF_NG*
> - */
> -static AVD_AMF_NG *ng_getnext(const SaNameT *dn)
> -{
> - SaNameT tmp = {0};
> -
> - tmp.length = dn->length;
> - memcpy(tmp.value, dn->value, tmp.length);
> -
> - return (AVD_AMF_NG *)ncs_patricia_tree_getnext(&nodegroup_db, (uint8_t 
> *)&tmp);
> + return nodegroup_db->find(dn);
>   }
>   
>   /**
> @@ -138,9 +107,9 @@ static AVD_AMF_NG *ng_create(SaNameT *dn
>   
>   ng = new AVD_AMF_NG();
>   
> - memcpy(ng->ng_name.value, dn->value, dn->length);
> - ng->ng_name.length = dn->length;
> - ng->tree_node.key_info = (uint8_t *)&(ng->ng_name);
> + memcpy(ng->name.value, dn->value, dn->length);
> + ng->name.length = dn->length;
> + ng->tree_node.key_info = (uint8_t *)&(ng->name);
>   
>   if 
> ((immutil_getAttrValuesNumber(const_cast("saAmfNGNodeList"), 
> attributes,
>   &values_number) == SA_AIS_OK) && (values_number > 0)) {
> @@ -174,10 +143,7 @@ done:
>*/
>   static void ng_delete(AVD_AMF_NG *ng)
>   {
> - unsigned int rc = ncs_patricia_tree_del(&nodegroup_db, &ng->tree_node);
> - osafassert(rc == NCSCC_RC_SUCCESS);
> -
> - osafassert(ng);
> + nodegroup_db->erase(ng);
>   free(ng->saAmfNGNodeList);
>   delete ng;
>   }
> @@ -203,8 +169,12 @@ SaAisErrorT avd_ng_config_get(void)
>   /* Could be here as a consequence of a fail/switch-over. Delete the DB
>   ** since it is anyway not synced and needs to be rebuilt. */
>   dn.length = 0;
> - for (ng = ng_getnext(&dn); ng != NULL; ng = ng_getnext(&dn))
> + for (std::map::const_iterator it = 
> nodegroup_db->begin();
> + it != nodegroup_db->end(); ) {
> + AVD_AMF_NG *ng = it->second;
> + it++;
>   ng_delete(ng);
> + }
>   
>   searchParam.searchOneAttr.attrName = 
> const_cast("SaImmAttrClassName");
>   searchParam.searchOneAttr.attrValueType = SA_IMM_ATTR_SASTRINGT;
> @@ -228,7 +198,7 @@ SaAisErrorT avd_ng_config_get(void)
>   if ((ng = ng_create(&dn, (const SaImmAttrValuesT_2 
> **)attributes)) == NULL)
>   goto done2;
>   
> - ng_db_add(ng);
> + nodegroup_db->insert(ng);
>   }
>   
>   rc = SA_AIS_OK;
> @@ -249,10 +219,10 @@ done1:
>*/
>   static bool su_is_mapped_to_node_via_nodegroup(const AVD_SU *su, const 
> AVD_AMF_NG *ng)
>   {
> - if ((memcmp(&ng->ng_name, &su->saAmfSUHostNodeOrNodeGroup, 
> sizeof(SaNameT)) == 0) ||
> - (memcmp(&ng->ng_name, &su->sg_of_su->saAmfSGSuHostNodeGroup, 
> sizeof(SaNameT)) == 0)) {
> + if ((memcmp(&ng->name, &su->saAmfSUHostNodeOrNodeGroup, 
> sizeof(SaNameT)) == 0) ||
> + (memcmp(&ng->name, &su->sg_of_su->saAmfSGSuHostNodeGroup, 
> sizeof(SaNameT)) == 0)) {
>   
> - TRACE("SU '%s' mapped using '%s'", su->name.value, 
> ng->ng_name.value);
> +   

Re: [devel] [PATCH 1 of 1] cpnd: increase performance when creating large numbers of sections [#770]

2014-05-23 Thread Anders Widell
Hi Alex!

Nice to see this performance enhancement out for review. Good work!

I have a few minor comments, see inline below (marked AndersW>):

regards,
Anders Widell

On 05/20/2014 11:27 PM, Alex Jones wrote:
>   osaf/libs/common/cpsv/include/cpnd_cb.h   |6 +-
>   osaf/libs/common/cpsv/include/cpnd_init.h |   14 +-
>   osaf/libs/common/cpsv/include/cpsv_evt.h  |2 +-
>   osaf/services/saf/cpsv/cpnd/Makefile.am   |3 +-
>   osaf/services/saf/cpsv/cpnd/cpnd_db.c |  246 +
>   osaf/services/saf/cpsv/cpnd/cpnd_evt.c|  115 ---
>   osaf/services/saf/cpsv/cpnd/cpnd_proc.c   |   26 +-
>   osaf/services/saf/cpsv/cpnd/cpnd_res.c|   15 +-
>   osaf/services/saf/cpsv/cpnd/cpnd_sec.cc   |  424 
> ++
>   9 files changed, 531 insertions(+), 320 deletions(-)
>
>
> Jan  7 21:32:32.772347 <1789648919> ERR|MDTM: Frag recd is not next frag 
> so dropping adest=<0x010010023922604c>
> Jan  7 21:32:32.772399 <1789648919> ERR|MDTM: Message is dropped as msg 
> is out of seq TRANSPOR-ID=<0x010010023922604c>
> With large numbers of sections (>5k) on the standby the CPU is pegged and all
> ckpt API functions return with SA_AIS_ERR_TIMEOUT, including ActiveReplicaSet,
> and CheckpointClose!
>
> The section id database is implemented as a linked list.  Each write to a
> section must traverse the list in order to find the section.  With 1000's of
> sections this takes a looong time.  Also, sync data being sent over is too 
> large
> for one packet (30M).  This causes the transport layer (in this case TIPC), to
> drop packets.  Lastly, the SectionCreate message is not asynchronous when
> ACTIVE_REPLICA is specified.
>
> Solution is in 3 parts:  (1) make the section id database a C++ STL map for 
> fast
> access.  (2) make MAX_SYNC_TRANSFER_SIZE much smaller: 3M instead of 30M.
> (3) SectionCreate message should be asynchronous when ACTIVE_REPLICA is
> specified.
>
> diff --git a/osaf/libs/common/cpsv/include/cpnd_cb.h 
> b/osaf/libs/common/cpsv/include/cpnd_cb.h
> --- a/osaf/libs/common/cpsv/include/cpnd_cb.h
> +++ b/osaf/libs/common/cpsv/include/cpnd_cb.h
> @@ -23,7 +23,7 @@
>   #include "ncs_queue.h"
>   
>   /* global variables */
> -uint32_t gl_cpnd_cb_hdl;
> +extern uint32_t gl_cpnd_cb_hdl;
>   
>   /* macros for the CB handle */
>   #define m_CPND_TAKE_CPND_CB  ncshm_take_hdl(NCS_SERVICE_ID_CPND, 
> gl_cpnd_cb_hdl)
> @@ -131,7 +131,6 @@ typedef struct cpnd_ckpt_section_info {
>   SaSizeT sec_size;
>   SaTimeT exp_tmr;
>   SaTimeT lastUpdate;
> - struct cpnd_ckpt_section_info *prev, *next;
>   } CPND_CKPT_SECTION_INFO;
>   
>   #define CPND_CKPT_SECTION_INFO_NULL ((CPND_CKPT_SECTION_INFO *)0)
> @@ -144,7 +143,8 @@ typedef struct cpnd_ckpt_replica_info_ta
>   SaUint32T mem_used; /* Used for status */
>   NCS_OS_POSIX_SHM_REQ_INFO open; /* for shm open */
>   uint32_t *shm_sec_mapping;  /* for validity of sec */
> - CPND_CKPT_SECTION_INFO *section_info;   /* Sections in the shared 
> memory */
> + void *section_db;   /* used for C++ STL map */
> + void *local_section_db; /* used for C++ STL map */
>   } CPND_CKPT_REPLICA_INFO;
>   
>   /*Structure to store info for ALL_REPL_WRITE EVT processing*/
> diff --git a/osaf/libs/common/cpsv/include/cpnd_init.h 
> b/osaf/libs/common/cpsv/include/cpnd_init.h
> --- a/osaf/libs/common/cpsv/include/cpnd_init.h
> +++ b/osaf/libs/common/cpsv/include/cpnd_init.h
> @@ -157,15 +157,21 @@ void cpnd_evt_node_getnext(CPND_CB *cb,
>   uint32_t cpnd_evt_node_add(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE 
> *evt_node);
>   uint32_t cpnd_evt_node_del(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE 
> *evt_node);
>   CPND_CKPT_NODE *cpnd_ckpt_node_find_by_name(CPND_CB *cpnd_cb, SaNameT 
> ckpt_name);
> -CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_get(CPND_CKPT_NODE *cp_node, 
> SaCkptSectionIdT *id);
> -CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_get_create(CPND_CKPT_NODE *cp_node, 
> SaCkptSectionIdT *id);
> -uint32_t cpnd_ckpt_sec_find(CPND_CKPT_NODE *cp_node, SaCkptSectionIdT *id);
> +void cpnd_ckpt_sec_map_init(CPND_CKPT_REPLICA_INFO *replica_info);
> +void cpnd_ckpt_sec_map_destroy(CPND_CKPT_REPLICA_INFO *replica_info);
> +CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_get_first(const CPND_CKPT_REPLICA_INFO 
> *replicaInfo);
> +CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_get_next(const CPND_CKPT_REPLICA_INFO 
> *replicaInfo, const CPND_CKPT_SECTION_INFO *section);
> +CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_get(const CPND_CKPT_NODE *cp_node, 
> const SaCkptSectionIdT *id);
> +CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_get_create(const CPND_CKPT_NODE 
> *cp_node, const SaCkptSectionIdT *id);
> +uint32_t cpnd_ckpt_sec_find(const CPND_CKPT_NODE *cp_node, const 
> SaCkptSectionIdT *id);
>   CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_del(CPND_CKPT_NODE *cp_node, 
> SaCkptSectionIdT *id);
>   CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CKPT_NODE *cp_node, 
> SaCkptSectionIdT *id, SaTimeT exp_time,
>

[devel] [PATCH 0 of 1] Review Request for amf #926

2014-05-23 Thread Hans Feldt
Summary: Fix sidepstate checkpointing
Review request for Trac Ticket(s): 926
Peer Reviewer(s): AMF team
Pull request to: <>
Affected branch(es): All
Development branch: 4.4


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesy
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-

changeset d933a1f00ffd10767e168beff9654d4abcb6bfcd
Author: Hans Feldt 
Date:   Fri, 23 May 2014 13:21:08 +0200

amfd: create SI to store ckpt:ed dep_state [#926]

abort in standby amfd with back trace:

#0 0x7f71264bcb35 in raise () from /lib64/libc.so.6 No symbol table 
info
available. #1 0x7f71264be111 in abort () from /lib64/libc.so.6 No 
symbol
table info available. #2 0x7f7127d51e07 in __osafassert_fail
(__file=, __line=, __func=,
__assertion=) at sysf_def.c:401 No locals. #3
0x004103e7 in dec_si_dep_state (cb=0x69c980, dec=) at
avd_ckpt_dec.c:2042 si_struct = 0x0

When an SI dependency is created on the active amfd it checkpoints the
dep_state. When this reach the standby amfd it has not yet created the 
SI so
it cannot store the state. The reason is the well-known race problem of
standby amfd being applier.

We fix this in standby amfd by creating the SI if it does not exist, 
this in
context of the xcheck point handling.


Complete diffstat:
--
 osaf/services/saf/amf/amfd/ckpt_dec.cc  |  7 +--
 osaf/services/saf/amf/amfd/include/si.h |  1 +
 osaf/services/saf/amf/amfd/si.cc|  2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)


Testing Commands:
-
 Not tested, just built


Testing, Expected Results:
--
 <>


Conditions of Submission:
-
 <>


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  n  n
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.


--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS 

[devel] [PATCH 1 of 1] amfd: create SI to store ckpt:ed dep_state [#926]

2014-05-23 Thread Hans Feldt
 osaf/services/saf/amf/amfd/ckpt_dec.cc  |  7 +--
 osaf/services/saf/amf/amfd/include/si.h |  1 +
 osaf/services/saf/amf/amfd/si.cc|  2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)


abort in standby amfd with back trace:

#0  0x7f71264bcb35 in raise () from /lib64/libc.so.6
No symbol table info available.
#1  0x7f71264be111 in abort () from /lib64/libc.so.6
No symbol table info available.
#2  0x7f7127d51e07 in __osafassert_fail (__file=, 
__line=, __func=, __assertion=)
at sysf_def.c:401
No locals.
#3  0x004103e7 in dec_si_dep_state (cb=0x69c980, dec=) 
at avd_ckpt_dec.c:2042
si_struct = 0x0

When an SI dependency is created on the active amfd it checkpoints the 
dep_state. When
this reach the standby amfd it has not yet created the SI so it cannot store 
the state.
The reason is the well-known race problem of standby amfd being applier.

We fix this in standby amfd by creating the SI if it does not exist, this in 
context of
the xcheck point handling.

diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
b/osaf/services/saf/amf/amfd/ckpt_dec.cc
--- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
+++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
@@ -2040,8 +2040,11 @@ static uint32_t dec_si_dep_state(AVD_CL_
 
osafassert(status == NCSCC_RC_SUCCESS);
 
-   if (NULL == (si_struct = avd_si_get(&si_ptr_dec->name)))
-   osafassert(0);
+   if (NULL == (si_struct = avd_si_get(&si_ptr_dec->name))) {
+   si_struct = avd_si_new(&si_ptr_dec->name);
+   osafassert(si_struct != NULL);
+   si_add_to_model(si_struct);
+   }
 
/* Update the fields received in this checkpoint message */
avd_sidep_si_dep_state_set(si_struct,si_ptr_dec->si_dep_state);
diff --git a/osaf/services/saf/amf/amfd/include/si.h 
b/osaf/services/saf/amf/amfd/include/si.h
--- a/osaf/services/saf/amf/amfd/include/si.h
+++ b/osaf/services/saf/amf/amfd/include/si.h
@@ -153,6 +153,7 @@ extern AVD_SI *avd_si_get(const SaNameT 
 extern AVD_SI *avd_si_getnext(const SaNameT *si_name);
 extern SaAisErrorT avd_si_config_get(struct avd_app_tag *app);
 extern void avd_si_constructor(void);
+void si_add_to_model(AVD_SI *si);
 
 extern AVD_SVC_TYPE *avd_svctype_get(const SaNameT *dn);
 extern SaAisErrorT avd_svctype_config_get(void);
diff --git a/osaf/services/saf/amf/amfd/si.cc b/osaf/services/saf/amf/amfd/si.cc
--- a/osaf/services/saf/amf/amfd/si.cc
+++ b/osaf/services/saf/amf/amfd/si.cc
@@ -466,7 +466,7 @@ AVD_SI *avd_si_getnext(const SaNameT *dn
return (AVD_SI *)ncs_patricia_tree_getnext(&si_db, (uint8_t *)&tmp);
 }
 
-static void si_add_to_model(AVD_SI *si)
+void si_add_to_model(AVD_SI *si)
 {
SaNameT dn;
 

--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 0 of 3] Review Request for Extended Name Type [#191]

2014-05-23 Thread Mathivanan Naickan Palanivelu
Hi Anders,

Good work.

Please find some comments(we have already discussed couple of them)

1) Iam thinking if we can make the **Lend and **Borrow to somehow (optimally) 
be included 
as a part of all service libraries. 
This would mean, the extended length handling(tunneling) is initialized as a 
part of  
saInitialize().

This way, the sa**Lend and sa**Borrow that is being proposed here would not be 
necessary
as everything is implicitly handled when that service user calls 
saInitialize().

2) I am also thinking whether we should check and see if we can avoid setting 
the environment variable
SA_ENABLE_EXTENDED_NAMES before starting the application.

 I mean, on top of turning on the build option, the additional environment 
variable sounds 
a crude approach! You might have thought/considered this, but still.

3) We had discussed about fixing a upper limit for the extended length. 
Otherwise, it would
be a security vulnerability.


I used the prototype and things did come up. Things also looked to work 
properly.
I will try to write from scratch an application and get back.

Cheers,
Mathi.


>-Original Message-
>From: Anders Widell [mailto:anders.wid...@ericsson.com]
>Sent: Friday, May 02, 2014 4:21 PM
>To: Mathivanan Naickan Palanivelu; anders.bjornerst...@ericsson.com
>Cc: opensaf-devel@lists.sourceforge.net
>Subject: [PATCH 0 of 3] Review Request for Extended Name Type [#191]
>
>Summary: Extended Name Type [#191]
>Review request for Trac Ticket(s): 191
>Peer Reviewer(s): Mathi, AndersBj
>Pull request to:
>Affected branch(es): default(4.5)
>Development branch: default
>
>
>Impacted area   Impact y/n
>
> Docsy
> Build systemn
> RPM/packaging   n
> Configuration files n
> Startup scripts n
> SAF servicesy
> OpenSAF servicesn
> Core libraries  y
> Samples n
> Tests   n
> Other   n
>
>
>Comments (indicate scope for each "y" above):
>-
>These patches add new AIS API functions and definitions for the extended
>SaNameT format, used to tunnel NUL-terminated strings through SaNameT.
>They also add support library functions to be used in agent libraries.
>
>changeset f3cf7ffb53b9a4dd6026cf58c262a46eac8bca3a
>Author:Anders Widell 
>Date:  Fri, 02 May 2014 12:44:08 +0200
>
>   osaf: Add saAisNameLend() and saAisNameBorrow() [#191]
>
>   Add declarations of saAisNameLend() and saAisNameBorrow() to
>saAis.h. Update
>   00-README.conf with description of how to enable the extended
>SaNameT type.
>
>changeset 84def835e0192244ba98eb6c80f192d2db26cd7d
>Author:Anders Widell 
>Date:  Fri, 02 May 2014 12:44:12 +0200
>
>   osaf: Add library functions for handling the extended SaNameT format
>[#191]
>
>   These library functions are primarily intended to be used in agent
>   libraries, to handle the old SAF APIs that still are using the SaNameT
>type.
>
>changeset 99143446a43030c140d0ae95192546108b7639e2
>Author:Anders Widell 
>Date:  Fri, 02 May 2014 12:44:16 +0200
>
>   imm: Add implementations of saAisNameLend and saAisNameBorrow
>[#191]
>
>   The functions saAisNameLend() and saAisNameBorrow() are defined
>in
>   saAis_B_5_14.h, but their implementation is placed in libSaImmOm
>since there
>   is no libSaAis library.
>
>
>Complete diffstat:
>--
> 00-README.conf |   18 +
> osaf/libs/agents/saf/imma/Makefile.am  |1 +
> osaf/libs/agents/saf/imma/aisa_api.c   |  131
>+++
>
> osaf/libs/core/common/Makefile.am  |1 +
> osaf/libs/core/common/include/osaf_extended_name.h |  232
>+++
>+++
>+
> osaf/libs/core/common/osaf_extended_name.c |  184
>+++
>+++
> osaf/libs/core/leap/sysf_def.c |3 +
> osaf/libs/saf/include/saAis.h  |4 ++
> osaf/libs/saf/include/saAis_B_5_14.h   |   17 
> osaf/libs/saf/libSaImm/libSaImmOm.map  |2 +
> 10 files changed, 593 insertions(+), 0 deletions(-)
>
>
>Testing Commands:
>-
>Build and start OpenSAF.
>
>
>Testing, Expected Results:
>--
>OpenSAF should build and start successfully.
>
>
>Conditions of Submission:
>-
>Ack from reviewers.
>
>
>Arch  Built StartedLinux distro
>---
>mipsn  n
>mips64  n  n
>x86 n  n
>x86_64  y  y
>powerpc n  n
>powerpc64   n  n

Re: [devel] [PATCH 1 of 1] log: Fix calculation of timeout time on 32 bit systems [#918]

2014-05-23 Thread Anders Widell
Ack with comment:

osaf_timespec_compare(¤t_ts, &evt->entered_at) < 1

On the line above you compare with 1, i.e. you require current time to 
be strictly greater than the entered time. In theory, the time stamps 
could be exactly the same, so you should compare with zero instead.

/ Anders Widell

On 05/22/2014 03:41 PM, Lennart Lund wrote:
>   osaf/services/saf/logsv/lgs/lgs_evt.c  |  32 
> 
>   osaf/services/saf/logsv/lgs/lgs_file.c |  24 +++-
>   osaf/services/saf/logsv/lgs/lgs_mds.c  |   5 +++--
>   3 files changed, 30 insertions(+), 31 deletions(-)
>
>
> Use opensaf time calculation help functions
>
> diff --git a/osaf/services/saf/logsv/lgs/lgs_evt.c 
> b/osaf/services/saf/logsv/lgs/lgs_evt.c
> --- a/osaf/services/saf/logsv/lgs/lgs_evt.c
> +++ b/osaf/services/saf/logsv/lgs/lgs_evt.c
> @@ -20,6 +20,7 @@
>   #include 
>   
>   #include "immutil.h"
> +#include "osaf_time.h"
>   
>   #include "lgs.h"
>   #include "lgs_util.h"
> @@ -1251,19 +1252,26 @@ static uint32_t process_api_evt(lgsv_lgs
>   goto done;
>   }
>   
> - // Discard too old messages. Don't discard writes as they are async,
> - // no one is waiting on a response
> + /* Discard too old messages. Don't discard writes as they are async,
> +  * no one is waiting on a response.
> +  * Using osaf time functions will guarantee that code works on 32 and 
> 64 bit
> +  * systems.
> +  */
>   if (api_type < LGSV_WRITE_LOG_ASYNC_REQ) {
> - struct timespec ts;
> - osafassert(clock_gettime(CLOCK_MONOTONIC, &ts) == 0);
> -
> - // convert to milliseconds
> - uint64_t entered = (evt->entered_at.tv_sec * 1000) +
> -  (evt->entered_at.tv_nsec / 100);
> - uint64_t removed = (ts.tv_sec * 1000) + (ts.tv_nsec / 100);
> -
> - // compare with sync send time used in library
> - if ((removed - entered) > (LGS_WAIT_TIME * 10)) {
> + struct timespec current_ts, diff_ts;
> + osaf_clock_gettime(CLOCK_MONOTONIC, ¤t_ts);
> + 
> + /* Calculate time diff current - entered */
> + if (osaf_timespec_compare(¤t_ts, &evt->entered_at) < 1) {
> + LOG_ER("%s - Entered message time > current time", 
> __FUNCTION__);
> + osafassert(0);
> + }
> + osaf_timespec_subtract(¤t_ts, &evt->entered_at, &diff_ts);
> + 
> + /* Convert to millisec and compare with sync send time used in
> +  * library
> +  */
> + if (osaf_timespec_to_millis(&diff_ts) > (LGS_WAIT_TIME * 10)) {
>   LOG_IN("discarded message from %" PRIx64 " type %u",
>   evt->fr_dest, api_type);
>   goto done;
> diff --git a/osaf/services/saf/logsv/lgs/lgs_file.c 
> b/osaf/services/saf/logsv/lgs/lgs_file.c
> --- a/osaf/services/saf/logsv/lgs/lgs_file.c
> +++ b/osaf/services/saf/logsv/lgs/lgs_file.c
> @@ -34,15 +34,14 @@
>   
>   #include "lgs.h"
>   #include "osaf_utility.h"
> -
> -#define GETTIME(x) osafassert(clock_gettime(CLOCK_REALTIME, &x) == 0);
> +#include "osaf_time.h"
>   
>   pthread_mutex_t lgs_ftcom_mutex;/* For locking communication */
>   static pthread_cond_t request_cv;   /* File thread waiting for request */
>   static pthread_cond_t answer_cv;/* API waiting for answer (timed) */
>   
>   /* Max time to wait for file thread to finish */
> -static SaUint32T max_waittime_ms = 500;
> +static uint32_t max_waittime_ms = 500;
>   
>   struct file_communicate {
>   bool request_f; /* True if pending request */
> @@ -82,22 +81,13 @@ static int start_file_thread(void);
>* @param timeout_time[out]
>* @param timeout_ms[in] in ms
>*/
> -static void get_timeout_time(struct timespec *timeout_time, long int 
> timeout_ms)
> +static void get_timeout_time(struct timespec *timeout_time, uint32_t 
> timeout_ms)
>   {
> - struct timespec start_time;
> - uint64_t millisec1,millisec2;
> + struct timespec start_time, add_time;
>   
> - GETTIME(start_time);
> - 
> - /* Convert to ms */
> - millisec1 = (start_time.tv_sec * 1000) + (start_time.tv_nsec / 100);
> - 
> - /* Add timeout time */
> - millisec2 = millisec1+timeout_ms;
> - 
> - /* Convert back to timespec */
> - timeout_time->tv_sec = millisec2 / 1000;
> - timeout_time->tv_nsec = (millisec2 % 1000) * 100;
> + osaf_clock_gettime(CLOCK_REALTIME, &start_time);
> + osaf_millis_to_timespec((uint64_t) timeout_ms, &add_time);
> + osaf_timespec_add(&start_time, &add_time, timeout_time);
>   }
>   
>   
> /*
> diff --git a/osaf/services/saf/logsv/lgs/lgs_mds.c 
> b/osaf/services/saf/logsv/lgs/lgs_mds.c
> --- a/osaf/services/saf/logsv/lgs/lgs_mds.c
> +++ b/o

Re: [devel] [PATCH 1 of 1] amfd: replace patricia tree with stl::maps in nodegroup [#713]

2014-05-23 Thread Nagendra Kumar
> - for (ng = ng_getnext(&dn); ng != NULL; ng = ng_getnext(&dn))
> + for (std::map::const_iterator it = 
> nodegroup_db->begin();
> + it != nodegroup_db->end(); ) {
> + AVD_AMF_NG *ng = it->second;
> + it++;
[Hans] move to for statements after semicolon
> 
> > ng_delete(ng);
> > +   }

I incremented it before ng_delete and not in for loop, because the element is 
getting deleted in ng_delete(ng);
So, I thought it is rather good to increment to next before, it gets deleted.

Thanks
-Nagu

> -Original Message-
> From: Hans Feldt [mailto:hans.fe...@ericsson.com]
> Sent: 23 May 2014 15:31
> To: Nagendra Kumar; Hans Nordebäck; Praveen Malviya
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: RE: [PATCH 1 of 1] amfd: replace patricia tree with stl::maps in
> nodegroup [#713]
> 
> Ack with minor comments inline
> /Hans
> 
> > -Original Message-
> > From: nagendr...@oracle.com [mailto:nagendr...@oracle.com]
> > Sent: den 23 maj 2014 10:45
> > To: Hans Feldt; Hans Nordebäck; praveen.malv...@oracle.com
> > Cc: opensaf-devel@lists.sourceforge.net
> > Subject: [PATCH 1 of 1] amfd: replace patricia tree with stl::maps in
> nodegroup [#713]
> >
> >  osaf/services/saf/amf/amfd/include/node.h |   2 +-
> >  osaf/services/saf/amf/amfd/nodegroup.cc   |  76 
> > --
> >  2 files changed, 22 insertions(+), 56 deletions(-)
> >
> >
> > diff --git a/osaf/services/saf/amf/amfd/include/node.h
> b/osaf/services/saf/amf/amfd/include/node.h
> > --- a/osaf/services/saf/amf/amfd/include/node.h
> > +++ b/osaf/services/saf/amf/amfd/include/node.h
> > @@ -147,7 +147,7 @@ typedef struct avd_avnd_tag {
> >  typedef struct avd_ng_tag {
> >
> > NCS_PATRICIA_NODE tree_node;/* key will be AMF  node
> group name */
> > -   SaNameT ng_name;
> > +   SaNameT name;
> > uint32_t number_nodes;  /* number of element in
> saAmfNGNodeList */
> > SaNameT *saAmfNGNodeList;   /* array of node names in group */
> >
> > diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc
> b/osaf/services/saf/amf/amfd/nodegroup.cc
> > --- a/osaf/services/saf/amf/amfd/nodegroup.cc
> > +++ b/osaf/services/saf/amf/amfd/nodegroup.cc
> > @@ -23,17 +23,7 @@
> >  #include 
> >  #include 
> >
> > -static NCS_PATRICIA_TREE nodegroup_db;
> > -
> > -/**
> > - * Add a node group object to the db.
> > - * @param ng
> > - */
> > -static void ng_db_add(AVD_AMF_NG *ng)
> > -{
> > -   unsigned int rc = ncs_patricia_tree_add(&nodegroup_db, &ng-
> >tree_node);
> > -   osafassert(rc == NCSCC_RC_SUCCESS);
> > -}
> > +AmfDb *nodegroup_db = 0;
> [Hans] = NULL;
> 
> >
> >  /**
> >   * Lookup object in db using dn
> > @@ -43,28 +33,7 @@ static void ng_db_add(AVD_AMF_NG *ng)
> >   */
> >  AVD_AMF_NG *avd_ng_get(const SaNameT *dn)
> >  {
> > -   SaNameT tmp = {0};
> > -
> > -   tmp.length = dn->length;
> > -   memcpy(tmp.value, dn->value, tmp.length);
> > -
> > -   return (AVD_AMF_NG *)ncs_patricia_tree_get(&nodegroup_db,
> (uint8_t *)&tmp);
> > -}
> > -
> > -/**
> > - * Get next object from db using dn
> > - * @param dn
> > - *
> > - * @return AVD_AMF_NG*
> > - */
> > -static AVD_AMF_NG *ng_getnext(const SaNameT *dn)
> > -{
> > -   SaNameT tmp = {0};
> > -
> > -   tmp.length = dn->length;
> > -   memcpy(tmp.value, dn->value, tmp.length);
> > -
> > -   return (AVD_AMF_NG *)ncs_patricia_tree_getnext(&nodegroup_db,
> (uint8_t *)&tmp);
> > +   return nodegroup_db->find(dn);
> >  }
> >
> >  /**
> > @@ -138,9 +107,9 @@ static AVD_AMF_NG *ng_create(SaNameT *dn
> >
> > ng = new AVD_AMF_NG();
> >
> > -   memcpy(ng->ng_name.value, dn->value, dn->length);
> > -   ng->ng_name.length = dn->length;
> > -   ng->tree_node.key_info = (uint8_t *)&(ng->ng_name);
> > +   memcpy(ng->name.value, dn->value, dn->length);
> > +   ng->name.length = dn->length;
> > +   ng->tree_node.key_info = (uint8_t *)&(ng->name);
> >
> > if
> ((immutil_getAttrValuesNumber(const_cast("saAmfNGNod
> eList"), attributes,
> > &values_number) == SA_AIS_OK) && (values_number > 0)) {
> > @@ -174,10 +143,7 @@ done:
> >   */
> >  static void ng_delete(AVD_AMF_NG *ng)
> >  {
> > -   unsigned int rc = ncs_patricia_tree_del(&nodegroup_db, &ng-
> >tree_node);
> > -   osafassert(rc == NCSCC_RC_SUCCESS);
> > -
> > -   osafassert(ng);
> > +   nodegroup_db->erase(ng);
> > free(ng->saAmfNGNodeList);
> > delete ng;
> >  }
> > @@ -203,8 +169,12 @@ SaAisErrorT avd_ng_config_get(void)
> > /* Could be here as a consequence of a fail/switch-over. Delete the DB
> > ** since it is anyway not synced and needs to be rebuilt. */
> > dn.length = 0;
> > -   for (ng = ng_getnext(&dn); ng != NULL; ng = ng_getnext(&dn))
> > +   for (std::map::const_iterator it =
> nodegroup_db->begin();
> > +   it != nodegroup_db->end(); ) {
> > +   AVD_AMF_NG *ng = it->second;
> > +   it++;
> [Hans] move to for statements after semicolon
> 
> > ng_delete(ng);
> > +   }
> >
> >

Re: [devel] [PATCH 1 of 1] amfd: replace patricia tree with stl::maps in nodegroup [#713]

2014-05-23 Thread Hans Feldt
Ack with minor comments inline
/Hans

> -Original Message-
> From: nagendr...@oracle.com [mailto:nagendr...@oracle.com]
> Sent: den 23 maj 2014 10:45
> To: Hans Feldt; Hans Nordebäck; praveen.malv...@oracle.com
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 1] amfd: replace patricia tree with stl::maps in 
> nodegroup [#713]
> 
>  osaf/services/saf/amf/amfd/include/node.h |   2 +-
>  osaf/services/saf/amf/amfd/nodegroup.cc   |  76 
> --
>  2 files changed, 22 insertions(+), 56 deletions(-)
> 
> 
> diff --git a/osaf/services/saf/amf/amfd/include/node.h 
> b/osaf/services/saf/amf/amfd/include/node.h
> --- a/osaf/services/saf/amf/amfd/include/node.h
> +++ b/osaf/services/saf/amf/amfd/include/node.h
> @@ -147,7 +147,7 @@ typedef struct avd_avnd_tag {
>  typedef struct avd_ng_tag {
> 
>   NCS_PATRICIA_NODE tree_node;/* key will be AMF  node group name */
> - SaNameT ng_name;
> + SaNameT name;
>   uint32_t number_nodes;  /* number of element in saAmfNGNodeList */
>   SaNameT *saAmfNGNodeList;   /* array of node names in group */
> 
> diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc 
> b/osaf/services/saf/amf/amfd/nodegroup.cc
> --- a/osaf/services/saf/amf/amfd/nodegroup.cc
> +++ b/osaf/services/saf/amf/amfd/nodegroup.cc
> @@ -23,17 +23,7 @@
>  #include 
>  #include 
> 
> -static NCS_PATRICIA_TREE nodegroup_db;
> -
> -/**
> - * Add a node group object to the db.
> - * @param ng
> - */
> -static void ng_db_add(AVD_AMF_NG *ng)
> -{
> - unsigned int rc = ncs_patricia_tree_add(&nodegroup_db, &ng->tree_node);
> - osafassert(rc == NCSCC_RC_SUCCESS);
> -}
> +AmfDb *nodegroup_db = 0;
[Hans] = NULL;

> 
>  /**
>   * Lookup object in db using dn
> @@ -43,28 +33,7 @@ static void ng_db_add(AVD_AMF_NG *ng)
>   */
>  AVD_AMF_NG *avd_ng_get(const SaNameT *dn)
>  {
> - SaNameT tmp = {0};
> -
> - tmp.length = dn->length;
> - memcpy(tmp.value, dn->value, tmp.length);
> -
> - return (AVD_AMF_NG *)ncs_patricia_tree_get(&nodegroup_db, (uint8_t 
> *)&tmp);
> -}
> -
> -/**
> - * Get next object from db using dn
> - * @param dn
> - *
> - * @return AVD_AMF_NG*
> - */
> -static AVD_AMF_NG *ng_getnext(const SaNameT *dn)
> -{
> - SaNameT tmp = {0};
> -
> - tmp.length = dn->length;
> - memcpy(tmp.value, dn->value, tmp.length);
> -
> - return (AVD_AMF_NG *)ncs_patricia_tree_getnext(&nodegroup_db, (uint8_t 
> *)&tmp);
> + return nodegroup_db->find(dn);
>  }
> 
>  /**
> @@ -138,9 +107,9 @@ static AVD_AMF_NG *ng_create(SaNameT *dn
> 
>   ng = new AVD_AMF_NG();
> 
> - memcpy(ng->ng_name.value, dn->value, dn->length);
> - ng->ng_name.length = dn->length;
> - ng->tree_node.key_info = (uint8_t *)&(ng->ng_name);
> + memcpy(ng->name.value, dn->value, dn->length);
> + ng->name.length = dn->length;
> + ng->tree_node.key_info = (uint8_t *)&(ng->name);
> 
>   if 
> ((immutil_getAttrValuesNumber(const_cast("saAmfNGNodeList"), 
> attributes,
>   &values_number) == SA_AIS_OK) && (values_number > 0)) {
> @@ -174,10 +143,7 @@ done:
>   */
>  static void ng_delete(AVD_AMF_NG *ng)
>  {
> - unsigned int rc = ncs_patricia_tree_del(&nodegroup_db, &ng->tree_node);
> - osafassert(rc == NCSCC_RC_SUCCESS);
> -
> - osafassert(ng);
> + nodegroup_db->erase(ng);
>   free(ng->saAmfNGNodeList);
>   delete ng;
>  }
> @@ -203,8 +169,12 @@ SaAisErrorT avd_ng_config_get(void)
>   /* Could be here as a consequence of a fail/switch-over. Delete the DB
>   ** since it is anyway not synced and needs to be rebuilt. */
>   dn.length = 0;
> - for (ng = ng_getnext(&dn); ng != NULL; ng = ng_getnext(&dn))
> + for (std::map::const_iterator it = 
> nodegroup_db->begin();
> + it != nodegroup_db->end(); ) {
> + AVD_AMF_NG *ng = it->second;
> + it++;
[Hans] move to for statements after semicolon

>   ng_delete(ng);
> + }
> 
>   searchParam.searchOneAttr.attrName = 
> const_cast("SaImmAttrClassName");
>   searchParam.searchOneAttr.attrValueType = SA_IMM_ATTR_SASTRINGT;
> @@ -228,7 +198,7 @@ SaAisErrorT avd_ng_config_get(void)
>   if ((ng = ng_create(&dn, (const SaImmAttrValuesT_2 
> **)attributes)) == NULL)
>   goto done2;
> 
> - ng_db_add(ng);
> + nodegroup_db->insert(ng);
>   }
> 
>   rc = SA_AIS_OK;
> @@ -249,10 +219,10 @@ done1:
>   */
>  static bool su_is_mapped_to_node_via_nodegroup(const AVD_SU *su, const 
> AVD_AMF_NG *ng)
>  {
> - if ((memcmp(&ng->ng_name, &su->saAmfSUHostNodeOrNodeGroup, 
> sizeof(SaNameT)) == 0) ||
> - (memcmp(&ng->ng_name, &su->sg_of_su->saAmfSGSuHostNodeGroup, 
> sizeof(SaNameT)) == 0)) {
> + if ((memcmp(&ng->name, &su->saAmfSUHostNodeOrNodeGroup, 
> sizeof(SaNameT)) == 0) ||
> + (memcmp(&ng->name, &su->sg_of_su->saAmfSGSuHostNodeGroup, 
> sizeof(SaNameT)) == 0)) {
> 
> - TRACE("SU '%s'

Re: [devel] [PATCH 1 of 1] base: add encode/decode utility functions [#910]

2014-05-23 Thread Ramesh Betham
Ack.

Thanks,
Ramesh.

On 5/22/2014 6:28 PM, Hans Feldt wrote:
>   osaf/libs/core/include/ncsencdec_pub.h |  110 +++--
>   osaf/libs/core/leap/hj_enc.c   |  144 
> 
>   2 files changed, 171 insertions(+), 83 deletions(-)
>
>
> Services not using EDU ends repeating functionality that should be common.
> This patch proposes a set of functions that makes it easy to removed use of 
> EDU.
> Functions for certain data types are missing but would be easy to add as 
> needed.
>
> diff --git a/osaf/libs/core/include/ncsencdec_pub.h 
> b/osaf/libs/core/include/ncsencdec_pub.h
> --- a/osaf/libs/core/include/ncsencdec_pub.h
> +++ b/osaf/libs/core/include/ncsencdec_pub.h
> @@ -1,6 +1,6 @@
>   /*  -*- OpenSAF  -*-
>*
> - * (C) Copyright 2008 The OpenSAF Foundation
> + * (C) Copyright 2008-2014 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
> @@ -11,7 +11,7 @@
>* See the Copying file included with the OpenSAF distribution for full
>* licensing terms.
>*
> - * Author(s): Emerson Network Power
> + * Author(s): Emerson Network Power, Ericsson
>*
>*/
>   
> @@ -92,6 +92,8 @@
>   
>   #include "ncsgl_defs.h"
>   #include "ncs_osprm.h"
> +#include 
> +#include 
>   #include "ncsusrbuf.h"
>   #include "ncs_svd.h"
>   
> @@ -102,84 +104,68 @@ extern "C" {
>   /*
>* NCS_ENC encode functions
>*/
> - USRBUF *ncs_encode_n_octets(USRBUF *, uint8_t *, unsigned int);
> - USRBUF *ncs_encode_uns8(USRBUF *u, uint8_t val8);
> - USRBUF *ncs_encode_uns16(USRBUF *u, uint16_t val16);
> - USRBUF *ncs_encode_uns32(USRBUF *u, uint32_t val32);
> - USRBUF *ncs_encode_uns64(USRBUF *u, uint64_t val64);
> - USRBUF *ncs_prepend_n_octets(USRBUF *pbuf, uint8_t *os, unsigned int);
> - USRBUF *ncs_prepend_uns16(USRBUF *u, uint16_t);
> - USRBUF *ncs_prepend_uns32(USRBUF *u, uint32_t);
> - USRBUF *ncs_prepend_uns64(USRBUF *u, uint64_t);
> - USRBUF *ncs_encode_float(USRBUF *u, float obj_val);
> +USRBUF *ncs_encode_n_octets(USRBUF *, uint8_t *, unsigned int);
> +USRBUF *ncs_encode_uns8(USRBUF *u, uint8_t val8);
> +USRBUF *ncs_encode_uns16(USRBUF *u, uint16_t val16);
> +USRBUF *ncs_encode_uns32(USRBUF *u, uint32_t val32);
> +USRBUF *ncs_encode_uns64(USRBUF *u, uint64_t val64);
> +USRBUF *ncs_prepend_n_octets(USRBUF *pbuf, uint8_t *os, unsigned int);
> +USRBUF *ncs_prepend_uns16(USRBUF *u, uint16_t);
> +USRBUF *ncs_prepend_uns32(USRBUF *u, uint32_t);
> +USRBUF *ncs_prepend_uns64(USRBUF *u, uint64_t);
> +USRBUF *ncs_encode_float(USRBUF *u, float obj_val);
>   
> - uint64_t ncs_encode_64bit(uint8_t **stream, uint64_t);
> - uint32_t ncs_encode_32bit(uint8_t **stream, uint32_t);
> - uint32_t ncs_encode_24bit(uint8_t **stream, uint32_t);
> - uint32_t ncs_encode_16bit(uint8_t **stream, uint32_t);
> - uint32_t ncs_encode_8bit(uint8_t **stream, uint32_t);
> - uint32_t ncs_encode_key(uint8_t **stream, NCS_KEY *key);
> -
> - uint32_t ncs_encode_octets(uint8_t **stream, uint8_t *val, uint32_t 
> count);
> +uint64_t ncs_encode_64bit(uint8_t **stream, uint64_t);
> +uint32_t ncs_encode_32bit(uint8_t **stream, uint32_t);
> +uint32_t ncs_encode_24bit(uint8_t **stream, uint32_t);
> +uint32_t ncs_encode_16bit(uint8_t **stream, uint32_t);
> +uint32_t ncs_encode_8bit(uint8_t **stream, uint32_t);
> +uint32_t ncs_encode_key(uint8_t **stream, NCS_KEY *key);
> +uint32_t ncs_encode_octets(uint8_t **stream, uint8_t *val, uint32_t count);
>   
>   /*
>* NCS_DEC decode functions
>*/
> - USRBUF *ncs_decode_n_octets(USRBUF *, uint8_t *, uint32_t);
> +USRBUF *ncs_decode_n_octets(USRBUF *, uint8_t *, uint32_t);
>   
> - USRBUF *ncs_skip_n_octets(USRBUF *, uint32_t);
> - uint8_t *ncs_flatten_n_octets(USRBUF *u, uint8_t *os, uint32_t count);
> +USRBUF *ncs_skip_n_octets(USRBUF *, uint32_t);
> +uint8_t *ncs_flatten_n_octets(USRBUF *u, uint8_t *os, uint32_t count);
>   
> - uint32_t ncs_decode_short(uint8_t **stream);
> - uint32_t ncs_decode_24bit(uint8_t **stream);
> - uint32_t ncs_decode_32bit(uint8_t **stream);
> - uint16_t ncs_decode_16bit(uint8_t **stream);
> - uint64_t ncs_decode_64bit(uint8_t **stream);
> - uint8_t ncs_decode_8bit(uint8_t **stream);
> - uint32_t ncs_decode_key(uint8_t **stream, NCS_KEY *key);
> +uint32_t ncs_decode_short(uint8_t **stream);
> +uint32_t ncs_decode_24bit(uint8_t **stream);
> +uint32_t ncs_decode_32bit(uint8_t **stream);
> +uint16_t ncs_decode_16bit(uint8_t **stream);
> +uint64_t ncs_decode_64bit(uint8_t **stream);
> +uint8_t ncs_decode_8bit(uint8_t **stream);
> +uint32_t ncs_decode_key(uint8_t **stream, NCS_KEY *key);
> +float ncs_decode_float(uint8_t **stream);
>   
> - float ncs_decode_float(uint8_t **stream);
> -
> -/*
> - * STRU

[devel] [PATCH 4 of 4] amfd: use db_template to replace patricia tree in AVD_CTCS_TYPE [#713]

2014-05-23 Thread praveen . malviya
 osaf/services/saf/amf/amfd/compcstype.cc  |   4 +-
 osaf/services/saf/amf/amfd/ctcstype.cc|  37 +++---
 osaf/services/saf/amf/amfd/include/comp.h |   5 ++-
 osaf/services/saf/amf/amfd/util.cc|   2 +-
 4 files changed, 15 insertions(+), 33 deletions(-)


diff --git a/osaf/services/saf/amf/amfd/compcstype.cc 
b/osaf/services/saf/amf/amfd/compcstype.cc
--- a/osaf/services/saf/amf/amfd/compcstype.cc
+++ b/osaf/services/saf/amf/amfd/compcstype.cc
@@ -206,7 +206,7 @@ static int is_config_valid(const SaNameT
 
ctcstype_name.length = sprintf((char*)ctcstype_name.value, "%s,%s", 
cstype_name, comptype_name->value);
 
-   if (avd_ctcstype_get(&ctcstype_name) == NULL) {
+   if (ctcstype_db->find(&ctcstype_name) == NULL) {
if (opdata == NULL) {
report_ccb_validation_error(opdata, "'%s' does not 
exist in model", ctcstype_name.value);
goto free_cstype_name;
@@ -258,7 +258,7 @@ static AVD_COMPCS_TYPE *compcstype_creat
ctcstype_name.length = sprintf((char*)ctcstype_name.value,
"%s,%s", cstype_name, comp->comp_type->name.value);
 
-   ctcstype = avd_ctcstype_get(&ctcstype_name);
+   ctcstype = ctcstype_db->find(&ctcstype_name);
 
if 
(immutil_getAttr(const_cast("saAmfCompNumMaxActiveCSIs"), 
attributes, 0,
&num_max_act_csi) != SA_AIS_OK) {
diff --git a/osaf/services/saf/amf/amfd/ctcstype.cc 
b/osaf/services/saf/amf/amfd/ctcstype.cc
--- a/osaf/services/saf/amf/amfd/ctcstype.cc
+++ b/osaf/services/saf/amf/amfd/ctcstype.cc
@@ -23,11 +23,11 @@
 #include 
 #include 
 
-static NCS_PATRICIA_TREE ctcstype_db;
+AmfDb *ctcstype_db = NULL;
 
 static void ctcstype_db_add(AVD_CTCS_TYPE *ctcstype)
 {
-   unsigned int rc = ncs_patricia_tree_add(&ctcstype_db, 
&ctcstype->tree_node);
+   unsigned int rc = ctcstype_db->insert(ctcstype);
osafassert(rc == NCSCC_RC_SUCCESS);
 }
 
@@ -74,7 +74,6 @@ static AVD_CTCS_TYPE *ctcstype_create(co
 
memcpy(ctcstype->name.value, dn->value, dn->length);
ctcstype->name.length = dn->length;
-   ctcstype->tree_node.key_info = (uint8_t *)&(ctcstype->name);
 
error = 
immutil_getAttr(const_cast("saAmfCtCompCapability"), 
attributes, 0, &ctcstype->saAmfCtCompCapability);
osafassert(error == SA_AIS_OK);
@@ -96,25 +95,6 @@ static AVD_CTCS_TYPE *ctcstype_create(co
return ctcstype;
 }
 
-static void ctcstype_delete(AVD_CTCS_TYPE *ctcstype)
-{
-   unsigned int rc;
-
-   rc = ncs_patricia_tree_del(&ctcstype_db, &ctcstype->tree_node);
-   osafassert(rc == NCSCC_RC_SUCCESS);
-   delete ctcstype;
-}
-
-AVD_CTCS_TYPE *avd_ctcstype_get(const SaNameT *dn)
-{
-   SaNameT tmp = {0};
-
-   tmp.length = dn->length;
-   memcpy(tmp.value, dn->value, tmp.length);
-
-   return (AVD_CTCS_TYPE *)ncs_patricia_tree_get(&ctcstype_db, (uint8_t 
*)&tmp);
-}
-
 SaAisErrorT avd_ctcstype_config_get(const SaNameT *comp_type_dn, AVD_COMP_TYPE 
*comp_type)
 {
SaAisErrorT error = SA_AIS_ERR_FAILED_OPERATION;
@@ -143,7 +123,7 @@ SaAisErrorT avd_ctcstype_config_get(cons
if (!is_config_valid(&dn, attributes, NULL))
goto done2;
 
-   if ((ctcstype = avd_ctcstype_get(&dn)) == NULL ) {
+   if ((ctcstype = ctcstype_db->find(&dn)) == NULL ) {
if ((ctcstype = ctcstype_create(&dn, attributes)) == 
NULL)
goto done2;
 
@@ -199,8 +179,11 @@ static void ctcstype_ccb_apply_cb(CcbUti
ctcstype_db_add(ctcstype);
break;
case CCBUTIL_DELETE:
-   ctcstype = avd_ctcstype_get(&opdata->objectName);
-   ctcstype_delete(ctcstype);
+   ctcstype = ctcstype_db->find(&opdata->objectName);
+   if (ctcstype != NULL) {
+   ctcstype_db->erase(ctcstype);
+   delete ctcstype;
+   }
break;
default:
osafassert(0);
@@ -212,10 +195,8 @@ static void ctcstype_ccb_apply_cb(CcbUti
 
 void avd_ctcstype_constructor(void)
 {
-   NCS_PATRICIA_PARAMS patricia_params;
+   ctcstype_db = new AmfDb;
 
-   patricia_params.key_size = sizeof(SaNameT);
-   osafassert(ncs_patricia_tree_init(&ctcstype_db, &patricia_params) == 
NCSCC_RC_SUCCESS);
avd_class_impl_set("SaAmfCtCsType", NULL, NULL,
ctcstype_ccb_completed_cb, ctcstype_ccb_apply_cb);
 }
diff --git a/osaf/services/saf/amf/amfd/include/comp.h 
b/osaf/services/saf/amf/amfd/include/comp.h
--- a/osaf/services/saf/amf/amfd/include/comp.h
+++ b/osaf/services/saf/amf/amfd/include/comp.h
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include "db_template.h"
 
 class AVD_SU;
 
@@ -165,7 +166,6 @@ typedef struct avd_comp_cs_type_tag {
 
 /* AMF Class SaAmfCtCsType */
 typedef struct {
-   NCS_PATRICIA_NODE tree_node;/* nam

[devel] [PATCH 1 of 4] amfd: use db_template to replace patricia tree in AVD_SVC_TYPE_CS_TYPE [#713]

2014-05-23 Thread praveen . malviya
 osaf/services/saf/amf/amfd/include/si.h  |   4 +--
 osaf/services/saf/amf/amfd/si.cc |   1 -
 osaf/services/saf/amf/amfd/svctypecstypes.cc |  40 +++
 3 files changed, 12 insertions(+), 33 deletions(-)


diff --git a/osaf/services/saf/amf/amfd/include/si.h 
b/osaf/services/saf/amf/amfd/include/si.h
--- a/osaf/services/saf/amf/amfd/include/si.h
+++ b/osaf/services/saf/amf/amfd/include/si.h
@@ -69,7 +69,6 @@ typedef struct avd_sirankedsu {
  */
 typedef struct avd_si_tag {
 
-   NCS_PATRICIA_NODE tree_node;/* key will be the SI name */
SaNameT name;
 
/ B.04 model 
*/
@@ -121,7 +120,6 @@ typedef struct avd_amf_svc_type_tag {
 } AVD_SVC_TYPE;
 
 typedef struct {
-   NCS_PATRICIA_NODE tree_node;/* key is name */
SaNameT name;
SaUint32T saAmfSvctMaxNumCSIs;
 
@@ -133,6 +131,7 @@ typedef struct {
 } AVD_SVC_TYPE_CS_TYPE;
 
 extern AmfDb *si_db;
+extern AmfDb *svctypecstypes_db;
 #define AVD_SI_NULL ((AVD_SI *)0)
 #define m_AVD_SI_ACTV_MAX_SU(l_si) (l_si)->saAmfSIPrefActiveAssignments
 #define m_AVD_SI_ACTV_CURR_SU(l_si) (l_si)->saAmfSINumCurrActiveAssignments
@@ -161,7 +160,6 @@ extern void avd_svctype_remove_si(AVD_SI
 extern void avd_svctype_constructor(void);
 
 extern SaAisErrorT avd_svctypecstypes_config_get(SaNameT *svctype_name);
-extern AVD_SVC_TYPE_CS_TYPE *avd_svctypecstypes_get(const SaNameT 
*svctypecstypes_name);
 extern void avd_svctypecstypes_constructor(void);
 extern void avd_si_inc_curr_act_ass(AVD_SI *si);
 extern void avd_si_dec_curr_act_ass(AVD_SI *si);
diff --git a/osaf/services/saf/amf/amfd/si.cc b/osaf/services/saf/amf/amfd/si.cc
--- a/osaf/services/saf/amf/amfd/si.cc
+++ b/osaf/services/saf/amf/amfd/si.cc
@@ -331,7 +331,6 @@ AVD_SI *avd_si_new(const SaNameT *dn)
 
memcpy(si->name.value, dn->value, dn->length);
si->name.length = dn->length;
-   si->tree_node.key_info = (uint8_t *)&si->name;
si->si_switch = AVSV_SI_TOGGLE_STABLE;
si->saAmfSIAdminState = SA_AMF_ADMIN_UNLOCKED;
si->si_dep_state = AVD_SI_NO_DEPENDENCY;
diff --git a/osaf/services/saf/amf/amfd/svctypecstypes.cc 
b/osaf/services/saf/amf/amfd/svctypecstypes.cc
--- a/osaf/services/saf/amf/amfd/svctypecstypes.cc
+++ b/osaf/services/saf/amf/amfd/svctypecstypes.cc
@@ -20,11 +20,11 @@
 #include 
 #include 
 
-static NCS_PATRICIA_TREE svctypecstypes_db;
 
+AmfDb *svctypecstypes_db = NULL;
 static void svctypecstype_db_add(AVD_SVC_TYPE_CS_TYPE *svctypecstype)
 {
-   unsigned int rc = ncs_patricia_tree_add(&svctypecstypes_db, 
&svctypecstype->tree_node);
+   uint32_t rc = svctypecstypes_db->insert(svctypecstype);
osafassert(rc == NCSCC_RC_SUCCESS);
 }
 
@@ -39,7 +39,6 @@ static AVD_SVC_TYPE_CS_TYPE *svctypecsty
 
memcpy(svctypecstype->name.value, dn->value, dn->length);
svctypecstype->name.length = dn->length;
-   svctypecstype->tree_node.key_info = (uint8_t *)&(svctypecstype->name);
 
if (immutil_getAttr(const_cast("saAmfSvctMaxNumCSIs"), 
attributes, 0, &svctypecstype->saAmfSvctMaxNumCSIs) != SA_AIS_OK)
svctypecstype->saAmfSvctMaxNumCSIs = -1; /* no limit */
@@ -47,25 +46,6 @@ static AVD_SVC_TYPE_CS_TYPE *svctypecsty
return svctypecstype;
 }
 
-static void svctypecstypes_delete(AVD_SVC_TYPE_CS_TYPE *svctypecstype)
-{
-   uint32_t rc;
-
-   rc = ncs_patricia_tree_del(&svctypecstypes_db, 
&svctypecstype->tree_node);
-   osafassert(rc == NCSCC_RC_SUCCESS);
-   delete svctypecstype;
-}
-
-AVD_SVC_TYPE_CS_TYPE *avd_svctypecstypes_get(const SaNameT *dn)
-{
-   SaNameT tmp = {0};
-
-   tmp.length = dn->length;
-   memcpy(tmp.value, dn->value, tmp.length);
-
-   return (AVD_SVC_TYPE_CS_TYPE*)ncs_patricia_tree_get(&svctypecstypes_db, 
(uint8_t *)&tmp);
-}
-
 /**
  * Get configuration for all SaAmfSvcTypeCSTypes objects from 
  * IMM and create AVD internal objects. 
@@ -100,7 +80,7 @@ SaAisErrorT avd_svctypecstypes_config_ge
 
while (immutil_saImmOmSearchNext_2(searchHandle, &dn, 
(SaImmAttrValuesT_2 ***)&attributes) == SA_AIS_OK) {
 
-   if ((svctypecstype = avd_svctypecstypes_get(&dn))== NULL) {
+   if ((svctypecstype = svctypecstypes_db->find(&dn))== NULL) {
if ((svctypecstype = svctypecstypes_create(&dn, 
attributes)) == NULL) {
error = SA_AIS_ERR_FAILED_OPERATION;
goto done2;
@@ -138,7 +118,7 @@ static SaAisErrorT svctypecstypes_ccb_co
report_ccb_validation_error(opdata, "Modification of 
SaAmfSvcTypeCSTypes not supported");
break;
case CCBUTIL_DELETE:
-   svctypecstype = avd_svctypecstypes_get(&opdata->objectName);
+   svctypecstype = svctypecstypes_db->find(&opdata->objectName);
if (svctypecstype->curr_num_csis == 0) {
rc =

[devel] [PATCH 2 of 4] amfd: use db_template to replace patricia tree in AVD_SVC_TYPE [#713]

2014-05-23 Thread praveen . malviya
 osaf/services/saf/amf/amfd/include/si.h |   2 +-
 osaf/services/saf/amf/amfd/si.cc|   4 ++--
 osaf/services/saf/amf/amfd/svctype.cc   |  27 ++-
 3 files changed, 9 insertions(+), 24 deletions(-)


diff --git a/osaf/services/saf/amf/amfd/include/si.h 
b/osaf/services/saf/amf/amfd/include/si.h
--- a/osaf/services/saf/amf/amfd/include/si.h
+++ b/osaf/services/saf/amf/amfd/include/si.h
@@ -132,6 +132,7 @@ typedef struct {
 
 extern AmfDb *si_db;
 extern AmfDb *svctypecstypes_db;
+extern AmfDb *svctype_db;
 #define AVD_SI_NULL ((AVD_SI *)0)
 #define m_AVD_SI_ACTV_MAX_SU(l_si) (l_si)->saAmfSIPrefActiveAssignments
 #define m_AVD_SI_ACTV_CURR_SU(l_si) (l_si)->saAmfSINumCurrActiveAssignments
@@ -153,7 +154,6 @@ extern AVD_SI *avd_si_get(const SaNameT 
 extern SaAisErrorT avd_si_config_get(struct avd_app_tag *app);
 extern void avd_si_constructor(void);
 
-extern AVD_SVC_TYPE *avd_svctype_get(const SaNameT *dn);
 extern SaAisErrorT avd_svctype_config_get(void);
 extern void avd_svctype_add_si(AVD_SI *si);
 extern void avd_svctype_remove_si(AVD_SI *si);
diff --git a/osaf/services/saf/amf/amfd/si.cc b/osaf/services/saf/amf/amfd/si.cc
--- a/osaf/services/saf/amf/amfd/si.cc
+++ b/osaf/services/saf/amf/amfd/si.cc
@@ -469,7 +469,7 @@ static void si_add_to_model(AVD_SI *si)
 
avd_si_db_add(si);
 
-   si->svc_type = avd_svctype_get(&si->saAmfSvcType);
+   si->svc_type = svctype_db->find(&si->saAmfSvcType);
 
if (si->saAmfSIProtectedbySG.length > 0)
si->sg_of_si = avd_sg_get(&si->saAmfSIProtectedbySG);
@@ -511,7 +511,7 @@ static int is_config_valid(const SaNameT
rc = immutil_getAttr(const_cast("saAmfSvcType"), 
attributes, 0, &aname);
osafassert(rc == SA_AIS_OK);
 
-   if (avd_svctype_get(&aname) == NULL) {
+   if (svctype_db->find(&aname) == NULL) {
/* SVC type does not exist in current model, check CCB if 
passed as param */
if (opdata == NULL) {
report_ccb_validation_error(opdata, "'%s' does not 
exist in model", aname.value);
diff --git a/osaf/services/saf/amf/amfd/svctype.cc 
b/osaf/services/saf/amf/amfd/svctype.cc
--- a/osaf/services/saf/amf/amfd/svctype.cc
+++ b/osaf/services/saf/amf/amfd/svctype.cc
@@ -28,7 +28,7 @@
 #include 
 #include 
 
-static NCS_PATRICIA_TREE svctype_db;
+AmfDb *svctype_db = NULL;
 
 //
 // TODO(HANO) Temporary use this function instead of strdup which uses malloc.
@@ -43,24 +43,14 @@ static char *StrDup(const char *s)
 
 static void svctype_db_add(AVD_SVC_TYPE *svct)
 {
-   unsigned int rc = ncs_patricia_tree_add(&svctype_db, &svct->tree_node);
+   unsigned int rc = svctype_db->insert(svct);
osafassert (rc == NCSCC_RC_SUCCESS);
 }
 
-AVD_SVC_TYPE *avd_svctype_get(const SaNameT *dn)
-{
-   SaNameT tmp = {0};
-
-   tmp.length = dn->length;
-   memcpy(tmp.value, dn->value, tmp.length);
-
-   return (AVD_SVC_TYPE *)ncs_patricia_tree_get(&svctype_db, (uint8_t 
*)&tmp);
-}
 
 static void svctype_delete(AVD_SVC_TYPE *svc_type)
 {
-   unsigned int rc = ncs_patricia_tree_del(&svctype_db, 
&svc_type->tree_node);
-   osafassert(rc == NCSCC_RC_SUCCESS);
+   svctype_db->erase(svc_type);
 
if (svc_type->saAmfSvcDefActiveWeight != NULL) {
unsigned int i = 0;
@@ -94,7 +84,6 @@ static AVD_SVC_TYPE *svctype_create(cons
 
memcpy(svct->name.value, dn->value, dn->length);
svct->name.length = dn->length;
-   svct->tree_node.key_info = (uint8_t *)&svct->name;
svct->saAmfSvcDefActiveWeight = NULL;
svct->saAmfSvcDefStandbyWeight = NULL;
 
@@ -159,7 +148,7 @@ static SaAisErrorT svctype_ccb_completed
report_ccb_validation_error(opdata, "Modification of 
SaAmfSvcType not supported");
break;
case CCBUTIL_DELETE:
-   svc_type = avd_svctype_get(&opdata->objectName);
+   svc_type = svctype_db->find(&opdata->objectName);
if (NULL != svc_type->list_of_si) {
/* check whether there exists a delete operation for
 * each of the SI in the svc_type list in the current 
CCB
@@ -250,7 +239,7 @@ SaAisErrorT avd_svctype_config_get(void)
if (!is_config_valid(&dn, attributes, NULL))
goto done2;
 
-   if ((svc_type = avd_svctype_get(&dn))==NULL) {
+   if ((svc_type = svctype_db->find(&dn)) == NULL) {
if ((svc_type = svctype_create(&dn, attributes)) == 
NULL)
goto done2;
 
@@ -308,11 +297,7 @@ void avd_svctype_remove_si(AVD_SI *si)
 
 void avd_svctype_constructor(void)
 {
-   NCS_PATRICIA_PARAMS patricia_params;
-
-   patricia_params.key_size = sizeof(SaNameT);
-
-   osafassert(ncs_patricia_tree_init(&svctype_db, &patricia_params) == 
NCSCC_RC_SUCCESS);
+   svctype_db = new AmfDb;
 
avd_class_impl_set("SaAmfSvcType", NULL

[devel] [PATCH 3 of 4] amfd: use db_template to replace patricia tree in avd_cstype_t [#713]

2014-05-23 Thread praveen . malviya
 osaf/services/saf/amf/amfd/csi.cc|   8 +++---
 osaf/services/saf/amf/amfd/cstype.cc |  35 +--
 osaf/services/saf/amf/amfd/include/csi.h |   3 +-
 3 files changed, 12 insertions(+), 34 deletions(-)


diff --git a/osaf/services/saf/amf/amfd/csi.cc 
b/osaf/services/saf/amf/amfd/csi.cc
--- a/osaf/services/saf/amf/amfd/csi.cc
+++ b/osaf/services/saf/amf/amfd/csi.cc
@@ -117,7 +117,7 @@ static int is_config_valid(const SaNameT
rc = immutil_getAttr(const_cast("saAmfCSType"), 
attributes, 0, &aname);
osafassert(rc == SA_AIS_OK);
 
-   if (avd_cstype_get(&aname) == NULL) {
+   if (cstype_db->find(&aname) == NULL) {
/* CS type does not exist in current model, check CCB if passed 
as param */
if (opdata == NULL) {
report_ccb_validation_error(opdata, "'%s' does not 
exist in model", aname.value);
@@ -331,7 +331,7 @@ static void csi_get_attr_and_add_to_mode
TRACE_ENTER2("DEP not configured, marking rank 1. Csi'%s', 
Rank'%u'",csi->name.value,csi->rank);
}
 
-   csi->cstype = avd_cstype_get(&csi->saAmfCSType);
+   csi->cstype = cstype_db->find(&csi->saAmfCSType);
csi->si = avd_si_get(si_name);
 
avd_cstype_add_csi(csi);
@@ -546,7 +546,7 @@ static SaAisErrorT csi_ccb_completed_mod
rc = SA_AIS_ERR_BAD_OPERATION;
goto done;
}
-   if (avd_cstype_get(&cstype_name) == NULL) {
+   if (cstype_db->find(&cstype_name) == NULL) {
report_ccb_validation_error(opdata, "CS Type 
not found '%s'", cstype_name.value);
rc = SA_AIS_ERR_BAD_OPERATION;
goto done;
@@ -778,7 +778,7 @@ static void csi_ccb_apply_modify_hdlr(st
SaNameT cstype_name = *(SaNameT*) 
attr_mod->modAttr.attrValues[0];
TRACE("saAmfCSType modified from '%s' to '%s' for 
Csi'%s'", csi->saAmfCSType.value,
cstype_name.value, csi->name.value);
-   csi_type = avd_cstype_get(&cstype_name);
+   csi_type = cstype_db->find(&cstype_name);
avd_cstype_remove_csi(csi);
csi->saAmfCSType = cstype_name;
csi->cstype = csi_type;
diff --git a/osaf/services/saf/amf/amfd/cstype.cc 
b/osaf/services/saf/amf/amfd/cstype.cc
--- a/osaf/services/saf/amf/amfd/cstype.cc
+++ b/osaf/services/saf/amf/amfd/cstype.cc
@@ -22,7 +22,7 @@
 #include 
 #include 
 
-static NCS_PATRICIA_TREE cstype_db;
+AmfDb *cstype_db = NULL;
 
 //
 // TODO(HANO) Temporary use this function instead of strdup which uses malloc.
@@ -37,7 +37,7 @@ static char *StrDup(const char *s)
 
 static void cstype_add_to_model(avd_cstype_t *cst)
 {
-   unsigned int rc = ncs_patricia_tree_add(&cstype_db, &cst->tree_node);
+   uint32_t rc = cstype_db->insert(cst);
osafassert(rc == NCSCC_RC_SUCCESS);
 }
 
@@ -52,7 +52,6 @@ static avd_cstype_t *cstype_create(const
 
memcpy(cst->name.value, dn->value, dn->length);
cst->name.length = dn->length;
-   cst->tree_node.key_info = (uint8_t *)&cst->name;
 
if 
((immutil_getAttrValuesNumber(const_cast("saAmfCSAttrName"), 
attributes, &values_number) == SA_AIS_OK) &&
(values_number > 0)) {
@@ -72,39 +71,20 @@ static avd_cstype_t *cstype_create(const
  */
 static void cstype_delete(avd_cstype_t *cst)
 {
-   unsigned int rc;
char *p;
int i = 0;
 
-   rc = ncs_patricia_tree_del(&cstype_db, &cst->tree_node);
-   osafassert(rc == NCSCC_RC_SUCCESS);
+   cstype_db->erase(cst);
 
if (cst->saAmfCSAttrName != NULL) {
while ((p = cst->saAmfCSAttrName[i++]) != NULL) {
delete [] p;
}
}
-
delete [] cst->saAmfCSAttrName;
delete cst;
 }
 
-/**
- * Lookup object using name in DB
- * @param dn
- * 
- * @return avd_cstype_t*
- */
-avd_cstype_t *avd_cstype_get(const SaNameT *dn)
-{
-   SaNameT tmp = {0};
-
-   tmp.length = dn->length;
-   memcpy(tmp.value, dn->value, tmp.length);
-
-   return (avd_cstype_t *)ncs_patricia_tree_get(&cstype_db, (uint8_t 
*)&tmp);
-}
-
 void avd_cstype_add_csi(AVD_CSI *csi)
 {
csi->csi_list_cs_type_next = csi->cstype->list_of_csi;
@@ -190,7 +170,7 @@ SaAisErrorT avd_cstype_config_get(void)
if (!is_config_valid(&dn, NULL))
goto done2;
 
-   if ((cst = avd_cstype_get(&dn)) == NULL){
+   if ((cst = cstype_db->find(&dn)) == NULL){
if ((cst = cstype_create(&dn, attributes)) == NULL)
goto done2;
 
@@ -232,7 +212,7 @@ static SaAisErrorT cstype_ccb_completed_
report_ccb_validation_error(opdata, 

[devel] [PATCH 0 of 4] Review Request for replace particia tree in svctypecstype, svctype, cstype and ctcstype [#713]

2014-05-23 Thread praveen . malviya
Summary: replace particia tree in svctypecstype, svctype, cstype and ctcstype 
[#713] 
Review request for Trac Ticket(s): #713 
Peer Reviewer(s):AMF contributors 
Pull request to: <>
Affected branch(es):default 
Development branch: <>


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesy
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-

changeset 34b541f210e22177398cfb4621403972a657c0d5
Author: praveen.malv...@oracle.com
Date:   Fri, 23 May 2014 14:34:56 +0530

amfd: use db_template to replace patricia tree in AVD_SVC_TYPE_CS_TYPE
[#713]

changeset 183ab6de0c288f7eb3f68e4efbc25f0953f2efd8
Author: praveen.malv...@oracle.com
Date:   Fri, 23 May 2014 14:36:13 +0530

amfd: use db_template to replace patricia tree in AVD_SVC_TYPE [#713]

changeset c641d2f357a3c5d9af5099e8ef892e629b58e278
Author: praveen.malv...@oracle.com
Date:   Fri, 23 May 2014 14:37:10 +0530

amfd: use db_template to replace patricia tree in avd_cstype_t [#713]

changeset 8a64a189b1f942fa852b77bbacf718cb19fdaf44
Author: praveen.malv...@oracle.com
Date:   Fri, 23 May 2014 14:37:54 +0530

amfd: use db_template to replace patricia tree in AVD_CTCS_TYPE [#713]


Complete diffstat:
--
 osaf/services/saf/amf/amfd/compcstype.cc |   4 ++--
 osaf/services/saf/amf/amfd/csi.cc|   8 
 osaf/services/saf/amf/amfd/cstype.cc |  35 
++-
 osaf/services/saf/amf/amfd/ctcstype.cc   |  37 
+
 osaf/services/saf/amf/amfd/include/comp.h|   5 +++--
 osaf/services/saf/amf/amfd/include/csi.h |   3 ++-
 osaf/services/saf/amf/amfd/include/si.h  |   6 ++
 osaf/services/saf/amf/amfd/si.cc |   5 ++---
 osaf/services/saf/amf/amfd/svctype.cc|  27 ++-
 osaf/services/saf/amf/amfd/svctypecstypes.cc |  40 
+++-
 osaf/services/saf/amf/amfd/util.cc   |   2 +-
 11 files changed, 48 insertions(+), 124 deletions(-)


Testing Commands:
-
Bring up one controller.
Add AMF application.
Bring it up.
Bring down application.
Delete application.



Testing, Expected Results:
--
Pass.

Conditions of Submission:
-
Ack from atleast one reviewer.

Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  y  y
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have 

[devel] [PATCH 1 of 1] amfd: replace patricia tree with stl::maps in nodegroup [#713]

2014-05-23 Thread nagendra . k
 osaf/services/saf/amf/amfd/include/node.h |   2 +-
 osaf/services/saf/amf/amfd/nodegroup.cc   |  76 --
 2 files changed, 22 insertions(+), 56 deletions(-)


diff --git a/osaf/services/saf/amf/amfd/include/node.h 
b/osaf/services/saf/amf/amfd/include/node.h
--- a/osaf/services/saf/amf/amfd/include/node.h
+++ b/osaf/services/saf/amf/amfd/include/node.h
@@ -147,7 +147,7 @@ typedef struct avd_avnd_tag {
 typedef struct avd_ng_tag {
 
NCS_PATRICIA_NODE tree_node;/* key will be AMF  node group name */
-   SaNameT ng_name;
+   SaNameT name;
uint32_t number_nodes;  /* number of element in saAmfNGNodeList */
SaNameT *saAmfNGNodeList;   /* array of node names in group */
 
diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc 
b/osaf/services/saf/amf/amfd/nodegroup.cc
--- a/osaf/services/saf/amf/amfd/nodegroup.cc
+++ b/osaf/services/saf/amf/amfd/nodegroup.cc
@@ -23,17 +23,7 @@
 #include 
 #include 
 
-static NCS_PATRICIA_TREE nodegroup_db;
-
-/**
- * Add a node group object to the db.
- * @param ng
- */
-static void ng_db_add(AVD_AMF_NG *ng)
-{
-   unsigned int rc = ncs_patricia_tree_add(&nodegroup_db, &ng->tree_node);
-   osafassert(rc == NCSCC_RC_SUCCESS);
-}
+AmfDb *nodegroup_db = 0;
 
 /**
  * Lookup object in db using dn
@@ -43,28 +33,7 @@ static void ng_db_add(AVD_AMF_NG *ng)
  */
 AVD_AMF_NG *avd_ng_get(const SaNameT *dn)
 {
-   SaNameT tmp = {0};
-
-   tmp.length = dn->length;
-   memcpy(tmp.value, dn->value, tmp.length);
-
-   return (AVD_AMF_NG *)ncs_patricia_tree_get(&nodegroup_db, (uint8_t 
*)&tmp);
-}
-
-/**
- * Get next object from db using dn
- * @param dn
- * 
- * @return AVD_AMF_NG*
- */
-static AVD_AMF_NG *ng_getnext(const SaNameT *dn)
-{
-   SaNameT tmp = {0};
-
-   tmp.length = dn->length;
-   memcpy(tmp.value, dn->value, tmp.length);
-
-   return (AVD_AMF_NG *)ncs_patricia_tree_getnext(&nodegroup_db, (uint8_t 
*)&tmp);
+   return nodegroup_db->find(dn);
 }
 
 /**
@@ -138,9 +107,9 @@ static AVD_AMF_NG *ng_create(SaNameT *dn
 
ng = new AVD_AMF_NG();
 
-   memcpy(ng->ng_name.value, dn->value, dn->length);
-   ng->ng_name.length = dn->length;
-   ng->tree_node.key_info = (uint8_t *)&(ng->ng_name);
+   memcpy(ng->name.value, dn->value, dn->length);
+   ng->name.length = dn->length;
+   ng->tree_node.key_info = (uint8_t *)&(ng->name);
 
if 
((immutil_getAttrValuesNumber(const_cast("saAmfNGNodeList"), 
attributes,
&values_number) == SA_AIS_OK) && (values_number > 0)) {
@@ -174,10 +143,7 @@ done:
  */
 static void ng_delete(AVD_AMF_NG *ng)
 {
-   unsigned int rc = ncs_patricia_tree_del(&nodegroup_db, &ng->tree_node);
-   osafassert(rc == NCSCC_RC_SUCCESS);
-
-   osafassert(ng);
+   nodegroup_db->erase(ng);
free(ng->saAmfNGNodeList);
delete ng;
 }
@@ -203,8 +169,12 @@ SaAisErrorT avd_ng_config_get(void)
/* Could be here as a consequence of a fail/switch-over. Delete the DB
** since it is anyway not synced and needs to be rebuilt. */
dn.length = 0;
-   for (ng = ng_getnext(&dn); ng != NULL; ng = ng_getnext(&dn))
+   for (std::map::const_iterator it = 
nodegroup_db->begin();
+   it != nodegroup_db->end(); ) {
+   AVD_AMF_NG *ng = it->second;
+   it++;
ng_delete(ng);
+   }
 
searchParam.searchOneAttr.attrName = 
const_cast("SaImmAttrClassName");
searchParam.searchOneAttr.attrValueType = SA_IMM_ATTR_SASTRINGT;
@@ -228,7 +198,7 @@ SaAisErrorT avd_ng_config_get(void)
if ((ng = ng_create(&dn, (const SaImmAttrValuesT_2 
**)attributes)) == NULL)
goto done2;
 
-   ng_db_add(ng);
+   nodegroup_db->insert(ng);
}
 
rc = SA_AIS_OK;
@@ -249,10 +219,10 @@ done1:
  */
 static bool su_is_mapped_to_node_via_nodegroup(const AVD_SU *su, const 
AVD_AMF_NG *ng)
 {
-   if ((memcmp(&ng->ng_name, &su->saAmfSUHostNodeOrNodeGroup, 
sizeof(SaNameT)) == 0) ||
-   (memcmp(&ng->ng_name, &su->sg_of_su->saAmfSGSuHostNodeGroup, 
sizeof(SaNameT)) == 0)) {
+   if ((memcmp(&ng->name, &su->saAmfSUHostNodeOrNodeGroup, 
sizeof(SaNameT)) == 0) ||
+   (memcmp(&ng->name, &su->sg_of_su->saAmfSGSuHostNodeGroup, 
sizeof(SaNameT)) == 0)) {

-   TRACE("SU '%s' mapped using '%s'", su->name.value, 
ng->ng_name.value);
+   TRACE("SU '%s' mapped using '%s'", su->name.value, 
ng->name.value);
return true;
}
 
@@ -337,7 +307,7 @@ static SaAisErrorT ng_ccb_completed_modi
if 
(su_is_mapped_to_node_via_nodegroup(su, ng)) {

report_ccb_validation_error(opdata, "Cannot delete '%s' from '%s'."
" An SU is 
mapped using node group",
-

[devel] [PATCH 0 of 1] Review Request for amfd: replace patricia tree with stl::maps in nodegroup [#713]

2014-05-23 Thread nagendra . k
Summary: amfd: replace patricia tree with stl::maps in nodegroup [#713]
Review request for Trac Ticket(s): #713
Peer Reviewer(s): hans.fe...@ericsson.com, hans.nordeb...@ericsson.com, 
praveen.malv...@oracle.com
Pull request to: <>
Affected branch(es): Default
Development branch: Default


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesy
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-
 <>

changeset d29368040992c44ed032acca783238657c2c4699
Author: Nagendra Kumar
Date:   Fri, 23 May 2014 13:48:27 +0530

amfd: replace patricia tree with stl::maps in nodegroup [#713]


Complete diffstat:
--
 osaf/services/saf/amf/amfd/include/node.h |   2 +-
 osaf/services/saf/amf/amfd/nodegroup.cc   |  76 
+---
 2 files changed, 22 insertions(+), 56 deletions(-)


Testing Commands:
-
Started two controllers.
Killed immnd on one controller to check 
whether ng_delete is working fine with iterator.


Testing, Expected Results:
--
ng_delete got called 3 times and 
ng_create got called 3 times to create.


Conditions of Submission:
-
Ack from reviewers


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  y  y
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.


--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 0 of 1] Review Request for log: handle ending quote for messages in variable log records: v2 [#882]

2014-05-23 Thread Lennart Lund
Hi,

Ack
Have tested. Looks good

Thanks
Lennart

> -Original Message-
> From: mathi.naic...@oracle.com [mailto:mathi.naic...@oracle.com]
> Sent: den 23 maj 2014 02:02
> To: Lennart Lund
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 0 of 1] Review Request for log: handle ending quote for
> messages in variable log records: v2 [#882]
> 
> Summary: log: handle ending quote for messages in variable log records: v2
> [#882] Review request for Trac Ticket(s): <> Peer
> Reviewer(s): Lennart Pull request to: < HERE>> Affected branch(es): 4.3.x, 4.4.x, default Development branch: < ANY GIVE THE REPO URL>>
> 
> 
> Impacted area   Impact y/n
> 
>  Docsn
>  Build systemn
>  RPM/packaging   n
>  Configuration files n
>  Startup scripts n
>  SAF servicesy
>  OpenSAF servicesn
>  Core libraries  n
>  Samples n
>  Tests   n
>  Other   n
> 
> 
> Comments (indicate scope for each "y" above):
> -
> 
> changeset b004b7447aa2e17a3c3cca21ccf1fe21d8bc2f0d
> Author:   Mathivanan N.P.
> Date: Thu, 22 May 2014 19:50:25 -0400
> 
>   log: handle ending quote for messages in variable log records [#882]
>   Currently, When varible log records are enabled for applications, the
> log
>   message is missing the ending quote. i.e. as below saflogger -a test
> will
>   create a message with a single open quote: saflogger -a test hello will
>   create the message witha single openquote : hello The same
> behaviour can be
>   seen for system streams also. The problem is that when the
> logoutputstring
>   is constructed, the ending quotes are indeed getting added to the
> output
>   string, but this is getting overwritten by the existing code when
>   introducing the newline character tothe logoutputstring. The patch
> inserts
>   the newline to the outputstring after the ending quote and also
> adjusts the
>   length of the final logstring to be printed.
> 
> 
> Complete diffstat:
> --
>  osaf/services/saf/logsv/lgs/lgs_evt.c   |   2 +-
>  osaf/services/saf/logsv/lgs/lgs_fmt.c   |  26 +++---
>  osaf/services/saf/logsv/lgs/lgs_fmt.h   |   2 +-
>  osaf/services/saf/logsv/lgs/lgs_mbcsv.c |   2 +-
>  4 files changed, 26 insertions(+), 6 deletions(-)
> 
> 
> Testing Commands:
> -
> The following commands should print with both open and closing quotes and
> subsequent log records should end up in a new line:
> 
> Suite1:
> Test case1: $saflogger -y
> Result: Should create an empty string with open and close quotes in the
> system stream.
> 
> Testcase2: saflogger -y hello
> Result: Should create the string "hello" from a new line in the system stream.
> 
> Testcase3: saflogger -y "a big string... bigger than 1024"
> Result: Should create the string "a big string... bigger than 1024" from a new
> line inthe system stream.
> Repeat 1, 2, 3 above in different order.
> 
> Suite2:
> Run the above commands for application stream.
> Testcase3 should print only 128 byte long strings withinquotes in teh
> application stream.
> For eg:- $saflogger -a dumper
> For eg:- $saflogger -a dumper hello
> For eg:- $saflogger -a dumper "string bigger than 128 bytes"
> 
> Suite3:
> Modify saflogger to enable variable length records:
> Repeat tests under Suite1
> 
> Suite4:
> Modify saflogger to enable variable length records:
> Repeat tests under Suite2
> For Testcase3, should print only 1024 byte strings because default max
> filesize for app streams is 1024.
> 
> Testing, Expected Results:
> --
> Same as Above.
> 
> Conditions of Submission:
> -
> Ack from Lennart.
> 
> Arch  Built StartedLinux distro
> ---
> mipsn  n
> mips64  n  n
> x86 n  n
> x86_64  n  n
> powerpc n  n
> powerpc64   n  n
> 
> 
> Reviewer Checklist:
> ---
> [Submitters: make sure that your review doesn't trigger any checkmarks!]
> 
> 
> Your checkin has not passed review because (see checked entries):
> 
> ___ Your RR template is generally incomplete; it has too many blank entries
> that need proper data filled in.
> 
> ___ You have failed to nominate the proper persons for review and push.
> 
> ___ Your patches do not have proper short+long header
> 
> ___ You have grammar/spelling in your header that is unacceptable.
> 
> ___ You have exceeded a sensible line length in your
> headers/comments/text.
> 
> ___ You have failed to put in a proper Trac Ticket # into your commits.
> 
> ___ You have incorrectly put/left internal data in your comments/files
> (i.e. internal bug tracking tool IDs, product names etc)
> 
> ___ You have not given any evid

Re: [devel] [PATCH 1 of 1] log: Fix calculation of timeout time on 32 bit systems [#918]

2014-05-23 Thread Mathivanan Naickan Palanivelu
Ack,

Mathi.

- lennart.l...@ericsson.com wrote:

> osaf/services/saf/logsv/lgs/lgs_evt.c  |  32
> 
>  osaf/services/saf/logsv/lgs/lgs_file.c |  24
> +++-
>  osaf/services/saf/logsv/lgs/lgs_mds.c  |   5 +++--
>  3 files changed, 30 insertions(+), 31 deletions(-)
> 
> 
> Use opensaf time calculation help functions
> 
> diff --git a/osaf/services/saf/logsv/lgs/lgs_evt.c
> b/osaf/services/saf/logsv/lgs/lgs_evt.c
> --- a/osaf/services/saf/logsv/lgs/lgs_evt.c
> +++ b/osaf/services/saf/logsv/lgs/lgs_evt.c
> @@ -20,6 +20,7 @@
>  #include 
>  
>  #include "immutil.h"
> +#include "osaf_time.h"
>  
>  #include "lgs.h"
>  #include "lgs_util.h"
> @@ -1251,19 +1252,26 @@ static uint32_t process_api_evt(lgsv_lgs
>   goto done;
>   }
>  
> - // Discard too old messages. Don't discard writes as they are
> async,
> - // no one is waiting on a response
> + /* Discard too old messages. Don't discard writes as they are
> async,
> +  * no one is waiting on a response.
> +  * Using osaf time functions will guarantee that code works on 32
> and 64 bit
> +  * systems.
> +  */
>   if (api_type < LGSV_WRITE_LOG_ASYNC_REQ) {
> - struct timespec ts;
> - osafassert(clock_gettime(CLOCK_MONOTONIC, &ts) == 0);
> -
> - // convert to milliseconds
> - uint64_t entered = (evt->entered_at.tv_sec * 1000) +
> -  (evt->entered_at.tv_nsec / 100);
> - uint64_t removed = (ts.tv_sec * 1000) + (ts.tv_nsec / 100);
> -
> - // compare with sync send time used in library
> - if ((removed - entered) > (LGS_WAIT_TIME * 10)) {
> + struct timespec current_ts, diff_ts;
> + osaf_clock_gettime(CLOCK_MONOTONIC, ¤t_ts);
> + 
> + /* Calculate time diff current - entered */
> + if (osaf_timespec_compare(¤t_ts, &evt->entered_at) < 1) {
> + LOG_ER("%s - Entered message time > current time", 
> __FUNCTION__);
> + osafassert(0);
> + }
> + osaf_timespec_subtract(¤t_ts, &evt->entered_at, &diff_ts);
> + 
> + /* Convert to millisec and compare with sync send time used in
> +  * library
> +  */
> + if (osaf_timespec_to_millis(&diff_ts) > (LGS_WAIT_TIME * 10)) {
>   LOG_IN("discarded message from %" PRIx64 " type %u",
>   evt->fr_dest, api_type);
>   goto done;
> diff --git a/osaf/services/saf/logsv/lgs/lgs_file.c
> b/osaf/services/saf/logsv/lgs/lgs_file.c
> --- a/osaf/services/saf/logsv/lgs/lgs_file.c
> +++ b/osaf/services/saf/logsv/lgs/lgs_file.c
> @@ -34,15 +34,14 @@
>  
>  #include "lgs.h"
>  #include "osaf_utility.h"
> -
> -#define GETTIME(x) osafassert(clock_gettime(CLOCK_REALTIME, &x) ==
> 0);
> +#include "osaf_time.h"
>  
>  pthread_mutex_t lgs_ftcom_mutex; /* For locking communication */
>  static pthread_cond_t request_cv;/* File thread waiting for request
> */
>  static pthread_cond_t answer_cv; /* API waiting for answer (timed)
> */
>  
>  /* Max time to wait for file thread to finish */
> -static SaUint32T max_waittime_ms = 500;
> +static uint32_t max_waittime_ms = 500;
>  
>  struct file_communicate {
>   bool request_f; /* True if pending request */
> @@ -82,22 +81,13 @@ static int start_file_thread(void);
>   * @param timeout_time[out]
>   * @param timeout_ms[in] in ms
>   */
> -static void get_timeout_time(struct timespec *timeout_time, long int
> timeout_ms)
> +static void get_timeout_time(struct timespec *timeout_time, uint32_t
> timeout_ms)
>  {
> - struct timespec start_time;
> - uint64_t millisec1,millisec2;
> + struct timespec start_time, add_time;
>   
> - GETTIME(start_time);
> - 
> - /* Convert to ms */
> - millisec1 = (start_time.tv_sec * 1000) + (start_time.tv_nsec /
> 100);
> - 
> - /* Add timeout time */
> - millisec2 = millisec1+timeout_ms;
> - 
> - /* Convert back to timespec */
> - timeout_time->tv_sec = millisec2 / 1000;
> - timeout_time->tv_nsec = (millisec2 % 1000) * 100;
> + osaf_clock_gettime(CLOCK_REALTIME, &start_time);
> + osaf_millis_to_timespec((uint64_t) timeout_ms, &add_time);
> + osaf_timespec_add(&start_time, &add_time, timeout_time);
>  }
>  
> 
> /*
> diff --git a/osaf/services/saf/logsv/lgs/lgs_mds.c
> b/osaf/services/saf/logsv/lgs/lgs_mds.c
> --- a/osaf/services/saf/logsv/lgs/lgs_mds.c
> +++ b/osaf/services/saf/logsv/lgs/lgs_mds.c
> @@ -17,6 +17,7 @@
>  
>  #include 
>  #include "lgs.h"
> +#include "osaf_time.h"
>  
>  #define LGS_SVC_PVT_SUBPART_VERSION 1
>  #define LGS_WRT_LGA_SUBPART_VER_AT_MIN_MSG_FMT 1
> @@ -890,7 +891,7 @@ static uint32_t mds_rcv(struct ncsmds_ca
>  
>   // for all msg t

[devel] [PATCH 1 of 1] v2 amfd: send node down notification during controller failover [#914]

2014-05-23 Thread nagendra . k
 osaf/services/saf/amf/amfd/node.cc |  13 +
 1 files changed, 13 insertions(+), 0 deletions(-)


When Act controller is stopped, newly act controller is not sending node oper 
state
disable notification. This is because of marking node oper state disable
first in avd_mds_avnd_down_evh at standby controller and then calling
avd_node_oper_state_set() from avd_node_failover. In
avd_node_oper_state_set, since oper state remain disable, the function only
update rt attributes and donot send notification.
Amf is checking whether node is absent and oper state is down and
this way it deduces that the failover has happened and it need to send
notification.

diff --git a/osaf/services/saf/amf/amfd/node.cc 
b/osaf/services/saf/amf/amfd/node.cc
--- a/osaf/services/saf/amf/amfd/node.cc
+++ b/osaf/services/saf/amf/amfd/node.cc
@@ -398,6 +398,19 @@ void avd_node_oper_state_set(AVD_AVND *n
 */
avd_saImmOiRtObjectUpdate(&node->name, "saAmfNodeOperState",
SA_IMM_ATTR_SAUINT32T, &node->saAmfNodeOperState);
+
+   /* Send notification for node oper state down. It is set to 
+  DISABLE in avd_mds_avnd_down_evh and again
+  avd_node_oper_state_set is called from avd_node_mark_absent.
+  Since the oper state is the same when called from
+  avd_node_mark_absent, we need to send notification. */
+   if ((node->saAmfNodeOperState == SA_AMF_OPERATIONAL_DISABLED) &&
+   (node->node_state == AVD_AVND_STATE_ABSENT))
+   avd_send_oper_chg_ntf(&node->name,
+   SA_AMF_NTFID_NODE_OP_STATE,
+   SA_AMF_OPERATIONAL_ENABLED,
+   node->saAmfNodeOperState);
+
return;
}


--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 0 of 1] Review Request for v2 amfd: send node down notification during controller failover [#914]

2014-05-23 Thread nagendra . k
Summary: v2 amfd: send node down notification during controller failover [#914]
Review request for Trac Ticket(s): #914
Peer Reviewer(s): Hans F, Hans N, Praveen 
Pull request to: <>
Affected branch(es): All 
Development branch: Default


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesy
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-
 <>

changeset ff039879e1edb9f4d98a477922acbbb9444b08b2
Author: Nagendra Kumar
Date:   Fri, 23 May 2014 12:10:55 +0530

v2 amfd: send node down notification during controller failover [#914] 
When
Act controller is stopped, newly act controller is not sending node oper
state disable notification. This is because of marking node oper state
disable first in avd_mds_avnd_down_evh at standby controller and then
calling avd_node_oper_state_set() from avd_node_failover. In
avd_node_oper_state_set, since oper state remain disable, the function 
only
update rt attributes and donot send notification. Amf is checking 
whether
node is absent and oper state is down and this way it deduces that the
failover has happened and it need to send notification.


Complete diffstat:
--
 osaf/services/saf/amf/amfd/node.cc |  13 +
 1 files changed, 13 insertions(+), 0 deletions(-)


Testing Commands:
-
Check the ticket.


Testing, Expected Results:
--
The below notification will come:

eventType = SA_NTF_OBJECT_STATE_CHANGE
notificationObject = "safAmfNode=SC-1,safAmfCluster=myAmfCluster"
notifyingObject = "safApp=safAmfService"
notificationClassId = SA_NTF_VENDOR_ID_SAF.SA_SVC_AMF.107 (0x6b)
additionalText = "Oper state safAmfNode=SC-1,safAmfCluster=myAmfCluster changed"
sourceIndicator = SA_NTF_OBJECT_OPERATION
State ID = SA_AMF_OP_STATE
New State: SA_AMF_OPERATIONAL_DISABLED

Conditions of Submission:
-
Ack from reviewers


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  y  y
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.


---