Loading...
Searching...
No Matches
uuid.h File Reference

UUID types and functions. More...

Data Structures

struct  spdk_uuid
 

Macros

#define SPDK_UUID_STRING_LEN   37 /* 36 characters + null terminator */
 

Functions

 SPDK_STATIC_ASSERT (sizeof(struct spdk_uuid)==16, "Incorrect size")
 
int spdk_uuid_parse (struct spdk_uuid *uuid, const char *uuid_str)
 Convert UUID in textual format into a spdk_uuid.
 
int spdk_uuid_fmt_lower (char *uuid_str, size_t uuid_str_size, const struct spdk_uuid *uuid)
 Convert UUID in spdk_uuid into lowercase textual format.
 
int spdk_uuid_compare (const struct spdk_uuid *u1, const struct spdk_uuid *u2)
 Compare two UUIDs.
 
void spdk_uuid_generate (struct spdk_uuid *uuid)
 Generate a new UUID.
 
int spdk_uuid_generate_sha1 (struct spdk_uuid *uuid, struct spdk_uuid *ns_uuid, const char *name, size_t len)
 Generate a new UUID using SHA1 hash.
 
void spdk_uuid_copy (struct spdk_uuid *dst, const struct spdk_uuid *src)
 Copy a UUID.
 
bool spdk_uuid_is_null (const struct spdk_uuid *uuid)
 Compare the UUID to the NULL value (all bits equal to zero).
 
void spdk_uuid_set_null (struct spdk_uuid *uuid)
 Set the value of UUID to the NULL value.
 

Detailed Description

UUID types and functions.

Function Documentation

◆ spdk_uuid_compare()

int spdk_uuid_compare ( const struct spdk_uuid * u1,
const struct spdk_uuid * u2 )

Compare two UUIDs.

Parameters
u1UUID 1.
u2UUID 2.
Returns
0 if u1 == u2, less than 0 if u1 < u2, greater than 0 if u1 > u2.

◆ spdk_uuid_copy()

void spdk_uuid_copy ( struct spdk_uuid * dst,
const struct spdk_uuid * src )

Copy a UUID.

Parameters
srcSource UUID to copy from.
dstDestination UUID to store.

◆ spdk_uuid_fmt_lower()

int spdk_uuid_fmt_lower ( char * uuid_str,
size_t uuid_str_size,
const struct spdk_uuid * uuid )

Convert UUID in spdk_uuid into lowercase textual format.

Parameters
uuid_strUser-provided string buffer to write the textual format into.
uuid_str_sizeSize of uuid_str buffer. Must be at least SPDK_UUID_STRING_LEN.
uuidUUID to convert to textual format.
Returns
0 on success, or negative errno on failure.

◆ spdk_uuid_generate()

void spdk_uuid_generate ( struct spdk_uuid * uuid)

Generate a new UUID.

Parameters
[out]uuidUser-provided UUID buffer to fill.

◆ spdk_uuid_generate_sha1()

int spdk_uuid_generate_sha1 ( struct spdk_uuid * uuid,
struct spdk_uuid * ns_uuid,
const char * name,
size_t len )

Generate a new UUID using SHA1 hash.

Parameters
[out]uuidUser-provided UUID buffer to fill.
ns_uuidWell-known namespace UUID for generated UUID.
nameArbitrary, binary string.
lenLength of binary string.
Returns
0 on success, or negative errno on failure.

◆ spdk_uuid_is_null()

bool spdk_uuid_is_null ( const struct spdk_uuid * uuid)

Compare the UUID to the NULL value (all bits equal to zero).

Parameters
uuidThe UUID to test.
Returns
true if uuid is equal to the NULL value, false if not.

◆ spdk_uuid_parse()

int spdk_uuid_parse ( struct spdk_uuid * uuid,
const char * uuid_str )

Convert UUID in textual format into a spdk_uuid.

Parameters
[out]uuidUser-provided UUID buffer.
uuid_strUUID in textual format in C string.
Returns
0 on success, or negative errno on failure.

◆ spdk_uuid_set_null()

void spdk_uuid_set_null ( struct spdk_uuid * uuid)

Set the value of UUID to the NULL value.

Parameters
uuidThe UUID to set.