Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/scsipi Prevent detaching an open device unless forced.
details: https://anonhg.NetBSD.org/src/rev/41fc4bc79c07
branches: trunk
changeset: 330500:41fc4bc79c07
user: hannken <hannken%NetBSD.org@localhost>
date: Sat Jul 12 12:13:01 2014 +0000
description:
Prevent detaching an open device unless forced.
diffstat:
sys/dev/scsipi/cd.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (28 lines):
diff -r 71405ecdd06c -r 41fc4bc79c07 sys/dev/scsipi/cd.c
--- a/sys/dev/scsipi/cd.c Sat Jul 12 12:11:22 2014 +0000
+++ b/sys/dev/scsipi/cd.c Sat Jul 12 12:13:01 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cd.c,v 1.319 2014/04/18 06:23:32 martin Exp $ */
+/* $NetBSD: cd.c,v 1.320 2014/07/12 12:13:01 hannken Exp $ */
/*-
* Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.319 2014/04/18 06:23:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.320 2014/07/12 12:13:01 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -313,6 +313,9 @@
struct cd_softc *cd = device_private(self);
int s, bmaj, cmaj, i, mn;
+ if (cd->sc_dk.dk_openmask != 0 && (flags & DETACH_FORCE) == 0)
+ return EBUSY;
+
/* locate the major number */
bmaj = bdevsw_lookup_major(&cd_bdevsw);
cmaj = cdevsw_lookup_major(&cd_cdevsw);
Home |
Main Index |
Thread Index |
Old Index