186d7f5d3SJohn Marino /* $NetBSD: polldaemon.h,v 1.1.1.2 2009/12/02 00:25:53 haad Exp $ */ 286d7f5d3SJohn Marino 386d7f5d3SJohn Marino /* 486d7f5d3SJohn Marino * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. 586d7f5d3SJohn Marino * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 686d7f5d3SJohn Marino * 786d7f5d3SJohn Marino * This file is part of LVM2. 886d7f5d3SJohn Marino * 986d7f5d3SJohn Marino * This copyrighted material is made available to anyone wishing to use, 1086d7f5d3SJohn Marino * modify, copy, or redistribute it subject to the terms and conditions 1186d7f5d3SJohn Marino * of the GNU Lesser General Public License v.2.1. 1286d7f5d3SJohn Marino * 1386d7f5d3SJohn Marino * You should have received a copy of the GNU Lesser General Public License 1486d7f5d3SJohn Marino * along with this program; if not, write to the Free Software Foundation, 1586d7f5d3SJohn Marino * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 1686d7f5d3SJohn Marino */ 1786d7f5d3SJohn Marino 1886d7f5d3SJohn Marino #ifndef _LVM_TOOL_POLLDAEMON_H 1986d7f5d3SJohn Marino #define _LVM_TOOL_POLLDAEMON_H 2086d7f5d3SJohn Marino 2186d7f5d3SJohn Marino #include "metadata-exported.h" 2286d7f5d3SJohn Marino 2386d7f5d3SJohn Marino typedef enum { 2486d7f5d3SJohn Marino PROGRESS_CHECK_FAILED = 0, 2586d7f5d3SJohn Marino PROGRESS_UNFINISHED = 1, 2686d7f5d3SJohn Marino PROGRESS_FINISHED_SEGMENT = 2, 2786d7f5d3SJohn Marino PROGRESS_FINISHED_ALL = 3 2886d7f5d3SJohn Marino } progress_t; 2986d7f5d3SJohn Marino 3086d7f5d3SJohn Marino struct daemon_parms; 3186d7f5d3SJohn Marino 3286d7f5d3SJohn Marino struct poll_functions { 3386d7f5d3SJohn Marino const char *(*get_copy_name_from_lv) (struct logical_volume *lv); 3486d7f5d3SJohn Marino struct volume_group *(*get_copy_vg) (struct cmd_context *cmd, 3586d7f5d3SJohn Marino const char *name, 3686d7f5d3SJohn Marino const char *uuid); 3786d7f5d3SJohn Marino struct logical_volume *(*get_copy_lv) (struct cmd_context *cmd, 3886d7f5d3SJohn Marino struct volume_group *vg, 3986d7f5d3SJohn Marino const char *name, 4086d7f5d3SJohn Marino const char *uuid, 4186d7f5d3SJohn Marino uint32_t lv_type); 4286d7f5d3SJohn Marino progress_t (*poll_progress)(struct cmd_context *cmd, 4386d7f5d3SJohn Marino struct logical_volume *lv, 4486d7f5d3SJohn Marino const char *name, 4586d7f5d3SJohn Marino struct daemon_parms *parms); 4686d7f5d3SJohn Marino int (*update_metadata) (struct cmd_context *cmd, 4786d7f5d3SJohn Marino struct volume_group *vg, 4886d7f5d3SJohn Marino struct logical_volume *lv, 4986d7f5d3SJohn Marino struct dm_list *lvs_changed, unsigned flags); 5086d7f5d3SJohn Marino int (*finish_copy) (struct cmd_context *cmd, 5186d7f5d3SJohn Marino struct volume_group *vg, 5286d7f5d3SJohn Marino struct logical_volume *lv, 5386d7f5d3SJohn Marino struct dm_list *lvs_changed); 5486d7f5d3SJohn Marino }; 5586d7f5d3SJohn Marino 5686d7f5d3SJohn Marino struct daemon_parms { 5786d7f5d3SJohn Marino unsigned interval; 5886d7f5d3SJohn Marino unsigned aborting; 5986d7f5d3SJohn Marino unsigned background; 6086d7f5d3SJohn Marino unsigned outstanding_count; 6186d7f5d3SJohn Marino unsigned progress_display; 6286d7f5d3SJohn Marino const char *progress_title; 6386d7f5d3SJohn Marino uint32_t lv_type; 6486d7f5d3SJohn Marino struct poll_functions *poll_fns; 6586d7f5d3SJohn Marino }; 6686d7f5d3SJohn Marino 6786d7f5d3SJohn Marino int poll_daemon(struct cmd_context *cmd, const char *name, const char *uuid, 6886d7f5d3SJohn Marino unsigned background, 6986d7f5d3SJohn Marino uint32_t lv_type, struct poll_functions *poll_fns, 7086d7f5d3SJohn Marino const char *progress_title); 7186d7f5d3SJohn Marino 7286d7f5d3SJohn Marino progress_t poll_mirror_progress(struct cmd_context *cmd, 7386d7f5d3SJohn Marino struct logical_volume *lv, const char *name, 7486d7f5d3SJohn Marino struct daemon_parms *parms); 7586d7f5d3SJohn Marino 7686d7f5d3SJohn Marino #endif 77