Lines Matching refs:uuid

40 #include <sys/uuid.h>
56 CTASSERT(sizeof(struct uuid) == 16);
129 struct uuid *
130 kern_uuidgen(struct uuid *store, size_t count)
132 struct uuid_private uuid;
138 uuid_node(uuid.node);
141 if (uuid_last.time.ll == 0LL || uuid_last.node[0] != uuid.node[0] ||
142 uuid_last.node[1] != uuid.node[1] ||
143 uuid_last.node[2] != uuid.node[2])
144 uuid.seq = (uint16_t)arc4random() & 0x3fff;
146 uuid.seq = (uuid_last.seq + 1) & 0x3fff;
148 uuid.seq = uuid_last.seq;
150 uuid_last = uuid;
156 uuid.seq = htobe16(uuid.seq | 0x8000);
160 uuid.time.x.low = (uint32_t)time;
161 uuid.time.x.mid = (uint16_t)(time >> 32);
162 uuid.time.x.hi = ((uint16_t)(time >> 48) & 0xfff) | (1 << 12);
163 store[n] = *(struct uuid *)&uuid;
172 struct uuid *store;
179 struct uuid *store;
193 store = malloc(count * sizeof(struct uuid), M_TEMP, M_WAITOK);
195 error = copyout(store, uap->store, count * sizeof(struct uuid));
271 snprintf_uuid(char *buf, size_t sz, struct uuid *uuid)
276 id = (struct uuid_private *)uuid;
284 printf_uuid(struct uuid *uuid)
288 snprintf_uuid(buf, sizeof(buf), uuid);
293 sbuf_printf_uuid(struct sbuf *sb, struct uuid *uuid)
297 snprintf_uuid(buf, sizeof(buf), uuid);
319 le_uuid_enc(void *buf, struct uuid const *uuid)
325 le32enc(p, uuid->time_low);
326 le16enc(p + 4, uuid->time_mid);
327 le16enc(p + 6, uuid->time_hi_and_version);
328 p[8] = uuid->clock_seq_hi_and_reserved;
329 p[9] = uuid->clock_seq_low;
331 p[10 + i] = uuid->node[i];
335 le_uuid_dec(void const *buf, struct uuid *uuid)
341 uuid->time_low = le32dec(p);
342 uuid->time_mid = le16dec(p + 4);
343 uuid->time_hi_and_version = le16dec(p + 6);
344 uuid->clock_seq_hi_and_reserved = p[8];
345 uuid->clock_seq_low = p[9];
347 uuid->node[i] = p[10 + i];
351 be_uuid_enc(void *buf, struct uuid const *uuid)
357 be32enc(p, uuid->time_low);
358 be16enc(p + 4, uuid->time_mid);
359 be16enc(p + 6, uuid->time_hi_and_version);
360 p[8] = uuid->clock_seq_hi_and_reserved;
361 p[9] = uuid->clock_seq_low;
363 p[10 + i] = uuid->node[i];
367 be_uuid_dec(void const *buf, struct uuid *uuid)
373 uuid->time_low = be32dec(p);
374 uuid->time_mid = be16dec(p + 4);
375 uuid->time_hi_and_version = be16dec(p + 6);
376 uuid->clock_seq_hi_and_reserved = p[8];
377 uuid->clock_seq_low = p[9];
379 uuid->node[i] = p[10 + i];
383 parse_uuid(const char *str, struct uuid *uuid)
390 bzero(uuid, sizeof(*uuid));
414 uuid->time_low = c[0];
415 uuid->time_mid = c[1];
416 uuid->time_hi_and_version = c[2];
417 uuid->clock_seq_hi_and_reserved = c[3];
418 uuid->clock_seq_low = c[4];
420 uuid->node[n] = c[n + 5];