Lines Matching refs:uuid

42 #include <sys/uuid.h>
58 CTASSERT(sizeof(struct uuid) == 16);
131 struct uuid *
132 kern_uuidgen(struct uuid *store, size_t count)
134 struct uuid_private uuid;
140 uuid_node(uuid.node);
143 if (uuid_last.time.ll == 0LL || uuid_last.node[0] != uuid.node[0] ||
144 uuid_last.node[1] != uuid.node[1] ||
145 uuid_last.node[2] != uuid.node[2])
146 uuid.seq = (uint16_t)arc4random() & 0x3fff;
148 uuid.seq = (uuid_last.seq + 1) & 0x3fff;
150 uuid.seq = uuid_last.seq;
152 uuid_last = uuid;
158 uuid.seq = htobe16(uuid.seq | 0x8000);
162 uuid.time.x.low = (uint32_t)time;
163 uuid.time.x.mid = (uint16_t)(time >> 32);
164 uuid.time.x.hi = ((uint16_t)(time >> 48) & 0xfff) | (1 << 12);
165 store[n] = *(struct uuid *)&uuid;
174 struct uuid *store;
181 struct uuid *store;
195 store = malloc(count * sizeof(struct uuid), M_TEMP, M_WAITOK);
197 error = copyout(store, uap->store, count * sizeof(struct uuid));
273 snprintf_uuid(char *buf, size_t sz, struct uuid *uuid)
278 id = (struct uuid_private *)uuid;
286 printf_uuid(struct uuid *uuid)
290 snprintf_uuid(buf, sizeof(buf), uuid);
295 sbuf_printf_uuid(struct sbuf *sb, struct uuid *uuid)
299 snprintf_uuid(buf, sizeof(buf), uuid);
321 le_uuid_enc(void *buf, struct uuid const *uuid)
327 le32enc(p, uuid->time_low);
328 le16enc(p + 4, uuid->time_mid);
329 le16enc(p + 6, uuid->time_hi_and_version);
330 p[8] = uuid->clock_seq_hi_and_reserved;
331 p[9] = uuid->clock_seq_low;
333 p[10 + i] = uuid->node[i];
337 le_uuid_dec(void const *buf, struct uuid *uuid)
343 uuid->time_low = le32dec(p);
344 uuid->time_mid = le16dec(p + 4);
345 uuid->time_hi_and_version = le16dec(p + 6);
346 uuid->clock_seq_hi_and_reserved = p[8];
347 uuid->clock_seq_low = p[9];
349 uuid->node[i] = p[10 + i];
353 be_uuid_enc(void *buf, struct uuid const *uuid)
359 be32enc(p, uuid->time_low);
360 be16enc(p + 4, uuid->time_mid);
361 be16enc(p + 6, uuid->time_hi_and_version);
362 p[8] = uuid->clock_seq_hi_and_reserved;
363 p[9] = uuid->clock_seq_low;
365 p[10 + i] = uuid->node[i];
369 be_uuid_dec(void const *buf, struct uuid *uuid)
375 uuid->time_low = be32dec(p);
376 uuid->time_mid = be16dec(p + 4);
377 uuid->time_hi_and_version = be16dec(p + 6);
378 uuid->clock_seq_hi_and_reserved = p[8];
379 uuid->clock_seq_low = p[9];
381 uuid->node[i] = p[10 + i];
385 validate_uuid(const char *str, size_t size, struct uuid *uuid, int flags)
393 if (uuid != NULL)
394 bzero(uuid, sizeof(*uuid));
422 if (uuid != NULL) {
423 uuid->time_low = c[0];
424 uuid->time_mid = c[1];
425 uuid->time_hi_and_version = c[2];
426 uuid->clock_seq_hi_and_reserved = c[3];
427 uuid->clock_seq_low = c[4];
429 uuid->node[n] = c[n + 5];
443 parse_uuid(const char *str, struct uuid *uuid)
446 return (validate_uuid(str, strlen(str), uuid, VUUIDF_PARSEFLAGS));
450 uuidcmp(const struct uuid *uuid1, const struct uuid *uuid2)
453 return (memcmp(uuid1, uuid2, sizeof(struct uuid)));