diff options
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -31,6 +31,7 @@ #include "md_p.h" #include <sys/utsname.h> #include <ctype.h> +#include <linux/blkpg.h> /* * Parse a 128 bit uuid in 4 integers @@ -118,6 +119,25 @@ int get_linux_version() return (a*1000000)+(b*1000)+c; } +void remove_partitions(int fd) +{ + /* remove partitions from this block devices. + * This is used for components added to an array + */ +#ifdef BLKPG_DEL_PARTITION + struct blkpg_ioctl_arg a; + struct blkpg_partition p; + + a.op = BLKPG_DEL_PARTITION; + a.data = (void*)&p; + a.datalen = sizeof(p); + a.flags = 0; + memset(a.data, 0, a.datalen); + for (p.pno=0; p.pno < 16; p.pno++) + ioctl(fd, BLKPG, &a); +#endif +} + int enough(int level, int raid_disks, int layout, char *avail, int avail_disks) { |