summaryrefslogtreecommitdiff
path: root/ext2fs/dir.c
diff options
context:
space:
mode:
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,