summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1999-07-03 23:53:01 +0000
committerThomas Bushnell <thomas@gnu.org>1999-07-03 23:53:01 +0000
commit1584a9200a511a6ce330917be8dcaf957bb7c2e2 (patch)
tree3c1ba5995adf8ab6fd72f7eab6a6df1ba19b99a5
parent157a9dcf73718cf04690b1646995549a52cee43d (diff)
1999-07-03 Thomas Bushnell, BSG <tb@mit.edu>
* bunzip2.c (bunzip2): Use munmap instead of vm_deallocate. (store_bunzip2_create): Likewise. * rdwr.c (store_read): Likewise. * gunzip.c (gunzip): Likewise. (store_gunzip_create): Likewise. * enc.c (store_enc_dealloc): Likewise. * copy.c (copy_cleanup): Likewise.
-rw-r--r--libstore/ChangeLog10
-rw-r--r--libstore/bunzip2.c15
-rw-r--r--libstore/copy.c4
-rw-r--r--libstore/enc.c17
-rw-r--r--libstore/gunzip.c17
-rw-r--r--libstore/rdwr.c13
6 files changed, 34 insertions, 42 deletions
diff --git a/libstore/ChangeLog b/libstore/ChangeLog
index 0753f0dd..3f01f6df 100644
--- a/libstore/ChangeLog
+++ b/libstore/ChangeLog
@@ -1,3 +1,13 @@
+1999-07-03 Thomas Bushnell, BSG <tb@mit.edu>
+
+ * bunzip2.c (bunzip2): Use munmap instead of vm_deallocate.
+ (store_bunzip2_create): Likewise.
+ * rdwr.c (store_read): Likewise.
+ * gunzip.c (gunzip): Likewise.
+ (store_gunzip_create): Likewise.
+ * enc.c (store_enc_dealloc): Likewise.
+ * copy.c (copy_cleanup): Likewise.
+
1999-05-23 Roland McGrath <roland@baalperazim.frob.com>
* remap.c (remap_open): Don't multiply by 512. Offsets and sizes are
diff --git a/libstore/bunzip2.c b/libstore/bunzip2.c
index a09aa9f6..71a69db6 100644
--- a/libstore/bunzip2.c
+++ b/libstore/bunzip2.c
@@ -101,8 +101,7 @@ bunzip2 (struct store *from, void **buf, size_t *buf_len)
if (new_in_buf != in_buf)
{
if (in_buf_len > 0)
- vm_deallocate (mach_task_self (),
- (vm_address_t)in_buf, in_buf_len);
+ munmap (in_buf, in_buf_len);
in_buf = new_in_buf;
in_buf_len = new_in_buf_len;
}
@@ -146,8 +145,7 @@ bunzip2 (struct store *from, void **buf, size_t *buf_len)
/* Copy the old buffer into the start of the new & free it. */
bcopy (old_buf, new_buf, out_buf_offs);
- vm_deallocate (mach_task_self (),
- (vm_address_t)old_buf, old_buf_len);
+ munmap (old_buf, old_buf_len);
*buf = new_buf;
}
@@ -193,20 +191,19 @@ bunzip2 (struct store *from, void **buf, size_t *buf_len)
mutex_unlock (&bunzip2_lock);
if (in_buf_len > 0)
- vm_deallocate (mach_task_self (), (vm_address_t)in_buf, in_buf_len);
+ munmap (in_buf, in_buf_len);
if (zerr)
{
if (*buf_len > 0)
- vm_deallocate (mach_task_self (), (vm_address_t)*buf, *buf_len);
+ munmap (*buf, *buf_len);
}
else if (out_buf_offs < *buf_len)
/* Trim the output buffer to be the right length. */
{
size_t end = round_page (out_buf_offs);
if (end < *buf_len)
- vm_deallocate (mach_task_self (),
- (vm_address_t)(*buf + end), *buf_len - end);
+ munmap (*buf + end, *buf_len - end);
*buf_len = out_buf_offs;
}
@@ -226,7 +223,7 @@ store_bunzip2_create (struct store *from, int flags, struct store **store)
{
err = store_buffer_create (buf, buf_len, flags, store);
if (err)
- vm_deallocate (mach_task_self (), (vm_address_t)buf, buf_len);
+ munmap (buf, buf_len);
else
store_free (from);
}
diff --git a/libstore/copy.c b/libstore/copy.c
index e5e83121..7856c634 100644
--- a/libstore/copy.c
+++ b/libstore/copy.c
@@ -1,6 +1,6 @@
/* Copy store backend
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -114,7 +114,7 @@ void
copy_cleanup (struct store *store)
{
if (store->size > 0)
- vm_deallocate (mach_task_self (), (vm_address_t)store->hook, store->size);
+ munmap (store->hook, store->size);
}
/* Copy any format-dependent fields in FROM to TO; if there's some reason
diff --git a/libstore/enc.c b/libstore/enc.c
index ec5510ab..8ab76f4f 100644
--- a/libstore/enc.c
+++ b/libstore/enc.c
@@ -1,6 +1,6 @@
/* Store wire encoding/decoding
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
This file is part of the GNU Hurd.
@@ -60,25 +60,18 @@ store_enc_dealloc (struct store_enc *enc)
}
if (enc->ports != enc->init_ports)
- vm_deallocate (mach_task_self (),
- (vm_address_t)enc->ports,
- enc->num_ports * sizeof (*enc->ports));
+ munmap (enc->ports, enc->num_ports * sizeof (*enc->ports));
}
if (enc->ints && enc->num_ints > 0 && enc->ints != enc->init_ints)
- vm_deallocate (mach_task_self (),
- (vm_address_t)enc->ints,
- enc->num_ints * sizeof (*enc->ints));
+ munmap (enc->ints, enc->num_ints * sizeof (*enc->ints));
if (enc->offsets && enc->num_offsets > 0
&& enc->offsets != enc->init_offsets)
- vm_deallocate (mach_task_self (),
- (vm_address_t)enc->offsets,
- enc->num_offsets * sizeof (*enc->offsets));
+ munmap (enc->offsets, enc->num_offsets * sizeof (*enc->offsets));
if (enc->data && enc->data_len > 0 && enc->data != enc->init_data)
- vm_deallocate (mach_task_self (),
- (vm_address_t)enc->data, enc->data_len);
+ munmap (enc->data, enc->data_len);
/* For good measure... */
bzero (enc, sizeof (*enc));
diff --git a/libstore/gunzip.c b/libstore/gunzip.c
index 230ce1b0..261baee3 100644
--- a/libstore/gunzip.c
+++ b/libstore/gunzip.c
@@ -1,6 +1,6 @@
/* Decompressing store backend
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
This file is part of the GNU Hurd.
@@ -108,8 +108,7 @@ gunzip (struct store *from, void **buf, size_t *buf_len)
if (new_in_buf != in_buf)
{
if (in_buf_len > 0)
- vm_deallocate (mach_task_self (),
- (vm_address_t)in_buf, in_buf_len);
+ munmap (in_buf, in_buf_len);
in_buf = new_in_buf;
in_buf_len = new_in_buf_len;
}
@@ -153,8 +152,7 @@ gunzip (struct store *from, void **buf, size_t *buf_len)
/* Copy the old buffer into the start of the new & free it. */
bcopy (old_buf, new_buf, out_buf_offs);
- vm_deallocate (mach_task_self (),
- (vm_address_t)old_buf, old_buf_len);
+ munmap (old_buf, old_buf_len);
*buf = new_buf;
}
@@ -209,20 +207,19 @@ gunzip (struct store *from, void **buf, size_t *buf_len)
mutex_unlock (&unzip_lock);
if (in_buf_len > 0)
- vm_deallocate (mach_task_self (), (vm_address_t)in_buf, in_buf_len);
+ munmap (in_buf, in_buf_len);
if (zerr)
{
if (*buf_len > 0)
- vm_deallocate (mach_task_self (), (vm_address_t)*buf, *buf_len);
+ munmap (*buf, *buf_len);
}
else if (out_buf_offs < *buf_len)
/* Trim the output buffer to be the right length. */
{
size_t end = round_page (out_buf_offs);
if (end < *buf_len)
- vm_deallocate (mach_task_self (),
- (vm_address_t)(*buf + end), *buf_len - end);
+ munmap (*buf + end, *buf_len - end);
*buf_len = out_buf_offs;
}
@@ -242,7 +239,7 @@ store_gunzip_create (struct store *from, int flags, struct store **store)
{
err = store_buffer_create (buf, buf_len, flags, store);
if (err)
- vm_deallocate (mach_task_self (), (vm_address_t)buf, buf_len);
+ munmap (buf, buf_len);
else
store_free (from);
}
diff --git a/libstore/rdwr.c b/libstore/rdwr.c
index 4b3cf84f..27c2916d 100644
--- a/libstore/rdwr.c
+++ b/libstore/rdwr.c
@@ -1,6 +1,6 @@
/* Store I/O
- Copyright (C) 1995, 96, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1995, 96, 97, 98, 1999 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
This file is part of the GNU Hurd.
@@ -211,8 +211,7 @@ store_read (struct store *store,
if (seg_buf != buf_end)
{
bcopy (seg_buf, buf_end, seg_buf_len);
- vm_deallocate (mach_task_self (),
- (vm_address_t)seg_buf, seg_buf_len);
+ munmap (seg_buf, seg_buf_len);
}
buf_end += seg_buf_len;
amount -= seg_buf_len;
@@ -261,16 +260,12 @@ store_read (struct store *store,
if (whole_buf != *buf)
{
if (err)
- vm_deallocate (mach_task_self (),
- (vm_address_t)whole_buf, whole_buf_len);
+ munmap (whole_buf, whole_buf_len);
else
{
vm_size_t unused = whole_buf_len - round_page (*len);
if (unused)
- vm_deallocate (mach_task_self (),
- (vm_address_t)whole_buf + whole_buf_len
- - unused,
- unused);
+ munmap (whole_buf + whole_buf_len - unused, unused);
*buf = whole_buf;
}
}