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