2 * Copyright (c) 2008 Andrew Thompson <thompsa@FreeBSD.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #define G_LLVM_DEBUG(lvl, ...) do { \
30 if (g_llvm_debug >= (lvl)) { \
31 printf("GEOM_LINUX_LVM"); \
32 if (g_llvm_debug > 0) \
33 printf("[%u]", lvl); \
35 printf(__VA_ARGS__); \
40 #define G_LLVM_CLASS_NAME "LINUX_LVM"
41 #define G_LLVM_NAMELEN 128
42 #define G_LLVM_UUIDLEN 40
43 #define G_LLVM_MAGIC "\040\114\126\115\062\040\170\133" \
44 "\065\101\045\162\060\116\052\076"
50 char ll_uuid[G_LLVM_UUIDLEN];
53 uint64_t ll_md_offset;
57 struct g_llvm_metadata {
62 uint64_t md_reloffset;
64 struct g_llvm_vg *md_vg;
68 LIST_ENTRY(g_llvm_lv) lv_next;
69 struct g_llvm_vg *lv_vg;
70 char lv_name[G_LLVM_NAMELEN];
71 char lv_uuid[G_LLVM_UUIDLEN];
74 struct g_provider *lv_gprov;
76 LIST_HEAD(, g_llvm_segment) lv_segs;
78 struct g_llvm_segment *lv_firstsg;
82 LIST_ENTRY(g_llvm_pv) pv_next;
83 struct g_llvm_vg *pv_vg;
84 char pv_name[G_LLVM_NAMELEN];
85 char pv_uuid[G_LLVM_UUIDLEN];
89 struct g_provider *pv_gprov;
90 struct g_consumer *pv_gcons;
93 struct g_llvm_segment {
94 LIST_ENTRY(g_llvm_segment) sg_next;
98 char sg_pvname[G_LLVM_NAMELEN];
99 struct g_llvm_pv *sg_pv;
105 LIST_ENTRY(g_llvm_vg) vg_next;
106 char vg_name[G_LLVM_NAMELEN];
107 char vg_uuid[G_LLVM_UUIDLEN];
108 size_t vg_extentsize;
110 struct g_geom *vg_geom;
111 LIST_HEAD(, g_llvm_pv) vg_pvs;
112 LIST_HEAD(, g_llvm_lv) vg_lvs;