Hi,

IMO, both are fine also  I would like to see some guideline as to when to
use destroy and delete accordingly.

So if you create() an entity then its corresponding should be destroy() (ie
in case of BUFFER_POOL)
 and if you alloc() an entity then its corresponding should be free() (i.e
in case of BUFFER ).

Maybe something like,
create <--> destroy
alloc <----> free
new <---> delete

Regards,
Bala

On 25 September 2014 18:18, Anders Roxell <anders.rox...@linaro.org> wrote:

>
>
> On 24 September 2014 22:12, Anders Roxell <anders.rox...@linaro.org>
> wrote:
>
>> Signed-off-by: Anders Roxell <anders.rox...@linaro.org>
>> ---
>>  .../linux-generic/include/api/odp_buffer_pool.h    |  9 ++++++++
>>  platform/linux-generic/odp_buffer_pool.c           | 25
>> ++++++++++++++++++++++
>>  2 files changed, 34 insertions(+)
>>
>> diff --git a/platform/linux-generic/include/api/odp_buffer_pool.h
>> b/platform/linux-generic/include/api/odp_buffer_pool.h
>> index fe88898..fca2c62 100644
>> --- a/platform/linux-generic/include/api/odp_buffer_pool.h
>> +++ b/platform/linux-generic/include/api/odp_buffer_pool.h
>> @@ -34,6 +34,15 @@ typedef uint32_t odp_buffer_pool_t;
>>
>>
>>  /**
>> + * Delete a buffer pool
>> + *
>> + * @param pool_hdl Buffer pool handle
>> + *
>> + * @return 0 if successful else -1
>> + */
>> +int odp_buffer_pool_delete(odp_buffer_pool_t pool_hdl);
>> +
>> +/**
>>   * Create a buffer pool
>>   *
>>   * @param name      Name of the pool (max ODP_BUFFER_POOL_NAME_LEN - 1
>> chars)
>> diff --git a/platform/linux-generic/odp_buffer_pool.c
>> b/platform/linux-generic/odp_buffer_pool.c
>> index 4d9ff45..7ba793d 100644
>> --- a/platform/linux-generic/odp_buffer_pool.c
>> +++ b/platform/linux-generic/odp_buffer_pool.c
>> @@ -375,6 +375,31 @@ static void link_bufs(pool_entry_t *pool)
>>         }
>>  }
>>
>> +int odp_buffer_pool_delete(odp_buffer_pool_t pool_hdl)
>> +{
>> +       pool_entry_t *pool;
>> +       if (odp_unlikely(ODP_CONFIG_BUFFER_POOLS <= pool_hdl))
>> +               ODP_ERR("set_handle: Bad pool handle %u\n", pool_hdl);
>> +
>> +       pool = get_pool_entry(pool_hdl);
>> +       pool->s.free_bufs = 0;
>> +       strcpy(pool->s.name, "");
>> +       /* Need to restore this because this is setup in
>> +        * odp_buffer_pool_init_global
>> +        * */
>> +       pool->s.pool_hdl = pool_hdl;
>> +       pool->s.buf_base = 0;
>> +       pool->s.buf_size = 0;
>> +       pool->s.buf_offset = 0;
>> +       pool->s.num_bufs = 0;
>> +       pool->s.pool_base_addr = NULL;
>> +       pool->s.pool_size = 0;
>> +       pool->s.user_size = 0;
>> +       pool->s.user_align = 0;
>> +       pool->s.buf_type = ODP_BUFFER_POOL_INVALID;
>> +       pool->s.hdr_size = 0;
>> +       return 0;
>> +}
>>
>>  odp_buffer_pool_t odp_buffer_pool_create(const char *name,
>>                                          void *base_addr, uint64_t size,
>> --
>> 2.1.0
>>
>>
>
> Hi all,
>
> I had a chat with Ola and he proposed destroy instead of delete
>
> I think I like odp_buffer_pool_destroy more than what I've done in the
> patch odp_buffer_pool_delete... =)
>
> Comments?
>
> Cheers,
> Anders
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to