mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
rename config file vars & always use / as separator
This commit is contained in:
parent
de17d760ba
commit
814643d8a2
@ -120,8 +120,7 @@ static int _passes_activation_filter(struct cmd_context *cmd,
|
||||
char *str;
|
||||
char path[PATH_MAX];
|
||||
|
||||
if (!(cn = find_config_node(cmd->cf->root, "activation/volume_list",
|
||||
'/'))) {
|
||||
if (!(cn = find_config_node(cmd->cft->root, "activation/volume_list"))) {
|
||||
/* If no hosts tags defined, activate */
|
||||
if (list_empty(&cmd->tags))
|
||||
return 1;
|
||||
@ -244,7 +243,7 @@ static int _lv_info(const struct logical_volume *lv, int mknodes,
|
||||
if (!activation())
|
||||
return 0;
|
||||
|
||||
if (!(dm = dev_manager_create(lv->vg->name, lv->vg->cmd->cf))) {
|
||||
if (!(dm = dev_manager_create(lv->vg->name, lv->vg->cmd->cft))) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
@ -279,7 +278,7 @@ int lv_snapshot_percent(struct logical_volume *lv, float *percent)
|
||||
if (!activation())
|
||||
return 0;
|
||||
|
||||
if (!(dm = dev_manager_create(lv->vg->name, lv->vg->cmd->cf))) {
|
||||
if (!(dm = dev_manager_create(lv->vg->name, lv->vg->cmd->cft))) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
@ -302,7 +301,7 @@ int lv_mirror_percent(struct logical_volume *lv, int wait, float *percent,
|
||||
if (!activation())
|
||||
return 0;
|
||||
|
||||
if (!(dm = dev_manager_create(lv->vg->name, lv->vg->cmd->cf))) {
|
||||
if (!(dm = dev_manager_create(lv->vg->name, lv->vg->cmd->cft))) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
@ -345,7 +344,7 @@ static int _lv_activate(struct logical_volume *lv)
|
||||
int r;
|
||||
struct dev_manager *dm;
|
||||
|
||||
if (!(dm = dev_manager_create(lv->vg->name, lv->vg->cmd->cf))) {
|
||||
if (!(dm = dev_manager_create(lv->vg->name, lv->vg->cmd->cft))) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
@ -362,7 +361,7 @@ static int _lv_deactivate(struct logical_volume *lv)
|
||||
int r;
|
||||
struct dev_manager *dm;
|
||||
|
||||
if (!(dm = dev_manager_create(lv->vg->name, lv->vg->cmd->cf))) {
|
||||
if (!(dm = dev_manager_create(lv->vg->name, lv->vg->cmd->cft))) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
@ -379,7 +378,7 @@ static int _lv_suspend(struct logical_volume *lv)
|
||||
int r;
|
||||
struct dev_manager *dm;
|
||||
|
||||
if (!(dm = dev_manager_create(lv->vg->name, lv->vg->cmd->cf))) {
|
||||
if (!(dm = dev_manager_create(lv->vg->name, lv->vg->cmd->cft))) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ static uint32_t mirror_region_size = 0;
|
||||
struct dev_manager {
|
||||
struct pool *mem;
|
||||
|
||||
struct config_tree *cf;
|
||||
struct config_tree *cft;
|
||||
const char *stripe_filler;
|
||||
uint32_t mirror_region_size;
|
||||
uint32_t pvmove_mirror_count;
|
||||
@ -1015,7 +1015,7 @@ static int _populate_snapshot(struct dev_manager *dm,
|
||||
* dev_manager implementation.
|
||||
*/
|
||||
struct dev_manager *dev_manager_create(const char *vg_name,
|
||||
struct config_tree *cf)
|
||||
struct config_tree *cft)
|
||||
{
|
||||
struct pool *mem;
|
||||
struct dev_manager *dm;
|
||||
@ -1031,18 +1031,17 @@ struct dev_manager *dev_manager_create(const char *vg_name,
|
||||
}
|
||||
|
||||
dm->mem = mem;
|
||||
dm->cf = cf;
|
||||
dm->cft = cft;
|
||||
if (!stripe_filler) {
|
||||
stripe_filler = find_config_str(cf->root,
|
||||
stripe_filler = find_config_str(cft->root,
|
||||
"activation/missing_stripe_filler",
|
||||
'/', DEFAULT_STRIPE_FILLER);
|
||||
DEFAULT_STRIPE_FILLER);
|
||||
}
|
||||
dm->stripe_filler = stripe_filler;
|
||||
|
||||
if (!mirror_region_size) {
|
||||
mirror_region_size = 2 * find_config_int(cf->root,
|
||||
mirror_region_size = 2 * find_config_int(cft->root,
|
||||
"activation/mirror_region_size",
|
||||
'/',
|
||||
DEFAULT_MIRROR_REGION_SIZE);
|
||||
}
|
||||
dm->mirror_region_size = mirror_region_size;
|
||||
|
@ -70,7 +70,7 @@ static void _init_logging(struct cmd_context *cmd)
|
||||
|
||||
/* Syslog */
|
||||
cmd->default_settings.syslog =
|
||||
find_config_int(cmd->cf->root, "log/syslog", '/', DEFAULT_SYSLOG);
|
||||
find_config_int(cmd->cft->root, "log/syslog", DEFAULT_SYSLOG);
|
||||
if (cmd->default_settings.syslog != 1)
|
||||
fin_syslog();
|
||||
|
||||
@ -79,38 +79,38 @@ static void _init_logging(struct cmd_context *cmd)
|
||||
|
||||
/* Debug level for log file output */
|
||||
cmd->default_settings.debug =
|
||||
find_config_int(cmd->cf->root, "log/level", '/', DEFAULT_LOGLEVEL);
|
||||
find_config_int(cmd->cft->root, "log/level", DEFAULT_LOGLEVEL);
|
||||
init_debug(cmd->default_settings.debug);
|
||||
|
||||
/* Verbose level for tty output */
|
||||
cmd->default_settings.verbose =
|
||||
find_config_int(cmd->cf->root, "log/verbose", '/', DEFAULT_VERBOSE);
|
||||
find_config_int(cmd->cft->root, "log/verbose", DEFAULT_VERBOSE);
|
||||
init_verbose(cmd->default_settings.verbose);
|
||||
|
||||
/* Log message formatting */
|
||||
init_indent(find_config_int(cmd->cf->root, "log/indent", '/',
|
||||
init_indent(find_config_int(cmd->cft->root, "log/indent",
|
||||
DEFAULT_INDENT));
|
||||
|
||||
cmd->default_settings.msg_prefix = find_config_str(cmd->cf->root,
|
||||
"log/prefix", '/',
|
||||
cmd->default_settings.msg_prefix = find_config_str(cmd->cft->root,
|
||||
"log/prefix",
|
||||
DEFAULT_MSG_PREFIX);
|
||||
init_msg_prefix(cmd->default_settings.msg_prefix);
|
||||
|
||||
cmd->default_settings.cmd_name = find_config_int(cmd->cf->root,
|
||||
cmd->default_settings.cmd_name = find_config_int(cmd->cft->root,
|
||||
"log/command_names",
|
||||
'/', DEFAULT_CMD_NAME);
|
||||
DEFAULT_CMD_NAME);
|
||||
init_cmd_name(cmd->default_settings.cmd_name);
|
||||
|
||||
/* Test mode */
|
||||
cmd->default_settings.test =
|
||||
find_config_int(cmd->cf->root, "global/test", '/', 0);
|
||||
find_config_int(cmd->cft->root, "global/test", 0);
|
||||
|
||||
/* Settings for logging to file */
|
||||
if (find_config_int(cmd->cf->root, "log/overwrite", '/',
|
||||
if (find_config_int(cmd->cft->root, "log/overwrite",
|
||||
DEFAULT_OVERWRITE))
|
||||
append = 0;
|
||||
|
||||
log_file = find_config_str(cmd->cf->root, "log/file", '/', 0);
|
||||
log_file = find_config_str(cmd->cft->root, "log/file", 0);
|
||||
|
||||
if (log_file) {
|
||||
release_log_memory();
|
||||
@ -118,12 +118,12 @@ static void _init_logging(struct cmd_context *cmd)
|
||||
init_log_file(log_file, append);
|
||||
}
|
||||
|
||||
log_file = find_config_str(cmd->cf->root, "log/activate_file", '/', 0);
|
||||
log_file = find_config_str(cmd->cft->root, "log/activate_file", 0);
|
||||
if (log_file)
|
||||
init_log_direct(log_file, append);
|
||||
|
||||
init_log_while_suspended(find_config_int(cmd->cf->root,
|
||||
"log/activation", '/', 0));
|
||||
init_log_while_suspended(find_config_int(cmd->cft->root,
|
||||
"log/activation", 0));
|
||||
|
||||
t = time(NULL);
|
||||
log_verbose("Logging initialised at %s", ctime(&t));
|
||||
@ -139,8 +139,8 @@ static int _process_config(struct cmd_context *cmd)
|
||||
mode_t old_umask;
|
||||
|
||||
/* umask */
|
||||
cmd->default_settings.umask = find_config_int(cmd->cf->root,
|
||||
"global/umask", '/',
|
||||
cmd->default_settings.umask = find_config_int(cmd->cft->root,
|
||||
"global/umask",
|
||||
DEFAULT_UMASK);
|
||||
|
||||
if ((old_umask = umask((mode_t) cmd->default_settings.umask)) !=
|
||||
@ -149,8 +149,8 @@ static int _process_config(struct cmd_context *cmd)
|
||||
|
||||
/* dev dir */
|
||||
if (lvm_snprintf(cmd->dev_dir, sizeof(cmd->dev_dir), "%s/",
|
||||
find_config_str(cmd->cf->root, "devices/dir",
|
||||
'/', DEFAULT_DEV_DIR)) < 0) {
|
||||
find_config_str(cmd->cft->root, "devices/dir",
|
||||
DEFAULT_DEV_DIR)) < 0) {
|
||||
log_error("Device directory given in config file too long");
|
||||
return 0;
|
||||
}
|
||||
@ -160,27 +160,25 @@ static int _process_config(struct cmd_context *cmd)
|
||||
|
||||
/* proc dir */
|
||||
if (lvm_snprintf(cmd->proc_dir, sizeof(cmd->proc_dir), "%s",
|
||||
find_config_str(cmd->cf->root, "global/proc",
|
||||
'/', DEFAULT_PROC_DIR)) < 0) {
|
||||
find_config_str(cmd->cft->root, "global/proc",
|
||||
DEFAULT_PROC_DIR)) < 0) {
|
||||
log_error("Device directory given in config file too long");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* activation? */
|
||||
cmd->default_settings.activation = find_config_int(cmd->cf->root,
|
||||
cmd->default_settings.activation = find_config_int(cmd->cft->root,
|
||||
"global/activation",
|
||||
'/',
|
||||
DEFAULT_ACTIVATION);
|
||||
set_activation(cmd->default_settings.activation);
|
||||
|
||||
cmd->default_settings.suffix = find_config_int(cmd->cf->root,
|
||||
cmd->default_settings.suffix = find_config_int(cmd->cft->root,
|
||||
"global/suffix",
|
||||
'/', DEFAULT_SUFFIX);
|
||||
DEFAULT_SUFFIX);
|
||||
|
||||
if (!(cmd->default_settings.unit_factor =
|
||||
units_to_bytes(find_config_str(cmd->cf->root,
|
||||
units_to_bytes(find_config_str(cmd->cft->root,
|
||||
"global/units",
|
||||
'/',
|
||||
DEFAULT_UNITS),
|
||||
&cmd->default_settings.unit_type))) {
|
||||
log_error("Invalid units specification");
|
||||
@ -196,7 +194,7 @@ static int _init_config(struct cmd_context *cmd)
|
||||
struct stat info;
|
||||
char config_file[PATH_MAX] = "";
|
||||
|
||||
if (!(cmd->cf = create_config_tree())) {
|
||||
if (!(cmd->cft = create_config_tree())) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
@ -208,7 +206,7 @@ static int _init_config(struct cmd_context *cmd)
|
||||
if (lvm_snprintf(config_file, sizeof(config_file),
|
||||
"%s/lvm.conf", cmd->sys_dir) < 0) {
|
||||
log_error("LVM_SYSTEM_DIR was too long");
|
||||
destroy_config_tree(cmd->cf);
|
||||
destroy_config_tree(cmd->cft);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -217,13 +215,13 @@ static int _init_config(struct cmd_context *cmd)
|
||||
if (errno == ENOENT)
|
||||
return 1;
|
||||
log_sys_error("stat", config_file);
|
||||
destroy_config_tree(cmd->cf);
|
||||
destroy_config_tree(cmd->cft);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!read_config_file(cmd->cf, config_file)) {
|
||||
if (!read_config_file(cmd->cft, config_file)) {
|
||||
log_error("Failed to load config file %s", config_file);
|
||||
destroy_config_tree(cmd->cf);
|
||||
destroy_config_tree(cmd->cft);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -240,7 +238,7 @@ static int _init_dev_cache(struct cmd_context *cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(cn = find_config_node(cmd->cf->root, "devices/scan", '/'))) {
|
||||
if (!(cn = find_config_node(cmd->cft->root, "devices/scan"))) {
|
||||
if (!dev_cache_add_dir("/dev")) {
|
||||
log_error("Failed to add /dev to internal "
|
||||
"device cache");
|
||||
@ -279,14 +277,14 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
|
||||
memset(filters, 0, sizeof(filters));
|
||||
|
||||
/* sysfs filter */
|
||||
if (find_config_bool(cmd->cf->root, "devices/sysfs_scan", '/',
|
||||
if (find_config_bool(cmd->cft->root, "devices/sysfs_scan",
|
||||
DEFAULT_SYSFS_SCAN)) {
|
||||
if ((filters[nr_filt] = sysfs_filter_create(cmd->proc_dir)))
|
||||
nr_filt++;
|
||||
}
|
||||
|
||||
/* regex filter */
|
||||
if (!(cn = find_config_node(cmd->cf->root, "devices/filter", '/')))
|
||||
if (!(cn = find_config_node(cmd->cft->root, "devices/filter")))
|
||||
log_debug("devices/filter not found in config file: no regex "
|
||||
"filter installed");
|
||||
|
||||
@ -296,7 +294,7 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
|
||||
}
|
||||
|
||||
/* device type filter */
|
||||
cn = find_config_node(cmd->cf->root, "devices/types", '/');
|
||||
cn = find_config_node(cmd->cft->root, "devices/types");
|
||||
if (!(filters[nr_filt++] = lvm_type_filter_create(cmd->proc_dir, cn))) {
|
||||
log_error("Failed to create lvm type filter");
|
||||
return NULL;
|
||||
@ -327,21 +325,21 @@ static int _init_filters(struct cmd_context *cmd)
|
||||
}
|
||||
|
||||
dev_cache =
|
||||
find_config_str(cmd->cf->root, "devices/cache", '/', cache_file);
|
||||
find_config_str(cmd->cft->root, "devices/cache", cache_file);
|
||||
if (!(f4 = persistent_filter_create(f3, dev_cache))) {
|
||||
log_error("Failed to create persistent device filter");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Should we ever dump persistent filter state? */
|
||||
if (find_config_int(cmd->cf->root, "devices/write_cache_state", '/', 1))
|
||||
if (find_config_int(cmd->cft->root, "devices/write_cache_state", 1))
|
||||
cmd->dump_filter = 1;
|
||||
|
||||
if (!*cmd->sys_dir)
|
||||
cmd->dump_filter = 0;
|
||||
|
||||
if (!stat(dev_cache, &st) &&
|
||||
(st.st_mtime > config_file_timestamp(cmd->cf)) &&
|
||||
(st.st_mtime > config_file_timestamp(cmd->cft)) &&
|
||||
!persistent_filter_load(f4))
|
||||
log_verbose("Failed to load existing device cache from %s",
|
||||
dev_cache);
|
||||
@ -373,8 +371,7 @@ static int _init_formats(struct cmd_context *cmd)
|
||||
|
||||
#ifdef HAVE_LIBDL
|
||||
/* Load any formats in shared libs */
|
||||
if ((cn = find_config_node(cmd->cf->root, "global/format_libraries",
|
||||
'/'))) {
|
||||
if ((cn = find_config_node(cmd->cft->root, "global/format_libraries"))) {
|
||||
|
||||
struct config_value *cv;
|
||||
struct format_type *(*init_format_fn) (struct cmd_context *);
|
||||
@ -386,7 +383,7 @@ static int _init_formats(struct cmd_context *cmd)
|
||||
"global/format_libraries");
|
||||
return 0;
|
||||
}
|
||||
if (!(lib = load_shared_library(cmd->cf, cv->v.str,
|
||||
if (!(lib = load_shared_library(cmd->cft, cv->v.str,
|
||||
"format"))) {
|
||||
stack;
|
||||
return 0;
|
||||
@ -414,7 +411,7 @@ static int _init_formats(struct cmd_context *cmd)
|
||||
|
||||
cmd->fmt_backup = fmt;
|
||||
|
||||
format = find_config_str(cmd->cf->root, "global/format", '/',
|
||||
format = find_config_str(cmd->cft->root, "global/format",
|
||||
DEFAULT_FORMAT);
|
||||
|
||||
list_iterate(fmth, &cmd->formats) {
|
||||
@ -503,13 +500,13 @@ static int _init_tags(struct cmd_context *cmd)
|
||||
|
||||
list_init(&cmd->tags);
|
||||
|
||||
if (!(tn = find_config_node(cmd->cf->root, "tags", '/')) ||
|
||||
if (!(tn = find_config_node(cmd->cft->root, "tags")) ||
|
||||
!tn->child) {
|
||||
log_very_verbose("No tags defined in config file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (find_config_int(cmd->cf->root, "tags/hosttags", '/',
|
||||
if (find_config_int(cmd->cft->root, "tags/hosttags",
|
||||
DEFAULT_HOSTTAGS)) {
|
||||
/* FIXME Strip out invalid chars: only A-Za-z0-9_+.- */
|
||||
if (!_set_tag(cmd, cmd->hostname)) {
|
||||
@ -665,7 +662,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
|
||||
cmd->filter->destroy(cmd->filter);
|
||||
pool_destroy(cmd->mem);
|
||||
dev_cache_exit();
|
||||
destroy_config_tree(cmd->cf);
|
||||
destroy_config_tree(cmd->cft);
|
||||
pool_destroy(cmd->libmem);
|
||||
dbg_free(cmd);
|
||||
|
||||
|
@ -59,7 +59,7 @@ struct cmd_context {
|
||||
struct dev_filter *filter;
|
||||
int dump_filter; /* Dump filter when exiting? */
|
||||
|
||||
struct config_tree *cf;
|
||||
struct config_tree *cft;
|
||||
struct config_info default_settings;
|
||||
struct config_info current_settings;
|
||||
|
||||
|
@ -43,7 +43,7 @@ struct parser {
|
||||
};
|
||||
|
||||
struct cs {
|
||||
struct config_tree cf;
|
||||
struct config_tree cft;
|
||||
struct pool *mem;
|
||||
time_t timestamp;
|
||||
char *filename;
|
||||
@ -60,6 +60,8 @@ static struct config_value *_create_value(struct parser *p);
|
||||
static struct config_node *_create_node(struct parser *p);
|
||||
static char *_dup_tok(struct parser *p);
|
||||
|
||||
static const int sep = '/';
|
||||
|
||||
#define MAX_INDENT 32
|
||||
|
||||
#define match(t) do {\
|
||||
@ -99,22 +101,22 @@ struct config_tree *create_config_tree(void)
|
||||
}
|
||||
|
||||
c->mem = mem;
|
||||
c->cf.root = (struct config_node *) NULL;
|
||||
c->cft.root = (struct config_node *) NULL;
|
||||
c->timestamp = 0;
|
||||
c->filename = NULL;
|
||||
return &c->cf;
|
||||
return &c->cft;
|
||||
}
|
||||
|
||||
void destroy_config_tree(struct config_tree *cf)
|
||||
void destroy_config_tree(struct config_tree *cft)
|
||||
{
|
||||
pool_destroy(((struct cs *) cf)->mem);
|
||||
pool_destroy(((struct cs *) cft)->mem);
|
||||
}
|
||||
|
||||
int read_config_fd(struct config_tree *cf, struct device *dev,
|
||||
int read_config_fd(struct config_tree *cft, struct device *dev,
|
||||
off_t offset, size_t size, off_t offset2, size_t size2,
|
||||
checksum_fn_t checksum_fn, uint32_t checksum)
|
||||
{
|
||||
struct cs *c = (struct cs *) cf;
|
||||
struct cs *c = (struct cs *) cft;
|
||||
struct parser *p;
|
||||
int r = 0;
|
||||
int use_mmap = 1;
|
||||
@ -172,7 +174,7 @@ int read_config_fd(struct config_tree *cf, struct device *dev,
|
||||
p->tb = p->te = p->fb;
|
||||
p->line = 1;
|
||||
_get_token(p, TOK_SECTION_E);
|
||||
if (!(cf->root = _file(p))) {
|
||||
if (!(cft->root = _file(p))) {
|
||||
stack;
|
||||
goto out;
|
||||
}
|
||||
@ -193,9 +195,9 @@ int read_config_fd(struct config_tree *cf, struct device *dev,
|
||||
return r;
|
||||
}
|
||||
|
||||
int read_config_file(struct config_tree *cf, const char *file)
|
||||
int read_config_file(struct config_tree *cft, const char *file)
|
||||
{
|
||||
struct cs *c = (struct cs *) cf;
|
||||
struct cs *c = (struct cs *) cft;
|
||||
struct stat info;
|
||||
struct device *dev;
|
||||
int r = 1;
|
||||
@ -225,7 +227,7 @@ int read_config_file(struct config_tree *cf, const char *file)
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = read_config_fd(cf, dev, 0, (size_t) info.st_size, 0, 0,
|
||||
r = read_config_fd(cft, dev, 0, (size_t) info.st_size, 0, 0,
|
||||
(checksum_fn_t) NULL, 0);
|
||||
|
||||
dev_close(dev);
|
||||
@ -236,9 +238,9 @@ int read_config_file(struct config_tree *cf, const char *file)
|
||||
return r;
|
||||
}
|
||||
|
||||
time_t config_file_timestamp(struct config_tree *cf)
|
||||
time_t config_file_timestamp(struct config_tree *cft)
|
||||
{
|
||||
struct cs *c = (struct cs *) cf;
|
||||
struct cs *c = (struct cs *) cft;
|
||||
|
||||
return c->timestamp;
|
||||
}
|
||||
@ -246,10 +248,10 @@ time_t config_file_timestamp(struct config_tree *cf)
|
||||
/*
|
||||
* Returns 1 if config file reloaded
|
||||
*/
|
||||
int reload_config_file(struct config_tree **cf)
|
||||
int reload_config_file(struct config_tree **cft)
|
||||
{
|
||||
struct config_tree *new_cf;
|
||||
struct cs *c = (struct cs *) *cf;
|
||||
struct config_tree *new_cft;
|
||||
struct cs *c = (struct cs *) *cft;
|
||||
struct cs *new_cs;
|
||||
struct stat info;
|
||||
struct device *dev;
|
||||
@ -283,7 +285,7 @@ int reload_config_file(struct config_tree **cf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(new_cf = create_config_tree())) {
|
||||
if (!(new_cft = create_config_tree())) {
|
||||
log_error("Allocation of new config_tree failed");
|
||||
return 0;
|
||||
}
|
||||
@ -298,17 +300,17 @@ int reload_config_file(struct config_tree **cf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = read_config_fd(new_cf, dev, 0, (size_t) info.st_size,
|
||||
r = read_config_fd(new_cft, dev, 0, (size_t) info.st_size,
|
||||
0, 0, (checksum_fn_t) NULL, 0);
|
||||
|
||||
dev_close(dev);
|
||||
|
||||
if (r) {
|
||||
new_cs = (struct cs *) new_cf;
|
||||
new_cs = (struct cs *) new_cft;
|
||||
new_cs->filename = pool_strdup(new_cs->mem, c->filename);
|
||||
new_cs->timestamp = info.st_mtime;
|
||||
destroy_config_tree(*cf);
|
||||
*cf = new_cf;
|
||||
destroy_config_tree(*cft);
|
||||
*cft = new_cft;
|
||||
}
|
||||
|
||||
return r;
|
||||
@ -382,7 +384,7 @@ static int _write_config(struct config_node *n, FILE *fp, int level)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int write_config_file(struct config_tree *cf, const char *file)
|
||||
int write_config_file(struct config_tree *cft, const char *file)
|
||||
{
|
||||
int r = 1;
|
||||
FILE *fp;
|
||||
@ -396,7 +398,7 @@ int write_config_file(struct config_tree *cf, const char *file)
|
||||
}
|
||||
|
||||
log_verbose("Dumping configuration to %s", file);
|
||||
if (!_write_config(cf->root, fp, 0)) {
|
||||
if (!_write_config(cft->root, fp, 0)) {
|
||||
log_error("Failure while writing configuration");
|
||||
r = 0;
|
||||
}
|
||||
@ -728,8 +730,7 @@ static char *_dup_tok(struct parser *p)
|
||||
/*
|
||||
* utility functions
|
||||
*/
|
||||
struct config_node *find_config_node(struct config_node *cn,
|
||||
const char *path, const int sep)
|
||||
struct config_node *find_config_node(struct config_node *cn, const char *path)
|
||||
{
|
||||
const char *e;
|
||||
|
||||
@ -761,9 +762,9 @@ struct config_node *find_config_node(struct config_node *cn,
|
||||
}
|
||||
|
||||
const char *find_config_str(struct config_node *cn,
|
||||
const char *path, const int sep, const char *fail)
|
||||
const char *path, const char *fail)
|
||||
{
|
||||
struct config_node *n = find_config_node(cn, path, sep);
|
||||
struct config_node *n = find_config_node(cn, path);
|
||||
|
||||
if (n && n->v->type == CFG_STRING) {
|
||||
if (*n->v->v.str)
|
||||
@ -777,10 +778,9 @@ const char *find_config_str(struct config_node *cn,
|
||||
return fail;
|
||||
}
|
||||
|
||||
int find_config_int(struct config_node *cn, const char *path,
|
||||
const int sep, int fail)
|
||||
int find_config_int(struct config_node *cn, const char *path, int fail)
|
||||
{
|
||||
struct config_node *n = find_config_node(cn, path, sep);
|
||||
struct config_node *n = find_config_node(cn, path);
|
||||
|
||||
if (n && n->v->type == CFG_INT) {
|
||||
log_very_verbose("Setting %s to %d", path, n->v->v.i);
|
||||
@ -792,10 +792,9 @@ int find_config_int(struct config_node *cn, const char *path,
|
||||
return fail;
|
||||
}
|
||||
|
||||
float find_config_float(struct config_node *cn, const char *path,
|
||||
const int sep, float fail)
|
||||
float find_config_float(struct config_node *cn, const char *path, float fail)
|
||||
{
|
||||
struct config_node *n = find_config_node(cn, path, sep);
|
||||
struct config_node *n = find_config_node(cn, path);
|
||||
|
||||
if (n && n->v->type == CFG_FLOAT) {
|
||||
log_very_verbose("Setting %s to %f", path, n->v->v.r);
|
||||
@ -835,10 +834,9 @@ static int _str_to_bool(const char *str, int fail)
|
||||
return fail;
|
||||
}
|
||||
|
||||
int find_config_bool(struct config_node *cn, const char *path,
|
||||
const int sep, int fail)
|
||||
int find_config_bool(struct config_node *cn, const char *path, int fail)
|
||||
{
|
||||
struct config_node *n = find_config_node(cn, path, sep);
|
||||
struct config_node *n = find_config_node(cn, path);
|
||||
struct config_value *v;
|
||||
|
||||
if (!n)
|
||||
@ -858,11 +856,11 @@ int find_config_bool(struct config_node *cn, const char *path,
|
||||
}
|
||||
|
||||
int get_config_uint32(struct config_node *cn, const char *path,
|
||||
const int sep, uint32_t *result)
|
||||
uint32_t *result)
|
||||
{
|
||||
struct config_node *n;
|
||||
|
||||
n = find_config_node(cn, path, sep);
|
||||
n = find_config_node(cn, path);
|
||||
|
||||
if (!n || !n->v || n->v->type != CFG_INT)
|
||||
return 0;
|
||||
@ -872,11 +870,11 @@ int get_config_uint32(struct config_node *cn, const char *path,
|
||||
}
|
||||
|
||||
int get_config_uint64(struct config_node *cn, const char *path,
|
||||
const int sep, uint64_t *result)
|
||||
uint64_t *result)
|
||||
{
|
||||
struct config_node *n;
|
||||
|
||||
n = find_config_node(cn, path, sep);
|
||||
n = find_config_node(cn, path);
|
||||
|
||||
if (!n || !n->v || n->v->type != CFG_INT)
|
||||
return 0;
|
||||
@ -886,12 +884,11 @@ int get_config_uint64(struct config_node *cn, const char *path,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int get_config_str(struct config_node *cn, const char *path,
|
||||
const int sep, char **result)
|
||||
int get_config_str(struct config_node *cn, const char *path, char **result)
|
||||
{
|
||||
struct config_node *n;
|
||||
|
||||
n = find_config_node(cn, path, sep);
|
||||
n = find_config_node(cn, path);
|
||||
|
||||
if (!n || !n->v || n->v->type != CFG_STRING)
|
||||
return 0;
|
||||
|
@ -51,31 +51,27 @@ int reload_config_file(struct config_tree **cf);
|
||||
time_t config_file_timestamp(struct config_tree *cf);
|
||||
|
||||
struct config_node *find_config_node(struct config_node *cn,
|
||||
const char *path, const int separator);
|
||||
const char *path);
|
||||
|
||||
const char *find_config_str(struct config_node *cn,
|
||||
const char *path, const int sep, const char *fail);
|
||||
const char *find_config_str(struct config_node *cn, const char *path,
|
||||
const char *fail);
|
||||
|
||||
int find_config_int(struct config_node *cn, const char *path,
|
||||
const int sep, int fail);
|
||||
int find_config_int(struct config_node *cn, const char *path, int fail);
|
||||
|
||||
float find_config_float(struct config_node *cn, const char *path,
|
||||
const int sep, float fail);
|
||||
float find_config_float(struct config_node *cn, const char *path, float fail);
|
||||
|
||||
/*
|
||||
* Understands (0, ~0), (y, n), (yes, no), (on,
|
||||
* off), (true, false).
|
||||
*/
|
||||
int find_config_bool(struct config_node *cn, const char *path,
|
||||
const int sep, int fail);
|
||||
int find_config_bool(struct config_node *cn, const char *path, int fail);
|
||||
|
||||
int get_config_uint32(struct config_node *cn, const char *path,
|
||||
const int sep, uint32_t *result);
|
||||
uint32_t *result);
|
||||
|
||||
int get_config_uint64(struct config_node *cn, const char *path,
|
||||
const int sep, uint64_t *result);
|
||||
uint64_t *result);
|
||||
|
||||
int get_config_str(struct config_node *cn, const char *path,
|
||||
const int sep, char **result);
|
||||
int get_config_str(struct config_node *cn, const char *path, char **result);
|
||||
|
||||
#endif
|
||||
|
@ -51,13 +51,13 @@ int persistent_filter_wipe(struct dev_filter *f)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _read_array(struct pfilter *pf, struct config_tree *cf,
|
||||
static int _read_array(struct pfilter *pf, struct config_tree *cft,
|
||||
const char *path, void *data)
|
||||
{
|
||||
struct config_node *cn;
|
||||
struct config_value *cv;
|
||||
|
||||
if (!(cn = find_config_node(cf->root, path, '/'))) {
|
||||
if (!(cn = find_config_node(cft->root, path))) {
|
||||
log_very_verbose("Couldn't find %s array in '%s'",
|
||||
path, pf->file);
|
||||
return 0;
|
||||
@ -88,22 +88,22 @@ int persistent_filter_load(struct dev_filter *f)
|
||||
struct pfilter *pf = (struct pfilter *) f->private;
|
||||
|
||||
int r = 0;
|
||||
struct config_tree *cf;
|
||||
struct config_tree *cft;
|
||||
|
||||
if (!(cf = create_config_tree())) {
|
||||
if (!(cft = create_config_tree())) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!read_config_file(cf, pf->file)) {
|
||||
if (!read_config_file(cft, pf->file)) {
|
||||
stack;
|
||||
goto out;
|
||||
}
|
||||
|
||||
_read_array(pf, cf, "persistent_filter_cache/valid_devices",
|
||||
_read_array(pf, cft, "persistent_filter_cache/valid_devices",
|
||||
PF_GOOD_DEVICE);
|
||||
/* We don't gain anything by holding invalid devices */
|
||||
/* _read_array(pf, cf, "persistent_filter_cache/invalid_devices",
|
||||
/* _read_array(pf, cft, "persistent_filter_cache/invalid_devices",
|
||||
PF_BAD_DEVICE); */
|
||||
|
||||
/* Did we find anything? */
|
||||
@ -116,7 +116,7 @@ int persistent_filter_load(struct dev_filter *f)
|
||||
log_very_verbose("Loaded persistent filter cache from %s", pf->file);
|
||||
|
||||
out:
|
||||
destroy_config_tree(cf);
|
||||
destroy_config_tree(cft);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -1584,21 +1584,21 @@ static int _get_config_disk_area(struct cmd_context *cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!get_config_uint64(cn, "start_sector", '/', &dev_area.start)) {
|
||||
if (!get_config_uint64(cn, "start_sector", &dev_area.start)) {
|
||||
log_error("Missing start_sector in metadata disk_area section "
|
||||
"of config file");
|
||||
return 0;
|
||||
}
|
||||
dev_area.start <<= SECTOR_SHIFT;
|
||||
|
||||
if (!get_config_uint64(cn, "size", '/', &dev_area.size)) {
|
||||
if (!get_config_uint64(cn, "size", &dev_area.size)) {
|
||||
log_error("Missing size in metadata disk_area section "
|
||||
"of config file");
|
||||
return 0;
|
||||
}
|
||||
dev_area.size <<= SECTOR_SHIFT;
|
||||
|
||||
if (!get_config_str(cn, "id", '/', &id_str)) {
|
||||
if (!get_config_str(cn, "id", &id_str)) {
|
||||
log_error("Missing uuid in metadata disk_area section "
|
||||
"of config file");
|
||||
return 0;
|
||||
@ -1663,7 +1663,7 @@ struct format_type *create_text_format(struct cmd_context *cmd)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((cn = find_config_node(cmd->cf->root, "metadata/dirs", '/'))) {
|
||||
if ((cn = find_config_node(cmd->cft->root, "metadata/dirs"))) {
|
||||
for (cv = cn->v; cv; cv = cv->next) {
|
||||
if (cv->type != CFG_STRING) {
|
||||
log_error("Invalid string in config file: "
|
||||
@ -1679,7 +1679,7 @@ struct format_type *create_text_format(struct cmd_context *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
if (!(cn = find_config_node(cmd->cf->root, "metadata/disk_areas", '/')))
|
||||
if (!(cn = find_config_node(cmd->cft->root, "metadata/disk_areas")))
|
||||
return fmt;
|
||||
|
||||
for (cn = cn->child; cn; cn = cn->sib) {
|
||||
|
@ -26,7 +26,7 @@ struct volume_group *text_vg_import_fd(struct format_instance *fid,
|
||||
time_t *when, char **desc)
|
||||
{
|
||||
struct volume_group *vg = NULL;
|
||||
struct config_tree *cf;
|
||||
struct config_tree *cft;
|
||||
struct text_vg_version_ops **vsn;
|
||||
|
||||
static int _initialised = 0;
|
||||
@ -40,13 +40,13 @@ struct volume_group *text_vg_import_fd(struct format_instance *fid,
|
||||
*desc = NULL;
|
||||
*when = 0;
|
||||
|
||||
if (!(cf = create_config_tree())) {
|
||||
if (!(cft = create_config_tree())) {
|
||||
stack;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((!dev && !read_config_file(cf, file)) ||
|
||||
(dev && !read_config_fd(cf, dev, offset, size,
|
||||
if ((!dev && !read_config_file(cft, file)) ||
|
||||
(dev && !read_config_fd(cft, dev, offset, size,
|
||||
offset2, size2, checksum_fn, checksum))) {
|
||||
log_error("Couldn't read volume group metadata.");
|
||||
goto out;
|
||||
@ -56,20 +56,20 @@ struct volume_group *text_vg_import_fd(struct format_instance *fid,
|
||||
* Find a set of version functions that can read this file
|
||||
*/
|
||||
for (vsn = &_text_vsn_list[0]; *vsn; vsn++) {
|
||||
if (!(*vsn)->check_version(cf))
|
||||
if (!(*vsn)->check_version(cft))
|
||||
continue;
|
||||
|
||||
if (!(vg = (*vsn)->read_vg(fid, cf))) {
|
||||
if (!(vg = (*vsn)->read_vg(fid, cft))) {
|
||||
stack;
|
||||
goto out;
|
||||
}
|
||||
|
||||
(*vsn)->read_desc(fid->fmt->cmd->mem, cf, when, desc);
|
||||
(*vsn)->read_desc(fid->fmt->cmd->mem, cft, when, desc);
|
||||
break;
|
||||
}
|
||||
|
||||
out:
|
||||
destroy_config_tree(cf);
|
||||
destroy_config_tree(cft);
|
||||
return vg;
|
||||
}
|
||||
|
||||
|
@ -20,13 +20,13 @@ typedef int (*section_fn) (struct format_instance * fid, struct pool * mem,
|
||||
struct hash_table * pv_hash);
|
||||
|
||||
#define _read_int32(root, path, result) \
|
||||
get_config_uint32(root, path, '/', result)
|
||||
get_config_uint32(root, path, result)
|
||||
|
||||
#define _read_uint32(root, path, result) \
|
||||
get_config_uint32(root, path, '/', result)
|
||||
get_config_uint32(root, path, result)
|
||||
|
||||
#define _read_int64(root, path, result) \
|
||||
get_config_uint64(root, path, '/', result)
|
||||
get_config_uint64(root, path, result)
|
||||
|
||||
/*
|
||||
* Logs an attempt to read an invalid format file.
|
||||
@ -40,7 +40,7 @@ static void _invalid_format(const char *str)
|
||||
* Checks that the config file contains vg metadata, and that it
|
||||
* we recognise the version number,
|
||||
*/
|
||||
static int _check_version(struct config_tree *cf)
|
||||
static int _check_version(struct config_tree *cft)
|
||||
{
|
||||
struct config_node *cn;
|
||||
struct config_value *cv;
|
||||
@ -48,7 +48,7 @@ static int _check_version(struct config_tree *cf)
|
||||
/*
|
||||
* Check the contents field.
|
||||
*/
|
||||
if (!(cn = find_config_node(cf->root, CONTENTS_FIELD, '/'))) {
|
||||
if (!(cn = find_config_node(cft->root, CONTENTS_FIELD))) {
|
||||
_invalid_format("missing contents field");
|
||||
return 0;
|
||||
}
|
||||
@ -62,7 +62,7 @@ static int _check_version(struct config_tree *cf)
|
||||
/*
|
||||
* Check the version number.
|
||||
*/
|
||||
if (!(cn = find_config_node(cf->root, FORMAT_VERSION_FIELD, '/'))) {
|
||||
if (!(cn = find_config_node(cft->root, FORMAT_VERSION_FIELD))) {
|
||||
_invalid_format("missing version number");
|
||||
return 0;
|
||||
}
|
||||
@ -80,7 +80,7 @@ static int _read_id(struct id *id, struct config_node *cn, const char *path)
|
||||
{
|
||||
struct config_value *cv;
|
||||
|
||||
if (!(cn = find_config_node(cn, path, '/'))) {
|
||||
if (!(cn = find_config_node(cn, path))) {
|
||||
log_error("Couldn't find uuid.");
|
||||
return 0;
|
||||
}
|
||||
@ -157,7 +157,7 @@ static int _read_pv(struct format_instance *fid, struct pool *mem,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(cn = find_config_node(pvn, "status", '/'))) {
|
||||
if (!(cn = find_config_node(pvn, "status"))) {
|
||||
log_error("Couldn't find status flags for physical volume.");
|
||||
return 0;
|
||||
}
|
||||
@ -181,7 +181,7 @@ static int _read_pv(struct format_instance *fid, struct pool *mem,
|
||||
list_init(&pv->tags);
|
||||
|
||||
/* Optional tags */
|
||||
if ((cn = find_config_node(pvn, "tags", '/')) &&
|
||||
if ((cn = find_config_node(pvn, "tags")) &&
|
||||
!(read_tags(mem, &pv->tags, cn->v))) {
|
||||
log_error("Couldn't read tags for physical volume %s in %s.",
|
||||
dev_name(pv->dev), vg->name);
|
||||
@ -255,7 +255,7 @@ static int _read_segment(struct pool *mem, struct volume_group *vg,
|
||||
}
|
||||
|
||||
segtype = SEG_STRIPED; /* Default */
|
||||
if ((cn = find_config_node(sn, "type", '/'))) {
|
||||
if ((cn = find_config_node(sn, "type"))) {
|
||||
cv = cn->v;
|
||||
if (!cv || !cv->v.str) {
|
||||
log_error("Segment type must be a string.");
|
||||
@ -279,7 +279,7 @@ static int _read_segment(struct pool *mem, struct volume_group *vg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (find_config_node(sn, "extents_moved", '/')) {
|
||||
if (find_config_node(sn, "extents_moved")) {
|
||||
if (_read_uint32(sn, "extents_moved", &extents_moved))
|
||||
seg_status |= PVMOVE;
|
||||
else {
|
||||
@ -304,7 +304,7 @@ static int _read_segment(struct pool *mem, struct volume_group *vg,
|
||||
seg->extents_moved = extents_moved;
|
||||
|
||||
/* Optional tags */
|
||||
if ((cn = find_config_node(sn, "tags", '/')) &&
|
||||
if ((cn = find_config_node(sn, "tags")) &&
|
||||
!(read_tags(mem, &seg->tags, cn->v))) {
|
||||
log_error("Couldn't read tags for a segment of %s/%s.",
|
||||
vg->name, lv->name);
|
||||
@ -322,13 +322,13 @@ static int _read_segment(struct pool *mem, struct volume_group *vg,
|
||||
|
||||
log_suppress(1);
|
||||
|
||||
if (!(cow_name = find_config_str(sn, "cow_store", '/', NULL))) {
|
||||
if (!(cow_name = find_config_str(sn, "cow_store", NULL))) {
|
||||
log_suppress(0);
|
||||
log_error("Snapshot cow storage not specified.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(org_name = find_config_str(sn, "origin", '/', NULL))) {
|
||||
if (!(org_name = find_config_str(sn, "origin", NULL))) {
|
||||
log_suppress(0);
|
||||
log_error("Snapshot origin not specified.");
|
||||
return 0;
|
||||
@ -362,7 +362,7 @@ static int _read_segment(struct pool *mem, struct volume_group *vg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(cn = find_config_node(sn, "stripes", '/'))) {
|
||||
if (!(cn = find_config_node(sn, "stripes"))) {
|
||||
log_error("Couldn't find stripes array for segment "
|
||||
"'%s'.", sn->key);
|
||||
return 0;
|
||||
@ -380,7 +380,7 @@ static int _read_segment(struct pool *mem, struct volume_group *vg,
|
||||
}
|
||||
|
||||
if ((seg->type == SEG_MIRRORED) &&
|
||||
!(cn = find_config_node(sn, "mirrors", '/'))) {
|
||||
!(cn = find_config_node(sn, "mirrors"))) {
|
||||
log_error("Couldn't find mirrors array for segment "
|
||||
"'%s'.", sn->key);
|
||||
return 0;
|
||||
@ -536,7 +536,7 @@ static int _read_lvnames(struct format_instance *fid, struct pool *mem,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(cn = find_config_node(lvn, "status", '/'))) {
|
||||
if (!(cn = find_config_node(lvn, "status"))) {
|
||||
log_error("Couldn't find status flags for logical volume.");
|
||||
return 0;
|
||||
}
|
||||
@ -547,7 +547,7 @@ static int _read_lvnames(struct format_instance *fid, struct pool *mem,
|
||||
}
|
||||
|
||||
lv->alloc = ALLOC_DEFAULT;
|
||||
if ((cn = find_config_node(lvn, "allocation_policy", '/'))) {
|
||||
if ((cn = find_config_node(lvn, "allocation_policy"))) {
|
||||
struct config_value *cv = cn->v;
|
||||
if (!cv || !cv->v.str) {
|
||||
log_error("allocation_policy must be a string.");
|
||||
@ -565,7 +565,7 @@ static int _read_lvnames(struct format_instance *fid, struct pool *mem,
|
||||
list_init(&lv->tags);
|
||||
|
||||
/* Optional tags */
|
||||
if ((cn = find_config_node(lvn, "tags", '/')) &&
|
||||
if ((cn = find_config_node(lvn, "tags")) &&
|
||||
!(read_tags(mem, &lv->tags, cn->v))) {
|
||||
log_error("Couldn't read tags for logical volume %s/%s.",
|
||||
vg->name, lv->name);
|
||||
@ -645,7 +645,7 @@ static int _read_sections(struct format_instance *fid,
|
||||
{
|
||||
struct config_node *n;
|
||||
|
||||
if (!(n = find_config_node(vgn, section, '/'))) {
|
||||
if (!(n = find_config_node(vgn, section))) {
|
||||
if (!optional) {
|
||||
log_error("Couldn't find section '%s'.", section);
|
||||
return 0;
|
||||
@ -665,7 +665,7 @@ static int _read_sections(struct format_instance *fid,
|
||||
}
|
||||
|
||||
static struct volume_group *_read_vg(struct format_instance *fid,
|
||||
struct config_tree *cf)
|
||||
struct config_tree *cft)
|
||||
{
|
||||
struct config_node *vgn, *cn;
|
||||
struct volume_group *vg;
|
||||
@ -673,7 +673,7 @@ static struct volume_group *_read_vg(struct format_instance *fid,
|
||||
struct pool *mem = fid->fmt->cmd->mem;
|
||||
|
||||
/* skip any top-level values */
|
||||
for (vgn = cf->root; (vgn && vgn->v); vgn = vgn->sib) ;
|
||||
for (vgn = cft->root; (vgn && vgn->v); vgn = vgn->sib) ;
|
||||
|
||||
if (!vgn) {
|
||||
log_error("Couldn't find volume group in file.");
|
||||
@ -702,7 +702,7 @@ static struct volume_group *_read_vg(struct format_instance *fid,
|
||||
|
||||
vgn = vgn->child;
|
||||
|
||||
if ((cn = find_config_node(vgn, "system_id", '/')) && cn->v) {
|
||||
if ((cn = find_config_node(vgn, "system_id")) && cn->v) {
|
||||
if (!cn->v->v.str) {
|
||||
log_error("system_id must be a string");
|
||||
goto bad;
|
||||
@ -721,7 +721,7 @@ static struct volume_group *_read_vg(struct format_instance *fid,
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (!(cn = find_config_node(vgn, "status", '/'))) {
|
||||
if (!(cn = find_config_node(vgn, "status"))) {
|
||||
log_error("Couldn't find status flags for volume group %s.",
|
||||
vg->name);
|
||||
goto bad;
|
||||
@ -778,7 +778,7 @@ static struct volume_group *_read_vg(struct format_instance *fid,
|
||||
list_init(&vg->tags);
|
||||
|
||||
/* Optional tags */
|
||||
if ((cn = find_config_node(vgn, "tags", '/')) &&
|
||||
if ((cn = find_config_node(vgn, "tags")) &&
|
||||
!(read_tags(mem, &vg->tags, cn->v))) {
|
||||
log_error("Couldn't read tags for volume group %s.", vg->name);
|
||||
goto bad;
|
||||
@ -819,17 +819,17 @@ static struct volume_group *_read_vg(struct format_instance *fid,
|
||||
}
|
||||
|
||||
static void _read_desc(struct pool *mem,
|
||||
struct config_tree *cf, time_t *when, char **desc)
|
||||
struct config_tree *cft, time_t *when, char **desc)
|
||||
{
|
||||
const char *d;
|
||||
unsigned int u = 0u;
|
||||
|
||||
log_suppress(1);
|
||||
d = find_config_str(cf->root, "description", '/', "");
|
||||
d = find_config_str(cft->root, "description", "");
|
||||
log_suppress(0);
|
||||
*desc = pool_strdup(mem, d);
|
||||
|
||||
get_config_uint32(cf->root, "creation_time", '/', &u);
|
||||
get_config_uint32(cft->root, "creation_time", &u);
|
||||
*when = u;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ static void *_locking_lib = NULL;
|
||||
static void (*_end_fn) (void) = NULL;
|
||||
static int (*_lock_fn) (struct cmd_context * cmd, const char *resource,
|
||||
int flags) = NULL;
|
||||
static int (*_init_fn) (int type, struct config_tree * cf) = NULL;
|
||||
static int (*_init_fn) (int type, struct config_tree * cft) = NULL;
|
||||
|
||||
static int _lock_resource(struct cmd_context *cmd, const char *resource,
|
||||
int flags)
|
||||
@ -38,7 +38,7 @@ static void _fin_external_locking(void)
|
||||
_lock_fn = NULL;
|
||||
}
|
||||
|
||||
int init_external_locking(struct locking_type *locking, struct config_tree *cf)
|
||||
int init_external_locking(struct locking_type *locking, struct config_tree *cft)
|
||||
{
|
||||
const char *libname;
|
||||
|
||||
@ -50,10 +50,10 @@ int init_external_locking(struct locking_type *locking, struct config_tree *cf)
|
||||
locking->lock_resource = _lock_resource;
|
||||
locking->fin_locking = _fin_external_locking;
|
||||
|
||||
libname = find_config_str(cf->root, "global/locking_library", '/',
|
||||
libname = find_config_str(cft->root, "global/locking_library",
|
||||
DEFAULT_LOCKING_LIB);
|
||||
|
||||
if (!(_locking_lib = load_shared_library(cf, libname, "locking"))) {
|
||||
if (!(_locking_lib = load_shared_library(cft, libname, "locking"))) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
@ -70,5 +70,5 @@ int init_external_locking(struct locking_type *locking, struct config_tree *cf)
|
||||
}
|
||||
|
||||
log_verbose("Loaded external locking library %s", libname);
|
||||
return _init_fn(2, cf);
|
||||
return _init_fn(2, cft);
|
||||
}
|
||||
|
@ -252,15 +252,15 @@ static int _file_lock_resource(struct cmd_context *cmd, const char *resource,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int init_file_locking(struct locking_type *locking, struct config_tree *cf)
|
||||
int init_file_locking(struct locking_type *locking, struct config_tree *cft)
|
||||
{
|
||||
locking->lock_resource = _file_lock_resource;
|
||||
locking->reset_locking = _reset_file_locking;
|
||||
locking->fin_locking = _fin_file_locking;
|
||||
|
||||
/* Get lockfile directory from config file */
|
||||
strncpy(_lock_dir, find_config_str(cf->root, "global/locking_dir",
|
||||
'/', DEFAULT_LOCK_DIR),
|
||||
strncpy(_lock_dir, find_config_str(cft->root, "global/locking_dir",
|
||||
DEFAULT_LOCK_DIR),
|
||||
sizeof(_lock_dir));
|
||||
|
||||
if (!create_dir(_lock_dir))
|
||||
|
@ -95,24 +95,24 @@ static inline void _update_vg_lock_count(int flags)
|
||||
/*
|
||||
* Select a locking type
|
||||
*/
|
||||
int init_locking(int type, struct config_tree *cf)
|
||||
int init_locking(int type, struct config_tree *cft)
|
||||
{
|
||||
switch (type) {
|
||||
case 0:
|
||||
init_no_locking(&_locking, cf);
|
||||
init_no_locking(&_locking, cft);
|
||||
log_print("WARNING: Locking disabled. Be careful! "
|
||||
"This could corrupt your metadata.");
|
||||
return 1;
|
||||
|
||||
case 1:
|
||||
if (!init_file_locking(&_locking, cf))
|
||||
if (!init_file_locking(&_locking, cft))
|
||||
break;
|
||||
log_very_verbose("File-based locking enabled.");
|
||||
return 1;
|
||||
|
||||
#ifdef HAVE_LIBDL
|
||||
case 2:
|
||||
if (!init_external_locking(&_locking, cf))
|
||||
if (!init_external_locking(&_locking, cft))
|
||||
break;
|
||||
log_very_verbose("External locking enabled.");
|
||||
return 1;
|
||||
@ -129,7 +129,7 @@ int init_locking(int type, struct config_tree *cf)
|
||||
/* FIXME Ensure only read ops are permitted */
|
||||
log_verbose("Locking disabled - only read operations permitted.");
|
||||
|
||||
init_no_locking(&_locking, cf);
|
||||
init_no_locking(&_locking, cft);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ static int _no_lock_resource(struct cmd_context *cmd, const char *resource,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int init_no_locking(struct locking_type *locking, struct config_tree *cf)
|
||||
int init_no_locking(struct locking_type *locking, struct config_tree *cft)
|
||||
{
|
||||
locking->lock_resource = _no_lock_resource;
|
||||
locking->reset_locking = _no_reset_locking;
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
void *load_shared_library(struct config_tree *cf, const char *libname,
|
||||
void *load_shared_library(struct config_tree *cft, const char *libname,
|
||||
const char *desc)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
@ -25,8 +25,7 @@ void *load_shared_library(struct config_tree *cf, const char *libname,
|
||||
/* If libname doesn't begin with '/' then use lib_dir/libname,
|
||||
* if present */
|
||||
if (libname[0] == '/' ||
|
||||
!(lib_dir = find_config_str(cf->root, "global/library_dir",
|
||||
'/', 0)) ||
|
||||
!(lib_dir = find_config_str(cft->root, "global/library_dir", 0)) ||
|
||||
(lvm_snprintf(path, sizeof(path), "%s/%s", lib_dir,
|
||||
libname) == -1) || stat(path, &info) == -1)
|
||||
strncpy(path, libname, sizeof(path));
|
||||
|
@ -134,15 +134,15 @@ int memlock(void)
|
||||
|
||||
void memlock_init(struct cmd_context *cmd)
|
||||
{
|
||||
_size_stack = find_config_int(cmd->cf->root,
|
||||
_size_stack = find_config_int(cmd->cft->root,
|
||||
"activation/reserved_stack",
|
||||
'/', DEFAULT_RESERVED_STACK) * 1024;
|
||||
_size_malloc_tmp = find_config_int(cmd->cf->root,
|
||||
DEFAULT_RESERVED_STACK) * 1024;
|
||||
_size_malloc_tmp = find_config_int(cmd->cft->root,
|
||||
"activation/reserved_memory",
|
||||
'/', DEFAULT_RESERVED_MEMORY) * 1024;
|
||||
_default_priority = find_config_int(cmd->cf->root,
|
||||
DEFAULT_RESERVED_MEMORY) * 1024;
|
||||
_default_priority = find_config_int(cmd->cft->root,
|
||||
"activation/process_priority",
|
||||
'/', DEFAULT_PROCESS_PRIORITY);
|
||||
DEFAULT_PROCESS_PRIORITY);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct config_file *cf;
|
||||
struct config_file *cft;
|
||||
struct config_node *cn;
|
||||
struct dev_filter *rfilter, *pfilter;
|
||||
struct dev_iter *iter;
|
||||
@ -46,17 +46,17 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(cf = create_config_file())) {
|
||||
if (!(cft = create_config_file())) {
|
||||
fprintf(stderr, "couldn't create config file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!read_config(cf, argv[1])) {
|
||||
if (!read_config(cft, argv[1])) {
|
||||
fprintf(stderr, "couldn't read config file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(cn = find_config_node(cf->root, "/devices/filter", '/'))) {
|
||||
if (!(cn = find_config_node(cft->root, "/devices/filter", '/'))) {
|
||||
fprintf(stderr, "couldn't find filter section\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -104,7 +104,7 @@ int main(int argc, char **argv)
|
||||
dev_iter_destroy(iter);
|
||||
pfilter->destroy(pfilter);
|
||||
dev_cache_exit();
|
||||
destroy_config_file(cf);
|
||||
destroy_config_file(cft);
|
||||
|
||||
dump_memory();
|
||||
fin_log();
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct config_file *cf;
|
||||
struct config_file *cft;
|
||||
struct config_node *cn;
|
||||
struct dev_filter *filter;
|
||||
struct dev_iter *iter;
|
||||
@ -34,17 +34,17 @@ int main(int argc, char **argv)
|
||||
init_log(stderr);
|
||||
init_debug(_LOG_DEBUG);
|
||||
|
||||
if (!(cf = create_config_file())) {
|
||||
if (!(cft = create_config_file())) {
|
||||
fprintf(stderr, "couldn't create config file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!read_config(cf, argv[1])) {
|
||||
if (!read_config(cft, argv[1])) {
|
||||
fprintf(stderr, "couldn't read config file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!(cn = find_config_node(cf->root, "/devices/filter", '/'))) {
|
||||
if (!(cn = find_config_node(cft->root, "/devices/filter", '/'))) {
|
||||
fprintf(stderr, "couldn't find filter section\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -75,7 +75,7 @@ int main(int argc, char **argv)
|
||||
dev_iter_destroy(iter);
|
||||
filter->destroy(filter);
|
||||
dev_cache_exit();
|
||||
destroy_config_file(cf);
|
||||
destroy_config_file(cft);
|
||||
|
||||
dump_memory();
|
||||
fin_log();
|
||||
|
@ -32,7 +32,7 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
||||
if (!write_config_file(cmd->cf, file))
|
||||
if (!write_config_file(cmd->cft, file))
|
||||
return ECMD_FAILED;
|
||||
|
||||
return ECMD_PROCESSED;
|
||||
|
@ -196,8 +196,8 @@ static int _read_stripe_params(struct lvcreate_params *lp,
|
||||
}
|
||||
|
||||
if (lp->stripes > 1 && !lp->stripe_size) {
|
||||
lp->stripe_size = find_config_int(cmd->cf->root,
|
||||
"metadata/stripesize", '/',
|
||||
lp->stripe_size = find_config_int(cmd->cft->root,
|
||||
"metadata/stripesize",
|
||||
DEFAULT_STRIPESIZE) * 2;
|
||||
log_print("Using default stripesize %dKB", lp->stripe_size / 2);
|
||||
}
|
||||
|
32
tools/lvm.c
32
tools/lvm.c
@ -749,7 +749,7 @@ static int _run_command(struct cmd_context *cmd, int argc, char **argv)
|
||||
|
||||
set_cmd_name(cmd->command->name);
|
||||
|
||||
if (reload_config_file(&cmd->cf)) {
|
||||
if (reload_config_file(&cmd->cft)) {
|
||||
/* Reinitialise various settings inc. logging, filters */
|
||||
if (!refresh_toolcontext(cmd)) {
|
||||
log_error("Updated config file invalid. Aborting.");
|
||||
@ -764,9 +764,9 @@ static int _run_command(struct cmd_context *cmd, int argc, char **argv)
|
||||
if ((ret = _process_common_commands(cmd)))
|
||||
goto out;
|
||||
|
||||
locking_type = find_config_int(cmd->cf->root, "global/locking_type",
|
||||
'/', 1);
|
||||
if (!init_locking(locking_type, cmd->cf)) {
|
||||
locking_type = find_config_int(cmd->cft->root, "global/locking_type",
|
||||
1);
|
||||
if (!init_locking(locking_type, cmd->cft)) {
|
||||
log_error("Locking type %d initialisation failed.",
|
||||
locking_type);
|
||||
ret = ECMD_FAILED;
|
||||
@ -830,7 +830,7 @@ static void _init_rand(void)
|
||||
srand((unsigned int) time(NULL) + (unsigned int) getpid());
|
||||
}
|
||||
|
||||
static int _init_backup(struct cmd_context *cmd, struct config_tree *cf)
|
||||
static int _init_backup(struct cmd_context *cmd, struct config_tree *cft)
|
||||
{
|
||||
uint32_t days, min;
|
||||
char default_dir[PATH_MAX];
|
||||
@ -845,14 +845,14 @@ static int _init_backup(struct cmd_context *cmd, struct config_tree *cf)
|
||||
|
||||
/* set up archiving */
|
||||
cmd->default_settings.archive =
|
||||
find_config_bool(cmd->cf->root, "backup/archive", '/',
|
||||
find_config_bool(cmd->cft->root, "backup/archive",
|
||||
DEFAULT_ARCHIVE_ENABLED);
|
||||
|
||||
days = (uint32_t) find_config_int(cmd->cf->root, "backup/retain_days",
|
||||
'/', DEFAULT_ARCHIVE_DAYS);
|
||||
days = (uint32_t) find_config_int(cmd->cft->root, "backup/retain_days",
|
||||
DEFAULT_ARCHIVE_DAYS);
|
||||
|
||||
min = (uint32_t) find_config_int(cmd->cf->root, "backup/retain_min",
|
||||
'/', DEFAULT_ARCHIVE_NUMBER);
|
||||
min = (uint32_t) find_config_int(cmd->cft->root, "backup/retain_min",
|
||||
DEFAULT_ARCHIVE_NUMBER);
|
||||
|
||||
if (lvm_snprintf
|
||||
(default_dir, sizeof(default_dir), "%s/%s", cmd->sys_dir,
|
||||
@ -862,7 +862,7 @@ static int _init_backup(struct cmd_context *cmd, struct config_tree *cf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
dir = find_config_str(cmd->cf->root, "backup/archive_dir", '/',
|
||||
dir = find_config_str(cmd->cft->root, "backup/archive_dir",
|
||||
default_dir);
|
||||
|
||||
if (!archive_init(dir, days, min)) {
|
||||
@ -872,7 +872,7 @@ static int _init_backup(struct cmd_context *cmd, struct config_tree *cf)
|
||||
|
||||
/* set up the backup */
|
||||
cmd->default_settings.backup =
|
||||
find_config_bool(cmd->cf->root, "backup/backup", '/',
|
||||
find_config_bool(cmd->cft->root, "backup/backup",
|
||||
DEFAULT_BACKUP_ENABLED);
|
||||
|
||||
if (lvm_snprintf
|
||||
@ -883,7 +883,7 @@ static int _init_backup(struct cmd_context *cmd, struct config_tree *cf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
dir = find_config_str(cmd->cf->root, "backup/backup_dir", '/',
|
||||
dir = find_config_str(cmd->cft->root, "backup/backup_dir",
|
||||
default_dir);
|
||||
|
||||
if (!backup_init(dir)) {
|
||||
@ -905,7 +905,7 @@ static struct cmd_context *_init(void)
|
||||
|
||||
_init_rand();
|
||||
|
||||
if (!_init_backup(cmd, cmd->cf))
|
||||
if (!_init_backup(cmd, cmd->cft))
|
||||
return NULL;
|
||||
|
||||
_apply_settings(cmd);
|
||||
@ -1109,8 +1109,8 @@ static void _read_history(struct cmd_context *cmd)
|
||||
if (read_history(hist_file))
|
||||
log_very_verbose("Couldn't read history from %s.", hist_file);
|
||||
|
||||
stifle_history(find_config_int(cmd->cf->root, "shell/history_size",
|
||||
'/', DEFAULT_MAX_HISTORY));
|
||||
stifle_history(find_config_int(cmd->cft->root, "shell/history_size",
|
||||
DEFAULT_MAX_HISTORY));
|
||||
|
||||
}
|
||||
|
||||
|
@ -228,9 +228,8 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv)
|
||||
"%dKB", seg_stripesize / 2);
|
||||
ssize = seg_stripesize;
|
||||
} else {
|
||||
ssize = find_config_int(cmd->cf->root,
|
||||
ssize = find_config_int(cmd->cft->root,
|
||||
"metadata/stripesize",
|
||||
'/',
|
||||
DEFAULT_STRIPESIZE) * 2;
|
||||
log_print("Using default stripesize %dKB",
|
||||
ssize / 2);
|
||||
|
@ -143,15 +143,14 @@ static int pvcreate_single(struct cmd_context *cmd, const char *pv_name,
|
||||
pvmetadatasize = arg_uint64_value(cmd, metadatasize_ARG, UINT64_C(0))
|
||||
* 2;
|
||||
if (!pvmetadatasize)
|
||||
pvmetadatasize = find_config_int(cmd->cf->root,
|
||||
pvmetadatasize = find_config_int(cmd->cft->root,
|
||||
"metadata/pvmetadatasize",
|
||||
'/', DEFAULT_PVMETADATASIZE);
|
||||
DEFAULT_PVMETADATASIZE);
|
||||
|
||||
pvmetadatacopies = arg_int_value(cmd, metadatacopies_ARG, -1);
|
||||
if (pvmetadatacopies < 0)
|
||||
pvmetadatacopies = find_config_int(cmd->cf->root,
|
||||
pvmetadatacopies = find_config_int(cmd->cft->root,
|
||||
"metadata/pvmetadatacopies",
|
||||
'/',
|
||||
DEFAULT_PVMETADATACOPIES);
|
||||
|
||||
if (!(dev = dev_cache_get(pv_name, cmd->filter))) {
|
||||
|
@ -93,63 +93,63 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
|
||||
|
||||
int aligned, buffered, headings;
|
||||
|
||||
aligned = find_config_int(cmd->cf->root, "report/aligned", '/',
|
||||
aligned = find_config_int(cmd->cft->root, "report/aligned",
|
||||
DEFAULT_REP_ALIGNED);
|
||||
buffered = find_config_int(cmd->cf->root, "report/buffered", '/',
|
||||
buffered = find_config_int(cmd->cft->root, "report/buffered",
|
||||
DEFAULT_REP_BUFFERED);
|
||||
headings = find_config_int(cmd->cf->root, "report/headings", '/',
|
||||
headings = find_config_int(cmd->cft->root, "report/headings",
|
||||
DEFAULT_REP_HEADINGS);
|
||||
separator = find_config_str(cmd->cf->root, "report/separator", '/',
|
||||
separator = find_config_str(cmd->cft->root, "report/separator",
|
||||
DEFAULT_REP_SEPARATOR);
|
||||
|
||||
switch (report_type) {
|
||||
case LVS:
|
||||
keys = find_config_str(cmd->cf->root, "report/lvs_sort", '/',
|
||||
keys = find_config_str(cmd->cft->root, "report/lvs_sort",
|
||||
DEFAULT_LVS_SORT);
|
||||
if (!arg_count(cmd, verbose_ARG))
|
||||
options = find_config_str(cmd->cf->root,
|
||||
"report/lvs_cols", '/',
|
||||
options = find_config_str(cmd->cft->root,
|
||||
"report/lvs_cols",
|
||||
DEFAULT_LVS_COLS);
|
||||
else
|
||||
options = find_config_str(cmd->cf->root,
|
||||
options = find_config_str(cmd->cft->root,
|
||||
"report/lvs_cols_verbose",
|
||||
'/', DEFAULT_LVS_COLS_VERB);
|
||||
DEFAULT_LVS_COLS_VERB);
|
||||
break;
|
||||
case VGS:
|
||||
keys = find_config_str(cmd->cf->root, "report/vgs_sort", '/',
|
||||
keys = find_config_str(cmd->cft->root, "report/vgs_sort",
|
||||
DEFAULT_VGS_SORT);
|
||||
if (!arg_count(cmd, verbose_ARG))
|
||||
options = find_config_str(cmd->cf->root,
|
||||
"report/vgs_cols", '/',
|
||||
options = find_config_str(cmd->cft->root,
|
||||
"report/vgs_cols",
|
||||
DEFAULT_VGS_COLS);
|
||||
else
|
||||
options = find_config_str(cmd->cf->root,
|
||||
options = find_config_str(cmd->cft->root,
|
||||
"report/vgs_cols_verbose",
|
||||
'/', DEFAULT_VGS_COLS_VERB);
|
||||
DEFAULT_VGS_COLS_VERB);
|
||||
break;
|
||||
case PVS:
|
||||
keys = find_config_str(cmd->cf->root, "report/pvs_sort", '/',
|
||||
keys = find_config_str(cmd->cft->root, "report/pvs_sort",
|
||||
DEFAULT_PVS_SORT);
|
||||
if (!arg_count(cmd, verbose_ARG))
|
||||
options = find_config_str(cmd->cf->root,
|
||||
"report/pvs_cols", '/',
|
||||
options = find_config_str(cmd->cft->root,
|
||||
"report/pvs_cols",
|
||||
DEFAULT_PVS_COLS);
|
||||
else
|
||||
options = find_config_str(cmd->cf->root,
|
||||
options = find_config_str(cmd->cft->root,
|
||||
"report/pvs_cols_verbose",
|
||||
'/', DEFAULT_PVS_COLS_VERB);
|
||||
DEFAULT_PVS_COLS_VERB);
|
||||
break;
|
||||
case SEGS:
|
||||
keys = find_config_str(cmd->cf->root, "report/segs_sort", '/',
|
||||
keys = find_config_str(cmd->cft->root, "report/segs_sort",
|
||||
DEFAULT_SEGS_SORT);
|
||||
if (!arg_count(cmd, verbose_ARG))
|
||||
options = find_config_str(cmd->cf->root,
|
||||
"report/segs_cols", '/',
|
||||
options = find_config_str(cmd->cft->root,
|
||||
"report/segs_cols",
|
||||
DEFAULT_SEGS_COLS);
|
||||
else
|
||||
options = find_config_str(cmd->cf->root,
|
||||
options = find_config_str(cmd->cft->root,
|
||||
"report/segs_cols_verbose",
|
||||
'/', DEFAULT_SEGS_COLS_VERB);
|
||||
DEFAULT_SEGS_COLS_VERB);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -76,16 +76,16 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
|
||||
UINT64_C(0)) * 2;
|
||||
if (!pvmetadatasize)
|
||||
pvmetadatasize =
|
||||
find_config_int(cmd->cf->root,
|
||||
find_config_int(cmd->cft->root,
|
||||
"metadata/pvmetadatasize",
|
||||
'/', DEFAULT_PVMETADATASIZE);
|
||||
DEFAULT_PVMETADATASIZE);
|
||||
|
||||
pvmetadatacopies = arg_int_value(cmd, metadatacopies_ARG, -1);
|
||||
if (pvmetadatacopies < 0)
|
||||
pvmetadatacopies =
|
||||
find_config_int(cmd->cf->root,
|
||||
find_config_int(cmd->cft->root,
|
||||
"metadata/pvmetadatacopies",
|
||||
'/', DEFAULT_PVMETADATACOPIES);
|
||||
DEFAULT_PVMETADATACOPIES);
|
||||
}
|
||||
|
||||
if (!archive(vg)) {
|
||||
|
Loading…
Reference in New Issue
Block a user