diff options
author | Venkatesh Vivekanandan <venkatesh.vivekanandan@linaro.org> | 2015-02-26 18:25:32 +0000 |
---|---|---|
committer | Venkatesh Vivekanandan <venkatesh.vivekanandan@linaro.org> | 2015-02-27 14:48:18 +0530 |
commit | bb7e919bab7770a714908ef7fc53ef539f456ffe (patch) | |
tree | 44807cfbc6f181838abd46d94bcd09df36279f7a | |
parent | 79b6b651ed69e802ea7daf51708ec9b8b2899e61 (diff) |
buffer: Fix logging and variable access in odp_buffer_snprint
Also sync the definition to the header
Signed-off-by: Venkatesh Vivekanandan <venkatesh.vivekanandan@linaro.org>
Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
-rw-r--r-- | platform/linux-dpdk/include/odp_buffer_internal.h | 2 | ||||
-rw-r--r-- | platform/linux-dpdk/odp_buffer.c | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/platform/linux-dpdk/include/odp_buffer_internal.h b/platform/linux-dpdk/include/odp_buffer_internal.h index b6c0c1c25..b1dad50f4 100644 --- a/platform/linux-dpdk/include/odp_buffer_internal.h +++ b/platform/linux-dpdk/include/odp_buffer_internal.h @@ -137,7 +137,7 @@ typedef struct odp_buffer_hdr_t { uint32_t index; /* Index in the rte_mempool */ } odp_buffer_hdr_t; -int odp_buffer_snprint(char *str, size_t n, odp_buffer_t buf); +int odp_buffer_snprint(char *str, uint32_t n, odp_buffer_t buf); #ifdef __cplusplus diff --git a/platform/linux-dpdk/odp_buffer.c b/platform/linux-dpdk/odp_buffer.c index 4914ca2a0..0b893e776 100644 --- a/platform/linux-dpdk/odp_buffer.c +++ b/platform/linux-dpdk/odp_buffer.c @@ -44,13 +44,13 @@ int odp_buffer_is_valid(odp_buffer_t buf) } -int odp_buffer_snprint(char *str, size_t n, odp_buffer_t buf) +int odp_buffer_snprint(char *str, uint32_t n, odp_buffer_t buf) { odp_buffer_hdr_t *hdr; int len = 0; if (!odp_buffer_is_valid(buf)) { - printf("Buffer is not valid.\n"); + ODP_PRINT("Buffer is not valid.\n"); return len; } @@ -67,7 +67,10 @@ int odp_buffer_snprint(char *str, size_t n, odp_buffer_t buf) len += snprintf(&str[len], n-len, " size %u\n", hdr->mb.buf_len); len += snprintf(&str[len], n-len, - " ref_count %i\n", hdr->mb.refcnt); + " ref_count %i\n", + odp_atomic_load_u32((odp_atomic_u32_t *) + &hdr->mb.refcnt)); + len += snprintf(&str[len], n-len, " dpdk type %i\n", hdr->mb.type); len += snprintf(&str[len], n-len, @@ -86,5 +89,5 @@ void odp_buffer_print(odp_buffer_t buf) len = odp_buffer_snprint(str, max_len-1, buf); str[len] = 0; - printf("\n%s\n", str); + ODP_PRINT("\n%s\n", str); } |