1 /* Copyright (c) 2008, XenSource Inc.
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above copyright
9  *       notice, this list of conditions and the following disclaimer in the
10  *       documentation and/or other materials provided with the distribution.
11  *     * Neither the name of XenSource Inc. nor the names of its contributors
12  *       may be used to endorse or promote products derived from this software
13  *       without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
19  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 #ifndef __BLKTAP2_VHD_UUID_H__
28 #define __BLKTAP2_VHD_UUID_H__
29 
30 #if defined(__linux__)
31 
32 #include <uuid/uuid.h>
33 typedef struct {
34     uuid_t uuid;
35 } vhd_uuid_t;
36 
37 #elif defined(__NetBSD__)
38 
39 #include <uuid.h>
40 
41 typedef uuid_t vhd_uuid_t;
42 
43 #else
44 
45 #error "Please update vhd-uuid.h for your OS"
46 
47 #endif
48 
49 int vhd_uuid_is_nil(vhd_uuid_t *uuid);
50 
51 void vhd_uuid_generate(vhd_uuid_t *uuid);
52 
53 void vhd_uuid_to_string(vhd_uuid_t *uuid, char *out, size_t size);
54 
55 void vhd_uuid_from_string(vhd_uuid_t *uuid, const char *in);
56 
57 void vhd_uuid_copy(vhd_uuid_t *dst, vhd_uuid_t *src);
58 
59 void vhd_uuid_clear(vhd_uuid_t *uuid);
60 
61 int vhd_uuid_compare(vhd_uuid_t *uuid1, vhd_uuid_t *uuid2);
62 
63 #endif /* __BLKTAP2_VHD_UUID_H__ */
64