lib/util: return const pointer from spdk_cpuset_fmt

Change-Id: Iab5f9703ae9235fd3820228127d72e85af9826bc
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/400601
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Pawel Wodkowski 2018-02-15 18:58:21 +01:00 committed by Jim Harris
parent d6408c0dd1
commit e7285749ed
3 changed files with 5 additions and 3 deletions

View File

@ -136,8 +136,10 @@ uint32_t spdk_cpuset_count(const struct spdk_cpuset *set);
* \param CPU set.
* \return Pointer to hexadecimal representation of CPU set. Buffer to store a
* string is dynamically allocated internally and freed with CPU set object.
* Memory returned by this function might be changed after subsequent calls to
* this function so string should be copied by user.
*/
char *spdk_cpuset_fmt(struct spdk_cpuset *set);
const char *spdk_cpuset_fmt(struct spdk_cpuset *set);
/**
* Convert a string containing a CPU core mask into a CPU set.

View File

@ -132,7 +132,7 @@ spdk_cpuset_count(const struct spdk_cpuset *set)
return count;
}
char *
const char *
spdk_cpuset_fmt(struct spdk_cpuset *set)
{
uint32_t lcore, lcore_max = 0;

View File

@ -189,7 +189,7 @@ test_cpuset_fmt(void)
int i;
uint32_t lcore;
struct spdk_cpuset *core_mask = spdk_cpuset_alloc();
char *hex_mask;
const char *hex_mask;
char hex_mask_ref[SPDK_CPUSET_SIZE / 4 + 1];
/* Clear coremask. hex_mask should be "0" */