1 /* $NetBSD: toollib.h,v 1.1.1.2 2009/02/18 11:17:49 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_TOOLLIB_H 19 #define _LVM_TOOLLIB_H 20 21 #include "metadata-exported.h" 22 23 int autobackup_set(void); 24 int autobackup_init(const char *backup_dir, int keep_days, int keep_number, 25 int autobackup); 26 int autobackup(struct volume_group *vg); 27 28 struct volume_group *recover_vg(struct cmd_context *cmd, const char *vgname, 29 uint32_t lock_type); 30 31 int process_each_vg(struct cmd_context *cmd, int argc, char **argv, 32 uint32_t lock_type, int consistent, void *handle, 33 int (*process_single) (struct cmd_context * cmd, 34 const char *vg_name, 35 struct volume_group * vg, 36 int consistent, void *handle)); 37 38 int process_each_pv(struct cmd_context *cmd, int argc, char **argv, 39 struct volume_group *vg, uint32_t lock_type, void *handle, 40 int (*process_single) (struct cmd_context * cmd, 41 struct volume_group * vg, 42 struct physical_volume * pv, 43 void *handle)); 44 int process_each_segment_in_pv(struct cmd_context *cmd, 45 struct volume_group *vg, 46 struct physical_volume *pv, 47 void *handle, 48 int (*process_single) (struct cmd_context * cmd, 49 struct volume_group * vg, 50 struct pv_segment * pvseg, 51 void *handle)); 52 53 int process_each_lv(struct cmd_context *cmd, int argc, char **argv, 54 uint32_t lock_type, void *handle, 55 int (*process_single) (struct cmd_context * cmd, 56 struct logical_volume * lv, 57 void *handle)); 58 59 int process_each_segment_in_lv(struct cmd_context *cmd, 60 struct logical_volume *lv, void *handle, 61 int (*process_single) (struct cmd_context * cmd, 62 struct lv_segment * seg, 63 void *handle)); 64 65 typedef int (*process_single_pv_fn_t) (struct cmd_context *cmd, 66 struct volume_group *vg, 67 struct physical_volume *pv, 68 void *handle); 69 70 int process_each_pv_in_vg(struct cmd_context *cmd, struct volume_group *vg, 71 const struct dm_list *tags, void *handle, 72 process_single_pv_fn_t process_single); 73 74 typedef int (*process_single_lv_fn_t) (struct cmd_context *cmd, 75 struct logical_volume *lv, 76 void *handle); 77 78 int process_each_lv_in_vg(struct cmd_context *cmd, 79 const struct volume_group *vg, 80 const struct dm_list *arg_lvnames, 81 const struct dm_list *tags, 82 void *handle, 83 process_single_lv_fn_t process_single); 84 85 char *default_vgname(struct cmd_context *cmd); 86 const char *extract_vgname(struct cmd_context *cmd, const char *lv_name); 87 char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name, 88 unsigned *dev_dir_found); 89 90 /* 91 * Builds a list of pv's from the names in argv. Used in 92 * lvcreate/extend. 93 */ 94 struct dm_list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int argc, 95 char **argv, int allocatable_only); 96 97 struct dm_list *clone_pv_list(struct dm_pool *mem, struct dm_list *pvs); 98 99 int apply_lvname_restrictions(const char *name); 100 int is_reserved_lvname(const char *name); 101 102 int fill_vg_create_params(struct cmd_context *cmd, 103 char *vg_name, struct vgcreate_params *vp_new, 104 struct vgcreate_params *vp_def); 105 106 int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv); 107 int vg_refresh_visible(struct cmd_context *cmd, struct volume_group *vg); 108 #endif 109