return (a*1000000)+(b*1000)+c;
}
+#ifndef MDASSEMBLE
int mdadm_version(char *version)
{
int a, b, c;
return (a*1000000)+(b*1000)+c;
}
-#ifndef MDASSEMBLE
long long parse_size(char *size)
{
/* parse 'size' which should be a number optionally
char buf[20];
sprintf(buf, "%d:%d", dev2major(devnum), dev2minor(devnum));
- return dev_open(buf, O_RDWR);
+ return dev_open(buf, O_RDONLY);
}
int open_dev_excl(int devnum)
return retval;
}
-int check_partitions(int fd, char *dname, unsigned long long freesize)
+int check_partitions(int fd, char *dname, unsigned long long freesize,
+ unsigned long long size)
{
/*
* Check where the last partition ends
Name ": metadata will over-write last partition on %s.\n",
dname);
return 1;
+ } else if (size && endofpart > size) {
+ /* partitions will be truncated in new device */
+ fprintf(stderr,
+ Name ": array size is too small to cover all partitions on %s.\n",
+ dname);
+ return 1;
}
}
return 0;
if (spare_group)
pol_add(&pol, pol_domain,
spare_group, NULL);
- if (!domain_test(domlist, pol, metadata))
+ if (domain_test(domlist, pol, metadata) != 1)
found = 0;
dev_policy_free(pol);
}