Merge branch 'vendor/NCURSES'
[dragonfly.git] / contrib / lvm2 / dist / include / activate.h
1 /*      $NetBSD: activate.h,v 1.1.1.2 2009/12/02 00:25:45 haad Exp $    */
2
3 /*
4  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.  
5  * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
6  *
7  * This file is part of LVM2.
8  *
9  * This copyrighted material is made available to anyone wishing to use,
10  * modify, copy, or redistribute it subject to the terms and conditions
11  * of the GNU Lesser General Public License v.2.1.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; if not, write to the Free Software Foundation,
15  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16  */
17
18 #ifndef LVM_ACTIVATE_H
19 #define LVM_ACTIVATE_H
20
21 #include "metadata-exported.h"
22
23 struct lvinfo {
24         int exists;
25         int suspended;
26         unsigned int open_count;
27         int major;
28         int minor;
29         int read_only;
30         int live_table;
31         int inactive_table;
32         uint32_t read_ahead;
33 };
34
35 /* target attribute flags */
36 #define MIRROR_LOG_CLUSTERED    0x00000001U
37
38 void set_activation(int activation);
39 int activation(void);
40
41 int driver_version(char *version, size_t size);
42 int library_version(char *version, size_t size);
43 int lvm1_present(struct cmd_context *cmd);
44
45 int module_present(struct cmd_context *cmd, const char *target_name);
46 int target_present(struct cmd_context *cmd, const char *target_name,
47                    int use_modprobe);
48 int target_version(const char *target_name, uint32_t *maj,
49                    uint32_t *min, uint32_t *patchlevel);
50 int list_segment_modules(struct dm_pool *mem, const struct lv_segment *seg,
51                          struct dm_list *modules);
52 int list_lv_modules(struct dm_pool *mem, const struct logical_volume *lv,
53                     struct dm_list *modules);
54
55 void activation_release(void);
56 void activation_exit(void);
57
58 int lv_suspend(struct cmd_context *cmd, const char *lvid_s);
59 int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s);
60 int lv_resume(struct cmd_context *cmd, const char *lvid_s);
61 int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s);
62 int lv_activate(struct cmd_context *cmd, const char *lvid_s, int exclusive);
63 int lv_activate_with_filter(struct cmd_context *cmd, const char *lvid_s,
64                             int exclusive);
65 int lv_deactivate(struct cmd_context *cmd, const char *lvid_s);
66
67 int lv_mknodes(struct cmd_context *cmd, const struct logical_volume *lv);
68
69 /*
70  * Returns 1 if info structure has been populated, else 0.
71  */
72 int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, struct lvinfo *info,
73             int with_open_count, int with_read_ahead);
74 int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s,
75                     struct lvinfo *info, int with_open_count, int with_read_ahead);
76
77 /*
78  * Returns 1 if activate_lv has been set: 1 = activate; 0 = don't.
79  */
80 int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s,
81                          int *activate_lv);
82
83 /*
84  * Returns 1 if percent has been set, else 0.
85  */
86 int lv_snapshot_percent(const struct logical_volume *lv, float *percent,
87                         percent_range_t *percent_range);
88 int lv_mirror_percent(struct cmd_context *cmd, struct logical_volume *lv,
89                       int wait, float *percent, percent_range_t *percent_range,
90                       uint32_t *event_nr);
91
92 /*
93  * Return number of LVs in the VG that are active.
94  */
95 int lvs_in_vg_activated(struct volume_group *vg);
96 int lvs_in_vg_activated_by_uuid_only(struct volume_group *vg);
97 int lvs_in_vg_opened(const struct volume_group *vg);
98
99 int lv_is_active(struct logical_volume *lv);
100
101 int monitor_dev_for_events(struct cmd_context *cmd,
102                             struct logical_volume *lv, int do_reg);
103
104 /*
105  * Returns 1 if PV has a dependency tree that uses anything in VG.
106  */
107 int pv_uses_vg(struct physical_volume *pv,
108                struct volume_group *vg);
109
110 /*
111  * Returns 1 if mapped device is not suspended.
112  */
113 int device_is_usable(dev_t dev);
114
115 #endif