diff options
author | Anas Nashif <anas.nashif@intel.com> | 2013-03-05 01:43:20 -0800 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2013-03-05 01:43:20 -0800 |
commit | 8bd28eea831fd5215c12e6fcecc8e9a772398ed9 (patch) | |
tree | 2579ba0d9921953cadfc17006c47ff419382898a /lib/commands/toolcontext.h | |
download | device-mapper-8bd28eea831fd5215c12e6fcecc8e9a772398ed9.tar.gz device-mapper-8bd28eea831fd5215c12e6fcecc8e9a772398ed9.tar.bz2 device-mapper-8bd28eea831fd5215c12e6fcecc8e9a772398ed9.zip |
Imported Upstream version 2.02.79upstream/2.02.79
Diffstat (limited to 'lib/commands/toolcontext.h')
-rw-r--r-- | lib/commands/toolcontext.h | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h new file mode 100644 index 0000000..4628c7c --- /dev/null +++ b/lib/commands/toolcontext.h @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * + * 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 + * of the GNU Lesser General Public License v.2.1. + * + * You should have received a copy of the GNU Lesser 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 + */ + +#ifndef _LVM_TOOLCONTEXT_H +#define _LVM_TOOLCONTEXT_H + +#include "dev-cache.h" + +#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; + int suffix; + int archive; /* should we archive ? */ + int backup; /* should we backup ? */ + int read_ahead; /* DM_READ_AHEAD_NONE or _AUTO */ + int udev_rules; + int udev_sync; + int cache_vgmetadata; + const char *msg_prefix; + const char *fmt_name; + uint64_t unit_factor; + int cmd_name; /* Show command name? */ + mode_t umask; + char unit_type; + char _padding[1]; +}; + +struct config_tree; +struct archive_params; +struct backup_params; +struct arg_values; + +/* FIXME Split into tool & library contexts */ +/* command-instance-related variables needed by library */ +struct cmd_context { + struct dm_pool *libmem; /* For permanent config data */ + struct dm_pool *mem; /* Transient: Cleared between each command */ + + const struct format_type *fmt; /* Current format to use by default */ + struct format_type *fmt_backup; /* Format to use for backups */ + + struct dm_list formats; /* Available formats */ + struct dm_list segtypes; /* Available segment types */ + const char *hostname; + const char *kernel_vsn; + + unsigned rand_seed; + const char *cmd_line; + struct command *command; + char **argv; + struct arg_values *arg_values; + struct dm_list arg_value_groups; + unsigned is_long_lived:1; /* Optimises persistent_filter handling */ + unsigned handles_missing_pvs:1; + unsigned handles_unknown_segments:1; + unsigned partial_activation:1; + unsigned si_unit_consistency:1; + unsigned metadata_read_only:1; + + unsigned independent_metadata_areas:1; /* Active formats have MDAs outside PVs */ + + struct dev_filter *filter; + int dump_filter; /* Dump filter when exiting? */ + + struct dm_list config_files; + int config_valid; + struct config_tree *cft; + struct config_tree *cft_override; + struct config_info default_settings; + struct config_info current_settings; + + struct archive_params *archive_params; + struct backup_params *backup_params; + const char *stripe_filler; + + /* List of defined tags */ + struct dm_list tags; + int hosttags; + + char system_dir[PATH_MAX]; + char dev_dir[PATH_MAX]; + char proc_dir[PATH_MAX]; + char sysfs_dir[PATH_MAX]; /* FIXME Use global value instead. */ +}; + +/* + * system_dir may be NULL to use the default value. + * The environment variable LVM_SYSTEM_DIR always takes precedence. + */ +struct cmd_context *create_toolcontext(unsigned is_long_lived, + const char *system_dir); +void destroy_toolcontext(struct cmd_context *cmd); +int refresh_toolcontext(struct cmd_context *cmd); +int refresh_filters(struct cmd_context *cmd); +int config_files_changed(struct cmd_context *cmd); +int init_lvmcache_orphans(struct cmd_context *cmd); + +struct format_type *get_format_by_name(struct cmd_context *cmd, const char *format); + +#endif |