1 /* lvm.h - On disk structures for LVM. */
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2006,2007 Free Software Foundation, Inc.
6 * GRUB is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * GRUB is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
23 #include <grub/types.h>
24 #include <grub/diskfilter.h>
26 /* Length of ID string, excluding terminating zero. */
27 #define GRUB_LVM_ID_STRLEN 38
29 #define GRUB_LVM_LABEL_SIZE GRUB_DISK_SECTOR_SIZE
30 #define GRUB_LVM_LABEL_SCAN_SECTORS 4L
32 #define GRUB_LVM_LABEL_ID "LABELONE"
33 #define GRUB_LVM_LVM2_LABEL "LVM2 001"
35 #define GRUB_LVM_ID_LEN 32
37 /* On disk - 32 bytes */
38 struct grub_lvm_label_header
{
39 grub_int8_t id
[8]; /* LABELONE */
40 grub_uint64_t sector_xl
; /* Sector number of this label */
41 grub_uint32_t crc_xl
; /* From next field to end of sector */
42 grub_uint32_t offset_xl
; /* Offset from start of struct to contents */
43 grub_int8_t type
[8]; /* LVM2 001 */
47 struct grub_lvm_disk_locn
{
48 grub_uint64_t offset
; /* Offset in bytes to start sector */
49 grub_uint64_t size
; /* Bytes */
52 /* Fields with the suffix _xl should be xlate'd wherever they appear */
54 struct grub_lvm_pv_header
{
55 grub_int8_t pv_uuid
[GRUB_LVM_ID_LEN
];
57 /* This size can be overridden if PV belongs to a VG */
58 grub_uint64_t device_size_xl
; /* Bytes */
60 /* NULL-terminated list of data areas followed by */
61 /* NULL-terminated list of metadata area headers */
62 struct grub_lvm_disk_locn disk_areas_xl
[0]; /* Two lists */
65 #define GRUB_LVM_FMTT_MAGIC "\040\114\126\115\062\040\170\133\065\101\045\162\060\116\052\076"
66 #define GRUB_LVM_FMTT_VERSION 1
67 #define GRUB_LVM_MDA_HEADER_SIZE 512
70 struct grub_lvm_raw_locn
{
71 grub_uint64_t offset
; /* Offset in bytes to start sector */
72 grub_uint64_t size
; /* Bytes */
73 grub_uint32_t checksum
;
78 /* Structure size limited to one sector */
79 struct grub_lvm_mda_header
{
80 grub_uint32_t checksum_xl
; /* Checksum of rest of mda_header */
81 grub_int8_t magic
[16]; /* To aid scans for metadata */
82 grub_uint32_t version
;
83 grub_uint64_t start
; /* Absolute start byte of mda_header */
84 grub_uint64_t size
; /* Size of metadata area */
86 struct grub_lvm_raw_locn raw_locns
[0]; /* NULL-terminated list */
90 #endif /* ! GRUB_LVM_H */