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

libdm: ensure suffixes list elements are const

This was rather API mistake - the internal of libdm
do handle suffixes list as const string, just the API
was only using  'const char **'.

So the user may pass safely casted 'const char * const`.
This commit is contained in:
Zdenek Kabelac 2024-05-03 23:05:40 +02:00
parent e02695cb45
commit 9b2f9d64c0
2 changed files with 4 additions and 4 deletions

View File

@ -348,7 +348,7 @@ struct dm_tree {
int retry_remove; /* 1 retries remove if not successful */
uint32_t cookie;
char buf[DM_NAME_LEN + 32]; /* print buffer for device_name (major:minor) */
const char **optional_uuid_suffixes; /* uuid suffixes ignored when matching */
const char * const *optional_uuid_suffixes; /* uuid suffixes ignored when matching */
};
/*
@ -600,7 +600,7 @@ static struct dm_tree_node *_find_dm_tree_node_by_uuid(struct dm_tree *dtree,
const char *suffix, *suffix_position;
char uuid_without_suffix[DM_UUID_LEN + 1];
unsigned i = 0;
const char **suffix_list = dtree->optional_uuid_suffixes;
const char * const *suffix_list = dtree->optional_uuid_suffixes;
if ((node = dm_hash_lookup(dtree->uuids, uuid))) {
log_debug_activation("Matched uuid %s %s in deptree.", uuid, _node_name(node));

View File

@ -308,7 +308,7 @@ struct dm_tree {
int retry_remove; /* 1 retries remove if not successful */
uint32_t cookie;
char buf[DM_NAME_LEN + 32]; /* print buffer for device_name (major:minor) */
const char **optional_uuid_suffixes; /* uuid suffixes ignored when matching */
const char * const *optional_uuid_suffixes; /* uuid suffixes ignored when matching */
};
/*
@ -560,7 +560,7 @@ static struct dm_tree_node *_find_dm_tree_node_by_uuid(struct dm_tree *dtree,
const char *suffix, *suffix_position;
char uuid_without_suffix[DM_UUID_LEN + 1];
unsigned i = 0;
const char **suffix_list = dtree->optional_uuid_suffixes;
const char * const *suffix_list = dtree->optional_uuid_suffixes;
if ((node = dm_hash_lookup(dtree->uuids, uuid))) {
log_debug_activation("Matched uuid %s %s in deptree.", uuid, _node_name(node));