aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/odp_pool.c
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2020-05-27 18:38:24 +0300
committerPetri Savolainen <petri.savolainen@nokia.com>2020-06-05 09:44:20 +0300
commitf08b56808a3a5199159ad0b1e972675f863b8987 (patch)
tree43a7af546e8ab08707a9ee5fea9eef7fbd8331e0 /platform/linux-generic/odp_pool.c
parent7067f5503fb289d02d314594d78b18d18377e0e9 (diff)
linux-gen: pool: include pool index into SHM name
Format pool and uarea SHM names to be similar and include pool index into the names. This helps debugging as pool names are optional or may not be unique. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'platform/linux-generic/odp_pool.c')
-rw-r--r--platform/linux-generic/odp_pool.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
index 5275c52fe..d31f210e7 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -513,9 +513,10 @@ static odp_pool_t pool_create(const char *name, const odp_pool_param_t *params,
uint32_t max_len, cache_size, burst_size;
uint32_t ring_size;
uint32_t num_extra = 0;
- int name_len;
- const char *postfix = "_uarea";
- char uarea_name[ODP_POOL_NAME_LEN + sizeof(postfix)];
+ const char *max_prefix = "pool_000_uarea_";
+ int max_prefix_len = strlen(max_prefix);
+ char shm_name[ODP_POOL_NAME_LEN + max_prefix_len];
+ char uarea_name[ODP_POOL_NAME_LEN + max_prefix_len];
align = 0;
@@ -622,9 +623,9 @@ static odp_pool_t pool_create(const char *name, const odp_pool_param_t *params,
pool->name[ODP_POOL_NAME_LEN - 1] = 0;
}
- name_len = strlen(pool->name);
- memcpy(uarea_name, pool->name, name_len);
- strcpy(&uarea_name[name_len], postfix);
+ /* Format SHM names from prefix, pool index and pool name. */
+ sprintf(shm_name, "pool_%03i_%s", pool->pool_idx, pool->name);
+ sprintf(uarea_name, "pool_%03i_uarea_%s", pool->pool_idx, pool->name);
pool->params = *params;
pool->block_offset = 0;
@@ -706,7 +707,7 @@ static odp_pool_t pool_create(const char *name, const odp_pool_param_t *params,
pool->burst_size = burst_size;
}
- shm = odp_shm_reserve(pool->name, pool->shm_size, ODP_PAGE_SIZE,
+ shm = odp_shm_reserve(shm_name, pool->shm_size, ODP_PAGE_SIZE,
shmflags);
pool->shm = shm;