master - config: add profile arg to find_config_tree_bool
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d6a91da4be08aa59bfabd626bdb599030db6e8f1 Commit: d6a91da4be08aa59bfabd626bdb599030db6e8f1 Parent: aeffa4cb5bbb707d7d42eea6d2504a10ed0b798f Author: Peter Rajnoha <[email protected]> AuthorDate: Tue Jun 25 12:31:53 2013 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Tue Jul 2 15:19:09 2013 +0200
config: add profile arg to find_config_tree_bool
--- lib/activate/dev_manager.c | 2 +- lib/commands/toolcontext.c | 64 ++++++++++++++++++++++---------------------- lib/config/config.c | 16 +++++++++-- lib/config/config.h | 2 +- lib/display/display.c | 2 +- lib/locking/file_locking.c | 2 +- lib/locking/locking.c | 6 ++-- lib/metadata/lv_manip.c | 8 +++--- lib/metadata/metadata.c | 6 ++-- lib/metadata/pv_manip.c | 2 +- lib/mm/memlock.c | 2 +- tools/lvmcmdline.c | 2 +- tools/pvcreate.c | 2 +- tools/pvscan.c | 2 +- tools/reporter.c | 12 ++++---- tools/toollib.c | 6 ++-- 16 files changed, 73 insertions(+), 63 deletions(-)
lib/activate/dev_manager.c +1 -1
@@ -1342,7 +1342,7 @@ static int _check_udev_fallback(struct cmd_context *cmd)* variable or udev rules are switched off. */ 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. */ if (!settings->udev_fallback && !_dm_driver_has_stable_udev_support ()) {
lib/commands/toolcontext.c +32 -32
217 lines not on this page · raw message
lib/config/config.c +13 -3
@@ -710,7 +710,7 @@ int config_def_check(struct cmd_context *cmd, int force, int skip, int suppress_ 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) {dm_hash_destroy (cmd->cft_def_hash); cmd->cft_def_hash =NULL ;
@@ -907,15 +907,25 @@ float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *prreturn 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);const char *path =cfg_def_get_path (item); +int profile_applied =0 ; +int b;if (item->type !=CFG_TYPE_BOOL )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 */
lib/config/config.h +1 -1
@@ -170,6 +170,6 @@ const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, stint 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);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
lib/display/display.c +1 -1
@@ -526,7 +526,7 @@ int lvdisplay_full(struct cmd_context *cmd,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)/* /dev/vgname/lvname doen't actually exist for internal devices */
lib/locking/file_locking.c +1 -1
@@ -355,7 +355,7 @@ int init_file_locking(struct locking_type *locking, struct cmd_context *cmd,strcpy (_lock_dir, locking_dir); _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 ); r =dm_create_dir (_lock_dir);
lib/locking/locking.c +3 -3
@@ -227,7 +227,7 @@ int init_locking(int type, struct cmd_context *cmd, int suppress_messages)if (type <0 ) 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) {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))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." );break ; }
@@ -287,7 +287,7 @@ int init_locking(int type, struct cmd_context *cmd, int suppress_messages) }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, "Volume Groups with the clustered attribute will "
lib/metadata/lv_manip.c +4 -4
@@ -1015,7 +1015,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,* a correct area_multiple. */ 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 (metadata_area_count) {
@@ -1042,7 +1042,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd, ah->log_len = ah->region_size; ah->region_size =0 ; 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 { ah->log_area_count = metadata_area_count; 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->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; }
@@ -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 */ - 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_check_not_in_use (cmd, lv, &info))
lib/metadata/metadata.c +3 -3
@@ -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 */ -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);if (_alignment_overrides_default (temp_pe_align, default_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 * (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);if (_alignment_overrides_default (temp_pe_align, default_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) 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);/* must handle a -1 alignment_offset; means dev is misaligned */ if (align_offset <0 )
lib/metadata/pv_manip.c +1 -1
@@ -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 * 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 ;/* Missing PV? */
lib/mm/memlock.c +1 -1
@@ -320,7 +320,7 @@ static void _lock_mem(struct cmd_context *cmd)* Note: assuming _memlock_count_daemon is updated before _memlock_count */ _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 (!*_procselfmaps &&
tools/lvmcmdline.c +1 -1
@@ -1467,7 +1467,7 @@ static int _lvm1_fallback(struct cmd_context *cmd)char vsn[80 ];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 ))return 0 ;
tools/pvcreate.c +1 -1
@@ -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, 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" );return 0 ; }
tools/pvscan.c +1 -1
@@ -149,7 +149,7 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)*/ /* TODO: Remove this once lvmetad + cluster supported! */ 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" );return ret; }
tools/reporter.c +6 -6
@@ -222,13 +222,13 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,int columns_as_rows;unsigned args_are_pvs; - aligned =find_config_tree_bool (cmd, report_aligned_CFG); - buffered =find_config_tree_bool (cmd, report_buffered_CFG); - headings =find_config_tree_bool (cmd, report_headings_CFG); + aligned =find_config_tree_bool (cmd, report_aligned_CFG,NULL ); + buffered =find_config_tree_bool (cmd, report_buffered_CFG,NULL ); + headings =find_config_tree_bool (cmd, report_headings_CFG,NULL ); separator =find_config_tree_str (cmd, report_separator_CFG,NULL ); - field_prefixes =find_config_tree_bool (cmd, report_prefixes_CFG); - quoted =find_config_tree_bool (cmd, report_quoted_CFG); - columns_as_rows =find_config_tree_bool (cmd, report_colums_as_rows_CFG); + field_prefixes =find_config_tree_bool (cmd, report_prefixes_CFG,NULL ); + quoted =find_config_tree_bool (cmd, report_quoted_CFG,NULL ); + columns_as_rows =find_config_tree_bool (cmd, report_colums_as_rows_CFG,NULL ); args_are_pvs = (report_type == PVS || report_type == LABEL ||
tools/toollib.c +3 -3
@@ -1442,7 +1442,7 @@ int pvcreate_params_validate(struct cmd_context *cmd, pp->metadataignore =arg_int_value (cmd, metadataignore_ARG,DEFAULT_PVMETADATAIGNORE ); 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) && !arg_int_value(cmd, pvmetadatacopies_ARG, -1) &&
@@ -1531,7 +1531,7 @@ int get_activation_monitoring_mode(struct cmd_context *cmd, DEFAULT_DMEVENTD_MONITOR); else if (is_static() || arg_count(cmd, ignoremonitoring_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;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" );log_very_verbose ("Setting pool zeroing: %u" , *zero); }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)) { *passed_args |=PASS_ARG_DISCARDS ;