Sync usage with man page.
[netbsd-mini2440.git] / external / gpl2 / lvm2 / dist / include / toolcontext.h
blob2a47bea557e920e9f5a895172b1be86914c101c4
1 /* $NetBSD$ */
3 /*
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"
23 #include <stdio.h>
24 #include <limits.h>
27 * Config options that can be changed while commands are processed
29 struct config_info {
30 int debug;
31 int verbose;
32 int test;
33 int syslog;
34 int activation;
35 int suffix;
36 int archive; /* should we archive ? */
37 int backup; /* should we backup ? */
38 int read_ahead; /* DM_READ_AHEAD_NONE or _AUTO */
39 int udev_sync;
40 int cache_vgmetadata;
41 const char *msg_prefix;
42 struct format_type *fmt;
43 uint64_t unit_factor;
44 int cmd_name; /* Show command name? */
45 mode_t umask;
46 char unit_type;
47 char _padding[1];
50 struct config_tree;
51 struct archive_params;
52 struct backup_params;
54 /* FIXME Split into tool & library contexts */
55 /* command-instance-related variables needed by library */
56 struct cmd_context {
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 */
65 const char *hostname;
66 const char *kernel_vsn;
68 unsigned rand_seed;
69 const char *cmd_line;
70 struct command *command;
71 char **argv;
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;
82 int config_valid;
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 */
93 struct dm_list tags;
94 int hosttags;
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);
114 #endif