diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 11:05:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 11:05:25 +0000 |
commit | d3b6c0269abf2332f6f4b43760524b040ca58ff8 (patch) | |
tree | 6a0ebdb4cb3c7b76c824f021d9f3624d16037457 /src/nvme/util.c | |
parent | Adding upstream version 1.8. (diff) | |
download | libnvme-d3b6c0269abf2332f6f4b43760524b040ca58ff8.tar.xz libnvme-d3b6c0269abf2332f6f4b43760524b040ca58ff8.zip |
Adding upstream version 1.9.upstream/1.9
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/nvme/util.c')
-rw-r--r-- | src/nvme/util.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/nvme/util.c b/src/nvme/util.c index f091da7..7404509 100644 --- a/src/nvme/util.c +++ b/src/nvme/util.c @@ -12,6 +12,7 @@ #include <stdbool.h> #include <string.h> #include <errno.h> +#include <malloc.h> #include <sys/stat.h> #include <fcntl.h> @@ -619,6 +620,7 @@ static const char * const libnvme_status[] = { [ENVME_CONNECT_OPNOTSUPP] = "not supported", [ENVME_CONNECT_CONNREFUSED] = "connection refused", [ENVME_CONNECT_ADDRNOTAVAIL] = "cannot assign requested address", + [ENVME_CONNECT_IGNORED] = "connection ignored", }; const char *nvme_errno_to_string(int status) @@ -1135,3 +1137,17 @@ void *__nvme_alloc(size_t len) memset(p, 0, _len); return p; } + +void *__nvme_realloc(void *p, size_t len) +{ + size_t old_len = malloc_usable_size(p); + + void *result = __nvme_alloc(len); + + if (p) { + memcpy(result, p, min(old_len, len)); + free(p); + } + + return result; +} |