opr: implement the BSD ffs() functions
[openafs.git] / src / opr / uuid.h
1 /*
2  * Copyright (c) 2012 Your File System Inc. All rights reserved.
3  */
4
5 #ifndef OPENAFS_OPR_UUID_H
6 #define OPENAFS_OPR_UUID_H 1
7
8 struct opr_uuid {
9     unsigned char data[16];
10 };
11
12 struct opr_uuid_unpacked {
13     afs_uint32 time_low;
14     unsigned short time_mid;
15     unsigned short time_hi_and_version;
16     char clock_seq_hi_and_reserved;
17     char clock_seq_low;
18     char node[6];
19 };
20
21 typedef struct opr_uuid opr_uuid_t;
22 typedef opr_uuid_t opr_uuid; /* For XDR */
23
24 extern void opr_uuid_create(opr_uuid_t *uuid);
25 extern int opr_uuid_isNil(const opr_uuid_t *uuid);
26 extern int opr_uuid_equal(const opr_uuid_t *uuid1, const opr_uuid_t *uuid2);
27 extern unsigned int opr_uuid_hash(const opr_uuid_t *uuid);
28
29 #if !defined(KERNEL)
30 extern int opr_uuid_toString(const opr_uuid_t *uuid, char **string);
31 extern void opr_uuid_freeString(char *string);
32 extern int opr_uuid_fromString(opr_uuid_t *uuid, const char *string);
33 #endif
34
35 extern void opr_uuid_pack(opr_uuid_t *uuid, const struct opr_uuid_unpacked *raw);
36 extern void opr_uuid_unpack(const opr_uuid_t *uuid, struct opr_uuid_unpacked *raw);
37
38 #endif