diff options
author | Thomas Bushnell <thomas@gnu.org> | 1999-07-11 05:27:35 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1999-07-11 05:27:35 +0000 |
commit | b84e750c4abc10e5e1fb066abf1757b1ea42315e (patch) | |
tree | 0fd15665b342fa7da7cd95c771935c5f18553dc7 | |
parent | 601c2121002d89a651d94038483f0aae82ebb924 (diff) |
1999-07-06 Thomas Bushnell, BSG <tb@mit.edu>
* dir.c (diskfs_get_directs): Use mmap instead of vm_allocate.
* hyper.c (allocate_mod_map): Likewise.
(get_hypermetadata): Likewise.
* pager.c (get_page_buf): Likewise.
* hyper.c (diskfs_readonly_changed): Use mprotect instead of
vm_protect.
-rw-r--r-- | ext2fs/ChangeLog | 10 | ||||
-rw-r--r-- | ext2fs/dir.c | 3 | ||||
-rw-r--r-- | ext2fs/hyper.c | 13 | ||||
-rw-r--r-- | ext2fs/pager.c | 5 |
4 files changed, 20 insertions, 11 deletions
diff --git a/ext2fs/ChangeLog b/ext2fs/ChangeLog index 55cb00da..4194769e 100644 --- a/ext2fs/ChangeLog +++ b/ext2fs/ChangeLog @@ -1,6 +1,16 @@ 1999-07-10 Roland McGrath <roland@baalperazim.frob.com> * ext2fs.h: Add #include <sys/mman.h> for munmap decl. + +1999-07-06 Thomas Bushnell, BSG <tb@mit.edu> + + * dir.c (diskfs_get_directs): Use mmap instead of vm_allocate. + * hyper.c (allocate_mod_map): Likewise. + (get_hypermetadata): Likewise. + * pager.c (get_page_buf): Likewise. + + * hyper.c (diskfs_readonly_changed): Use mprotect instead of + vm_protect. 1999-07-03 Thomas Bushnell, BSG <tb@mit.edu> diff --git a/ext2fs/dir.c b/ext2fs/dir.c index 1bfe0dd7..03e5aab9 100644 --- a/ext2fs/dir.c +++ b/ext2fs/dir.c @@ -867,7 +867,8 @@ diskfs_get_directs (struct node *dp, allocsize = round_page (bufsiz); if (allocsize > *datacnt) - vm_allocate (mach_task_self (), (vm_address_t *) data, allocsize, 1); + *data = (vm_address_t) mmap (0, allocsize, PROT_READ|PROT_WRITE, + MAP_ANON, 0, 0); /* Scan through the entries to find ENTRY. If we encounter a -1 in the process then stop to fill it. When we run diff --git a/ext2fs/hyper.c b/ext2fs/hyper.c index 0132d2e6..d9a1bc70 100644 --- a/ext2fs/hyper.c +++ b/ext2fs/hyper.c @@ -45,10 +45,9 @@ allocate_mod_map (void) error_t err; /* One bit per filesystem block. */ mod_map_size = sblock->s_blocks_count >> 3; - err = - vm_allocate (mach_task_self (), - (vm_address_t *)&modified_global_blocks, mod_map_size, 1); - assert_perror (err); + modified_global_blocks = mmap (0, mod_map_size, PROT_READ|PROT_WRITE, + MAP_ANON, 0, 0); + assert (modified_global_blocks != (void *) -1); } else modified_global_blocks = 0; @@ -154,7 +153,8 @@ get_hypermetadata (void) diskfs_end_catch_exception (); /* A handy source of page-aligned zeros. */ - vm_allocate (mach_task_self (), &zeroblock, block_size, 1); + zeroblock = (vm_address_t) mmap (0, block_size, PROT_READ|PROT_WRITE, + MAP_ANON, 0, 0); } error_t @@ -193,8 +193,7 @@ diskfs_readonly_changed (int readonly) (*(readonly ? store_set_flags : store_clear_flags)) (store, STORE_READONLY); - vm_protect (mach_task_self (), (vm_address_t)disk_image, - store->size, 0, VM_PROT_READ | (readonly ? 0 : VM_PROT_WRITE)); + mprotect (disk_image, store->size, PROT_READ | (readonly ? 0 : PROT_WRITE)); if (!readonly && !(sblock->s_state & EXT2_VALID_FS)) ext2_warning ("UNCLEANED FILESYSTEM NOW WRITABLE"); diff --git a/ext2fs/pager.c b/ext2fs/pager.c index 6cdb7786..1ccc0154 100644 --- a/ext2fs/pager.c +++ b/ext2fs/pager.c @@ -87,9 +87,8 @@ get_page_buf () { error_t err; spin_unlock (&free_page_bufs_lock); - err = vm_allocate (mach_task_self (), - (vm_address_t *)&buf, vm_page_size, 1); - if (err) + buf = mmap (0, vm_page_size, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); + if (buf == (void *) -1) buf = 0; } else |