diff options
author | Neil Brown <neilb@suse.de> | 2006-10-13 09:02:35 +1000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2006-10-13 09:02:35 +1000 |
commit | 0430ed4868970a9c72318357d30cd0b4d4144407 (patch) | |
tree | 663f128d5a4a5f72197f0a6c9b46754a297a0f4b /util.c | |
parent | 6ba83b5f5e8946d49877229752e76a14b7672f69 (diff) | |
download | mdadm-0430ed4868970a9c72318357d30cd0b4d4144407.tar.gz mdadm-0430ed4868970a9c72318357d30cd0b4d4144407.tar.xz mdadm-0430ed4868970a9c72318357d30cd0b4d4144407.zip |
Remove partitions from components of an md array
They do nothing but cause confusion.
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) { |