summaryrefslogtreecommitdiff
path: root/ext2fs/dir.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-10-20 23:32:37 +0000
committerMiles Bader <miles@gnu.org>1995-10-20 23:32:37 +0000
commitc154f2a8c3cc5adca9cd2829266a23a583c76629 (patch)
tree1d754b53fac73dcf5c21cfa571fdd80b0da6475e /ext2fs/dir.c
parent075122653ab078d87aac136ca51944bcf6684091 (diff)
(diskfs_lookup, diskfs_dirempty): Give diskfs_get_filemap a protection arg.
Diffstat (limited to 'ext2fs/dir.c')
-rw-r--r--ext2fs/dir.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/ext2fs/dir.c b/ext2fs/dir.c
index 6e6e4a57..5e6e1a53 100644
--- a/ext2fs/dir.c
+++ b/ext2fs/dir.c
@@ -101,6 +101,8 @@ diskfs_lookup (struct node *dp, char *name, enum lookup_type type,
int spec_dotdot;
struct node *np = 0;
int retry_dotdot = 0;
+ vm_prot_t prot =
+ (type == LOOKUP) ? VM_PROT_READ : (VM_PROT_READ | VM_PROT_WRITE);
memory_object_t memobj;
vm_address_t buf = 0;
vm_size_t buflen = 0;
@@ -143,17 +145,12 @@ diskfs_lookup (struct node *dp, char *name, enum lookup_type type,
ds->stat = LOOKING;
/* Map in the directory contents. */
- memobj = diskfs_get_filemap (dp);
+ memobj = diskfs_get_filemap (dp, prot);
buf = 0;
/* We allow extra space in case we have to do an EXTEND. */
buflen = round_page (dp->dn_stat.st_size + DIRBLKSIZ);
- if (type == LOOKUP)
- /* Map read-only; we won't be writing */
- err = vm_map (mach_task_self (), &buf, buflen, 0, 1, memobj, 0, 0,
- VM_PROT_READ, VM_PROT_READ, 0);
- else
- err = vm_map (mach_task_self (), &buf, buflen, 0, 1, memobj, 0, 0,
- VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE, 0);
+ err = vm_map (mach_task_self (),
+ &buf, buflen, 0, 1, memobj, 0, 0, prot, prot, 0);
mach_port_deallocate (mach_task_self (), memobj);
inum = 0;
@@ -666,7 +663,7 @@ diskfs_dirempty(struct node *dp,
memory_object_t memobj;
error_t err;
- memobj = diskfs_get_filemap (dp);
+ memobj = diskfs_get_filemap (dp, VM_PROT_READ);
buf = 0;
err = vm_map (mach_task_self (), &buf, dp->dn_stat.st_size, 0,