2 * mdadm - manage Linux "md" devices aka RAID arrays.
4 * Copyright (C) 2011 Neil Brown <neilb@suse.de>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * Email: <neilb@suse.de>
28 /* name/number mappings */
30 mapping_t r5layout
[] = {
31 { "left-asymmetric", ALGORITHM_LEFT_ASYMMETRIC
},
32 { "right-asymmetric", ALGORITHM_RIGHT_ASYMMETRIC
},
33 { "left-symmetric", ALGORITHM_LEFT_SYMMETRIC
},
34 { "right-symmetric", ALGORITHM_RIGHT_SYMMETRIC
},
36 { "default", ALGORITHM_LEFT_SYMMETRIC
},
37 { "la", ALGORITHM_LEFT_ASYMMETRIC
},
38 { "ra", ALGORITHM_RIGHT_ASYMMETRIC
},
39 { "ls", ALGORITHM_LEFT_SYMMETRIC
},
40 { "rs", ALGORITHM_RIGHT_SYMMETRIC
},
42 { "parity-first", ALGORITHM_PARITY_0
},
43 { "parity-last", ALGORITHM_PARITY_N
},
44 { "ddf-zero-restart", ALGORITHM_RIGHT_ASYMMETRIC
},
45 { "ddf-N-restart", ALGORITHM_LEFT_ASYMMETRIC
},
46 { "ddf-N-continue", ALGORITHM_LEFT_SYMMETRIC
},
50 mapping_t r6layout
[] = {
51 { "left-asymmetric", ALGORITHM_LEFT_ASYMMETRIC
},
52 { "right-asymmetric", ALGORITHM_RIGHT_ASYMMETRIC
},
53 { "left-symmetric", ALGORITHM_LEFT_SYMMETRIC
},
54 { "right-symmetric", ALGORITHM_RIGHT_SYMMETRIC
},
56 { "default", ALGORITHM_LEFT_SYMMETRIC
},
57 { "la", ALGORITHM_LEFT_ASYMMETRIC
},
58 { "ra", ALGORITHM_RIGHT_ASYMMETRIC
},
59 { "ls", ALGORITHM_LEFT_SYMMETRIC
},
60 { "rs", ALGORITHM_RIGHT_SYMMETRIC
},
62 { "parity-first", ALGORITHM_PARITY_0
},
63 { "parity-last", ALGORITHM_PARITY_N
},
64 { "ddf-zero-restart", ALGORITHM_ROTATING_ZERO_RESTART
},
65 { "ddf-N-restart", ALGORITHM_ROTATING_N_RESTART
},
66 { "ddf-N-continue", ALGORITHM_ROTATING_N_CONTINUE
},
68 { "left-asymmetric-6", ALGORITHM_LEFT_ASYMMETRIC_6
},
69 { "right-asymmetric-6", ALGORITHM_RIGHT_ASYMMETRIC_6
},
70 { "left-symmetric-6", ALGORITHM_LEFT_SYMMETRIC_6
},
71 { "right-symmetric-6", ALGORITHM_RIGHT_SYMMETRIC_6
},
72 { "parity-first-6", ALGORITHM_PARITY_0_6
},
78 { "linear", LEVEL_LINEAR
},
89 { "multipath", LEVEL_MULTIPATH
},
90 { "mp", LEVEL_MULTIPATH
},
95 { "faulty", LEVEL_FAULTY
},
96 { "container", LEVEL_CONTAINER
},
101 mapping_t modes
[] = {
102 { "assemble", ASSEMBLE
},
107 { "monitor", MONITOR
},
109 { "incremental", INCREMENTAL
},
110 { "auto-detect", AUTODETECT
},
113 mapping_t faultylayout
[] = {
114 { "write-transient", WriteTransient
},
115 { "wt", WriteTransient
},
116 { "read-transient", ReadTransient
},
117 { "rt", ReadTransient
},
118 { "write-persistent", WritePersistent
},
119 { "wp", WritePersistent
},
120 { "read-persistent", ReadPersistent
},
121 { "rp", ReadPersistent
},
122 { "write-all", WriteAll
},
124 { "read-fixable", ReadFixable
},
125 { "rf", ReadFixable
},
127 { "clear", ClearErrors
},
128 { "flush", ClearFaults
},
129 { "none", ClearErrors
},
130 { "default", ClearErrors
},
134 char *map_num(mapping_t
*map
, int num
)
144 int map_name(mapping_t
*map
, char *name
)
147 if (strcmp(map
->name
, name
)==0)