summaryrefslogtreecommitdiff
path: root/libdiskfs/rdwr-internal.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-10-19 19:42:56 +0000
committerMiles Bader <miles@gnu.org>1995-10-19 19:42:56 +0000
commit4741594bc52c58d3bb009b98ac4d32d10a217f90 (patch)
tree5f7677ea13414fd5854869b701cb4ebcfabde114 /libdiskfs/rdwr-internal.c
parentdb7c68a28467a43e7c3c09f6103ba37a5a272a7b (diff)
(_diskfs_rdwr_internal):
Pass the second protection arg to diskfs_get_filemap. Only map our i/o region with as much permission as we need.
Diffstat (limited to 'libdiskfs/rdwr-internal.c')
-rw-r--r--libdiskfs/rdwr-internal.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libdiskfs/rdwr-internal.c b/libdiskfs/rdwr-internal.c
index 900467cb..727c06b3 100644
--- a/libdiskfs/rdwr-internal.c
+++ b/libdiskfs/rdwr-internal.c
@@ -17,6 +17,7 @@
#include "priv.h"
#include <string.h>
+#include <fcntl.h>
/* Actually read or write a file. The file size must already permit
the requested access. NP is the file to read/write. DATA is a buffer
@@ -36,7 +37,8 @@ _diskfs_rdwr_internal (struct node *np,
int winoff;
volatile int cc;
memory_object_t memobj;
- int err = 0;
+ vm_prot_t prot = dir ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ;
+ error_t err = 0;
if (dir)
assert (!diskfs_readonly);
@@ -49,7 +51,7 @@ _diskfs_rdwr_internal (struct node *np,
np->dn_set_atime = 1;
}
- memobj = diskfs_get_filemap (np);
+ memobj = diskfs_get_filemap (np, prot);
while (amt > 0)
{
@@ -60,8 +62,7 @@ _diskfs_rdwr_internal (struct node *np,
vax has a 1024 pagesize and with 8k blocks that seems like a
reasonable number. */
err = vm_map (mach_task_self (), (u_int *)&window, 8 * __vm_page_size,
- 0, 1, memobj, winoff, 0, VM_PROT_READ|VM_PROT_WRITE,
- VM_PROT_READ|VM_PROT_WRITE, VM_INHERIT_NONE);
+ 0, 1, memobj, winoff, 0, prot, prot, VM_INHERIT_NONE);
assert_perror (err);
diskfs_register_memory_fault_area (diskfs_get_filemap_pager_struct (np),
winoff, window, 8 * __vm_page_size);