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