Implement DIOCLOCK and DIOCEJECT. DIOCEJECT is limited to removable
media. Fixes PR #1975.
This commit is contained in:
parent
489044a625
commit
c7a20f0ee3
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sd.c,v 1.85 1996/01/12 22:43:33 thorpej Exp $ */
|
||||
/* $NetBSD: sd.c,v 1.86 1996/01/30 18:24:47 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
|
||||
|
@ -713,6 +713,14 @@ sdioctl(dev, cmd, addr, flag, p)
|
|||
sd->flags &= ~SDF_WLABEL;
|
||||
return 0;
|
||||
|
||||
case DIOCLOCK:
|
||||
return scsi_prevent(sd->sc_link,
|
||||
(*(int *)addr) ? PR_PREVENT : PR_ALLOW, 0);
|
||||
|
||||
case DIOCEJECT:
|
||||
return ((sd->sc_link->flags & SDEV_REMOVABLE == 0) ? ENOTTY :
|
||||
scsi_start(sd->sc_link, SSS_STOP|SSS_LOEJ, 0));
|
||||
|
||||
default:
|
||||
if (SDPART(dev) != RAW_PART)
|
||||
return ENOTTY;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sd.c,v 1.85 1996/01/12 22:43:33 thorpej Exp $ */
|
||||
/* $NetBSD: sd.c,v 1.86 1996/01/30 18:24:47 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
|
||||
|
@ -713,6 +713,14 @@ sdioctl(dev, cmd, addr, flag, p)
|
|||
sd->flags &= ~SDF_WLABEL;
|
||||
return 0;
|
||||
|
||||
case DIOCLOCK:
|
||||
return scsi_prevent(sd->sc_link,
|
||||
(*(int *)addr) ? PR_PREVENT : PR_ALLOW, 0);
|
||||
|
||||
case DIOCEJECT:
|
||||
return ((sd->sc_link->flags & SDEV_REMOVABLE == 0) ? ENOTTY :
|
||||
scsi_start(sd->sc_link, SSS_STOP|SSS_LOEJ, 0));
|
||||
|
||||
default:
|
||||
if (SDPART(dev) != RAW_PART)
|
||||
return ENOTTY;
|
||||
|
|
Loading…
Reference in New Issue