summaryrefslogtreecommitdiff
path: root/sys/dev/ata
diff options
context:
space:
mode:
authormycroft <mycroft@NetBSD.org>1995-03-23 12:11:07 +0000
committermycroft <mycroft@NetBSD.org>1995-03-23 12:11:07 +0000
commit06d0a67a076bc65f8a973288cb89f2f29d01f0d9 (patch)
tree5fd683305d1c6fcec328fe1c13e0b57de24f0b8d /sys/dev/ata
parentd21add8356e0d6506a294985465611a2d48b1209 (diff)
Check for read-only media in open(), not write().
Diffstat (limited to 'sys/dev/ata')
-rw-r--r--sys/dev/ata/wd.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c
index 9d2a4b6fb15..d65eaf30cb9 100644
--- a/sys/dev/ata/wd.c
+++ b/sys/dev/ata/wd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wd.c,v 1.132 1995/03/23 11:33:32 mycroft Exp $ */
+/* $NetBSD: wd.c,v 1.133 1995/03/23 12:12:26 mycroft Exp $ */
/*
* Copyright (c) 1994, 1995 Charles Hannum. All rights reserved.
@@ -396,14 +396,6 @@ wdstrategy(bp)
goto bad;
}
-#if 0
- /* "Soft" write protect check. */
- if ((wd->sc_flags & WDF_WRITEPROT) && (bp->b_flags & B_READ) == 0) {
- bp->b_error = EROFS;
- goto bad;
- }
-#endif
-
/* If it's a null transfer, return immediately. */
if (bp->b_bcount == 0)
goto done;
@@ -928,6 +920,15 @@ wdopen(dev, flag, fmt)
wdunlock(wd);
}
+#if 0
+ /* Check for read-only media. */
+ if ((flag & FWRITE) != 0 &&
+ (wd->sc_flags & WDF_WRITEPROT) != 0) {
+ error = EROFS;
+ goto bad;
+ }
+#endif
+
/* Check that the partition exists. */
if (part != RAW_PART &&
(part >= wd->sc_dk.dk_label.d_npartitions ||