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) {
}
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);
}
}
struct mdp_superblock_1 *sb = sbv;
time_t atime;
int d;
- int spares, faulty;
+ int faulty;
int i;
char *c;
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");
}
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;
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;
- 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);