summaryrefslogtreecommitdiff
path: root/libdiskfs/readonly.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-02-28 20:49:09 +0000
committerRoland McGrath <roland@gnu.org>1999-02-28 20:49:09 +0000
commitcaa1666dd2eb38fbc72dab53a588401c2da90f89 (patch)
tree8d8c0c6b08299101c59d9f14fafe47e7b2d5e5bd /libdiskfs/readonly.c
parent96bea14c36260f932db458d59e2b8f18340eaad0 (diff)
1999-02-28 Roland McGrath <roland@baalperazim.frob.com>
* io-revoke.c (diskfs_S_io_revoke): Use ports_class_iterate. * readonly.c (diskfs_set_readonly): Likewise.
Diffstat (limited to 'libdiskfs/readonly.c')
-rw-r--r--libdiskfs/readonly.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/libdiskfs/readonly.c b/libdiskfs/readonly.c
index e4ba4401..02f583c8 100644
--- a/libdiskfs/readonly.c
+++ b/libdiskfs/readonly.c
@@ -1,6 +1,6 @@
/* Change to/from read-only
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -33,7 +33,7 @@ int
diskfs_check_readonly ()
{
error_t err;
-
+
if (diskfs_readonly)
return 1;
else
@@ -43,7 +43,7 @@ diskfs_check_readonly ()
err = diskfs_set_hypermetadata (1, 0);
if (err)
{
- error (0, 0,
+ error (0, 0,
"%s: MEDIA NOT WRITABLE; switching to READ-ONLY",
diskfs_disk_name ?: "-");
diskfs_hard_readonly = diskfs_readonly = 1;
@@ -76,15 +76,13 @@ diskfs_set_readonly (int readonly)
{
error_t peropen_writable (void *pi)
{
- if (((struct port_info *)pi)->class == diskfs_protid_class
- && (((struct protid *)pi)->po->openstat & O_WRITE))
- return EBUSY;
- else
- return 0;
+ struct protid *const cred = pi;
+ return (cred->po->openstat & O_WRITE) ? EBUSY : 0;
}
/* Any writable open files? */
- err = ports_bucket_iterate (diskfs_port_bucket, peropen_writable);
+ err = ports_class_iterate (diskfs_protid_class,
+ peropen_writable);
/* Any writable pagers? */
if (!err && (diskfs_max_user_pager_prot () & VM_PROT_WRITE))