From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id E9BEB298F for ; Thu, 14 Apr 2016 12:20:23 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 9118128F36; Thu, 14 Apr 2016 12:19:40 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Cc: bruce.richardson@intel.com, stephen@networkplumber.org Date: Thu, 14 Apr 2016 12:19:32 +0200 Message-Id: <1460629199-32489-10-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1460629199-32489-1-git-send-email-olivier.matz@6wind.com> References: <1457540381-20274-1-git-send-email-olivier.matz@6wind.com> <1460629199-32489-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH 09/36] mempool: remove const qualifier in dump and audit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Apr 2016 10:20:24 -0000 In next commits, we will use an iterator to walk through the objects in mempool in rte_mempool_audit(). This iterator takes a "struct rte_mempool *" as a parameter because it is assumed that the callback function can modify the mempool. The previous approach was to introduce a RTE_DECONST() macro, but after discussion it seems that removing the const qualifier is better to avoid fooling the compiler, and also because these functions are not used in datapath (possible compiler optimizations due to const are not critical). Signed-off-by: Olivier Matz --- lib/librte_mempool/rte_mempool.c | 8 ++++---- lib/librte_mempool/rte_mempool.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 664a2bf..0fd244b 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -781,7 +781,7 @@ mempool_obj_audit(void *arg, void *start, void *end, uint32_t idx) } static void -mempool_audit_cookies(const struct rte_mempool *mp) +mempool_audit_cookies(struct rte_mempool *mp) { uint32_t elt_sz, num; struct mempool_audit_arg arg; @@ -839,7 +839,7 @@ mempool_audit_cache(const struct rte_mempool *mp) /* check the consistency of mempool (size, cookies, ...) */ void -rte_mempool_audit(const struct rte_mempool *mp) +rte_mempool_audit(struct rte_mempool *mp) { mempool_audit_cache(mp); mempool_audit_cookies(mp); @@ -850,7 +850,7 @@ rte_mempool_audit(const struct rte_mempool *mp) /* dump the status of the mempool on the console */ void -rte_mempool_dump(FILE *f, const struct rte_mempool *mp) +rte_mempool_dump(FILE *f, struct rte_mempool *mp) { #ifdef RTE_LIBRTE_MEMPOOL_DEBUG struct rte_mempool_debug_stats sum; @@ -921,7 +921,7 @@ rte_mempool_dump(FILE *f, const struct rte_mempool *mp) void rte_mempool_list_dump(FILE *f) { - const struct rte_mempool *mp = NULL; + struct rte_mempool *mp = NULL; struct rte_tailq_entry *te; struct rte_mempool_list *mempool_list; diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 54a5917..a80335f 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -645,7 +645,7 @@ rte_dom0_mempool_create(const char *name, unsigned n, unsigned elt_size, * @param mp * A pointer to the mempool structure. */ -void rte_mempool_dump(FILE *f, const struct rte_mempool *mp); +void rte_mempool_dump(FILE *f, struct rte_mempool *mp); /** * @internal Put several objects back in the mempool; used internally. @@ -1183,7 +1183,7 @@ rte_mempool_virt2phy(const struct rte_mempool *mp, const void *elt) * @param mp * A pointer to the mempool structure. */ -void rte_mempool_audit(const struct rte_mempool *mp); +void rte_mempool_audit(struct rte_mempool *mp); /** * Return a pointer to the private data in an mempool structure. -- 2.1.4