summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-04-18 01:42:52 +0200
committerNeil Brown <neilb@suse.de>2006-04-18 01:42:52 +0200
commit6fbba4c9295a1df735565d1cf0e376d15c2c2809 (patch)
treea46fc8f0b970881cf50c2a3e1fbbc3bbdae1a742
parentStuff (diff)
downloadmdadm-6fbba4c9295a1df735565d1cf0e376d15c2c2809.tar.xz
mdadm-6fbba4c9295a1df735565d1cf0e376d15c2c2809.zip
Stuff
Description... Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
-rw-r--r--mdadm.c8
-rw-r--r--super1.c21
-rw-r--r--util.c8
3 files changed, 19 insertions, 18 deletions
diff --git a/mdadm.c b/mdadm.c
index 44fd30c9..e8e8ed37 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -778,8 +778,8 @@ int main(int argc, char *argv[])
if (raiddisks) {
if (raiddisks > max_disks) {
- fprintf(stderr, Name ": invalid number of raid devices: %s\n",
- optarg);
+ fprintf(stderr, Name ": invalid number of raid devices: %d\n",
+ raiddisks);
exit(2);
}
if (raiddisks == 1 && !force && level != -5) {
@@ -791,8 +791,8 @@ int main(int argc, char *argv[])
}
if (sparedisks) {
if ( sparedisks > max_disks - raiddisks) {
- fprintf(stderr, Name ": invalid number of spare-devices: %s\n",
- optarg);
+ fprintf(stderr, Name ": invalid number of spare-devices: %d\n",
+ sparedisks);
exit(2);
}
}
diff --git a/super1.c b/super1.c
index 63918576..114ef83e 100644
--- a/super1.c
+++ b/super1.c
@@ -121,7 +121,7 @@ static void examine_super1(void *sbv)
struct mdp_superblock_1 *sb = sbv;
time_t atime;
int d;
- int spares, faulty;
+ int faulty;
int i;
char *c;
@@ -198,15 +198,12 @@ static void examine_super1(void *sbv)
else if (cnt == 1) printf("u");
else printf ("_");
}
- spares = faulty = 0;
+ faulty = 0;
for (i=0; i< __le32_to_cpu(sb->max_dev); i++) {
int role = __le16_to_cpu(sb->dev_roles[i]);
- switch (role) {
- case 0xFFFF: spares++; break;
- case 0xFFFE: faulty++;
- }
+ if (role == 0xFFFE)
+ faulty++;
}
- if (spares) printf(" %d spares", spares);
if (faulty) printf(" %d failed", faulty);
printf("\n");
}
@@ -441,7 +438,7 @@ static void add_to_super1(void *sbv, mdu_disk_info_t *dk)
static int store_super1(struct supertype *st, int fd, void *sbv)
{
struct mdp_superblock_1 *sb = sbv;
- long long sb_offset;
+ unsigned long long sb_offset;
int sbsize;
long size;
@@ -467,7 +464,7 @@ static int store_super1(struct supertype *st, int fd, void *sbv)
sb_offset &= ~(4*2-1);
break;
case 1:
- sb->super_offset = __cpu_to_le64(0);
+ sb_offset = 0;
break;
case 2:
sb_offset = 4*2;
@@ -478,14 +475,14 @@ static int store_super1(struct supertype *st, int fd, void *sbv)
- if (sb_offset != (__le64_to_cpu(sb->super_offset) << 9 ) &&
- 0 != (__le64_to_cpu(sb->super_offset) << 9 )
+ if (sb_offset != __le64_to_cpu(sb->super_offset) &&
+ 0 != __le64_to_cpu(sb->super_offset)
) {
fprintf(stderr, Name ": internal error - sb_offset is wrong\n");
abort();
}
- if (lseek64(fd, sb_offset, 0)< 0LL)
+ if (lseek64(fd, sb_offset << 9, 0)< 0LL)
return 3;
sbsize = sizeof(*sb) + 2 * __le32_to_cpu(sb->max_dev);
diff --git a/util.c b/util.c
index 04a689bb..05362c7a 100644
--- a/util.c
+++ b/util.c
@@ -537,11 +537,15 @@ struct supertype *super_by_version(int vers, int minor)
{
struct supertype *st = malloc(sizeof(*st));
if (!st) return st;
- if (vers == 0)
+ if (vers == 0) {
st->ss = &super0;
+ st->max_devs = MD_SB_DISKS;
+ }
- if (vers == 1)
+ if (vers == 1) {
st->ss = &super1;
+ st->max_devs = 384;
+ }
st->minor_version = minor;
return st;
}