import source from lvm2 2.02.79
[external/device-mapper.git] / lib / metadata / lv.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_LV_H
16 #define _LVM_LV_H
17
18 union lvid;
19 struct volume_group;
20 struct dm_list;
21 struct lv_segment;
22 struct replicator_device;
23
24 struct logical_volume {
25         union lvid lvid;
26         char *name;
27
28         struct volume_group *vg;
29
30         uint64_t status;
31         alloc_policy_t alloc;
32         uint32_t read_ahead;
33         int32_t major;
34         int32_t minor;
35
36         uint64_t size;          /* Sectors */
37         uint32_t le_count;
38
39         uint32_t origin_count;
40         struct dm_list snapshot_segs;
41         struct lv_segment *snapshot;
42
43         struct replicator_device *rdevice;/* For replicator-devs, rimages, slogs - reference to rdevice */
44         struct dm_list rsites;  /* For replicators - all sites */
45
46         struct dm_list segments;
47         struct dm_list tags;
48         struct dm_list segs_using_this_lv;
49 };
50
51 uint64_t lv_size(const struct logical_volume *lv);
52 char *lv_attr_dup(struct dm_pool *mem, const struct logical_volume *lv);
53 char *lv_uuid_dup(const struct logical_volume *lv);
54 char *lv_tags_dup(const struct logical_volume *lv);
55 char *lv_path_dup(struct dm_pool *mem, const struct logical_volume *lv);
56 uint64_t lv_origin_size(const struct logical_volume *lv);
57 char *lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume *lv);
58 char *lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv);
59 int lv_kernel_major(const struct logical_volume *lv);
60 int lv_kernel_minor(const struct logical_volume *lv);
61 char *lv_mirror_log_dup(struct dm_pool *mem, const struct logical_volume *lv);
62 char *lv_modules_dup(struct dm_pool *mem, const struct logical_volume *lv);
63 char *lv_name_dup(struct dm_pool *mem, const struct logical_volume *lv);
64 char *lv_origin_dup(struct dm_pool *mem, const struct logical_volume *lv);
65 uint32_t lv_kernel_read_ahead(const struct logical_volume *lv);
66 uint64_t lvseg_start(const struct lv_segment *seg);
67 uint64_t lvseg_size(const struct lv_segment *seg);
68 uint64_t lvseg_chunksize(const struct lv_segment *seg);
69 char *lvseg_segtype_dup(const struct lv_segment *seg);
70 char *lvseg_tags_dup(const struct lv_segment *seg);
71
72 #endif /* _LVM_LV_H */