Many open source projects have moved to using SPDX identifiers to specify license information, reducing the amount of boilerplate code in every source file. This patch replaces the bulk of SPDK .c, .cpp and Makefiles with the BSD-3-Clause identifier. Almost all of these files share the exact same license text, and this patch only modifies the files that contain the most common license text. There can be slight variations because the third clause contains company names - most say "Intel Corporation", but there are instances for Nvidia, Samsung, Eideticom and even "the copyright holder". Used a bash script to automate replacement of the license text with SPDX identifier which is checked into scripts/spdx.sh. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: Iaa88ab5e92ea471691dc298cfe41ebfb5d169780 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12904 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Dong Yi <dongx.yi@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: <qun.wan@intel.com>
81 lines
1.8 KiB
C
81 lines
1.8 KiB
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright (c) Intel Corporation.
|
|
* All rights reserved.
|
|
*/
|
|
|
|
/** \file
|
|
* UUID types and functions
|
|
*/
|
|
|
|
#ifndef SPDK_UUID_H
|
|
#define SPDK_UUID_H
|
|
|
|
#include "spdk/stdinc.h"
|
|
|
|
#include "spdk/assert.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct spdk_uuid {
|
|
union {
|
|
uint8_t raw[16];
|
|
} u;
|
|
};
|
|
SPDK_STATIC_ASSERT(sizeof(struct spdk_uuid) == 16, "Incorrect size");
|
|
|
|
#define SPDK_UUID_STRING_LEN 37 /* 36 characters + null terminator */
|
|
|
|
/**
|
|
* Convert UUID in textual format into a spdk_uuid.
|
|
*
|
|
* \param[out] uuid User-provided UUID buffer.
|
|
* \param uuid_str UUID in textual format in C string.
|
|
*
|
|
* \return 0 on success, or negative errno on failure.
|
|
*/
|
|
int spdk_uuid_parse(struct spdk_uuid *uuid, const char *uuid_str);
|
|
|
|
/**
|
|
* Convert UUID in spdk_uuid into lowercase textual format.
|
|
*
|
|
* \param uuid_str User-provided string buffer to write the textual format into.
|
|
* \param uuid_str_size Size of uuid_str buffer. Must be at least SPDK_UUID_STRING_LEN.
|
|
* \param uuid UUID to convert to textual format.
|
|
*
|
|
* \return 0 on success, or negative errno on failure.
|
|
*/
|
|
int spdk_uuid_fmt_lower(char *uuid_str, size_t uuid_str_size, const struct spdk_uuid *uuid);
|
|
|
|
/**
|
|
* Compare two UUIDs.
|
|
*
|
|
* \param u1 UUID 1.
|
|
* \param u2 UUID 2.
|
|
*
|
|
* \return 0 if u1 == u2, less than 0 if u1 < u2, greater than 0 if u1 > u2.
|
|
*/
|
|
int spdk_uuid_compare(const struct spdk_uuid *u1, const struct spdk_uuid *u2);
|
|
|
|
/**
|
|
* Generate a new UUID.
|
|
*
|
|
* \param[out] uuid User-provided UUID buffer to fill.
|
|
*/
|
|
void spdk_uuid_generate(struct spdk_uuid *uuid);
|
|
|
|
/**
|
|
* Copy a UUID.
|
|
*
|
|
* \param src Source UUID to copy from.
|
|
* \param dst Destination UUID to store.
|
|
*/
|
|
void spdk_uuid_copy(struct spdk_uuid *dst, const struct spdk_uuid *src);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|