diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2005-08-18 04:49:53 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2005-08-18 04:49:53 +0000 |
commit | 4eb64979878c88021ad286c154decd88cdb5fd8e (patch) | |
tree | 547762decd40704f43cb991b555de411199fb59f /sys | |
parent | 554d489dce3a2e3c280f90fb15459a80f14ade1a (diff) |
Add "create hot spare" ok dlg@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/biovar.h | 22 | ||||
-rw-r--r-- | sys/dev/ic/ami.c | 46 |
2 files changed, 59 insertions, 9 deletions
diff --git a/sys/dev/biovar.h b/sys/dev/biovar.h index c5e7e739dac..4df28be56d6 100644 --- a/sys/dev/biovar.h +++ b/sys/dev/biovar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: biovar.h,v 1.17 2005/08/17 22:28:54 marco Exp $ */ +/* $OpenBSD: biovar.h,v 1.18 2005/08/18 04:49:52 marco Exp $ */ /* * Copyright (c) 2002 Niklas Hallqvist. All rights reserved. @@ -151,21 +151,31 @@ struct bioc_blink { #define BIOC_SBUNBLINK 0x00 /* disable blinking */ #define BIOC_SBBLINK 0x01 /* enable blink */ #define BIOC_SBALARM 0x02 /* enable alarm blink */ + + u_int16_t bs_channel; + u_int16_t bs_target; + u_int16_t bs_lun; + u_int16_t bs_other_id; /* unused for now */ }; #define BIOCSETSTATE _IOWR('B', 37, struct bioc_setstate) struct bioc_setstate { void *bs_cookie; - int bs_volid; /* volume */ - int bs_diskid; /* virtual disk */ - int bs_status; /* current status */ + int bs_resv1; /* for binary compatibility */ + int bs_resv2; /* for binary compatibility */ + int bs_status; /* change to this status */ #define BIOC_SSONLINE 0x00 /* online disk */ #define BIOC_SSOFFLINE 0x01 /* offline disk */ #define BIOC_SSHOTSPARE 0x02 /* mark as hotspare */ - int bs_resv1; /* for binary compatibility */ + int bs_resv3; /* for binary compatibility */ + + u_int16_t bs_channel; + u_int16_t bs_target; + u_int16_t bs_lun; + u_int16_t bs_other_id; /* unused for now */ - int bs_resv2; + int bs_resv4; }; #define BIOC_INQ 0x0001 diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c index 73a03811465..94a2fc0f924 100644 --- a/sys/dev/ic/ami.c +++ b/sys/dev/ic/ami.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ami.c,v 1.67 2005/08/17 21:49:14 marco Exp $ */ +/* $OpenBSD: ami.c,v 1.68 2005/08/18 04:49:52 marco Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -148,6 +148,7 @@ int ami_disk(struct ami_softc *, struct bioc_disk *, int ami_ioctl_vol(struct ami_softc *, struct bioc_vol *); int ami_ioctl_disk(struct ami_softc *, struct bioc_disk *); int ami_ioctl_alarm(struct ami_softc *, struct bioc_alarm *); +int ami_ioctl_setstate(struct ami_softc *, struct bioc_setstate *); #endif /* NBIO > 0 */ struct ami_ccb * @@ -1819,6 +1820,7 @@ ami_ioctl(dev, cmd, addr) case BIOCVOL: case BIOCDISK: case BIOCALARM: + case BIOCSETSTATE: sc->sc_flags |= AMI_CMDWAIT; while (!TAILQ_EMPTY(&sc->sc_ccbq)) if (tsleep(&sc->sc_free_ccb, PRIBIO, "ami_ioctl", @@ -1846,7 +1848,12 @@ ami_ioctl(dev, cmd, addr) AMI_DPRINTF(AMI_D_IOCTL, ("alarm ")); error = ami_ioctl_alarm(sc, (struct bioc_alarm *)addr); break; - + + case BIOCSETSTATE: + AMI_DPRINTF(AMI_D_IOCTL, ("setstate ")); + error = ami_ioctl_setstate(sc, (struct bioc_setstate *)addr); + break; + default: AMI_DPRINTF(AMI_D_IOCTL, ("%s: invalid ioctl\n", sc->sc_dev.dv_xname)); @@ -2487,7 +2494,7 @@ int ami_ioctl_alarm(sc, ba) default: AMI_DPRINTF(AMI_D_IOCTL, ("%s: biocalarm invalid opcode %x\n", sc->sc_dev.dv_xname, ba->ba_opcode)); - error = EINVAL; + return (EINVAL); } if (ami_mgmt(sc, AMI_SPEAKER, func, 0, 0, sizeof ret, &ret)) @@ -2500,6 +2507,39 @@ int ami_ioctl_alarm(sc, ba) return (error); } + +int +ami_ioctl_setstate(sc, bs) + struct ami_softc *sc; + struct bioc_setstate *bs; +{ + int func; + + switch (bs->bs_status) { + case BIOC_SSONLINE: + func = AMI_STATE_ON; + break; + + case BIOC_SSOFFLINE: + func = AMI_STATE_FAIL; + break; + + case BIOC_SSHOTSPARE: + func = AMI_STATE_SPARE; + break; + + default: + AMI_DPRINTF(AMI_D_IOCTL, ("%s: biocsetstate invalid opcode %x\n" + , sc->sc_dev.dv_xname, bs->bs_status)); + return (EINVAL); + } + + if (ami_mgmt(sc, AMI_CHSTATE, bs->bs_channel, bs->bs_target, func, + 0, NULL)) + return (EINVAL); + + return (0); +} #endif /* NBIO > 0 */ #ifdef AMI_DEBUG |