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