~ubuntu-branches/debian/sid/grub2/sid-200907171837

« back to all changes in this revision

Viewing changes to include/grub/lvm.h

  • Committer: Bazaar Package Importer
  • Author(s): Robert Millan
  • Date: 2006-10-14 21:19:21 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20061014211921-ge29q0dowqxicngk
Tags: 1.95-1
* New upstream release.
  - patches/03_revert_partition_numbering.diff: Delete (obsoleted).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* lvm.h - On disk structures for LVM. */
 
2
/*
 
3
 *  GRUB  --  GRand Unified Bootloader
 
4
 *  Copyright (C) 2006  Free Software Foundation, Inc.
 
5
 *
 
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 2 of the License, or
 
9
 *  (at your option) any later version.
 
10
 *
 
11
 *  This program 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.
 
15
 *
 
16
 *  You should have received a copy of the GNU General Public License
 
17
 *  along with GRUB; if not, write to the Free Software
 
18
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
 */
 
20
 
 
21
#ifndef GRUB_LVM_H
 
22
#define GRUB_LVM_H      1
 
23
 
 
24
#include <grub/types.h>
 
25
 
 
26
/* Length of ID string, excluding terminating zero. */
 
27
#define GRUB_LVM_ID_STRLEN 38
 
28
 
 
29
struct grub_lvm_vg {
 
30
  char id[GRUB_LVM_ID_STRLEN+1];
 
31
  char *name;
 
32
  int extent_size;
 
33
  struct grub_lvm_pv *pvs;
 
34
  struct grub_lvm_lv *lvs;
 
35
  struct grub_lvm_vg *next;
 
36
};
 
37
 
 
38
struct grub_lvm_pv {
 
39
  char id[GRUB_LVM_ID_STRLEN+1];
 
40
  char *name;
 
41
  grub_disk_t disk;
 
42
  int start; /* Sector number where the data area starts. */
 
43
  struct grub_lvm_pv *next;
 
44
};
 
45
 
 
46
struct grub_lvm_lv {
 
47
  char *name;
 
48
  unsigned int number;
 
49
  unsigned int segment_count;
 
50
  grub_uint64_t size;
 
51
  struct grub_lvm_segment *segments; /* Pointer to segment_count segments. */
 
52
  struct grub_lvm_vg *vg;
 
53
  struct grub_lvm_lv *next;
 
54
};
 
55
 
 
56
struct grub_lvm_segment {
 
57
  unsigned int start_extent;
 
58
  unsigned int extent_count;
 
59
  unsigned int stripe_count;
 
60
  unsigned int stripe_size;
 
61
  struct grub_lvm_stripe *stripes; /* Pointer to stripe_count stripes. */
 
62
};
 
63
 
 
64
struct grub_lvm_stripe {
 
65
  int start;
 
66
  struct grub_lvm_pv *pv;
 
67
};
 
68
 
 
69
#define GRUB_LVM_LABEL_SIZE GRUB_DISK_SECTOR_SIZE
 
70
#define GRUB_LVM_LABEL_SCAN_SECTORS 4L
 
71
 
 
72
#define GRUB_LVM_LABEL_ID "LABELONE"
 
73
#define GRUB_LVM_LVM2_LABEL "LVM2 001"
 
74
 
 
75
#define GRUB_LVM_ID_LEN 32
 
76
 
 
77
/* On disk - 32 bytes */
 
78
struct grub_lvm_label_header {
 
79
  grub_int8_t id[8];            /* LABELONE */
 
80
  grub_uint64_t sector_xl;      /* Sector number of this label */
 
81
  grub_uint32_t crc_xl;         /* From next field to end of sector */
 
82
  grub_uint32_t offset_xl;      /* Offset from start of struct to contents */
 
83
  grub_int8_t type[8];          /* LVM2 001 */
 
84
} __attribute__ ((packed));
 
85
 
 
86
/* On disk */
 
87
struct grub_lvm_disk_locn {
 
88
  grub_uint64_t offset;         /* Offset in bytes to start sector */
 
89
  grub_uint64_t size;           /* Bytes */
 
90
} __attribute__ ((packed));
 
91
 
 
92
/* Fields with the suffix _xl should be xlate'd wherever they appear */
 
93
/* On disk */
 
94
struct grub_lvm_pv_header {
 
95
  grub_int8_t pv_uuid[GRUB_LVM_ID_LEN];
 
96
 
 
97
  /* This size can be overridden if PV belongs to a VG */
 
98
  grub_uint64_t device_size_xl; /* Bytes */
 
99
 
 
100
  /* NULL-terminated list of data areas followed by */
 
101
  /* NULL-terminated list of metadata area headers */
 
102
  struct grub_lvm_disk_locn disk_areas_xl[0];   /* Two lists */
 
103
} __attribute__ ((packed));
 
104
 
 
105
#define GRUB_LVM_FMTT_MAGIC "\040\114\126\115\062\040\170\133\065\101\045\162\060\116\052\076"
 
106
#define GRUB_LVM_FMTT_VERSION 1
 
107
 
 
108
/* On disk */
 
109
struct grub_lvm_raw_locn {
 
110
  grub_uint64_t offset;         /* Offset in bytes to start sector */
 
111
  grub_uint64_t size;           /* Bytes */
 
112
  grub_uint32_t checksum;
 
113
  grub_uint32_t filler;
 
114
} __attribute__ ((packed));
 
115
 
 
116
/* On disk */
 
117
/* Structure size limited to one sector */
 
118
struct grub_lvm_mda_header {
 
119
  grub_uint32_t checksum_xl;    /* Checksum of rest of mda_header */
 
120
  grub_int8_t magic[16];        /* To aid scans for metadata */
 
121
  grub_uint32_t version;
 
122
  grub_uint64_t start;          /* Absolute start byte of mda_header */
 
123
  grub_uint64_t size;           /* Size of metadata area */
 
124
  
 
125
  struct grub_lvm_raw_locn raw_locns[0];        /* NULL-terminated list */
 
126
} __attribute__ ((packed));
 
127
 
 
128
 
 
129
#endif /* ! GRUB_LVM_H */