From 0a124c37042c94b1e069e3b956005e3cace1e205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Schmidt?= Date: Fri, 2 May 2003 12:42:31 +0000 Subject: [PATCH] Add "addspare" functionality. --- sbin/atacontrol/atacontrol.8 | 5 +++++ sbin/atacontrol/atacontrol.c | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/sbin/atacontrol/atacontrol.8 b/sbin/atacontrol/atacontrol.8 index 9efb2de5998f..2f6945721943 100644 --- a/sbin/atacontrol/atacontrol.8 +++ b/sbin/atacontrol/atacontrol.8 @@ -52,6 +52,9 @@ .Ic delete .Ar raid .Nm +.Ic addspare +.Ar raid disk +.Nm .Ic rebuild .Ar raid .Nm @@ -152,6 +155,8 @@ the partition to boot must reside on the first disk in the SPAN. .It Ic delete Delete a RAID array on a RAID capable ATA controller. +.It Ic addspare +Add a spare disk to an existing RAID. .It Ic rebuild Rebuild a RAID1 array on a RAID capable ATA controller. .It Ic status diff --git a/sbin/atacontrol/atacontrol.c b/sbin/atacontrol/atacontrol.c index d453d2a8bb34..ea7f4cb38a5f 100644 --- a/sbin/atacontrol/atacontrol.c +++ b/sbin/atacontrol/atacontrol.c @@ -263,9 +263,10 @@ main(int argc, char **argv) if (argc > 2 && strcmp(argv[1], "create")) { int chan; - if (!strcmp(argv[1], "delete") || - !strcmp(argv[1], "status") || - !strcmp(argv[1], "rebuild")) { + if (!strcmp(argv[1], "addspare") || + !strcmp(argv[1], "delete") || + !strcmp(argv[1], "rebuild") || + !strcmp(argv[1], "status")) { if (!(sscanf(argv[2], "%d", &chan) == 1 || sscanf(argv[2], "ar%d", &chan) == 1)) usage(); @@ -361,6 +362,17 @@ main(int argc, char **argv) if (ioctl(fd, IOCATA, &iocmd) < 0) warn("ioctl(ATARAIDDELETE)"); } + else if (!strcmp(argv[1], "addspare") && argc == 4) { + int dev; + + iocmd.cmd = ATARAIDADDSPARE; + if (!(sscanf(argv[3], "%d", &dev) == 1 || + sscanf(argv[3], "ad%d", &dev) == 1)) + usage(); + iocmd.u.raid_spare.disk = dev; + if (ioctl(fd, IOCATA, &iocmd) < 0) + warn("ioctl(ATARAIDADDSPARE)"); + } else if (!strcmp(argv[1], "rebuild") && argc == 3) { iocmd.cmd = ATARAIDREBUILD; if (ioctl(fd, IOCATA, &iocmd) < 0)