summaryrefslogtreecommitdiff
path: root/libdiskfs
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
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')
-rw-r--r--libdiskfs/ChangeLog10
-rw-r--r--libdiskfs/diskfs.h9
-rw-r--r--libdiskfs/readonly.c9
3 files changed, 23 insertions, 5 deletions
diff --git a/libdiskfs/ChangeLog b/libdiskfs/ChangeLog
index 87829b0e..55f58a77 100644
--- a/libdiskfs/ChangeLog
+++ b/libdiskfs/ChangeLog
@@ -1,3 +1,13 @@
+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.
+
1997-06-23 Miles Bader <miles@gnu.ai.mit.edu>
* peropen-make.c (diskfs_make_peropen): Initialize the
diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h
index e92158f4..4a87d16d 100644
--- a/libdiskfs/diskfs.h
+++ b/libdiskfs/diskfs.h
@@ -168,6 +168,9 @@ extern spin_lock_t diskfs_node_refcnt_lock;
extern int pager_port_type;
+/* Whether the filesystem is currently writable or not. */
+extern int diskfs_readonly;
+
struct pager;
@@ -204,9 +207,9 @@ extern int diskfs_link_max;
If this is exceeded, dir_pathtrans will return ELOOP. */
extern int diskfs_maxsymlinks;
-/* The user must define this variable and set it if the filesystem
- should be readonly. */
-extern int diskfs_readonly;
+/* This variable is defined by diskfs; the suer should set it if
+ the filesystem media cannot be made writeable. */
+extern int diskfs_hard_readonly;
/* The user must define this variable. Set this to be the node
of root of the filesystem. */
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);