]> sourceware.org Git - lvm2.git/blame - lib/activate/activate.h
thin: fix recent commits
[lvm2.git] / lib / activate / activate.h
CommitLineData
b1713d28 1/*
6606c3ae 2 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
a18dcfb5 3 * Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
b1713d28 4 *
6606c3ae
AK
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
be684599 9 * of the GNU Lesser General Public License v.2.1.
6606c3ae 10 *
be684599 11 * You should have received a copy of the GNU Lesser General Public License
6606c3ae
AK
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
b1713d28
JT
14 */
15
a381c45a
AK
16#ifndef LVM_ACTIVATE_H
17#define LVM_ACTIVATE_H
b1713d28 18
03eee0e2 19#include "metadata-exported.h"
199e490e 20
199e490e
AK
21struct lvinfo {
22 int exists;
23 int suspended;
24 unsigned int open_count;
25 int major;
26 int minor;
27 int read_only;
5f4b2acf
AK
28 int live_table;
29 int inactive_table;
a6b22cf3 30 uint32_t read_ahead;
199e490e 31};
3080a754 32
81beded3
ZK
33struct lv_activate_opts {
34 int exclusive;
35 int origin_only;
36 int no_merging;
a0c4e85c 37 int real_pool;
78c3b21b 38 int is_activate;
2caa558e 39 int skip_in_use;
10d0d9c7 40 unsigned revert;
a18dcfb5 41 unsigned read_only;
81beded3
ZK
42};
43
5619c629
MB
44/* target attribute flags */
45#define MIRROR_LOG_CLUSTERED 0x00000001U
46
260e8f24
ZK
47/* thin target attribute flags */
48enum {
49 /* bitfields - new features from 1.1 version */
701b4a83 50 THIN_FEATURE_DISCARDS = (1 << 0),
260e8f24
ZK
51 THIN_FEATURE_EXTERNAL_ORIGIN = (1 << 1),
52 THIN_FEATURE_HELD_ROOT = (1 << 2),
53 THIN_FEATURE_BLOCK_SIZE = (1 << 3),
54};
55
d1d9800e 56void set_activation(int activation);
8ef2b021 57int activation(void);
d1d9800e 58
fae0c576
AK
59int driver_version(char *version, size_t size);
60int library_version(char *version, size_t size);
7d1552c9 61int lvm1_present(struct cmd_context *cmd);
fae0c576 62
ed82bfd2
AK
63int module_present(struct cmd_context *cmd, const char *target_name);
64int target_present(struct cmd_context *cmd, const char *target_name,
65 int use_modprobe);
bbf83db1 66int target_version(const char *target_name, uint32_t *maj,
d1e8046f 67 uint32_t *min, uint32_t *patchlevel);
a3390bb5 68int lvm_dm_prefix_check(int major, int minor, const char *prefix);
6c81ed26 69int list_segment_modules(struct dm_pool *mem, const struct lv_segment *seg,
2c44337b 70 struct dm_list *modules);
6c81ed26 71int list_lv_modules(struct dm_pool *mem, const struct logical_volume *lv,
2c44337b 72 struct dm_list *modules);
d1f4953a 73
2293567c 74void activation_release(void);
914c9723
AK
75void activation_exit(void);
76
2d6fcbf6 77/* int lv_suspend(struct cmd_context *cmd, const char *lvid_s); */
25d14105 78int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive);
2d6fcbf6 79int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only);
c054e7cc 80int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s,
10d0d9c7 81 unsigned origin_only, unsigned exclusive, unsigned revert);
07d31831
AK
82int lv_activate(struct cmd_context *cmd, const char *lvid_s, int exclusive);
83int lv_activate_with_filter(struct cmd_context *cmd, const char *lvid_s,
84 int exclusive);
a9953411
AK
85int lv_deactivate(struct cmd_context *cmd, const char *lvid_s);
86
f7dd6d84
AK
87int lv_mknodes(struct cmd_context *cmd, const struct logical_volume *lv);
88
a62ee8ad
AK
89/*
90 * Returns 1 if info structure has been populated, else 0.
91 */
e8905d98
ZK
92int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_layer,
93 struct lvinfo *info, int with_open_count, int with_read_ahead);
94int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, int use_layer,
a6b22cf3 95 struct lvinfo *info, int with_open_count, int with_read_ahead);
658b5812 96
125712be
PR
97int lv_check_not_in_use(struct cmd_context *cmd, struct logical_volume *lv,
98 struct lvinfo *info);
99
658b5812
AK
100/*
101 * Returns 1 if activate_lv has been set: 1 = activate; 0 = don't.
102 */
103int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s,
d1f4953a 104 int *activate_lv);
95ced7a7
PR
105/*
106 * Checks against the auto_activation_volume_list and
107 * returns 1 if the LV should be activated, 0 otherwise.
108 */
109int lv_passes_auto_activation_filter(struct cmd_context *cmd, struct logical_volume *lv);
658b5812 110
d345bf2c 111int lv_check_transient(struct logical_volume *lv);
1951dba9
AL
112/*
113 * Returns 1 if percent has been set, else 0.
114 */
8191fe4f 115int lv_snapshot_percent(const struct logical_volume *lv, percent_t *percent);
aec21154 116int lv_mirror_percent(struct cmd_context *cmd, const struct logical_volume *lv,
8191fe4f 117 int wait, percent_t *percent, uint32_t *event_nr);
4aebd52c 118int lv_raid_percent(const struct logical_volume *lv, percent_t *percent);
63368983
ZK
119int lv_thin_pool_percent(const struct logical_volume *lv, int metadata,
120 percent_t *percent);
76ee0899
ZK
121int lv_thin_percent(const struct logical_volume *lv, int mapped,
122 percent_t *percent);
bdba904d
ZK
123int lv_thin_pool_transaction_id(const struct logical_volume *lv,
124 uint64_t *transaction_id);
2ba80b43 125
37ed70b9 126/*
6d52fb46 127 * Return number of LVs in the VG that are active.
37ed70b9 128 */
499a1616 129int lvs_in_vg_activated(const struct volume_group *vg);
08c9ff43 130int lvs_in_vg_opened(const struct volume_group *vg);
a381c45a 131
499a1616
ZK
132int lv_is_active(const struct logical_volume *lv);
133int lv_is_active_but_not_locally(const struct logical_volume *lv);
134int lv_is_active_exclusive(const struct logical_volume *lv);
135int lv_is_active_exclusive_locally(const struct logical_volume *lv);
136int lv_is_active_exclusive_remotely(const struct logical_volume *lv);
3e3d5d85 137
1f661c5d
MS
138int lv_has_target_type(struct dm_pool *mem, struct logical_volume *lv,
139 const char *layer, const char *target_type);
140
2d6fcbf6 141int monitor_dev_for_events(struct cmd_context *cmd, struct logical_volume *lv,
81beded3 142 const struct lv_activate_opts *laopts, int do_reg);
3e3d5d85 143
d1e8046f
AK
144#ifdef DMEVENTD
145# include "libdevmapper-event.h"
146char *get_monitor_dso_path(struct cmd_context *cmd, const char *libpath);
f92b4f94
AK
147int target_registered_with_dmeventd(struct cmd_context *cmd, const char *libpath,
148 struct logical_volume *lv, int *pending);
149int target_register_events(struct cmd_context *cmd, const char *dso, struct logical_volume *lv,
d1e8046f
AK
150 int evmask __attribute__((unused)), int set, int timeout);
151#endif
152
8dd6036d
AK
153int add_linear_area_to_dtree(struct dm_tree_node *node, uint64_t size,
154 uint32_t extent_size, int use_linear_target,
155 const char *vgname, const char *lvname);
156
352a99b9
AK
157/*
158 * Returns 1 if PV has a dependency tree that uses anything in VG.
159 */
898e6f8e 160int pv_uses_vg(struct physical_volume *pv,
352a99b9
AK
161 struct volume_group *vg);
162
f247a4e7
AK
163/*
164 * Returns 1 if mapped device is not suspended.
165 */
28e2b5b2 166int device_is_usable(struct device *dev);
f247a4e7 167
937a21f0
ZK
168/*
169 * Declaration moved here from fs.h to keep header fs.h hidden
170 */
171void fs_unlock(void);
172
b1713d28 173#endif
This page took 0.108927 seconds and 5 git commands to generate.