mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
libdm: maintain binary interface for new FEATURE flag
Older library version was not detecting unknown 'feature' bits and could let start target without needed option. New versioned symbol now checks for supported feature bits. _Base version keeps accepting only previously known features and mask/ignores unknown bits. NB: if the older binary passed in 'random' bits, it will not get metadata2 by chance. New linked binary get new validation function. Library user is required to not pass 'trash' for unsupported bits, as such calls will be rejected.
This commit is contained in:
parent
ddd5a76801
commit
bb20fac4ab
@ -1,5 +1,6 @@
|
||||
Version 1.02.138 -
|
||||
=====================================
|
||||
Provide dm_tree_node_add_cache_target@base compatible symbol.
|
||||
Support DM_CACHE_FEATURE_METADATA2, new cache metadata format 2.
|
||||
Improve code to handle mode mask for cache nodes.
|
||||
Cache status check for passthrough also require trailing space.
|
||||
|
@ -234,7 +234,6 @@ dm_tree_free
|
||||
dm_tree_get_cookie
|
||||
dm_tree_children_use_uuid
|
||||
dm_tree_next_child
|
||||
dm_tree_node_add_cache_target
|
||||
dm_tree_node_add_crypt_target
|
||||
dm_tree_node_add_error_target
|
||||
dm_tree_node_add_linear_target
|
||||
|
@ -6,3 +6,4 @@ dm_bitset_parse_list
|
||||
dm_stats_bind_from_fd
|
||||
dm_stats_start_filemapd
|
||||
dm_tree_node_add_raid_target_with_params_v2
|
||||
dm_tree_node_add_cache_target
|
||||
|
@ -4034,13 +4034,15 @@ void dm_tree_node_set_callback(struct dm_tree_node *dnode,
|
||||
dnode->callback_data = data;
|
||||
}
|
||||
|
||||
/*
|
||||
* Backward compatible dm_tree_node_size_changed() implementations.
|
||||
*
|
||||
* Keep these at the end of the file to avoid adding clutter around the
|
||||
* current dm_tree_node_size_changed() version.
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
/*
|
||||
* Backward compatible implementations.
|
||||
*
|
||||
* Keep these at the end of the file to make sure that
|
||||
* no code in this file accidentally calls it.
|
||||
*/
|
||||
|
||||
/* Backward compatible dm_tree_node_size_changed() implementations. */
|
||||
int dm_tree_node_size_changed_base(const struct dm_tree_node *dnode);
|
||||
DM_EXPORT_SYMBOL_BASE(dm_tree_node_size_changed);
|
||||
int dm_tree_node_size_changed_base(const struct dm_tree_node *dnode)
|
||||
@ -4048,4 +4050,43 @@ int dm_tree_node_size_changed_base(const struct dm_tree_node *dnode)
|
||||
/* Base does not make difference between smaller and bigger */
|
||||
return dm_tree_node_size_changed(dnode) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Retain ABI compatibility after adding the DM_CACHE_FEATURE_METADATA2
|
||||
* in version 1.02.138.
|
||||
*
|
||||
* Binaries compiled against version 1.02.138 onwards will use
|
||||
* the new function dm_tree_node_add_cache_target which detects unknown
|
||||
* feature flags and returns error for them.
|
||||
*/
|
||||
int dm_tree_node_add_cache_target_base(struct dm_tree_node *node,
|
||||
uint64_t size,
|
||||
uint64_t feature_flags, /* DM_CACHE_FEATURE_* */
|
||||
const char *metadata_uuid,
|
||||
const char *data_uuid,
|
||||
const char *origin_uuid,
|
||||
const char *policy_name,
|
||||
const struct dm_config_node *policy_settings,
|
||||
uint32_t data_block_size);
|
||||
DM_EXPORT_SYMBOL_BASE(dm_tree_node_add_cache_target);
|
||||
int dm_tree_node_add_cache_target_base(struct dm_tree_node *node,
|
||||
uint64_t size,
|
||||
uint64_t feature_flags,
|
||||
const char *metadata_uuid,
|
||||
const char *data_uuid,
|
||||
const char *origin_uuid,
|
||||
const char *policy_name,
|
||||
const struct dm_config_node *policy_settings,
|
||||
uint32_t data_block_size)
|
||||
{
|
||||
/* Old version supported only these FEATURE bits, others were ignored so masked them */
|
||||
static const uint64_t _mask =
|
||||
DM_CACHE_FEATURE_WRITEBACK |
|
||||
DM_CACHE_FEATURE_WRITETHROUGH |
|
||||
DM_CACHE_FEATURE_PASSTHROUGH;
|
||||
|
||||
return dm_tree_node_add_cache_target(node, size, feature_flags & _mask,
|
||||
metadata_uuid, data_uuid, origin_uuid,
|
||||
policy_name, policy_settings, data_block_size);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user