1/*	$NetBSD$	*/
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_FORMAT_TEXT_H
19#define _LVM_FORMAT_TEXT_H
20
21#include "lvm-types.h"
22#include "metadata.h"
23
24#define FMT_TEXT_NAME "lvm2"
25#define FMT_TEXT_ALIAS "text"
26#define FMT_TEXT_ORPHAN_VG_NAME ORPHAN_VG_NAME(FMT_TEXT_NAME)
27
28/*
29 * Archives a vg config.  'retain_days' is the minimum number of
30 * days that an archive file must be held for.  'min_archives' is
31 * the minimum number of archives required to be kept for each
32 * volume group.
33 */
34int archive_vg(struct volume_group *vg,
35	       const char *dir,
36	       const char *desc, uint32_t retain_days, uint32_t min_archive);
37
38/*
39 * Displays a list of vg backups in a particular archive directory.
40 */
41int archive_list(struct cmd_context *cmd, const char *dir, const char *vgname);
42int archive_list_file(struct cmd_context *cmd, const char *file);
43int backup_list(struct cmd_context *cmd, const char *dir, const char *vgname);
44
45/*
46 * The text format can read and write a volume_group to a file.
47 */
48struct format_type *create_text_format(struct cmd_context *cmd);
49void *create_text_context(struct cmd_context *cmd, const char *path,
50			  const char *desc);
51
52struct labeller *text_labeller_create(const struct format_type *fmt);
53
54int pvhdr_read(struct device *dev, char *buf);
55
56int add_da(struct dm_pool *mem, struct dm_list *das,
57	   uint64_t start, uint64_t size);
58void del_das(struct dm_list *das);
59
60int add_mda(const struct format_type *fmt, struct dm_pool *mem, struct dm_list *mdas,
61	    struct device *dev, uint64_t start, uint64_t size);
62void del_mdas(struct dm_list *mdas);
63
64const char *vgname_from_mda(const struct format_type *fmt,
65			    struct device_area *dev_area, struct id *vgid,
66			    uint32_t *vgstatus, char **creation_host,
67			    uint64_t *mda_free_sectors);
68
69#endif
70