2 * Public include file for the UUID library
4 * Copyright (C) 1996, 1997, 1998 Theodore Ts'o.
5 * Copyright (C) 2002 Cluster File System
6 * - changed for use in lustre
9 * This file may be redistributed under the terms of the GNU
10 * Library General Public License.
13 #define DEBUG_SUBSYSTEM S_CLASS
16 # include <liblustre.h>
19 #include <obd_support.h>
20 #include <obd_class.h>
25 __u16 time_hi_and_version;
30 static void uuid_unpack(class_uuid_t in, struct uuid *uu)
36 tmp = (tmp << 8) | *ptr++;
37 tmp = (tmp << 8) | *ptr++;
38 tmp = (tmp << 8) | *ptr++;
42 tmp = (tmp << 8) | *ptr++;
46 tmp = (tmp << 8) | *ptr++;
47 uu->time_hi_and_version = tmp;
50 tmp = (tmp << 8) | *ptr++;
53 memcpy(uu->node, ptr, 6);
56 void generate_random_uuid(unsigned char uuid_out[16]);
58 void class_uuid_unparse(class_uuid_t uu, struct obd_uuid *out)
62 uuid_unpack(uu, &uuid);
64 "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
65 uuid.time_low, uuid.time_mid, uuid.time_hi_and_version,
66 uuid.clock_seq >> 8, uuid.clock_seq & 0xFF,
67 uuid.node[0], uuid.node[1], uuid.node[2],
68 uuid.node[3], uuid.node[4], uuid.node[5]);