2002-02-11 23:50:53 +03:00
/*
2004-03-30 23:35:44 +04:00
* Copyright ( C ) 2001 - 2004 Sistina Software , Inc . All rights reserved .
* Copyright ( C ) 2004 Red Hat , Inc . All rights reserved .
2002-02-11 23:50:53 +03:00
*
2004-03-30 23:35:44 +04:00
* This file is part of LVM2 .
2002-02-11 23:50:53 +03:00
*
2004-03-30 23:35:44 +04:00
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
* of the GNU General Public License v .2 .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software Foundation ,
* Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
2002-02-11 23:50:53 +03:00
*/
# ifndef _LVM_TOOLCONTEXT_H
# define _LVM_TOOLCONTEXT_H
# include "dev-cache.h"
# include "pool.h"
2002-11-18 17:01:16 +03:00
# include <stdio.h>
# include <limits.h>
/*
* Config options that can be changed while commands are processed
*/
struct config_info {
int debug ;
int verbose ;
int test ;
int syslog ;
int activation ;
2002-12-12 23:55:49 +03:00
int suffix ;
uint64_t unit_factor ;
char unit_type ;
2002-11-18 17:01:16 +03:00
const char * msg_prefix ;
int cmd_name ; /* Show command name? */
int archive ; /* should we archive ? */
int backup ; /* should we backup ? */
struct format_type * fmt ;
mode_t umask ;
} ;
2004-05-04 22:28:15 +04:00
struct config_tree ;
2002-11-18 17:01:16 +03:00
/* FIXME Split into tool & library contexts */
2002-02-11 23:50:53 +03:00
/* command-instance-related variables needed by library */
struct cmd_context {
2004-03-08 20:25:59 +03:00
struct pool * libmem ; /* For permanent config data */
struct pool * mem ; /* Transient: Cleared between each command */
2002-02-11 23:50:53 +03:00
2002-12-20 02:25:55 +03:00
const struct format_type * fmt ; /* Current format to use by default */
2002-11-18 17:01:16 +03:00
struct format_type * fmt_backup ; /* Format to use for backups */
2002-04-24 22:20:51 +04:00
2002-11-18 17:01:16 +03:00
struct list formats ; /* Available formats */
2004-05-05 01:25:57 +04:00
struct list segtypes ; /* Available segment types */
2004-03-08 20:25:59 +03:00
const char * hostname ;
2004-04-08 19:23:23 +04:00
const char * kernel_vsn ;
2002-02-11 23:50:53 +03:00
char * cmd_line ;
struct command * command ;
struct arg * args ;
2003-05-06 16:00:51 +04:00
char * * argv ;
2002-11-18 17:01:16 +03:00
struct dev_filter * filter ;
int dump_filter ; /* Dump filter when exiting? */
2004-05-04 22:28:15 +04:00
struct list config_files ;
int config_valid ;
2004-03-08 21:28:45 +03:00
struct config_tree * cft ;
2002-11-18 17:01:16 +03:00
struct config_info default_settings ;
struct config_info current_settings ;
2004-03-08 21:13:22 +03:00
/* List of defined tags */
struct list tags ;
2004-05-04 22:28:15 +04:00
int hosttags ;
2004-03-08 21:13:22 +03:00
2002-11-18 17:01:16 +03:00
char sys_dir [ PATH_MAX ] ;
char dev_dir [ PATH_MAX ] ;
char proc_dir [ PATH_MAX ] ;
2002-02-11 23:50:53 +03:00
} ;
2002-11-18 17:01:16 +03:00
struct cmd_context * create_toolcontext ( struct arg * the_args ) ;
void destroy_toolcontext ( struct cmd_context * cmd ) ;
2004-03-08 21:13:22 +03:00
int refresh_toolcontext ( struct cmd_context * cmd ) ;
2004-05-04 22:28:15 +04:00
int config_files_changed ( struct cmd_context * cmd ) ;
2002-11-18 17:01:16 +03:00
2002-02-11 23:50:53 +03:00
# endif