per Intel policy to include file commit date using git cmd below. The policy does not apply to non-Intel (C) notices. git log --follow -C90% --format=%ad --date default <file> | tail -1 and then pull just the 4 digit year from the result. Intel copyrights were not added to files where Intel either had no contribution ot the contribution lacked substance (ie license header updates, formatting changes, etc). Contribution date used "--follow -C95%" to get the most accurate date. Note that several files in this patch didn't end the license/(c) block with a blank comment line so these were added as the vast majority of files do have this last blank line. Simply there for consistency. Signed-off-by: paul luse <paul.e.luse@intel.com> Change-Id: Id5b7ce4f658fe87132f14139ead58d6e285c04d4 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15192 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Community-CI: Mellanox Build Bot
81 lines
1.8 KiB
C
81 lines
1.8 KiB
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright (C) 2018 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
|