2004-05-05 01:25:57 +04:00
/*
* Copyright ( C ) 2003 - 2004 Sistina Software , Inc . All rights reserved .
2024-10-28 20:35:18 +03:00
* Copyright ( C ) 2004 - 2024 Red Hat , Inc . All rights reserved .
2004-05-05 01:25:57 +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-05-05 01:25:57 +04:00
*
2007-08-21 00:55:30 +04:00
* You should have received a copy of the GNU Lesser General Public License
2004-05-05 01:25:57 +04:00
* along with this program ; if not , write to the Free Software Foundation ,
2016-01-21 13:49:46 +03:00
* Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA
2004-05-05 01:25:57 +04:00
*/
# ifndef _LVM_TEXT_IMPORT_H
# define _LVM_TEXT_IMPORT_H
2012-01-26 02:26:33 +04:00
# include <inttypes.h>
struct dm_hash_table ;
2004-05-05 01:25:57 +04:00
struct lv_segment ;
2011-08-30 18:55:15 +04:00
struct dm_config_node ;
2004-05-05 01:25:57 +04:00
2011-08-30 18:55:15 +04:00
int text_import_areas ( struct lv_segment * seg , const struct dm_config_node * sn ,
2024-10-24 17:12:18 +03:00
const struct dm_config_value * cv , uint64_t status ) ;
2004-05-05 01:25:57 +04:00
2024-10-28 20:35:18 +03:00
typedef enum {
CONFIG_VALUE_STRING , /* const char * */
CONFIG_VALUE_UINT64 , /* uint64_t * */
CONFIG_VALUE_UINT32 , /* uint32_t * */
CONFIG_VALUE_LIST , /* struct dm_config_value * */
} config_value_t ;
struct config_value {
const char * name ; /* config value name/path to look for */
void * result ; /* where to store resulting value of expected type */
config_value_t type ; /* expected value type */
int mandatory ; /* fail import if this value is missing in config node */
} ;
/*
* Parses config values out of config node out of sorted array like this
*
* struct config_value values [ ] = {
* { " value1 " , & uint_value1 , CONFIG_VALUE_UINT32 , 1 } ,
* { " value2 " , & list_value2 , CONFIG_VALUE_LIST , } ,
* } ;
*/
int text_import_values ( const struct dm_config_node * cn ,
struct config_value * values , size_t values_count ) ;
2004-05-05 01:25:57 +04:00
# endif