1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Add "addspare" functionality.

This commit is contained in:
Søren Schmidt 2003-05-02 12:42:31 +00:00
parent 31de970e72
commit 0a124c3704
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114530
2 changed files with 20 additions and 3 deletions

View File

@ -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

View File

@ -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)