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

const: suffixes list

dm_tree_set_optional_uuid_suffixes() is safe to use with overcasted
array to (const char**)
This commit is contained in:
Zdenek Kabelac 2024-05-03 12:43:14 +02:00
parent 9cf127b429
commit eae0314b55

View File

@ -47,7 +47,7 @@ typedef enum {
} action_t;
/* This list must match lib/misc/lvm-string.c:build_dm_uuid(). */
const char *uuid_suffix_list[] = { "pool", "cdata", "cmeta", "cvol", "tdata", "tmeta", "vdata", "vpool", "imeta", NULL};
static const char * const _uuid_suffix_list[] = { "pool", "cdata", "cmeta", "cvol", "tdata", "tmeta", "vdata", "vpool", "imeta", NULL};
struct dlid_list {
struct dm_list list;
@ -928,7 +928,7 @@ static int _info(struct cmd_context *cmd,
/* Check for original version of dlid before the suffixes got added in 2.02.106 */
if ((suffix_position = strrchr(dlid, '-'))) {
while ((suffix = uuid_suffix_list[i++])) {
while ((suffix = _uuid_suffix_list[i++])) {
if (strcmp(suffix_position + 1, suffix))
continue;
@ -2970,7 +2970,7 @@ static struct dm_tree *_create_partial_dtree(struct dev_manager *dm, const struc
return NULL;
}
dm_tree_set_optional_uuid_suffixes(dtree, &uuid_suffix_list[0]);
dm_tree_set_optional_uuid_suffixes(dtree, (const char**)_uuid_suffix_list);
if (!_add_lv_to_dtree(dm, dtree, lv, (lv_is_origin(lv) || lv_is_thin_volume(lv) || lv_is_thin_pool(lv)) ? origin_only : 0))
goto_bad;
@ -4100,7 +4100,7 @@ int dev_manager_device_uses_vg(struct device *dev,
return r;
}
dm_tree_set_optional_uuid_suffixes(dtree, &uuid_suffix_list[0]);
dm_tree_set_optional_uuid_suffixes(dtree, (const char**)_uuid_suffix_list);
if (!dm_tree_add_dev(dtree, (uint32_t) MAJOR(dev->dev), (uint32_t) MINOR(dev->dev))) {
log_error("Failed to add device %s (%" PRIu32 ":%" PRIu32") to dtree.",