1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

config: add profile arg to find_config_tree_bool

This commit is contained in:
Peter Rajnoha 2013-06-25 12:31:53 +02:00
parent aeffa4cb5b
commit d6a91da4be
16 changed files with 73 additions and 63 deletions

View File

@ -1342,7 +1342,7 @@ static int _check_udev_fallback(struct cmd_context *cmd)
* variable or udev rules are switched off. * variable or udev rules are switched off.
*/ */
settings->udev_fallback = !settings->udev_rules ? 1 : settings->udev_fallback = !settings->udev_rules ? 1 :
find_config_tree_bool(cmd, activation_verify_udev_operations_CFG); find_config_tree_bool(cmd, activation_verify_udev_operations_CFG, NULL);
/* Do not rely fully on udev if the udev support is known to be incomplete. */ /* Do not rely fully on udev if the udev support is known to be incomplete. */
if (!settings->udev_fallback && !_dm_driver_has_stable_udev_support()) { if (!settings->udev_fallback && !_dm_driver_has_stable_udev_support()) {

View File

@ -174,7 +174,7 @@ static void _init_logging(struct cmd_context *cmd)
char timebuf[26]; char timebuf[26];
/* Syslog */ /* Syslog */
cmd->default_settings.syslog = find_config_tree_bool(cmd, log_syslog_CFG); cmd->default_settings.syslog = find_config_tree_bool(cmd, log_syslog_CFG, NULL);
if (cmd->default_settings.syslog != 1) if (cmd->default_settings.syslog != 1)
fin_syslog(); fin_syslog();
@ -191,30 +191,30 @@ static void _init_logging(struct cmd_context *cmd)
* Once set to 1, there is no facility to change it back to 0. * Once set to 1, there is no facility to change it back to 0.
*/ */
cmd->default_settings.silent = silent_mode() ? : cmd->default_settings.silent = silent_mode() ? :
find_config_tree_bool(cmd, log_silent_CFG); find_config_tree_bool(cmd, log_silent_CFG, NULL);
init_silent(cmd->default_settings.silent); init_silent(cmd->default_settings.silent);
/* Verbose level for tty output */ /* Verbose level for tty output */
cmd->default_settings.verbose = find_config_tree_bool(cmd, log_verbose_CFG); cmd->default_settings.verbose = find_config_tree_bool(cmd, log_verbose_CFG, NULL);
init_verbose(cmd->default_settings.verbose + VERBOSE_BASE_LEVEL); init_verbose(cmd->default_settings.verbose + VERBOSE_BASE_LEVEL);
/* Log message formatting */ /* Log message formatting */
init_indent(find_config_tree_bool(cmd, log_indent_CFG)); init_indent(find_config_tree_bool(cmd, log_indent_CFG, NULL));
init_abort_on_internal_errors(find_config_tree_bool(cmd, global_abort_on_internal_errors_CFG)); init_abort_on_internal_errors(find_config_tree_bool(cmd, global_abort_on_internal_errors_CFG, NULL));
cmd->default_settings.msg_prefix = find_config_tree_str_allow_empty(cmd, log_prefix_CFG, NULL); cmd->default_settings.msg_prefix = find_config_tree_str_allow_empty(cmd, log_prefix_CFG, NULL);
init_msg_prefix(cmd->default_settings.msg_prefix); init_msg_prefix(cmd->default_settings.msg_prefix);
cmd->default_settings.cmd_name = find_config_tree_bool(cmd, log_command_names_CFG); cmd->default_settings.cmd_name = find_config_tree_bool(cmd, log_command_names_CFG, NULL);
init_cmd_name(cmd->default_settings.cmd_name); init_cmd_name(cmd->default_settings.cmd_name);
/* Test mode */ /* Test mode */
cmd->default_settings.test = cmd->default_settings.test =
find_config_tree_bool(cmd, global_test_CFG); find_config_tree_bool(cmd, global_test_CFG, NULL);
init_test(cmd->default_settings.test); init_test(cmd->default_settings.test);
/* Settings for logging to file */ /* Settings for logging to file */
if (find_config_tree_bool(cmd, log_overwrite_CFG)) if (find_config_tree_bool(cmd, log_overwrite_CFG, NULL))
append = 0; append = 0;
log_file = find_config_tree_str(cmd, log_file_CFG, NULL); log_file = find_config_tree_str(cmd, log_file_CFG, NULL);
@ -229,7 +229,7 @@ static void _init_logging(struct cmd_context *cmd)
if (log_file) if (log_file)
init_log_direct(log_file, append); init_log_direct(log_file, append);
init_log_while_suspended(find_config_tree_bool(cmd, log_activation_CFG)); init_log_while_suspended(find_config_tree_bool(cmd, log_activation_CFG, NULL));
cmd->default_settings.debug_classes = _parse_debug_classes(cmd); cmd->default_settings.debug_classes = _parse_debug_classes(cmd);
log_debug("Setting log debug classes to %d", cmd->default_settings.debug_classes); log_debug("Setting log debug classes to %d", cmd->default_settings.debug_classes);
@ -275,7 +275,7 @@ static int _process_config(struct cmd_context *cmd)
int udev_disabled = 0; int udev_disabled = 0;
char sysfs_dir[PATH_MAX]; char sysfs_dir[PATH_MAX];
if (!config_def_check(cmd, 0, 0, 0) && find_config_tree_bool(cmd, config_abort_on_errors_CFG)) { if (!config_def_check(cmd, 0, 0, 0) && find_config_tree_bool(cmd, config_abort_on_errors_CFG, NULL)) {
log_error("LVM configuration invalid."); log_error("LVM configuration invalid.");
return 0; return 0;
} }
@ -318,10 +318,10 @@ static int _process_config(struct cmd_context *cmd)
dm_set_sysfs_dir(sysfs_dir); dm_set_sysfs_dir(sysfs_dir);
/* activation? */ /* activation? */
cmd->default_settings.activation = find_config_tree_bool(cmd, global_activation_CFG); cmd->default_settings.activation = find_config_tree_bool(cmd, global_activation_CFG, NULL);
set_activation(cmd->default_settings.activation); set_activation(cmd->default_settings.activation);
cmd->default_settings.suffix = find_config_tree_bool(cmd, global_suffix_CFG); cmd->default_settings.suffix = find_config_tree_bool(cmd, global_suffix_CFG, NULL);
if (!(cmd->default_settings.unit_factor = if (!(cmd->default_settings.unit_factor =
units_to_bytes(find_config_tree_str(cmd, global_units_CFG, NULL), units_to_bytes(find_config_tree_str(cmd, global_units_CFG, NULL),
@ -350,10 +350,10 @@ static int _process_config(struct cmd_context *cmd)
udev_disabled = _check_disable_udev("manage logical volume symlinks in device directory"); udev_disabled = _check_disable_udev("manage logical volume symlinks in device directory");
cmd->default_settings.udev_rules = udev_disabled ? 0 : cmd->default_settings.udev_rules = udev_disabled ? 0 :
find_config_tree_bool(cmd, activation_udev_rules_CFG); find_config_tree_bool(cmd, activation_udev_rules_CFG, NULL);
cmd->default_settings.udev_sync = udev_disabled ? 0 : cmd->default_settings.udev_sync = udev_disabled ? 0 :
find_config_tree_bool(cmd, activation_udev_sync_CFG); find_config_tree_bool(cmd, activation_udev_sync_CFG, NULL);
/* /*
* Set udev_fallback lazily on first use since it requires * Set udev_fallback lazily on first use since it requires
@ -363,11 +363,11 @@ static int _process_config(struct cmd_context *cmd)
*/ */
cmd->default_settings.udev_fallback = udev_disabled ? 1 : -1; cmd->default_settings.udev_fallback = udev_disabled ? 1 : -1;
init_retry_deactivation(find_config_tree_bool(cmd, activation_retry_deactivation_CFG)); init_retry_deactivation(find_config_tree_bool(cmd, activation_retry_deactivation_CFG, NULL));
init_activation_checks(find_config_tree_bool(cmd, activation_checks_CFG)); init_activation_checks(find_config_tree_bool(cmd, activation_checks_CFG, NULL));
cmd->use_linear_target = find_config_tree_bool(cmd, activation_use_linear_target_CFG); cmd->use_linear_target = find_config_tree_bool(cmd, activation_use_linear_target_CFG, NULL);
cmd->stripe_filler = find_config_tree_str(cmd, activation_missing_stripe_filler_CFG, NULL); cmd->stripe_filler = find_config_tree_str(cmd, activation_missing_stripe_filler_CFG, NULL);
@ -391,14 +391,14 @@ static int _process_config(struct cmd_context *cmd)
} }
} }
cmd->si_unit_consistency = find_config_tree_bool(cmd, global_si_unit_consistency_CFG); cmd->si_unit_consistency = find_config_tree_bool(cmd, global_si_unit_consistency_CFG, NULL);
if ((cn = find_config_tree_node(cmd, activation_mlock_filter_CFG, NULL))) if ((cn = find_config_tree_node(cmd, activation_mlock_filter_CFG, NULL)))
for (cv = cn->v; cv; cv = cv->next) for (cv = cn->v; cv; cv = cv->next)
if ((cv->type != DM_CFG_STRING) || !cv->v.str[0]) if ((cv->type != DM_CFG_STRING) || !cv->v.str[0])
log_error("Ignoring invalid activation/mlock_filter entry in config file"); log_error("Ignoring invalid activation/mlock_filter entry in config file");
cmd->metadata_read_only = find_config_tree_bool(cmd, global_metadata_read_only_CFG); cmd->metadata_read_only = find_config_tree_bool(cmd, global_metadata_read_only_CFG, NULL);
pv_min_kb = find_config_tree_int64(cmd, devices_pv_min_size_CFG, NULL); pv_min_kb = find_config_tree_int64(cmd, devices_pv_min_size_CFG, NULL);
if (pv_min_kb < PV_MIN_SIZE_KB) { if (pv_min_kb < PV_MIN_SIZE_KB) {
@ -410,7 +410,7 @@ static int _process_config(struct cmd_context *cmd)
init_pv_min_size((uint64_t)pv_min_kb * (1024 >> SECTOR_SHIFT)); init_pv_min_size((uint64_t)pv_min_kb * (1024 >> SECTOR_SHIFT));
init_detect_internal_vg_cache_corruption init_detect_internal_vg_cache_corruption
(find_config_tree_bool(cmd, global_detect_internal_vg_cache_corruption_CFG)); (find_config_tree_bool(cmd, global_detect_internal_vg_cache_corruption_CFG, NULL));
lvmetad_disconnect(); lvmetad_disconnect();
@ -427,12 +427,12 @@ static int _process_config(struct cmd_context *cmd)
lvmetad_set_token(cn ? cn->v : NULL); lvmetad_set_token(cn ? cn->v : NULL);
if (find_config_tree_int(cmd, global_locking_type_CFG, NULL) == 3 && if (find_config_tree_int(cmd, global_locking_type_CFG, NULL) == 3 &&
find_config_tree_bool(cmd, global_use_lvmetad_CFG)) { find_config_tree_bool(cmd, global_use_lvmetad_CFG, NULL)) {
log_warn("WARNING: configuration setting use_lvmetad overridden to 0 due to locking_type 3. " log_warn("WARNING: configuration setting use_lvmetad overridden to 0 due to locking_type 3. "
"Clustered environment not supported by lvmetad yet."); "Clustered environment not supported by lvmetad yet.");
lvmetad_set_active(0); lvmetad_set_active(0);
} else } else
lvmetad_set_active(find_config_tree_bool(cmd, global_use_lvmetad_CFG)); lvmetad_set_active(find_config_tree_bool(cmd, global_use_lvmetad_CFG, NULL));
lvmetad_init(cmd); lvmetad_init(cmd);
@ -497,7 +497,7 @@ static int _init_tags(struct cmd_context *cmd, struct dm_config_tree *cft)
return 1; return 1;
/* NB hosttags 0 when already 1 intentionally does not delete the tag */ /* NB hosttags 0 when already 1 intentionally does not delete the tag */
if (!cmd->hosttags && find_config_tree_bool(cmd, tags_hosttags_CFG)) { if (!cmd->hosttags && find_config_tree_bool(cmd, tags_hosttags_CFG, NULL)) {
/* FIXME Strip out invalid chars: only A-Za-z0-9_+.- */ /* FIXME Strip out invalid chars: only A-Za-z0-9_+.- */
if (!_set_tag(cmd, cmd->hostname)) if (!_set_tag(cmd, cmd->hostname))
return_0; return_0;
@ -730,7 +730,7 @@ static int _init_dev_cache(struct cmd_context *cmd)
device_list_from_udev = 0; device_list_from_udev = 0;
else else
device_list_from_udev = udev_is_running() ? device_list_from_udev = udev_is_running() ?
find_config_tree_bool(cmd, devices_obtain_device_list_from_udev_CFG) : 0; find_config_tree_bool(cmd, devices_obtain_device_list_from_udev_CFG, NULL) : 0;
init_obtain_device_list_from_udev(device_list_from_udev); init_obtain_device_list_from_udev(device_list_from_udev);
@ -821,7 +821,7 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
* Listed first because it's very efficient at eliminating * Listed first because it's very efficient at eliminating
* unavailable devices. * unavailable devices.
*/ */
if (find_config_tree_bool(cmd, devices_sysfs_scan_CFG)) { if (find_config_tree_bool(cmd, devices_sysfs_scan_CFG, NULL)) {
if ((filters[nr_filt] = sysfs_filter_create())) if ((filters[nr_filt] = sysfs_filter_create()))
nr_filt++; nr_filt++;
} }
@ -845,14 +845,14 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
nr_filt++; nr_filt++;
/* md component filter. Optional, non-critical. */ /* md component filter. Optional, non-critical. */
if (find_config_tree_bool(cmd, devices_md_component_detection_CFG)) { if (find_config_tree_bool(cmd, devices_md_component_detection_CFG, NULL)) {
init_md_filtering(1); init_md_filtering(1);
if ((filters[nr_filt] = md_filter_create(cmd->dev_types))) if ((filters[nr_filt] = md_filter_create(cmd->dev_types)))
nr_filt++; nr_filt++;
} }
/* mpath component filter. Optional, non-critical. */ /* mpath component filter. Optional, non-critical. */
if (find_config_tree_bool(cmd, devices_multipath_component_detection_CFG)) { if (find_config_tree_bool(cmd, devices_multipath_component_detection_CFG, NULL)) {
if ((filters[nr_filt] = mpath_filter_create(cmd->dev_types))) if ((filters[nr_filt] = mpath_filter_create(cmd->dev_types)))
nr_filt++; nr_filt++;
} }
@ -885,7 +885,7 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
if (!(f3 = _init_filter_components(cmd))) if (!(f3 = _init_filter_components(cmd)))
goto_bad; goto_bad;
init_ignore_suspended_devices(find_config_tree_bool(cmd, devices_ignore_suspended_devices_CFG)); init_ignore_suspended_devices(find_config_tree_bool(cmd, devices_ignore_suspended_devices_CFG, NULL));
/* /*
* If 'cache_dir' or 'cache_file_prefix' is set, ignore 'cache'. * If 'cache_dir' or 'cache_file_prefix' is set, ignore 'cache'.
@ -922,7 +922,7 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
} }
/* Should we ever dump persistent filter state? */ /* Should we ever dump persistent filter state? */
if (find_config_tree_bool(cmd, devices_write_cache_state_CFG)) if (find_config_tree_bool(cmd, devices_write_cache_state_CFG, NULL))
cmd->dump_filter = 1; cmd->dump_filter = 1;
if (!*cmd->system_dir) if (!*cmd->system_dir)
@ -933,7 +933,7 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
* than the config file and this is not a long-lived process. Also avoid * than the config file and this is not a long-lived process. Also avoid
* it when lvmetad is enabled. * it when lvmetad is enabled.
*/ */
if (!find_config_tree_bool(cmd, global_use_lvmetad_CFG) && if (!find_config_tree_bool(cmd, global_use_lvmetad_CFG, NULL) &&
load_persistent_cache && !cmd->is_long_lived && load_persistent_cache && !cmd->is_long_lived &&
!stat(dev_cache, &st) && !stat(dev_cache, &st) &&
(st.st_ctime > config_file_timestamp(cmd->cft)) && (st.st_ctime > config_file_timestamp(cmd->cft)) &&
@ -1253,7 +1253,7 @@ static int _init_backup(struct cmd_context *cmd)
/* set up archiving */ /* set up archiving */
cmd->default_settings.archive = cmd->default_settings.archive =
find_config_tree_bool(cmd, backup_archive_CFG); find_config_tree_bool(cmd, backup_archive_CFG, NULL);
days = (uint32_t) find_config_tree_int(cmd, backup_retain_days_CFG, NULL); days = (uint32_t) find_config_tree_int(cmd, backup_retain_days_CFG, NULL);
@ -1277,7 +1277,7 @@ static int _init_backup(struct cmd_context *cmd)
} }
/* set up the backup */ /* set up the backup */
cmd->default_settings.backup = find_config_tree_bool(cmd, backup_backup_CFG); cmd->default_settings.backup = find_config_tree_bool(cmd, backup_backup_CFG, NULL);
if (dm_snprintf if (dm_snprintf
(default_dir, sizeof(default_dir), "%s/%s", cmd->system_dir, (default_dir, sizeof(default_dir), "%s/%s", cmd->system_dir,

View File

@ -710,7 +710,7 @@ int config_def_check(struct cmd_context *cmd, int force, int skip, int suppress_
def->flags &= ~(CFG_USED | CFG_VALID); def->flags &= ~(CFG_USED | CFG_VALID);
} }
if (!force && !find_config_tree_bool(cmd, config_checks_CFG)) { if (!force && !find_config_tree_bool(cmd, config_checks_CFG, NULL)) {
if (cmd->cft_def_hash) { if (cmd->cft_def_hash) {
dm_hash_destroy(cmd->cft_def_hash); dm_hash_destroy(cmd->cft_def_hash);
cmd->cft_def_hash = NULL; cmd->cft_def_hash = NULL;
@ -907,15 +907,25 @@ float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *pr
return f; return f;
} }
int find_config_tree_bool(struct cmd_context *cmd, int id) int find_config_tree_bool(struct cmd_context *cmd, int id, struct profile *profile)
{ {
cfg_def_item_t *item = cfg_def_get_item_p(id); cfg_def_item_t *item = cfg_def_get_item_p(id);
const char *path = cfg_def_get_path(item); const char *path = cfg_def_get_path(item);
int profile_applied = 0;
int b;
if (item->type != CFG_TYPE_BOOL) if (item->type != CFG_TYPE_BOOL)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as boolean.", path); log_error(INTERNAL_ERROR "%s cfg tree element not declared as boolean.", path);
return dm_config_tree_find_bool(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_BOOL)); if (profile && !cmd->profile_params->global_profile)
profile_applied = override_config_tree_from_profile(cmd, profile);
b = dm_config_tree_find_bool(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_BOOL));
if (profile_applied)
remove_config_tree_by_source(cmd, CONFIG_PROFILE);
return b;
} }
/* Insert cn2 after cn1 */ /* Insert cn2 after cn1 */

View File

@ -170,6 +170,6 @@ const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, st
int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profile); int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profile);
int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *profile); int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *profile);
float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *profile); float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *profile);
int find_config_tree_bool(struct cmd_context *cmd, int id); int find_config_tree_bool(struct cmd_context *cmd, int id, struct profile *profile);
#endif #endif

View File

@ -526,7 +526,7 @@ int lvdisplay_full(struct cmd_context *cmd,
log_print("--- Logical volume ---"); log_print("--- Logical volume ---");
lvm1compat = find_config_tree_bool(cmd, global_lvdisplay_shows_full_device_path_CFG); lvm1compat = find_config_tree_bool(cmd, global_lvdisplay_shows_full_device_path_CFG, NULL);
if (lvm1compat) if (lvm1compat)
/* /dev/vgname/lvname doen't actually exist for internal devices */ /* /dev/vgname/lvname doen't actually exist for internal devices */

View File

@ -355,7 +355,7 @@ int init_file_locking(struct locking_type *locking, struct cmd_context *cmd,
strcpy(_lock_dir, locking_dir); strcpy(_lock_dir, locking_dir);
_prioritise_write_locks = _prioritise_write_locks =
find_config_tree_bool(cmd, global_prioritise_write_locks_CFG); find_config_tree_bool(cmd, global_prioritise_write_locks_CFG, NULL);
(void) dm_prepare_selinux_context(_lock_dir, S_IFDIR); (void) dm_prepare_selinux_context(_lock_dir, S_IFDIR);
r = dm_create_dir(_lock_dir); r = dm_create_dir(_lock_dir);

View File

@ -227,7 +227,7 @@ int init_locking(int type, struct cmd_context *cmd, int suppress_messages)
if (type < 0) if (type < 0)
type = find_config_tree_int(cmd, global_locking_type_CFG, NULL); type = find_config_tree_int(cmd, global_locking_type_CFG, NULL);
_blocking_supported = find_config_tree_bool(cmd, global_wait_for_locks_CFG); _blocking_supported = find_config_tree_bool(cmd, global_wait_for_locks_CFG, NULL);
switch (type) { switch (type) {
case 0: case 0:
@ -254,7 +254,7 @@ int init_locking(int type, struct cmd_context *cmd, int suppress_messages)
if (init_external_locking(&_locking, cmd, suppress_messages)) if (init_external_locking(&_locking, cmd, suppress_messages))
return 1; return 1;
} }
if (!find_config_tree_bool(cmd, global_fallback_to_clustered_locking_CFG)) { if (!find_config_tree_bool(cmd, global_fallback_to_clustered_locking_CFG, NULL)) {
log_error_suppress(suppress_messages, "External locking initialisation failed."); log_error_suppress(suppress_messages, "External locking initialisation failed.");
break; break;
} }
@ -287,7 +287,7 @@ int init_locking(int type, struct cmd_context *cmd, int suppress_messages)
} }
if ((type == 2 || type == 3) && if ((type == 2 || type == 3) &&
find_config_tree_bool(cmd, global_fallback_to_local_locking_CFG)) { find_config_tree_bool(cmd, global_fallback_to_local_locking_CFG, NULL)) {
log_warn_suppress(suppress_messages, "WARNING: Falling back to local file-based locking."); log_warn_suppress(suppress_messages, "WARNING: Falling back to local file-based locking.");
log_warn_suppress(suppress_messages, log_warn_suppress(suppress_messages,
"Volume Groups with the clustered attribute will " "Volume Groups with the clustered attribute will "

View File

@ -1015,7 +1015,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
* a correct area_multiple. * a correct area_multiple.
*/ */
ah->area_multiple = _calc_area_multiple(segtype, area_count + parity_count, stripes); ah->area_multiple = _calc_area_multiple(segtype, area_count + parity_count, stripes);
ah->mirror_logs_separate = find_config_tree_bool(cmd, allocation_mirror_logs_require_separate_pvs_CFG); ah->mirror_logs_separate = find_config_tree_bool(cmd, allocation_mirror_logs_require_separate_pvs_CFG, NULL);
if (segtype_is_raid(segtype)) { if (segtype_is_raid(segtype)) {
if (metadata_area_count) { if (metadata_area_count) {
@ -1042,7 +1042,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
ah->log_len = ah->region_size; ah->log_len = ah->region_size;
ah->region_size = 0; ah->region_size = 0;
ah->mirror_logs_separate = ah->mirror_logs_separate =
find_config_tree_bool(cmd, allocation_thin_pool_metadata_require_separate_pvs_CFG); find_config_tree_bool(cmd, allocation_thin_pool_metadata_require_separate_pvs_CFG, NULL);
} else { } else {
ah->log_area_count = metadata_area_count; ah->log_area_count = metadata_area_count;
ah->log_len = !metadata_area_count ? 0 : ah->log_len = !metadata_area_count ? 0 :
@ -1057,7 +1057,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
ah->cling_tag_list_cn = find_config_tree_node(cmd, allocation_cling_tag_list_CFG, NULL); ah->cling_tag_list_cn = find_config_tree_node(cmd, allocation_cling_tag_list_CFG, NULL);
ah->maximise_cling = find_config_tree_bool(cmd, allocation_maximise_cling_CFG); ah->maximise_cling = find_config_tree_bool(cmd, allocation_maximise_cling_CFG, NULL);
return ah; return ah;
} }
@ -3481,7 +3481,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
} }
/* FIXME Ensure not referred to by another existing LVs */ /* FIXME Ensure not referred to by another existing LVs */
ask_discard = find_config_tree_bool(cmd, devices_issue_discards_CFG); ask_discard = find_config_tree_bool(cmd, devices_issue_discards_CFG, NULL);
if (lv_info(cmd, lv, 0, &info, 1, 0)) { if (lv_info(cmd, lv, 0, &info, 1, 0)) {
if (!lv_check_not_in_use(cmd, lv, &info)) if (!lv_check_not_in_use(cmd, lv, &info))

View File

@ -83,7 +83,7 @@ unsigned long set_pe_align(struct physical_volume *pv, unsigned long data_alignm
/* /*
* Align to stripe-width of underlying md device if present * Align to stripe-width of underlying md device if present
*/ */
if (find_config_tree_bool(pv->fmt->cmd, devices_md_chunk_alignment_CFG)) { if (find_config_tree_bool(pv->fmt->cmd, devices_md_chunk_alignment_CFG, NULL)) {
temp_pe_align = dev_md_stripe_width(pv->fmt->cmd->dev_types, pv->dev); temp_pe_align = dev_md_stripe_width(pv->fmt->cmd->dev_types, pv->dev);
if (_alignment_overrides_default(temp_pe_align, default_pe_align)) if (_alignment_overrides_default(temp_pe_align, default_pe_align))
pv->pe_align = temp_pe_align; pv->pe_align = temp_pe_align;
@ -96,7 +96,7 @@ unsigned long set_pe_align(struct physical_volume *pv, unsigned long data_alignm
* - optimal_io_size - the device's preferred unit of receiving I/O * - optimal_io_size - the device's preferred unit of receiving I/O
* (e.g. MD's stripe width) * (e.g. MD's stripe width)
*/ */
if (find_config_tree_bool(pv->fmt->cmd, devices_data_alignment_detection_CFG)) { if (find_config_tree_bool(pv->fmt->cmd, devices_data_alignment_detection_CFG, NULL)) {
temp_pe_align = dev_minimum_io_size(pv->fmt->cmd->dev_types, pv->dev); temp_pe_align = dev_minimum_io_size(pv->fmt->cmd->dev_types, pv->dev);
if (_alignment_overrides_default(temp_pe_align, default_pe_align)) if (_alignment_overrides_default(temp_pe_align, default_pe_align))
pv->pe_align = temp_pe_align; pv->pe_align = temp_pe_align;
@ -128,7 +128,7 @@ unsigned long set_pe_align_offset(struct physical_volume *pv,
if (!pv->dev) if (!pv->dev)
goto out; goto out;
if (find_config_tree_bool(pv->fmt->cmd, devices_data_alignment_offset_detection_CFG)) { if (find_config_tree_bool(pv->fmt->cmd, devices_data_alignment_offset_detection_CFG, NULL)) {
int align_offset = dev_alignment_offset(pv->fmt->cmd->dev_types, pv->dev); int align_offset = dev_alignment_offset(pv->fmt->cmd->dev_types, pv->dev);
/* must handle a -1 alignment_offset; means dev is misaligned */ /* must handle a -1 alignment_offset; means dev is misaligned */
if (align_offset < 0) if (align_offset < 0)

View File

@ -203,7 +203,7 @@ int discard_pv_segment(struct pv_segment *peg, uint32_t discard_area_reduction)
* Only issue discards if enabled in lvm.conf and both * Only issue discards if enabled in lvm.conf and both
* the device and kernel (>= 2.6.35) supports discards. * the device and kernel (>= 2.6.35) supports discards.
*/ */
if (!find_config_tree_bool(peg->pv->fmt->cmd, devices_issue_discards_CFG)) if (!find_config_tree_bool(peg->pv->fmt->cmd, devices_issue_discards_CFG, NULL))
return 1; return 1;
/* Missing PV? */ /* Missing PV? */

View File

@ -320,7 +320,7 @@ static void _lock_mem(struct cmd_context *cmd)
* Note: assuming _memlock_count_daemon is updated before _memlock_count * Note: assuming _memlock_count_daemon is updated before _memlock_count
*/ */
_use_mlockall = _memlock_count_daemon ? 1 : _use_mlockall = _memlock_count_daemon ? 1 :
find_config_tree_bool(cmd, activation_use_mlockall_CFG); find_config_tree_bool(cmd, activation_use_mlockall_CFG, NULL);
if (!_use_mlockall) { if (!_use_mlockall) {
if (!*_procselfmaps && if (!*_procselfmaps &&

View File

@ -1467,7 +1467,7 @@ static int _lvm1_fallback(struct cmd_context *cmd)
char vsn[80]; char vsn[80];
int dm_present; int dm_present;
if (!find_config_tree_bool(cmd, global_fallback_to_lvm1_CFG) || if (!find_config_tree_bool(cmd, global_fallback_to_lvm1_CFG, NULL) ||
strncmp(cmd->kernel_vsn, "2.4.", 4)) strncmp(cmd->kernel_vsn, "2.4.", 4))
return 0; return 0;

View File

@ -38,7 +38,7 @@ static int pvcreate_restore_params_validate(struct cmd_context *cmd,
if (!arg_count(cmd, restorefile_ARG) && arg_count(cmd, uuidstr_ARG)) { if (!arg_count(cmd, restorefile_ARG) && arg_count(cmd, uuidstr_ARG)) {
if (!arg_count(cmd, norestorefile_ARG) && if (!arg_count(cmd, norestorefile_ARG) &&
find_config_tree_bool(cmd, devices_require_restorefile_with_uuid_CFG)) { find_config_tree_bool(cmd, devices_require_restorefile_with_uuid_CFG, NULL)) {
log_error("--restorefile is required with --uuid"); log_error("--restorefile is required with --uuid");
return 0; return 0;
} }

View File

@ -149,7 +149,7 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)
*/ */
/* TODO: Remove this once lvmetad + cluster supported! */ /* TODO: Remove this once lvmetad + cluster supported! */
if (find_config_tree_int(cmd, global_locking_type_CFG, NULL) == 3 || if (find_config_tree_int(cmd, global_locking_type_CFG, NULL) == 3 ||
!find_config_tree_bool(cmd, global_use_lvmetad_CFG)) { !find_config_tree_bool(cmd, global_use_lvmetad_CFG, NULL)) {
log_debug_lvmetad("_pvscan_lvmetad: immediate return"); log_debug_lvmetad("_pvscan_lvmetad: immediate return");
return ret; return ret;
} }

View File

@ -222,13 +222,13 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
int columns_as_rows; int columns_as_rows;
unsigned args_are_pvs; unsigned args_are_pvs;
aligned = find_config_tree_bool(cmd, report_aligned_CFG); aligned = find_config_tree_bool(cmd, report_aligned_CFG, NULL);
buffered = find_config_tree_bool(cmd, report_buffered_CFG); buffered = find_config_tree_bool(cmd, report_buffered_CFG, NULL);
headings = find_config_tree_bool(cmd, report_headings_CFG); headings = find_config_tree_bool(cmd, report_headings_CFG, NULL);
separator = find_config_tree_str(cmd, report_separator_CFG, NULL); separator = find_config_tree_str(cmd, report_separator_CFG, NULL);
field_prefixes = find_config_tree_bool(cmd, report_prefixes_CFG); field_prefixes = find_config_tree_bool(cmd, report_prefixes_CFG, NULL);
quoted = find_config_tree_bool(cmd, report_quoted_CFG); quoted = find_config_tree_bool(cmd, report_quoted_CFG, NULL);
columns_as_rows = find_config_tree_bool(cmd, report_colums_as_rows_CFG); columns_as_rows = find_config_tree_bool(cmd, report_colums_as_rows_CFG, NULL);
args_are_pvs = (report_type == PVS || args_are_pvs = (report_type == PVS ||
report_type == LABEL || report_type == LABEL ||

View File

@ -1442,7 +1442,7 @@ int pvcreate_params_validate(struct cmd_context *cmd,
pp->metadataignore = arg_int_value(cmd, metadataignore_ARG, pp->metadataignore = arg_int_value(cmd, metadataignore_ARG,
DEFAULT_PVMETADATAIGNORE); DEFAULT_PVMETADATAIGNORE);
else else
pp->metadataignore = find_config_tree_bool(cmd, metadata_pvmetadataignore_CFG); pp->metadataignore = find_config_tree_bool(cmd, metadata_pvmetadataignore_CFG, NULL);
if (arg_count(cmd, pvmetadatacopies_ARG) && if (arg_count(cmd, pvmetadatacopies_ARG) &&
!arg_int_value(cmd, pvmetadatacopies_ARG, -1) && !arg_int_value(cmd, pvmetadatacopies_ARG, -1) &&
@ -1531,7 +1531,7 @@ int get_activation_monitoring_mode(struct cmd_context *cmd,
DEFAULT_DMEVENTD_MONITOR); DEFAULT_DMEVENTD_MONITOR);
else if (is_static() || arg_count(cmd, ignoremonitoring_ARG) || else if (is_static() || arg_count(cmd, ignoremonitoring_ARG) ||
arg_count(cmd, sysinit_ARG) || arg_count(cmd, sysinit_ARG) ||
!find_config_tree_bool(cmd, activation_monitoring_CFG)) !find_config_tree_bool(cmd, activation_monitoring_CFG, NULL))
*monitoring_mode = DMEVENTD_MONITOR_IGNORE; *monitoring_mode = DMEVENTD_MONITOR_IGNORE;
return 1; return 1;
@ -1551,7 +1551,7 @@ int get_pool_params(struct cmd_context *cmd, int *passed_args,
*zero = strcmp(arg_str_value(cmd, zero_ARG, "y"), "n"); *zero = strcmp(arg_str_value(cmd, zero_ARG, "y"), "n");
log_very_verbose("Setting pool zeroing: %u", *zero); log_very_verbose("Setting pool zeroing: %u", *zero);
} else } else
*zero = find_config_tree_bool(cmd, allocation_thin_pool_zero_CFG); *zero = find_config_tree_bool(cmd, allocation_thin_pool_zero_CFG, NULL);
if (arg_count(cmd, discards_ARG)) { if (arg_count(cmd, discards_ARG)) {
*passed_args |= PASS_ARG_DISCARDS; *passed_args |= PASS_ARG_DISCARDS;