1 /*	$NetBSD: dev_manager.h,v 1.1.1.2 2009/12/02 00:26:22 haad Exp $	*/
2 
3 /*
4  * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
5  * Copyright (C) 2004-2006 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_DEV_MANAGER_H
19 #define _LVM_DEV_MANAGER_H
20 
21 #include "metadata-exported.h"
22 
23 struct logical_volume;
24 struct volume_group;
25 struct cmd_context;
26 struct dev_manager;
27 struct dm_info;
28 struct device;
29 
30 /*
31  * Constructor and destructor.
32  */
33 struct dev_manager *dev_manager_create(struct cmd_context *cmd,
34 				       const char *vg_name);
35 void dev_manager_destroy(struct dev_manager *dm);
36 void dev_manager_release(void);
37 void dev_manager_exit(void);
38 
39 /*
40  * The device handler is responsible for creating all the layered
41  * dm devices, and ensuring that all constraints are maintained
42  * (eg, an origin is created before its snapshot, but is not
43  * unsuspended until the snapshot is also created.)
44  */
45 int dev_manager_info(struct dm_pool *mem, const char *name,
46 		     const struct logical_volume *lv,
47 		     int mknodes, int with_open_count, int with_read_ahead,
48 		     struct dm_info *info, uint32_t *read_ahead);
49 int dev_manager_snapshot_percent(struct dev_manager *dm,
50 				 const struct logical_volume *lv,
51 				 float *percent,
52 				 percent_range_t *percent_range);
53 int dev_manager_mirror_percent(struct dev_manager *dm,
54 			       struct logical_volume *lv, int wait,
55 			       float *percent, percent_range_t *percent_range,
56 			       uint32_t *event_nr);
57 int dev_manager_suspend(struct dev_manager *dm, struct logical_volume *lv,
58 			int lockfs, int flush_required);
59 int dev_manager_activate(struct dev_manager *dm, struct logical_volume *lv);
60 int dev_manager_preload(struct dev_manager *dm, struct logical_volume *lv,
61 			int *flush_required);
62 int dev_manager_deactivate(struct dev_manager *dm, struct logical_volume *lv);
63 
64 int dev_manager_lv_mknodes(const struct logical_volume *lv);
65 int dev_manager_lv_rmnodes(const struct logical_volume *lv);
66 
67 /*
68  * Put the desired changes into effect.
69  */
70 int dev_manager_execute(struct dev_manager *dm);
71 
72 int dev_manager_device_uses_vg(struct device *dev,
73 			       struct volume_group *vg);
74 
75 #endif
76