/* String conversion routines have the following copyright */
/*
- * Copyright (c) 2002 Kungliga Tekniska Högskolan
+ * Copyright (c) 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
# ifdef AFS_NT40_ENV
# include <rpc.h>
-# include <process.h>
# else
# include <net/if.h>
# if !defined(AFS_LINUX20_ENV) && !defined(AFS_ARM_DARWIN_ENV)
* +--------------------------...-----+
*/
-afsUUID afs_uuid_g_nil_uuid = { 0 };
+afsUUID afs_uuid_g_nil_uuid;
static uuid_time_t time_now, time_last;
static u_short uuid_time_adjust, clock_seq;
static afs_uint32 rand_m, rand_ia, rand_ib, rand_irand, uuid_init_done = 0;
return 0;
}
-/*
+/**
* Converts a UUID from binary representation to a string representation.
+ *
+ * @param[in] uuid pointer to a afsUUID
+ * @param[out] buf format work buffer
+ *
+ * @returns pointer to buffer containing string representation of "uuid"
*/
-int
-afsUUID_to_string(const afsUUID * uuid, char *str, size_t strsz)
+char *
+afsUUID_to_string(const afsUUID * uuid, struct uuid_fmtbuf *buf)
{
- snprintf(str, strsz, "%08x-%04x-%04x-%02x-%02x-%02x%02x%02x%02x%02x%02x",
+ memset(buf, 0, sizeof(*buf));
+ snprintf(buf->buffer, sizeof(buf->buffer),
+ "%08x-%04x-%04x-%02x-%02x-%02x%02x%02x%02x%02x%02x",
uuid->time_low, uuid->time_mid, uuid->time_hi_and_version,
(unsigned char)uuid->clock_seq_hi_and_reserved,
(unsigned char)uuid->clock_seq_low, (unsigned char)uuid->node[0],
(unsigned char)uuid->node[3], (unsigned char)uuid->node[4],
(unsigned char)uuid->node[5]);
- return 0;
+ return buf->buffer;
}
#endif
void
uuid__get_os_time(uuid_time_t * os_time)
{
- osi_timeval_t tp;
+ osi_timeval32_t tp;
osi_GetTime(&tp);
os_time->hi = tp.tv_sec;