]> sourceware.org Git - lvm2.git/blob - lib/uuid/uuid.h
thin: fix recent commits
[lvm2.git] / lib / uuid / uuid.h
1 /*
2 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4 *
5 * This file is part of LVM2.
6 *
7 * This copyrighted material is made available to anyone wishing to use,
8 * modify, copy, or redistribute it subject to the terms and conditions
9 * of the GNU Lesser General Public License v.2.1.
10 *
11 * You should have received a copy of the GNU Lesser General Public License
12 * along with this program; if not, write to the Free Software Foundation,
13 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14 */
15
16 #ifndef _LVM_UUID_H
17 #define _LVM_UUID_H
18
19 #define ID_LEN 32
20 #define ID_LEN_S "32"
21
22 struct id {
23 int8_t uuid[ID_LEN];
24 };
25
26 /*
27 * Unique logical volume identifier
28 * With format1 this is VG uuid + LV uuid + '\0' + padding
29 */
30 union lvid {
31 struct id id[2];
32 char s[2 * sizeof(struct id) + 1 + 7];
33 };
34
35 int lvid_from_lvnum(union lvid *lvid, struct id *vgid, uint32_t lv_num);
36 int lvnum_from_lvid(union lvid *lvid);
37 int lvid_in_restricted_range(union lvid *lvid);
38
39 void uuid_from_num(char *uuid, uint32_t num);
40
41 int lvid_create(union lvid *lvid, struct id *vgid);
42 int id_create(struct id *id);
43 int id_valid(struct id *id);
44 int id_equal(const struct id *lhs, const struct id *rhs);
45
46 /*
47 * Fills 'buffer' with a more human readable form
48 * of the uuid.
49 */
50 int id_write_format(const struct id *id, char *buffer, size_t size);
51
52 /*
53 * Reads a formatted uuid.
54 */
55 int id_read_format(struct id *id, const char *buffer);
56
57 char *id_format_and_copy(struct dm_pool *mem, const struct id *id);
58
59 #endif
This page took 0.036006 seconds and 5 git commands to generate.