summaryrefslogtreecommitdiff
path: root/libdiskfs/readonly.c
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1997-06-30 21:58:05 +0000
committerThomas Bushnell <thomas@gnu.org>1997-06-30 21:58:05 +0000
commita795457252de83a34d8802f0e37d440ba9505198 (patch)
treef64bf1c4a1c24b3437759decfd75c6a5ef0965fe /libdiskfs/readonly.c
parent740fad8677fc54536b060b88fe33585ed3a04b8d (diff)
Mon Jun 30 17:26:38 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* diskfs.h (diskfs_hard_readonly): New variable. (diskfs_readonly): Doc change. * readonly.c (diskfs_readonly): Provide initialized declaration. (diskfs_check_readonly): If we cannot write the media and so we switch to readonly, set diskfs_hard_readonly too. (diskfs_set_readonly): If diskfs_hard_readonly is set, then inhibit any attempt to clear readonly status.
Diffstat (limited to 'libdiskfs/readonly.c')
-rw-r--r--libdiskfs/readonly.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libdiskfs/readonly.c b/libdiskfs/readonly.c
index 5d5d9ba0..e4ba4401 100644
--- a/libdiskfs/readonly.c
+++ b/libdiskfs/readonly.c
@@ -1,6 +1,6 @@
/* Change to/from read-only
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -26,6 +26,8 @@
#include "priv.h"
int _diskfs_diskdirty;
+int diskfs_readonly = 0;
+int diskfs_hard_readonly = 0;
int
diskfs_check_readonly ()
@@ -44,7 +46,7 @@ diskfs_check_readonly ()
error (0, 0,
"%s: MEDIA NOT WRITABLE; switching to READ-ONLY",
diskfs_disk_name ?: "-");
- diskfs_readonly = 1;
+ diskfs_hard_readonly = diskfs_readonly = 1;
return 1;
}
_diskfs_diskdirty = 1;
@@ -62,6 +64,9 @@ diskfs_set_readonly (int readonly)
{
error_t err = 0;
+ if (diskfs_hard_readonly)
+ return readonly ? 0 : EROFS;
+
if (readonly != diskfs_readonly)
{
err = ports_inhibit_class_rpcs (diskfs_protid_class);