20 |
#include <sys/md.h> |
#include <sys/md.h> |
21 |
#include <linux/major.h> |
#include <linux/major.h> |
22 |
|
|
23 |
|
#include "kinit.h" |
24 |
#include "do_mounts.h" |
#include "do_mounts.h" |
25 |
|
|
26 |
#define LEVEL_NONE (-1000000) |
#define LEVEL_NONE (-1000000) |
143 |
*/ |
*/ |
144 |
static int md_setup(char *str) |
static int md_setup(char *str) |
145 |
{ |
{ |
146 |
int minor, level, factor, fault, partitioned = 0; |
int minor_num, level, factor, fault, partitioned = 0; |
147 |
char *pername = ""; |
char *pername = ""; |
148 |
char *str1; |
char *str1; |
149 |
int ent; |
int ent; |
152 |
partitioned = 1; |
partitioned = 1; |
153 |
str++; |
str++; |
154 |
} |
} |
155 |
if (get_option(&str, &minor) != 2) { /* MD Number */ |
if (get_option(&str, &minor_num) != 2) { /* MD Number */ |
156 |
fprintf(stderr, "md: Too few arguments supplied to md=.\n"); |
fprintf(stderr, "md: Too few arguments supplied to md=.\n"); |
157 |
return 0; |
return 0; |
158 |
} |
} |
159 |
str1 = str; |
str1 = str; |
160 |
if (minor >= MAX_MD_DEVS) { |
if (minor_num >= MAX_MD_DEVS) { |
161 |
fprintf(stderr, "md: md=%d, Minor device number too high.\n", |
fprintf(stderr, "md: md=%d, Minor device number too high.\n", |
162 |
minor); |
minor_num); |
163 |
return 0; |
return 0; |
164 |
} |
} |
165 |
for (ent = 0; ent < md_setup_ents; ent++) |
for (ent = 0; ent < md_setup_ents; ent++) |
166 |
if (md_setup_args[ent].minor == minor && |
if (md_setup_args[ent].minor == minor_num && |
167 |
md_setup_args[ent].partitioned == partitioned) { |
md_setup_args[ent].partitioned == partitioned) { |
168 |
fprintf(stderr, |
fprintf(stderr, |
169 |
"md: md=%s%d, Specified more than once. " |
"md: md=%s%d, Specified more than once. " |
170 |
"Replacing previous definition.\n", |
"Replacing previous definition.\n", |
171 |
partitioned ? "d" : "", minor); |
partitioned ? "d" : "", minor_num); |
172 |
break; |
break; |
173 |
} |
} |
174 |
if (ent >= MAX_MD_DEVS) { |
if (ent >= MAX_MD_DEVS) { |
175 |
fprintf(stderr, "md: md=%s%d - too many md initialisations\n", |
fprintf(stderr, "md: md=%s%d - too many md initialisations\n", |
176 |
partitioned ? "d" : "", minor); |
partitioned ? "d" : "", minor_num); |
177 |
return 0; |
return 0; |
178 |
} |
} |
179 |
if (ent >= md_setup_ents) |
if (ent >= md_setup_ents) |
205 |
} |
} |
206 |
|
|
207 |
fprintf(stderr, "md: Will configure md%s%d (%s) from %s, below.\n", |
fprintf(stderr, "md: Will configure md%s%d (%s) from %s, below.\n", |
208 |
partitioned?"_d":"", minor, pername, str); |
partitioned?"_d":"", minor_num, pername, str); |
209 |
md_setup_args[ent].device_names = str; |
md_setup_args[ent].device_names = str; |
210 |
md_setup_args[ent].partitioned = partitioned; |
md_setup_args[ent].partitioned = partitioned; |
211 |
md_setup_args[ent].minor = minor; |
md_setup_args[ent].minor = minor_num; |
212 |
|
|
213 |
return 1; |
return 1; |
214 |
} |
} |
227 |
char *devname; |
char *devname; |
228 |
mdu_disk_info_t dinfo; |
mdu_disk_info_t dinfo; |
229 |
char name[16]; |
char name[16]; |
230 |
|
struct stat st_chk; |
231 |
|
|
232 |
dev_minor = md_setup_args[ent].minor; |
dev_minor = md_setup_args[ent].minor; |
233 |
partitioned = md_setup_args[ent].partitioned; |
partitioned = md_setup_args[ent].partitioned; |
236 |
snprintf(name, sizeof name, |
snprintf(name, sizeof name, |
237 |
"/dev/md%s%d", partitioned ? "_d" : "", dev_minor); |
"/dev/md%s%d", partitioned ? "_d" : "", dev_minor); |
238 |
|
|
239 |
|
if (stat(name, &st_chk) == 0) |
240 |
|
continue; |
241 |
|
|
242 |
if (partitioned) |
if (partitioned) |
243 |
dev = makedev(mdp_major(), dev_minor << MdpMinorShift); |
dev = makedev(mdp_major(), dev_minor << MdpMinorShift); |
244 |
else |
else |