X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fcompat%2Fuuid.h;h=dcc4ed5609b2785945f54f00dd7d575e0c8ad82f;hb=22a7367148c238daf481e8e6756cdb76a73fd3a0;hp=5bf8beb406f0b018dd40bb25959c7b8018f610c6;hpb=ffe600149a7608221985751e1bf293234bf2545c;p=lttng-tools.git diff --git a/src/common/compat/uuid.h b/src/common/compat/uuid.h index 5bf8beb40..dcc4ed560 100644 --- a/src/common/compat/uuid.h +++ b/src/common/compat/uuid.h @@ -23,15 +23,20 @@ #ifndef LTTNG_UUID_H #define LTTNG_UUID_H -#include +#include + /* * Includes final \0. */ #define UUID_STR_LEN 37 +#define UUID_LEN 16 #ifdef LTTNG_HAVE_LIBUUID #include +/* + * uuid_out is of len UUID_LEN. + */ static inline int lttng_uuid_generate(unsigned char *uuid_out) { @@ -43,6 +48,9 @@ int lttng_uuid_generate(unsigned char *uuid_out) #include #include +/* + * uuid_out is of len UUID_LEN. + */ static inline int lttng_uuid_generate(unsigned char *uuid_out) { @@ -59,4 +67,13 @@ int lttng_uuid_generate(unsigned char *uuid_out) #error "LTTng-Tools needs to have a UUID generator configured." #endif +/* + * Convert a UUID to a human-readable, NULL-terminated, string of the form + * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. + * + * Assumes uuid_str is at least UUID_STR_LEN byte long. + */ +LTTNG_HIDDEN +void lttng_uuid_to_str(const unsigned char *uuid, char *uuid_str); + #endif /* LTTNG_UUID_H */