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 09FCE8D97 for ; Wed, 18 May 2016 13:05:15 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id A58CF29BA4; Wed, 18 May 2016 13:03:37 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Cc: bruce.richardson@intel.com, stephen@networkplumber.org, keith.wiles@intel.com Date: Wed, 18 May 2016 13:04:29 +0200 Message-Id: <1463569496-31086-9-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.8.0.rc3 In-Reply-To: <1463569496-31086-1-git-send-email-olivier.matz@6wind.com> References: <1460629199-32489-1-git-send-email-olivier.matz@6wind.com> <1463569496-31086-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v3 08/35] 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: Wed, 18 May 2016 11:05:15 -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 8c220ac..ad1895d 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -787,7 +787,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; @@ -845,7 +845,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); @@ -856,7 +856,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; @@ -927,7 +927,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 95f7505..c7a2fd6 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -650,7 +650,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. @@ -1188,7 +1188,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.8.0.rc3