From: Olivier Matz Date: Wed, 18 May 2016 11:04:29 +0000 (+0200) Subject: mempool: remove const qualifier in dump and audit X-Git-Tag: spdx-start~6893 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8c988cab80234cc489e300dd6afa446e7cd02704;p=dpdk.git mempool: remove const qualifier in dump and audit 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 --- diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 8c220acc58..ad1895d2af 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 95f7505a5e..c7a2fd6db9 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.