]> sourceware.org Git - lvm2.git/blob - lib/activate/activate.h
thin: fix recent commits
[lvm2.git] / lib / activate / activate.h
1 /*
2 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3 * Copyright (C) 2004-2012 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
16 #ifndef LVM_ACTIVATE_H
17 #define LVM_ACTIVATE_H
18
19 #include "metadata-exported.h"
20
21 struct lvinfo {
22 int exists;
23 int suspended;
24 unsigned int open_count;
25 int major;
26 int minor;
27 int read_only;
28 int live_table;
29 int inactive_table;
30 uint32_t read_ahead;
31 };
32
33 struct lv_activate_opts {
34 int exclusive;
35 int origin_only;
36 int no_merging;
37 int real_pool;
38 int is_activate;
39 int skip_in_use;
40 unsigned revert;
41 unsigned read_only;
42 };
43
44 /* target attribute flags */
45 #define MIRROR_LOG_CLUSTERED 0x00000001U
46
47 /* thin target attribute flags */
48 enum {
49 /* bitfields - new features from 1.1 version */
50 THIN_FEATURE_DISCARDS = (1 << 0),
51 THIN_FEATURE_EXTERNAL_ORIGIN = (1 << 1),
52 THIN_FEATURE_HELD_ROOT = (1 << 2),
53 THIN_FEATURE_BLOCK_SIZE = (1 << 3),
54 };
55
56 void set_activation(int activation);
57 int activation(void);
58
59 int driver_version(char *version, size_t size);
60 int library_version(char *version, size_t size);
61 int lvm1_present(struct cmd_context *cmd);
62
63 int module_present(struct cmd_context *cmd, const char *target_name);
64 int target_present(struct cmd_context *cmd, const char *target_name,
65 int use_modprobe);
66 int target_version(const char *target_name, uint32_t *maj,
67 uint32_t *min, uint32_t *patchlevel);
68 int lvm_dm_prefix_check(int major, int minor, const char *prefix);
69 int list_segment_modules(struct dm_pool *mem, const struct lv_segment *seg,
70 struct dm_list *modules);
71 int list_lv_modules(struct dm_pool *mem, const struct logical_volume *lv,
72 struct dm_list *modules);
73
74 void activation_release(void);
75 void activation_exit(void);
76
77 /* int lv_suspend(struct cmd_context *cmd, const char *lvid_s); */
78 int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive);
79 int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only);
80 int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s,
81 unsigned origin_only, unsigned exclusive, unsigned revert);
82 int lv_activate(struct cmd_context *cmd, const char *lvid_s, int exclusive);
83 int lv_activate_with_filter(struct cmd_context *cmd, const char *lvid_s,
84 int exclusive);
85 int lv_deactivate(struct cmd_context *cmd, const char *lvid_s);
86
87 int lv_mknodes(struct cmd_context *cmd, const struct logical_volume *lv);
88
89 /*
90 * Returns 1 if info structure has been populated, else 0.
91 */
92 int 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);
94 int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, int use_layer,
95 struct lvinfo *info, int with_open_count, int with_read_ahead);
96
97 int lv_check_not_in_use(struct cmd_context *cmd, struct logical_volume *lv,
98 struct lvinfo *info);
99
100 /*
101 * Returns 1 if activate_lv has been set: 1 = activate; 0 = don't.
102 */
103 int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s,
104 int *activate_lv);
105 /*
106 * Checks against the auto_activation_volume_list and
107 * returns 1 if the LV should be activated, 0 otherwise.
108 */
109 int lv_passes_auto_activation_filter(struct cmd_context *cmd, struct logical_volume *lv);
110
111 int lv_check_transient(struct logical_volume *lv);
112 /*
113 * Returns 1 if percent has been set, else 0.
114 */
115 int lv_snapshot_percent(const struct logical_volume *lv, percent_t *percent);
116 int lv_mirror_percent(struct cmd_context *cmd, const struct logical_volume *lv,
117 int wait, percent_t *percent, uint32_t *event_nr);
118 int lv_raid_percent(const struct logical_volume *lv, percent_t *percent);
119 int lv_thin_pool_percent(const struct logical_volume *lv, int metadata,
120 percent_t *percent);
121 int lv_thin_percent(const struct logical_volume *lv, int mapped,
122 percent_t *percent);
123 int lv_thin_pool_transaction_id(const struct logical_volume *lv,
124 uint64_t *transaction_id);
125
126 /*
127 * Return number of LVs in the VG that are active.
128 */
129 int lvs_in_vg_activated(const struct volume_group *vg);
130 int lvs_in_vg_opened(const struct volume_group *vg);
131
132 int lv_is_active(const struct logical_volume *lv);
133 int lv_is_active_but_not_locally(const struct logical_volume *lv);
134 int lv_is_active_exclusive(const struct logical_volume *lv);
135 int lv_is_active_exclusive_locally(const struct logical_volume *lv);
136 int lv_is_active_exclusive_remotely(const struct logical_volume *lv);
137
138 int lv_has_target_type(struct dm_pool *mem, struct logical_volume *lv,
139 const char *layer, const char *target_type);
140
141 int monitor_dev_for_events(struct cmd_context *cmd, struct logical_volume *lv,
142 const struct lv_activate_opts *laopts, int do_reg);
143
144 #ifdef DMEVENTD
145 # include "libdevmapper-event.h"
146 char *get_monitor_dso_path(struct cmd_context *cmd, const char *libpath);
147 int target_registered_with_dmeventd(struct cmd_context *cmd, const char *libpath,
148 struct logical_volume *lv, int *pending);
149 int target_register_events(struct cmd_context *cmd, const char *dso, struct logical_volume *lv,
150 int evmask __attribute__((unused)), int set, int timeout);
151 #endif
152
153 int 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
157 /*
158 * Returns 1 if PV has a dependency tree that uses anything in VG.
159 */
160 int pv_uses_vg(struct physical_volume *pv,
161 struct volume_group *vg);
162
163 /*
164 * Returns 1 if mapped device is not suspended.
165 */
166 int device_is_usable(struct device *dev);
167
168 /*
169 * Declaration moved here from fs.h to keep header fs.h hidden
170 */
171 void fs_unlock(void);
172
173 #endif
This page took 0.046014 seconds and 5 git commands to generate.