Message ID | 1435234172-2015-3-git-send-email-bill.fischofer@linaro.org |
---|---|
State | New |
Headers | show |
+ lng-odp. Unintentionally removed On 25.06.15 20:06, Ivan Khoronzhuk wrote: > Hi Bill, > > On 25.06.15 15:09, Bill Fischofer wrote: >> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> >> --- >> include/odp/api/pool.h | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h >> index b95f40d..dc94678 100644 >> --- a/include/odp/api/pool.h >> +++ b/include/odp/api/pool.h >> @@ -134,6 +134,15 @@ void odp_pool_print(odp_pool_t pool); >> uint64_t odp_pool_to_u64(odp_pool_t hdl); >> >> /** >> + * Initialize pool params >> + * >> + * This routine is used to initialze an odp_pool_param_t >> + * >> + * @param param Address of the odp_pool_param_t to be initialized >> + */ >> +void odp_pool_param_init(odp_pool_param_t *param); >> + >> +/** >> * @} >> */ >> >> > > Why this function is used as API? > Is it going to hide some hw/platform/OS related things? > If no - I can avoid using this. > Why this is a part of API?
This was one of the things we discussed during last week's ODP Design Sprint. The issue is that a number of APIs take parameter structures as arguments and the question is how are these structs to be initialized in a portable manner? Today the various ODP examples do this via memset(¶m_struct, 0, sizeof(param_struct)); however this is not portable because zeros may not always represent the "default" initialization state for every platform. The use of an explicit odp_structname_init() call follows the POSIX model and provides for that implementation flexibility. In this case for linux-generic it's implementated as a memset, but that detail is now hidden from the user as other platforms are free to implement the init functions in a manner that work best for them. On Thu, Jun 25, 2015 at 12:06 PM, Ivan Khoronzhuk < ivan.khoronzhuk@linaro.org> wrote: > Hi Bill, > > > On 25.06.15 15:09, Bill Fischofer wrote: > >> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> >> --- >> include/odp/api/pool.h | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h >> index b95f40d..dc94678 100644 >> --- a/include/odp/api/pool.h >> +++ b/include/odp/api/pool.h >> @@ -134,6 +134,15 @@ void odp_pool_print(odp_pool_t pool); >> uint64_t odp_pool_to_u64(odp_pool_t hdl); >> >> /** >> + * Initialize pool params >> + * >> + * This routine is used to initialze an odp_pool_param_t >> + * >> + * @param param Address of the odp_pool_param_t to be initialized >> + */ >> +void odp_pool_param_init(odp_pool_param_t *param); >> + >> +/** >> * @} >> */ >> >> >> > Why this function is used as API? > Is it going to hide some hw/platform/OS related things? > If no - I can avoid using this. > Why this is a part of API? >
Thanks for clarification. On 25.06.15 20:12, Bill Fischofer wrote: > This was one of the things we discussed during last week's ODP Design > Sprint. The issue is that a number of APIs take parameter structures as > arguments and the question is how are these structs to be initialized in > a portable manner? > > Today the various ODP examples do this via memset(¶m_struct, 0, > sizeof(param_struct)); however this is not portable because zeros may > not always represent the "default" initialization state for every > platform. The use of an explicit odp_structname_init() call follows the > POSIX model and provides for that implementation flexibility. In this > case for linux-generic it's implementated as a memset, but that detail > is now hidden from the user as other platforms are free to implement the > init functions in a manner that work best for them. > > On Thu, Jun 25, 2015 at 12:06 PM, Ivan Khoronzhuk > <ivan.khoronzhuk@linaro.org <mailto:ivan.khoronzhuk@linaro.org>> wrote: > > Hi Bill, > > > On 25.06.15 15:09, Bill Fischofer wrote: > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org > <mailto:bill.fischofer@linaro.org>> > --- > include/odp/api/pool.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h > index b95f40d..dc94678 100644 > --- a/include/odp/api/pool.h > +++ b/include/odp/api/pool.h > @@ -134,6 +134,15 @@ void odp_pool_print(odp_pool_t pool); > uint64_t odp_pool_to_u64(odp_pool_t hdl); > > /** > + * Initialize pool params > + * > + * This routine is used to initialze an odp_pool_param_t > + * > + * @param param Address of the odp_pool_param_t to be initialized > + */ > +void odp_pool_param_init(odp_pool_param_t *param); > + > +/** > * @} > */ > > > > Why this function is used as API? > Is it going to hide some hw/platform/OS related things? > If no - I can avoid using this. > Why this is a part of API? > >
diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h index b95f40d..dc94678 100644 --- a/include/odp/api/pool.h +++ b/include/odp/api/pool.h @@ -134,6 +134,15 @@ void odp_pool_print(odp_pool_t pool); uint64_t odp_pool_to_u64(odp_pool_t hdl); /** + * Initialize pool params + * + * This routine is used to initialze an odp_pool_param_t + * + * @param param Address of the odp_pool_param_t to be initialized + */ +void odp_pool_param_init(odp_pool_param_t *param); + +/** * @} */
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> --- include/odp/api/pool.h | 9 +++++++++ 1 file changed, 9 insertions(+)