diff options
author | Roland McGrath <roland@gnu.org> | 1999-02-28 20:49:09 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1999-02-28 20:49:09 +0000 |
commit | caa1666dd2eb38fbc72dab53a588401c2da90f89 (patch) | |
tree | 8d8c0c6b08299101c59d9f14fafe47e7b2d5e5bd /libdiskfs | |
parent | 96bea14c36260f932db458d59e2b8f18340eaad0 (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')
-rw-r--r-- | libdiskfs/io-revoke.c | 5 | ||||
-rw-r--r-- | libdiskfs/readonly.c | 16 |
2 files changed, 9 insertions, 12 deletions
diff --git a/libdiskfs/io-revoke.c b/libdiskfs/io-revoke.c index 0f15eaad..d42fb6c1 100644 --- a/libdiskfs/io-revoke.c +++ b/libdiskfs/io-revoke.c @@ -31,8 +31,7 @@ diskfs_S_io_revoke (struct protid *cred) { struct protid *user = port; - if ((user->pi.class == diskfs_protid_class) - && (user != cred) + if ((user != cred) && (user->po->np == np)) ports_destroy_right (user); return 0; @@ -53,7 +52,7 @@ diskfs_S_io_revoke (struct protid *cred) return err; ports_inhibit_bucket_rpcs (diskfs_port_bucket); - ports_bucket_iterate (diskfs_port_bucket, iterator_function); + ports_class_iterate (diskfs_protid_class, iterator_function); ports_resume_bucket_rpcs (diskfs_port_bucket); return 0; 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)) |