~ubuntu-branches/ubuntu/breezy/lvm2/breezy

« back to all changes in this revision

Viewing changes to lib/format_text/layout.h

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Caulfield
  • Date: 2004-11-03 09:37:56 UTC
  • Revision ID: james.westby@ubuntu.com-20041103093756-jt0nj8z0v8k1lyiv
Tags: upstream-2.00.25
ImportĀ upstreamĀ versionĀ 2.00.25

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.  
 
3
 * Copyright (C) 2004 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 General Public License v.2.
 
10
 *
 
11
 * You should have received a copy of the GNU 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_TEXT_LAYOUT_H
 
17
#define _LVM_TEXT_LAYOUT_H
 
18
 
 
19
#include "config.h"
 
20
#include "lvm-types.h"
 
21
#include "metadata.h"
 
22
#include "uuid.h"
 
23
 
 
24
/* On disk */
 
25
struct disk_locn {
 
26
        uint64_t offset;        /* Offset in bytes to start sector */
 
27
        uint64_t size;          /* Bytes */
 
28
} __attribute__ ((packed));
 
29
 
 
30
/* Data areas (holding PEs) */
 
31
struct data_area_list {
 
32
        struct list list;
 
33
        struct disk_locn disk_locn;
 
34
};
 
35
 
 
36
/* Fields with the suffix _xl should be xlate'd wherever they appear */
 
37
/* On disk */
 
38
struct pv_header {
 
39
        uint8_t pv_uuid[ID_LEN];
 
40
        uint64_t device_size_xl;        /* Bytes */
 
41
 
 
42
        /* NULL-terminated list of data areas followed by */
 
43
        /* NULL-terminated list of metadata area headers */
 
44
        struct disk_locn disk_areas_xl[0];      /* Two lists */
 
45
} __attribute__ ((packed));
 
46
 
 
47
/* On disk */
 
48
struct raw_locn {
 
49
        uint64_t offset;        /* Offset in bytes to start sector */
 
50
        uint64_t size;          /* Bytes */
 
51
        uint32_t checksum;
 
52
        uint32_t filler;
 
53
} __attribute__ ((packed));
 
54
 
 
55
/* On disk */
 
56
/* Structure size limited to one sector */
 
57
struct mda_header {
 
58
        uint32_t checksum_xl;   /* Checksum of rest of mda_header */
 
59
        uint8_t magic[16];      /* To aid scans for metadata */
 
60
        uint32_t version;
 
61
        uint64_t start;         /* Absolute start byte of mda_header */
 
62
        uint64_t size;          /* Size of metadata area */
 
63
 
 
64
        struct raw_locn raw_locns[0];   /* NULL-terminated list */
 
65
} __attribute__ ((packed));
 
66
 
 
67
struct mda_lists {
 
68
        struct list dirs;
 
69
        struct list raws;
 
70
        struct metadata_area_ops *file_ops;
 
71
        struct metadata_area_ops *raw_ops;
 
72
};
 
73
 
 
74
struct mda_context {
 
75
        struct device_area area;
 
76
        struct raw_locn rlocn;  /* Store inbetween write and commit */
 
77
};
 
78
 
 
79
/* FIXME Convert this at runtime */
 
80
#define FMTT_MAGIC "\040\114\126\115\062\040\170\133\065\101\045\162\060\116\052\076"
 
81
#define FMTT_VERSION 1
 
82
#define MDA_HEADER_SIZE 512
 
83
#define LVM2_LABEL "LVM2 001"
 
84
 
 
85
#endif