2001-11-21 12:20:05 +03:00
/*
2004-03-30 23:35:44 +04:00
* Copyright ( C ) 2001 - 2004 Sistina Software , Inc . All rights reserved .
2007-08-21 00:55:30 +04:00
* Copyright ( C ) 2004 - 2006 Red Hat , Inc . All rights reserved .
2001-11-21 12:20:05 +03:00
*
2004-03-30 23:35:44 +04:00
* This file is part of LVM2 .
*
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
2007-08-21 00:55:30 +04:00
* of the GNU Lesser General Public License v .2 .1 .
2004-03-30 23:35:44 +04:00
*
2007-08-21 00:55:30 +04:00
* You should have received a copy of the GNU Lesser General Public License
2004-03-30 23:35:44 +04:00
* along with this program ; if not , write to the Free Software Foundation ,
* Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
2001-11-21 12:20:05 +03:00
*/
# ifndef _LVM_TEXT_IMPORT_EXPORT_H
# define _LVM_TEXT_IMPORT_EXPORT_H
2001-12-11 15:16:58 +03:00
# include "config.h"
2001-12-20 14:52:54 +03:00
# include "lvm-types.h"
# include "metadata.h"
# include <stdio.h>
2001-12-11 15:16:58 +03:00
2002-07-02 22:47:43 +04:00
/*
2002-07-11 18:09:26 +04:00
* Constants to identify files this code can parse .
2002-07-02 22:47:43 +04:00
*/
# define CONTENTS_FIELD "contents"
# define CONTENTS_VALUE "Text Format Volume Group"
# define FORMAT_VERSION_FIELD "version"
# define FORMAT_VERSION_VALUE 1
/*
* VGs , PVs and LVs all have status bitsets , we gather together
* common code for reading and writing them .
*/
2001-12-11 15:16:58 +03:00
enum {
VG_FLAGS ,
PV_FLAGS ,
LV_FLAGS
} ;
2002-11-18 17:04:08 +03:00
struct text_vg_version_ops {
int ( * check_version ) ( struct config_tree * cf ) ;
struct volume_group * ( * read_vg ) ( struct format_instance * fid ,
struct config_tree * cf ) ;
2005-10-17 03:03:59 +04:00
void ( * read_desc ) ( struct dm_pool * mem , struct config_tree * cf ,
2002-11-18 17:04:08 +03:00
time_t * when , char * * desc ) ;
2006-04-11 17:55:59 +04:00
const char * ( * read_vgname ) ( const struct format_type * fmt ,
struct config_tree * cft ,
2006-04-13 21:32:24 +04:00
struct id * vgid , uint32_t * vgstatus ,
char * * creation_host ) ;
2002-11-18 17:04:08 +03:00
} ;
struct text_vg_version_ops * text_vg_vsn1_init ( void ) ;
2001-12-11 15:16:58 +03:00
int print_flags ( uint32_t status , int type , char * buffer , size_t size ) ;
int read_flags ( uint32_t * status , int type , struct config_value * cv ) ;
2004-03-08 20:19:15 +03:00
int print_tags ( struct list * tags , char * buffer , size_t size ) ;
2005-10-17 03:03:59 +04:00
int read_tags ( struct dm_pool * mem , struct list * tags , struct config_value * cv ) ;
2004-03-08 20:19:15 +03:00
2002-11-18 17:04:08 +03:00
int text_vg_export_file ( struct volume_group * vg , const char * desc , FILE * fp ) ;
2005-06-07 15:00:07 +04:00
int text_vg_export_raw ( struct volume_group * vg , const char * desc , char * * buf ) ;
2002-11-18 17:04:08 +03:00
struct volume_group * text_vg_import_file ( struct format_instance * fid ,
const char * file ,
time_t * when , char * * desc ) ;
struct volume_group * text_vg_import_fd ( struct format_instance * fid ,
const char * file ,
2003-07-05 02:34:56 +04:00
struct device * dev ,
2002-11-18 17:04:08 +03:00
off_t offset , uint32_t size ,
off_t offset2 , uint32_t size2 ,
checksum_fn_t checksum_fn ,
uint32_t checksum ,
time_t * when , char * * desc ) ;
2006-04-11 17:55:59 +04:00
const char * text_vgname_import ( const struct format_type * fmt ,
struct device * dev ,
off_t offset , uint32_t size ,
off_t offset2 , uint32_t size2 ,
checksum_fn_t checksum_fn , uint32_t checksum ,
2006-04-13 21:32:24 +04:00
struct id * vgid , uint32_t * vgstatus ,
char * * creation_host ) ;
2001-11-21 12:20:05 +03:00
# endif