1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright (c) Intel Corporation. 3 * All rights reserved. 4 */ 5 6 #include "spdk/uuid.h" 7 8 #include <uuid/uuid.h> 9 10 SPDK_STATIC_ASSERT(sizeof(struct spdk_uuid) == sizeof(uuid_t), "Size mismatch"); 11 12 int 13 spdk_uuid_parse(struct spdk_uuid *uuid, const char *uuid_str) 14 { 15 return uuid_parse(uuid_str, (void *)uuid) == 0 ? 0 : -EINVAL; 16 } 17 18 int 19 spdk_uuid_fmt_lower(char *uuid_str, size_t uuid_str_size, const struct spdk_uuid *uuid) 20 { 21 if (uuid_str_size < SPDK_UUID_STRING_LEN) { 22 return -EINVAL; 23 } 24 25 uuid_unparse_lower((void *)uuid, uuid_str); 26 return 0; 27 } 28 29 int 30 spdk_uuid_compare(const struct spdk_uuid *u1, const struct spdk_uuid *u2) 31 { 32 return uuid_compare((void *)u1, (void *)u2); 33 } 34 35 void 36 spdk_uuid_generate(struct spdk_uuid *uuid) 37 { 38 uuid_generate((void *)uuid); 39 } 40 41 void 42 spdk_uuid_copy(struct spdk_uuid *dst, const struct spdk_uuid *src) 43 { 44 uuid_copy((void *)dst, (void *)src); 45 } 46