Tizen 2.1 base
[external/device-mapper.git] / lib / metadata / pv.h
1 /*
2  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3  * Copyright (C) 2004-2010 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 Lesser General Public License v.2.1.
10  *
11  * You should have received a copy of the GNU Lesser 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 #ifndef _LVM_PV_H
16 #define _LVM_PV_H
17
18 struct id;
19 struct device;
20 struct format_type;
21 struct volume_group;
22
23 struct physical_volume {
24         struct id id;
25         struct device *dev;
26         const struct format_type *fmt;
27
28         /*
29          * vg_name and vgid are used before the parent VG struct exists.
30          * FIXME: Investigate removal/substitution with 'vg' fields.
31          */
32         const char *vg_name;
33         struct id vgid;
34
35         /*
36          * 'vg' is set and maintained when the PV belongs to a 'pvs'
37          * list in a parent VG struct.
38          */
39         struct volume_group *vg;
40
41         uint64_t status;
42         uint64_t size;
43
44         /* physical extents */
45         uint32_t pe_size;
46         uint64_t pe_start;
47         uint32_t pe_count;
48         uint32_t pe_alloc_count;
49         unsigned long pe_align;
50         unsigned long pe_align_offset;
51
52         struct dm_list segments;        /* Ordered pv_segments covering complete PV */
53         struct dm_list tags;
54 };
55
56 char *pv_fmt_dup(const struct physical_volume *pv);
57 char *pv_name_dup(const struct physical_volume *pv);
58 struct device *pv_dev(const struct physical_volume *pv);
59 const char *pv_vg_name(const struct physical_volume *pv);
60 char *pv_attr_dup(struct dm_pool *mem, const struct physical_volume *pv);
61 const char *pv_dev_name(const struct physical_volume *pv);
62 char *pv_uuid_dup(const struct physical_volume *pv);
63 char *pv_tags_dup(const struct physical_volume *pv);
64 uint64_t pv_size(const struct physical_volume *pv);
65 uint64_t pv_size_field(const struct physical_volume *pv);
66 uint64_t pv_dev_size(const struct physical_volume *pv);
67 uint64_t pv_free(const struct physical_volume *pv);
68 uint64_t pv_status(const struct physical_volume *pv);
69 uint32_t pv_pe_size(const struct physical_volume *pv);
70 uint64_t pv_pe_start(const struct physical_volume *pv);
71 uint32_t pv_pe_count(const struct physical_volume *pv);
72 uint32_t pv_pe_alloc_count(const struct physical_volume *pv);
73 uint64_t pv_mda_size(const struct physical_volume *pv);
74 uint64_t pv_mda_free(const struct physical_volume *pv);
75 uint64_t pv_used(const struct physical_volume *pv);
76 uint32_t pv_mda_count(const struct physical_volume *pv);
77 uint32_t pv_mda_used_count(const struct physical_volume *pv);
78 unsigned pv_mda_set_ignored(const struct physical_volume *pv, unsigned ignored);
79 int is_orphan(const struct physical_volume *pv);
80 int is_missing_pv(const struct physical_volume *pv);
81 int is_pv(const struct physical_volume *pv);
82
83 #endif /* _LVM_PV_H */