2 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3 * Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
5 * This file is part of LVM2.
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.
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
20 struct format_instance;
28 ALLOC_CLING_BY_TAGS, /* Internal - never written or displayed. */
35 struct cmd_context *cmd;
36 struct dm_pool *vgmem;
37 struct format_instance *fid;
38 struct dm_list *cmd_vgs;/* List of wanted/locked and opened VGs */
39 uint32_t cmd_missing_vgs;/* Flag marks missing VG */
40 uint32_t seqno; /* Metadata sequence number */
47 const char *old_name; /* Set during vgrename and vgcfgrestore */
51 uint32_t extent_count;
57 /* physical volumes */
63 * The following relationship should always hold:
64 * dm_list_size(lvs) = user visible lv_count + snapshot_count + other invisible LVs
66 * Snapshots consist of 2 instances of "struct logical_volume":
67 * - cow (lv_name is visible to the user)
68 * - snapshot (lv_name is 'snapshotN')
70 * Mirrors consist of multiple instances of "struct logical_volume":
71 * - one for the mirror log
72 * - one for each mirror leg
73 * - one for the user-visible mirror LV
80 * FIXME: Move the next fields into a different struct?
84 * List of removed physical volumes by pvreduce.
85 * They have to get cleared on vg_commit.
87 struct dm_list removed_pvs;
88 uint32_t open_mode; /* FIXME: read or write - check lock type? */
91 * Store result of the last vg_read().
92 * 0 for success else appropriate FAILURE_* bits set.
95 uint32_t mda_copies; /* target number of mdas for this VG */
98 char *vg_fmt_dup(const struct volume_group *vg);
99 char *vg_name_dup(const struct volume_group *vg);
100 char *vg_system_id_dup(const struct volume_group *vg);
101 uint32_t vg_seqno(const struct volume_group *vg);
102 uint64_t vg_status(const struct volume_group *vg);
103 int vg_set_alloc_policy(struct volume_group *vg, alloc_policy_t alloc);
104 int vg_set_clustered(struct volume_group *vg, int clustered);
105 uint64_t vg_size(const struct volume_group *vg);
106 uint64_t vg_free(const struct volume_group *vg);
107 uint64_t vg_extent_size(const struct volume_group *vg);
108 int vg_set_extent_size(struct volume_group *vg, uint32_t new_extent_size);
109 uint64_t vg_extent_count(const struct volume_group *vg);
110 uint64_t vg_free_count(const struct volume_group *vg);
111 uint64_t vg_pv_count(const struct volume_group *vg);
112 uint64_t vg_max_pv(const struct volume_group *vg);
113 int vg_set_max_pv(struct volume_group *vg, uint32_t max_pv);
114 uint64_t vg_max_lv(const struct volume_group *vg);
115 int vg_set_max_lv(struct volume_group *vg, uint32_t max_lv);
116 uint32_t vg_mda_count(const struct volume_group *vg);
117 uint32_t vg_mda_used_count(const struct volume_group *vg);
118 uint32_t vg_mda_copies(const struct volume_group *vg);
119 int vg_set_mda_copies(struct volume_group *vg, uint32_t mda_copies);
121 * Returns visible LV count - number of LVs from user perspective
123 unsigned vg_visible_lvs(const struct volume_group *vg);
125 * Count snapshot LVs.
127 unsigned snapshot_count(const struct volume_group *vg);
129 uint64_t vg_mda_size(const struct volume_group *vg);
130 uint64_t vg_mda_free(const struct volume_group *vg);
131 char *vg_attr_dup(struct dm_pool *mem, const struct volume_group *vg);
132 char *vg_uuid_dup(const struct volume_group *vg);
133 char *vg_tags_dup(const struct volume_group *vg);
135 #endif /* _LVM_VG_H */