xref: /dflybsd-src/contrib/lvm2/dist/include/format-text.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino /*	$NetBSD: format-text.h,v 1.1.1.1 2008/12/22 00:18:47 haad Exp $	*/
286d7f5d3SJohn Marino 
386d7f5d3SJohn Marino /*
486d7f5d3SJohn Marino  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
586d7f5d3SJohn Marino  * Copyright (C) 2004-2007 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_FORMAT_TEXT_H
1986d7f5d3SJohn Marino #define _LVM_FORMAT_TEXT_H
2086d7f5d3SJohn Marino 
2186d7f5d3SJohn Marino #include "lvm-types.h"
2286d7f5d3SJohn Marino #include "metadata.h"
2386d7f5d3SJohn Marino 
2486d7f5d3SJohn Marino #define FMT_TEXT_NAME "lvm2"
2586d7f5d3SJohn Marino #define FMT_TEXT_ALIAS "text"
2686d7f5d3SJohn Marino #define FMT_TEXT_ORPHAN_VG_NAME ORPHAN_VG_NAME(FMT_TEXT_NAME)
2786d7f5d3SJohn Marino 
2886d7f5d3SJohn Marino /*
2986d7f5d3SJohn Marino  * Archives a vg config.  'retain_days' is the minimum number of
3086d7f5d3SJohn Marino  * days that an archive file must be held for.  'min_archives' is
3186d7f5d3SJohn Marino  * the minimum number of archives required to be kept for each
3286d7f5d3SJohn Marino  * volume group.
3386d7f5d3SJohn Marino  */
3486d7f5d3SJohn Marino int archive_vg(struct volume_group *vg,
3586d7f5d3SJohn Marino 	       const char *dir,
3686d7f5d3SJohn Marino 	       const char *desc, uint32_t retain_days, uint32_t min_archive);
3786d7f5d3SJohn Marino 
3886d7f5d3SJohn Marino /*
3986d7f5d3SJohn Marino  * Displays a list of vg backups in a particular archive directory.
4086d7f5d3SJohn Marino  */
4186d7f5d3SJohn Marino int archive_list(struct cmd_context *cmd, const char *dir, const char *vgname);
4286d7f5d3SJohn Marino int archive_list_file(struct cmd_context *cmd, const char *file);
4386d7f5d3SJohn Marino int backup_list(struct cmd_context *cmd, const char *dir, const char *vgname);
4486d7f5d3SJohn Marino 
4586d7f5d3SJohn Marino /*
4686d7f5d3SJohn Marino  * The text format can read and write a volume_group to a file.
4786d7f5d3SJohn Marino  */
4886d7f5d3SJohn Marino struct format_type *create_text_format(struct cmd_context *cmd);
4986d7f5d3SJohn Marino void *create_text_context(struct cmd_context *cmd, const char *path,
5086d7f5d3SJohn Marino 			  const char *desc);
5186d7f5d3SJohn Marino 
5286d7f5d3SJohn Marino struct labeller *text_labeller_create(const struct format_type *fmt);
5386d7f5d3SJohn Marino 
5486d7f5d3SJohn Marino int pvhdr_read(struct device *dev, char *buf);
5586d7f5d3SJohn Marino 
5686d7f5d3SJohn Marino int add_da(struct dm_pool *mem, struct dm_list *das,
5786d7f5d3SJohn Marino 	   uint64_t start, uint64_t size);
5886d7f5d3SJohn Marino void del_das(struct dm_list *das);
5986d7f5d3SJohn Marino 
6086d7f5d3SJohn Marino int add_mda(const struct format_type *fmt, struct dm_pool *mem, struct dm_list *mdas,
6186d7f5d3SJohn Marino 	    struct device *dev, uint64_t start, uint64_t size);
6286d7f5d3SJohn Marino void del_mdas(struct dm_list *mdas);
6386d7f5d3SJohn Marino 
6486d7f5d3SJohn Marino const char *vgname_from_mda(const struct format_type *fmt,
6586d7f5d3SJohn Marino 			    struct device_area *dev_area, struct id *vgid,
6686d7f5d3SJohn Marino 			    uint32_t *vgstatus, char **creation_host,
6786d7f5d3SJohn Marino 			    uint64_t *mda_free_sectors);
6886d7f5d3SJohn Marino 
6986d7f5d3SJohn Marino #endif
70