summaryrefslogtreecommitdiffstats
path: root/maps.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-25 16:20:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-25 16:20:34 +0000
commitd970b407fc0f4fba35fc31aab80ea6ea69788a52 (patch)
tree491e11b95bf9ea1a3fb1e6a886a65b8491cf9841 /maps.c
parentAdding debian version 4.2-5. (diff)
downloadmdadm-d970b407fc0f4fba35fc31aab80ea6ea69788a52.tar.xz
mdadm-d970b407fc0f4fba35fc31aab80ea6ea69788a52.zip
Merging upstream version 4.2+20230223.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'maps.c')
-rw-r--r--maps.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/maps.c b/maps.c
index a4fd279..b586679 100644
--- a/maps.c
+++ b/maps.c
@@ -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) {