diff options
author | Miles Bader <miles@gnu.org> | 1995-10-19 20:23:12 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-10-19 20:23:12 +0000 |
commit | e58710bde05d456347c85b2a27281262b5ad040b (patch) | |
tree | 65bdd0768a2739dda4b4ce70be72b6a7f9888cf2 /ufs | |
parent | 71955f28ace790b6349954e0cd3300ba6a4e623a (diff) |
(diskfs_lookup, diskfs_dirempty): Give diskfs_get_filemap a protection arg.
Diffstat (limited to 'ufs')
-rw-r--r-- | ufs/dir.c | 15 | ||||
-rw-r--r-- | ufs/sizes.c | 4 |
2 files changed, 8 insertions, 11 deletions
@@ -95,6 +95,8 @@ diskfs_lookup (struct node *dp, char *name, enum lookup_type type, struct node *np = 0; int retry_dotdot = 0; memory_object_t memobj; + vm_prot_t prot = + (type == LOOKUP) ? VM_PROT_READ : (VM_PROT_READ | VM_PROT_WRITE); vm_address_t buf = 0; vm_size_t buflen = 0; int blockaddr; @@ -136,17 +138,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; @@ -664,7 +661,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, diff --git a/ufs/sizes.c b/ufs/sizes.c index f4f81393..0dadac28 100644 --- a/ufs/sizes.c +++ b/ufs/sizes.c @@ -101,7 +101,7 @@ diskfs_truncate (struct node *np, pager_change_attributes (upi->p, MAY_CACHE, MEMORY_OBJECT_COPY_NONE, 1); - obj = diskfs_get_filemap (np); + obj = diskfs_get_filemap (np, VM_PROT_READ | VM_PROT_WRITE); poke_pages (obj, round_page (length), round_page (np->allocsize)); mach_port_deallocate (mach_task_self (), obj); pager_flush_some (upi->p, round_page (length), @@ -588,7 +588,7 @@ diskfs_grow (struct node *np, { mach_port_t obj; - obj = diskfs_get_filemap (np); + obj = diskfs_get_filemap (np, VM_PROT_READ | VM_PROT_WRITE); poke_pages (obj, trunc_page (poke_off), round_page (poke_off + poke_len)); mach_port_deallocate (mach_task_self (), obj); |