1
0
Fork 0

Merging upstream version 4.2+20230223.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-14 06:01:59 +01:00
parent 866376462c
commit 30ed170f74
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
76 changed files with 2282 additions and 1386 deletions

55
maps.c
View file

@ -165,7 +165,62 @@ mapping_t sysfs_array_states[] = {
{ "broken", ARRAY_BROKEN },
{ NULL, ARRAY_UNKNOWN_STATE }
};
/**
* mapping_t update_options - stores supported update options.
*/
mapping_t update_options[] = {
{ "name", UOPT_NAME },
{ "ppl", UOPT_PPL },
{ "no-ppl", UOPT_NO_PPL },
{ "bitmap", UOPT_BITMAP },
{ "no-bitmap", UOPT_NO_BITMAP },
{ "sparc2.2", UOPT_SPARC22 },
{ "super-minor", UOPT_SUPER_MINOR },
{ "summaries", UOPT_SUMMARIES },
{ "resync", UOPT_RESYNC },
{ "uuid", UOPT_UUID },
{ "homehost", UOPT_HOMEHOST },
{ "home-cluster", UOPT_HOME_CLUSTER },
{ "nodes", UOPT_NODES },
{ "devicesize", UOPT_DEVICESIZE },
{ "bbl", UOPT_BBL },
{ "no-bbl", UOPT_NO_BBL },
{ "force-no-bbl", UOPT_FORCE_NO_BBL },
{ "metadata", UOPT_METADATA },
{ "revert-reshape", UOPT_REVERT_RESHAPE },
{ "layout-original", UOPT_LAYOUT_ORIGINAL },
{ "layout-alternate", UOPT_LAYOUT_ALTERNATE },
{ "layout-unspecified", UOPT_LAYOUT_UNSPECIFIED },
{ "byteorder", UOPT_BYTEORDER },
{ "help", UOPT_HELP },
{ "?", UOPT_HELP },
{ NULL, UOPT_UNDEFINED}
};
/**
* map_num_s() - Safer alternative of map_num() function.
* @map: map to search.
* @num: key to match.
*
* Shall be used only if key existence is quaranted.
*
* Return: Pointer to name of the element.
*/
char *map_num_s(mapping_t *map, int num)
{
char *ret = map_num(map, num);
assert(ret);
return ret;
}
/**
* map_num() - get element name by key.
* @map: map to search.
* @num: key to match.
*
* Return: Pointer to name of the element or NULL.
*/
char *map_num(mapping_t *map, int num)
{
while (map->name) {