Hey Mike (and everyone else),

I noticed this code is replicated throughout the patch:

        cos_shm = odp_shm_lookup("shm_odp_cos_tbl");
        if (cos_shm == ODP_SHM_INVALID)
                return -1;
        ret = odp_shm_free(cos_shm);

As I was looking to make the changes we discussed (continue
on versus returning -1) it seemed instead of replicating
even more code it would be better to have some cleaner way
of doing this.

One possibility is to simply nest the calls (shm_free just
returns -1 if passed SHM_INVALID).

      ret = odp_shm_free(odp_shm_lookup("shm_odp_cos_tbl"));

Another option is to create a helper function, something like:

      ret = odp_shm_free_by_name("shm_odp_cos_tbl");

If the helper is the way to go, then it could either be internal
or published API.  Any thoughts on the "correct solution"?

1) nested calls
2) internal API
3) published API

Thanks,
Robbie  

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Mike Holmes
Sent: Monday, February 16, 2015 2:55 PM
To: [email protected]
Subject: [lng-odp] [PATCH v2 00/10] add global and local termination

v2:
Addresses the only comment to replace
static const char shm_name[] ....
with
const char SHM_DEFAULT_NAME[]

Yan Sonming (10):
  linux-generic: classification: add term_global
  linux-generic: odp_crypto: add term_global
  linux-generic: packet_io: add term_global
  linux-generic: schedule: add term_global
  linux-generic: queue: add term_global
  linux-generic: buffer_pool: add term_global
  linux-generic: thread: add term_global
  linux-generic: shm: add term_global
  linux-generic: schedule: add term_local
  linux-generic: buffer pool: add term_local

 platform/linux-generic/include/odp_internal.h | 10 ++++++
 platform/linux-generic/odp_buffer_pool.c      | 37 ++++++++++++++++++-
 platform/linux-generic/odp_classification.c   | 25 +++++++++++++
 platform/linux-generic/odp_crypto.c           | 13 +++++++
 platform/linux-generic/odp_init.c             | 51 ++++++++++++++++++++++++++-
 platform/linux-generic/odp_packet_io.c        | 20 +++++++++++
 platform/linux-generic/odp_queue.c            | 25 +++++++++++++
 platform/linux-generic/odp_schedule.c         | 31 ++++++++++++++++
 platform/linux-generic/odp_shared_memory.c    |  8 +++++
 platform/linux-generic/odp_thread.c           | 13 +++++++
 10 files changed, 231 insertions(+), 2 deletions(-)

-- 
2.1.0


_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to