diff options
Diffstat (limited to 'libstore')
-rw-r--r-- | libstore/ChangeLog | 8 | ||||
-rw-r--r-- | libstore/copy.c | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/libstore/ChangeLog b/libstore/ChangeLog index cb529cee..fe1405fc 100644 --- a/libstore/ChangeLog +++ b/libstore/ChangeLog @@ -1,3 +1,11 @@ +2001-01-07 Marcus Brinkmann <marcus@gnu.org> + + * copy.c: Include <mach.h>. New macro page_aligned. + (copy_write): Cast buf to vm_address_t in call to vm_write. + Dereference amount for memcpy. + (copy_read): Add len parameter to vm_read, remove redundant following + len assignment. + 2000-12-20 Roland McGrath <roland@frob.com> * zero.c (zero_open): Check for END being null after strtoul call. diff --git a/libstore/copy.c b/libstore/copy.c index b5f00c3b..6a4d0d5a 100644 --- a/libstore/copy.c +++ b/libstore/copy.c @@ -24,6 +24,9 @@ #include <string.h> #include <malloc.h> #include <sys/mman.h> +#include <mach.h> + +#define page_aligned(addr) (((size_t) addr & (vm_page_size - 1)) == 0) #include "store.h" @@ -37,8 +40,7 @@ copy_read (struct store *store, { /* When reading whole pages, we can avoid any real copying. */ error_t err = vm_read (mach_task_self (), - (vm_address_t) data, amount, (pointer_t *) buf); - *len = amount; + (vm_address_t) data, amount, (pointer_t *) buf, len); return err; } @@ -65,12 +67,12 @@ copy_write (struct store *store, { /* When reading whole pages, we can avoid any real copying. */ error_t err = vm_write (mach_task_self (), - (vm_address_t) data, buf, len); + (vm_address_t) data, (vm_address_t) buf, len); *amount = len; return err; } - memcpy (data, buf, amount); + memcpy (data, buf, *amount); *amount = len; return 0; } |