Sync usage with man page.
[netbsd-mini2440.git] / external / gpl2 / lvm2 / dist / lib / format_text / import-export.h
blob0cc44535afa09f0e972304a01979cc3a685450b7
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
5 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
7 * This file is part of LVM2.
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.
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
18 #ifndef _LVM_TEXT_IMPORT_EXPORT_H
19 #define _LVM_TEXT_IMPORT_EXPORT_H
21 #include "config.h"
22 #include "lvm-types.h"
23 #include "metadata.h"
25 #include <stdio.h>
28 * Constants to identify files this code can parse.
30 #define CONTENTS_FIELD "contents"
31 #define CONTENTS_VALUE "Text Format Volume Group"
33 #define FORMAT_VERSION_FIELD "version"
34 #define FORMAT_VERSION_VALUE 1
37 * VGs, PVs and LVs all have status bitsets, we gather together
38 * common code for reading and writing them.
40 enum {
41 COMPATIBLE_FLAG = 0x0,
42 VG_FLAGS,
43 PV_FLAGS,
44 LV_FLAGS,
45 STATUS_FLAG = 0x8,
48 struct text_vg_version_ops {
49 int (*check_version) (struct config_tree * cf);
50 struct volume_group *(*read_vg) (struct format_instance * fid,
51 struct config_tree * cf);
52 void (*read_desc) (struct dm_pool * mem, struct config_tree * cf,
53 time_t *when, char **desc);
54 const char *(*read_vgname) (const struct format_type *fmt,
55 struct config_tree *cft,
56 struct id *vgid, uint32_t *vgstatus,
57 char **creation_host);
60 struct text_vg_version_ops *text_vg_vsn1_init(void);
62 int print_flags(uint32_t status, int type, char *buffer, size_t size);
63 int read_flags(uint32_t *status, int type, struct config_value *cv);
65 int print_tags(struct dm_list *tags, char *buffer, size_t size);
66 int read_tags(struct dm_pool *mem, struct dm_list *tags, struct config_value *cv);
68 int text_vg_export_file(struct volume_group *vg, const char *desc, FILE *fp);
69 int text_vg_export_raw(struct volume_group *vg, const char *desc, char **buf);
70 struct volume_group *text_vg_import_file(struct format_instance *fid,
71 const char *file,
72 time_t *when, char **desc);
73 struct volume_group *text_vg_import_fd(struct format_instance *fid,
74 const char *file,
75 struct device *dev,
76 off_t offset, uint32_t size,
77 off_t offset2, uint32_t size2,
78 checksum_fn_t checksum_fn,
79 uint32_t checksum,
80 time_t *when, char **desc);
81 const char *text_vgname_import(const struct format_type *fmt,
82 struct device *dev,
83 off_t offset, uint32_t size,
84 off_t offset2, uint32_t size2,
85 checksum_fn_t checksum_fn, uint32_t checksum,
86 struct id *vgid, uint32_t *vgstatus,
87 char **creation_host);
89 #endif