From 8c988cab80234cc489e300dd6afa446e7cd02704 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Wed, 18 May 2016 13:04:29 +0200 Subject: [PATCH] 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 --- 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 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. -- 2.20.1