xref: /dflybsd-src/contrib/lvm2/dist/lib/format_text/format-text.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino /*	$NetBSD: format-text.h,v 1.1.1.1 2008/12/22 00:18:16 haad Exp $	*/
2*86d7f5d3SJohn Marino 
3*86d7f5d3SJohn Marino /*
4*86d7f5d3SJohn Marino  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
5*86d7f5d3SJohn Marino  * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
6*86d7f5d3SJohn Marino  *
7*86d7f5d3SJohn Marino  * This file is part of LVM2.
8*86d7f5d3SJohn Marino  *
9*86d7f5d3SJohn Marino  * This copyrighted material is made available to anyone wishing to use,
10*86d7f5d3SJohn Marino  * modify, copy, or redistribute it subject to the terms and conditions
11*86d7f5d3SJohn Marino  * of the GNU Lesser General Public License v.2.1.
12*86d7f5d3SJohn Marino  *
13*86d7f5d3SJohn Marino  * You should have received a copy of the GNU Lesser General Public License
14*86d7f5d3SJohn Marino  * along with this program; if not, write to the Free Software Foundation,
15*86d7f5d3SJohn Marino  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16*86d7f5d3SJohn Marino  */
17*86d7f5d3SJohn Marino 
18*86d7f5d3SJohn Marino #ifndef _LVM_FORMAT_TEXT_H
19*86d7f5d3SJohn Marino #define _LVM_FORMAT_TEXT_H
20*86d7f5d3SJohn Marino 
21*86d7f5d3SJohn Marino #include "lvm-types.h"
22*86d7f5d3SJohn Marino #include "metadata.h"
23*86d7f5d3SJohn Marino 
24*86d7f5d3SJohn Marino #define FMT_TEXT_NAME "lvm2"
25*86d7f5d3SJohn Marino #define FMT_TEXT_ALIAS "text"
26*86d7f5d3SJohn Marino #define FMT_TEXT_ORPHAN_VG_NAME ORPHAN_VG_NAME(FMT_TEXT_NAME)
27*86d7f5d3SJohn Marino 
28*86d7f5d3SJohn Marino /*
29*86d7f5d3SJohn Marino  * Archives a vg config.  'retain_days' is the minimum number of
30*86d7f5d3SJohn Marino  * days that an archive file must be held for.  'min_archives' is
31*86d7f5d3SJohn Marino  * the minimum number of archives required to be kept for each
32*86d7f5d3SJohn Marino  * volume group.
33*86d7f5d3SJohn Marino  */
34*86d7f5d3SJohn Marino int archive_vg(struct volume_group *vg,
35*86d7f5d3SJohn Marino 	       const char *dir,
36*86d7f5d3SJohn Marino 	       const char *desc, uint32_t retain_days, uint32_t min_archive);
37*86d7f5d3SJohn Marino 
38*86d7f5d3SJohn Marino /*
39*86d7f5d3SJohn Marino  * Displays a list of vg backups in a particular archive directory.
40*86d7f5d3SJohn Marino  */
41*86d7f5d3SJohn Marino int archive_list(struct cmd_context *cmd, const char *dir, const char *vgname);
42*86d7f5d3SJohn Marino int archive_list_file(struct cmd_context *cmd, const char *file);
43*86d7f5d3SJohn Marino int backup_list(struct cmd_context *cmd, const char *dir, const char *vgname);
44*86d7f5d3SJohn Marino 
45*86d7f5d3SJohn Marino /*
46*86d7f5d3SJohn Marino  * The text format can read and write a volume_group to a file.
47*86d7f5d3SJohn Marino  */
48*86d7f5d3SJohn Marino struct format_type *create_text_format(struct cmd_context *cmd);
49*86d7f5d3SJohn Marino void *create_text_context(struct cmd_context *cmd, const char *path,
50*86d7f5d3SJohn Marino 			  const char *desc);
51*86d7f5d3SJohn Marino 
52*86d7f5d3SJohn Marino struct labeller *text_labeller_create(const struct format_type *fmt);
53*86d7f5d3SJohn Marino 
54*86d7f5d3SJohn Marino int pvhdr_read(struct device *dev, char *buf);
55*86d7f5d3SJohn Marino 
56*86d7f5d3SJohn Marino int add_da(struct dm_pool *mem, struct dm_list *das,
57*86d7f5d3SJohn Marino 	   uint64_t start, uint64_t size);
58*86d7f5d3SJohn Marino void del_das(struct dm_list *das);
59*86d7f5d3SJohn Marino 
60*86d7f5d3SJohn Marino int add_mda(const struct format_type *fmt, struct dm_pool *mem, struct dm_list *mdas,
61*86d7f5d3SJohn Marino 	    struct device *dev, uint64_t start, uint64_t size);
62*86d7f5d3SJohn Marino void del_mdas(struct dm_list *mdas);
63*86d7f5d3SJohn Marino 
64*86d7f5d3SJohn Marino const char *vgname_from_mda(const struct format_type *fmt,
65*86d7f5d3SJohn Marino 			    struct device_area *dev_area, struct id *vgid,
66*86d7f5d3SJohn Marino 			    uint32_t *vgstatus, char **creation_host,
67*86d7f5d3SJohn Marino 			    uint64_t *mda_free_sectors);
68*86d7f5d3SJohn Marino 
69*86d7f5d3SJohn Marino #endif
70