From 9f506eb89e48fadf3589e5d36812af36d18466ad Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 3 May 2024 11:35:38 +0200 Subject: [PATCH] const: raid takover arrays --- lib/metadata/raid_manip.c | 14 +++++++------- lib/metadata/takeover_matrix.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 41736c711..96712ca1e 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -4517,7 +4517,7 @@ struct possible_type { const uint32_t options; }; -static struct possible_takeover_reshape_type _possible_takeover_reshape_types[] = { +static const struct possible_takeover_reshape_type _possible_takeover_reshape_types[] = { /* striped -> raid1 */ { .current_types = SEG_STRIPED_TARGET, /* linear, i.e. seg->area_count = 1 */ .possible_types = SEG_RAID1, @@ -4629,12 +4629,12 @@ static struct possible_takeover_reshape_type _possible_takeover_reshape_types[] /* * Return possible_type struct for current segment type. */ -static struct possible_takeover_reshape_type *_get_possible_takeover_reshape_type(const struct lv_segment *seg_from, - const struct segment_type *segtype_to, - struct possible_type *last_pt) +static const struct possible_takeover_reshape_type *_get_possible_takeover_reshape_type(const struct lv_segment *seg_from, + const struct segment_type *segtype_to, + const struct possible_type *last_pt) { - struct possible_takeover_reshape_type *lpt = (struct possible_takeover_reshape_type *) last_pt; - struct possible_takeover_reshape_type *pt = lpt ? lpt + 1 : _possible_takeover_reshape_types; + const struct possible_takeover_reshape_type *lpt = (const struct possible_takeover_reshape_type *) last_pt; + const struct possible_takeover_reshape_type *pt = lpt ? lpt + 1 : _possible_takeover_reshape_types; for ( ; pt->current_types; pt++) if ((seg_from->segtype->flags & pt->current_types) && @@ -6066,7 +6066,7 @@ static int _log_prohibited_option(const struct lv_segment *seg_from, * Find takeover raid flag for segment type flag of @seg */ /* Segment type flag correspondence for raid5 <-> raid6 conversions */ -static uint64_t _r5_to_r6[][2] = { +static const uint64_t _r5_to_r6[][2] = { { SEG_RAID5_LS, SEG_RAID6_LS_6 }, { SEG_RAID5_LA, SEG_RAID6_LA_6 }, { SEG_RAID5_RS, SEG_RAID6_RS_6 }, diff --git a/lib/metadata/takeover_matrix.h b/lib/metadata/takeover_matrix.h index 8ac2f75a8..e12b9b016 100644 --- a/lib/metadata/takeover_matrix.h +++ b/lib/metadata/takeover_matrix.h @@ -79,7 +79,7 @@ #define str_r45 _takeover_from_striped_to_raid45 #define str_r6 _takeover_from_striped_to_raid6 -static uint64_t _segtype_index[] = { +static const uint64_t _segtype_index[] = { 1, /* linear */ 1, /* striped */ SEG_MIRROR, @@ -100,7 +100,7 @@ static uint64_t _segtype_index[] = { * N represents a combination that has no effect (no-op). * X represents a combination that is unsupported. */ -static takeover_fn_t _takeover_fns[][11] = { +static const takeover_fn_t _takeover_fns[][11] = { /* from, to -> linear striped mirror raid0 raid0_meta raid1 raid4/5 raid6 raid10 raid01 other*/ /* | */ /* v */