From 0430ed4868970a9c72318357d30cd0b4d4144407 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 13 Oct 2006 09:02:35 +1000 Subject: Remove partitions from components of an md array They do nothing but cause confusion. --- util.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'util.c') diff --git a/util.c b/util.c index 08319cb..f3b7a39 100644 --- a/util.c +++ b/util.c @@ -31,6 +31,7 @@ #include "md_p.h" #include #include +#include /* * 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) { -- cgit