xref: /dragonfly/contrib/lvm2/dist/tools/polldaemon.h (revision 86d7f5d3)
1 /*	$NetBSD: polldaemon.h,v 1.1.1.2 2009/12/02 00:25:53 haad Exp $	*/
2 
3 /*
4  * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
5  * Copyright (C) 2004 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_TOOL_POLLDAEMON_H
19 #define _LVM_TOOL_POLLDAEMON_H
20 
21 #include "metadata-exported.h"
22 
23 typedef enum {
24 	PROGRESS_CHECK_FAILED = 0,
25 	PROGRESS_UNFINISHED = 1,
26 	PROGRESS_FINISHED_SEGMENT = 2,
27 	PROGRESS_FINISHED_ALL = 3
28 } progress_t;
29 
30 struct daemon_parms;
31 
32 struct poll_functions {
33 	const char *(*get_copy_name_from_lv) (struct logical_volume *lv);
34 	struct volume_group *(*get_copy_vg) (struct cmd_context *cmd,
35 					     const char *name,
36 					     const char *uuid);
37 	struct logical_volume *(*get_copy_lv) (struct cmd_context *cmd,
38 					       struct volume_group *vg,
39 					       const char *name,
40 					       const char *uuid,
41 					       uint32_t lv_type);
42 	progress_t (*poll_progress)(struct cmd_context *cmd,
43 				    struct logical_volume *lv,
44 				    const char *name,
45 				    struct daemon_parms *parms);
46 	int (*update_metadata) (struct cmd_context *cmd,
47 				struct volume_group *vg,
48 				struct logical_volume *lv,
49 				struct dm_list *lvs_changed, unsigned flags);
50 	int (*finish_copy) (struct cmd_context *cmd,
51 			    struct volume_group *vg,
52 			    struct logical_volume *lv,
53 			    struct dm_list *lvs_changed);
54 };
55 
56 struct daemon_parms {
57 	unsigned interval;
58 	unsigned aborting;
59 	unsigned background;
60 	unsigned outstanding_count;
61 	unsigned progress_display;
62 	const char *progress_title;
63 	uint32_t lv_type;
64 	struct poll_functions *poll_fns;
65 };
66 
67 int poll_daemon(struct cmd_context *cmd, const char *name, const char *uuid,
68 		unsigned background,
69 		uint32_t lv_type, struct poll_functions *poll_fns,
70 		const char *progress_title);
71 
72 progress_t poll_mirror_progress(struct cmd_context *cmd,
73 				struct logical_volume *lv, const char *name,
74 				struct daemon_parms *parms);
75 
76 #endif
77