From d0d946ddb47c192a6a6de07742c34100a7cfc756 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Wed, 8 Feb 2017 11:43:02 -0700 Subject: [PATCH] test: add an spdk_malloc implementation for test_env Signed-off-by: Jim Harris Change-Id: I6f738d510fde00d5d068dd530885d8b0b5e17035 --- test/lib/test_env.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/lib/test_env.c b/test/lib/test_env.c index d405c21d4..0cc7da1b3 100644 --- a/test/lib/test_env.c +++ b/test/lib/test_env.c @@ -39,7 +39,7 @@ #include "spdk/env.h" void * -spdk_zmalloc(size_t size, size_t align, uint64_t *phys_addr) +spdk_malloc(size_t size, size_t align, uint64_t *phys_addr) { void *buf = NULL; if (posix_memalign(&buf, align, size)) { @@ -51,6 +51,17 @@ spdk_zmalloc(size_t size, size_t align, uint64_t *phys_addr) return buf; } +void * +spdk_zmalloc(size_t size, size_t align, uint64_t *phys_addr) +{ + void *buf = spdk_malloc(size, align, phys_addr); + + if (buf != NULL) { + memset(buf, 0, size); + } + return buf; +} + void * spdk_realloc(void *buf, size_t size, size_t align, uint64_t *phys_addr) {