1 |
/* Copy store backend |
/* Copy store backend |
2 |
|
|
3 |
Copyright (C) 1995,96,97,99,2000,01 Free Software Foundation, Inc. |
Copyright (C) 1995,96,97,99,2000,01,02 Free Software Foundation, Inc. |
4 |
Written by Miles Bader <miles@gnu.org> |
Written by Miles Bader <miles@gnu.org> |
5 |
|
|
6 |
This file is part of the GNU Hurd. |
This file is part of the GNU Hurd. |
36 |
char *data = store->hook + (addr * store->block_size); |
char *data = store->hook + (addr * store->block_size); |
37 |
|
|
38 |
if (page_aligned (data) && page_aligned (amount)) |
if (page_aligned (data) && page_aligned (amount)) |
39 |
{ |
/* When reading whole pages, we can avoid any real copying. */ |
40 |
/* When reading whole pages, we can avoid any real copying. */ |
return vm_read (mach_task_self (), |
41 |
error_t err = vm_read (mach_task_self (), |
(vm_address_t) data, amount, |
42 |
(vm_address_t) data, amount, |
(pointer_t *) buf, len); |
|
(pointer_t *) buf, len); |
|
|
*len *= vm_page_size; |
|
|
return err; |
|
|
} |
|
43 |
|
|
44 |
if (*len < amount) |
if (*len < amount) |
45 |
/* Have to allocate memory for the return value. */ |
/* Have to allocate memory for the return value. */ |