Use a shutdownhook to make sure the drive motor is turned off

at halt/reboot time, as suggested by Perry Metzger.
This commit is contained in:
thorpej 1996-01-16 19:35:06 +00:00
parent 6b5e9088a1
commit 353f4388fb

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.19 1996/01/15 00:14:42 thorpej Exp $ */
/* $NetBSD: fd.c,v 1.20 1996/01/16 19:35:06 thorpej Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles Hannum.
@ -184,6 +184,8 @@ struct fd_softc {
#define FD_MOTOR_WAIT 0x04 /* motor coming up */
int sc_cylin; /* where we think the head is */
void *sc_sdhook; /* shutdownhook cookie */
TAILQ_ENTRY(fd_softc) sc_drivechain;
int sc_ops; /* I/O ops since last switch */
struct buf sc_q; /* head of buf chain */
@ -542,6 +544,9 @@ fdattach(parent, self, aux)
*/
mountroot_hook_establish(fd_mountroot_hook, &fd->sc_dv);
/* Make sure the drive motor gets turned off at shutdown time. */
fd->sc_sdhook = shutdownhook_establish(fd_motor_off, fd);
/* XXX Need to do some more fiddling with sc_dk. */
dk_establish(&fd->sc_dk, &fd->sc_dv);
}