Removed odp_buffer_type() from API and made it internal.

Signed-off-by: Petri Savolainen <[email protected]>
---
 platform/linux-generic/include/api/odp_buffer.h      | 16 ----------------
 platform/linux-generic/include/api/odp_buffer_pool.h |  4 ++++
 platform/linux-generic/include/odp_buffer_internal.h | 16 ++++++++++++++++
 platform/linux-generic/odp_buffer.c                  |  2 +-
 platform/linux-generic/odp_buffer_pool.c             |  4 ++--
 platform/linux-generic/odp_event.c                   |  4 +++-
 platform/linux-generic/odp_timer.c                   |  4 ++--
 7 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/platform/linux-generic/include/api/odp_buffer.h 
b/platform/linux-generic/include/api/odp_buffer.h
index 5f825a2..69d5779 100644
--- a/platform/linux-generic/include/api/odp_buffer.h
+++ b/platform/linux-generic/include/api/odp_buffer.h
@@ -69,22 +69,6 @@ void *odp_buffer_addr(odp_buffer_t buf);
 uint32_t odp_buffer_size(odp_buffer_t buf);
 
 /**
- * Buffer type
- *
- * @param buf      Buffer handle
- *
- * @return Buffer type
- */
-int odp_buffer_type(odp_buffer_t buf);
-
-#define ODP_BUFFER_TYPE_INVALID (-1) /**< Buffer type invalid */
-#define ODP_BUFFER_TYPE_ANY       0  /**< Buffer that can hold any other
-                                         buffer type */
-#define ODP_BUFFER_TYPE_RAW       1  /**< Raw buffer, no additional metadata */
-#define ODP_BUFFER_TYPE_PACKET    2  /**< Packet buffer */
-#define ODP_BUFFER_TYPE_TIMEOUT   3  /**< Timeout buffer */
-
-/**
  * Tests if buffer is valid
  *
  * @param buf      Buffer handle
diff --git a/platform/linux-generic/include/api/odp_buffer_pool.h 
b/platform/linux-generic/include/api/odp_buffer_pool.h
index 8380ac1..68fa69e 100644
--- a/platform/linux-generic/include/api/odp_buffer_pool.h
+++ b/platform/linux-generic/include/api/odp_buffer_pool.h
@@ -51,6 +51,10 @@ typedef struct odp_buffer_pool_param_t {
        int      buf_type;  /**< Buffer type */
 } odp_buffer_pool_param_t;
 
+#define ODP_BUFFER_TYPE_RAW       1  /**< Raw buffer, no additional metadata */
+#define ODP_BUFFER_TYPE_PACKET    2  /**< Packet buffer */
+#define ODP_BUFFER_TYPE_TIMEOUT   3  /**< Timeout buffer */
+
 /**
  * Create a buffer pool
  * This routine is used to create a buffer pool. It take three
diff --git a/platform/linux-generic/include/odp_buffer_internal.h 
b/platform/linux-generic/include/odp_buffer_internal.h
index 39b0b05..0d09531 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -153,6 +153,22 @@ typedef struct {
 /* Forward declarations */
 odp_buffer_t buffer_alloc(odp_buffer_pool_t pool, size_t size);
 
+
+/*
+ * Buffer type
+ *
+ * @param buf      Buffer handle
+ *
+ * @return Buffer type
+ */
+int _odp_buffer_type(odp_buffer_t buf);
+
+#define _ODP_BUFFER_TYPE_INVALID (-1) /**< Buffer type invalid */
+#define _ODP_BUFFER_TYPE_ANY       0  /**< Buffer that can hold any other
+                                         buffer type */
+
+
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_buffer.c 
b/platform/linux-generic/odp_buffer.c
index 939332a..e657e00 100644
--- a/platform/linux-generic/odp_buffer.c
+++ b/platform/linux-generic/odp_buffer.c
@@ -40,7 +40,7 @@ uint32_t odp_buffer_size(odp_buffer_t buf)
 }
 
 
-int odp_buffer_type(odp_buffer_t buf)
+int _odp_buffer_type(odp_buffer_t buf)
 {
        odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf);
 
diff --git a/platform/linux-generic/odp_buffer_pool.c 
b/platform/linux-generic/odp_buffer_pool.c
index eedb380..202d1c7 100644
--- a/platform/linux-generic/odp_buffer_pool.c
+++ b/platform/linux-generic/odp_buffer_pool.c
@@ -160,7 +160,7 @@ odp_buffer_pool_t odp_buffer_pool_create(const char *name,
                break;
 
        case ODP_BUFFER_TYPE_PACKET:
-       case ODP_BUFFER_TYPE_ANY:
+       case _ODP_BUFFER_TYPE_ANY:
                headroom = ODP_CONFIG_PACKET_HEADROOM;
                tailroom = ODP_CONFIG_PACKET_TAILROOM;
                unsegmented = params->buf_size > ODP_CONFIG_PACKET_BUF_LEN_MAX;
@@ -561,7 +561,7 @@ void odp_buffer_pool_print(odp_buffer_pool_t pool_hdl)
                pool->s.params.buf_type == ODP_BUFFER_TYPE_RAW ? "raw" :
               (pool->s.params.buf_type == ODP_BUFFER_TYPE_PACKET ? "packet" :
               (pool->s.params.buf_type == ODP_BUFFER_TYPE_TIMEOUT ? "timeout" :
-              (pool->s.params.buf_type == ODP_BUFFER_TYPE_ANY ? "any" :
+              (pool->s.params.buf_type == _ODP_BUFFER_TYPE_ANY ? "any" :
                "unknown"))));
        ODP_DBG(" pool storage    %sODP managed\n",
                pool->s.flags.user_supplied_shm ?
diff --git a/platform/linux-generic/odp_event.c 
b/platform/linux-generic/odp_event.c
index c646f42..285a19b 100644
--- a/platform/linux-generic/odp_event.c
+++ b/platform/linux-generic/odp_event.c
@@ -6,6 +6,8 @@
 
 #include <odp_event.h>
 #include <odp_buffer.h>
+#include <odp_buffer_pool.h>
+#include <odp_buffer_internal.h>
 
 int odp_event_type(odp_event_t event)
 {
@@ -13,7 +15,7 @@ int odp_event_type(odp_event_t event)
 
        buf = odp_buffer_from_event(event);
 
-       switch (odp_buffer_type(buf)) {
+       switch (_odp_buffer_type(buf)) {
        case ODP_BUFFER_TYPE_RAW:
                return ODP_EVENT_BUFFER;
        case ODP_BUFFER_TYPE_PACKET:
diff --git a/platform/linux-generic/odp_timer.c 
b/platform/linux-generic/odp_timer.c
index 3bb7770..dd4cc72 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -557,7 +557,7 @@ static unsigned timer_expire(odp_timer_pool *tp, uint32_t 
idx, uint64_t tick)
 #endif
        if (odp_likely(tmo_buf != ODP_BUFFER_INVALID)) {
                /* Fill in metadata fields in system timeout buffer */
-               if (odp_buffer_type(tmo_buf) == ODP_BUFFER_TYPE_TIMEOUT) {
+               if (_odp_buffer_type(tmo_buf) == ODP_BUFFER_TYPE_TIMEOUT) {
                        /* Convert from buffer to timeout hdr */
                        odp_timeout_hdr_t *tmo_hdr =
                                timeout_hdr_from_buf(tmo_buf);
@@ -798,7 +798,7 @@ int odp_timer_cancel(odp_timer_t hdl, odp_buffer_t *tmo_buf)
 odp_timeout_t odp_timeout_from_buf(odp_buffer_t buf)
 {
        /* This check not mandated by the API specification */
-       if (odp_buffer_type(buf) != ODP_BUFFER_TYPE_TIMEOUT)
+       if (_odp_buffer_type(buf) != ODP_BUFFER_TYPE_TIMEOUT)
                ODP_ABORT("Buffer not a timeout");
        return (odp_timeout_t)timeout_hdr_from_buf(buf);
 }
-- 
2.2.2


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

Reply via email to