4 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
5 * Copyright (C) 2004-2009 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_TOOLCONTEXT_H
19 #define _LVM_TOOLCONTEXT_H
21 #include "dev-cache.h"
27 * Config options that can be changed while commands are processed
36 int archive
; /* should we archive ? */
37 int backup
; /* should we backup ? */
38 int read_ahead
; /* DM_READ_AHEAD_NONE or _AUTO */
41 const char *msg_prefix
;
42 struct format_type
*fmt
;
44 int cmd_name
; /* Show command name? */
51 struct archive_params
;
54 /* FIXME Split into tool & library contexts */
55 /* command-instance-related variables needed by library */
57 struct dm_pool
*libmem
; /* For permanent config data */
58 struct dm_pool
*mem
; /* Transient: Cleared between each command */
60 const struct format_type
*fmt
; /* Current format to use by default */
61 struct format_type
*fmt_backup
; /* Format to use for backups */
63 struct dm_list formats
; /* Available formats */
64 struct dm_list segtypes
; /* Available segment types */
66 const char *kernel_vsn
;
70 struct command
*command
;
72 unsigned is_long_lived
:1; /* Optimises persistent_filter handling */
73 unsigned handles_missing_pvs
:1;
74 unsigned handles_unknown_segments
:1;
75 unsigned partial_activation
:1;
76 unsigned si_unit_consistency
:1;
78 struct dev_filter
*filter
;
79 int dump_filter
; /* Dump filter when exiting? */
81 struct dm_list config_files
;
83 struct config_tree
*cft
;
84 struct config_tree
*cft_override
;
85 struct config_info default_settings
;
86 struct config_info current_settings
;
88 struct archive_params
*archive_params
;
89 struct backup_params
*backup_params
;
90 const char *stripe_filler
;
92 /* List of defined tags */
96 char system_dir
[PATH_MAX
];
97 char dev_dir
[PATH_MAX
];
98 char proc_dir
[PATH_MAX
];
99 char sysfs_dir
[PATH_MAX
];
103 * system_dir may be NULL to use the default value.
104 * The environment variable LVM_SYSTEM_DIR always takes precedence.
106 struct cmd_context
*create_toolcontext(unsigned is_long_lived
,
107 const char *system_dir
);
108 void destroy_toolcontext(struct cmd_context
*cmd
);
109 int refresh_toolcontext(struct cmd_context
*cmd
);
110 int refresh_filters(struct cmd_context
*cmd
);
111 int config_files_changed(struct cmd_context
*cmd
);
112 int init_lvmcache_orphans(struct cmd_context
*cmd
);