aboutsummaryrefslogtreecommitdiff
path: root/libstore/copy.c
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2023-05-09 00:31:04 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-05-10 02:18:14 +0200
commit070292f3118b75de9fc0e79fac6ca0186d157c28 (patch)
treebe54835aaa641d50e0453747092d5e53e1cd4958 /libstore/copy.c
parent4ba239ddbe936322bd7f9a8b17715ebaeb1cb800 (diff)
downloadhurd-070292f3118b75de9fc0e79fac6ca0186d157c28.tar.gz
hurd-070292f3118b75de9fc0e79fac6ca0186d157c28.tar.bz2
hurd-070292f3118b75de9fc0e79fac6ca0186d157c28.zip
libstore: Port to x86_64
Message-Id: <20230508213136.608575-10-bugaevc@gmail.com>
Diffstat (limited to 'libstore/copy.c')
-rw-r--r--libstore/copy.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libstore/copy.c b/libstore/copy.c
index c670ebf3..16b99390 100644
--- a/libstore/copy.c
+++ b/libstore/copy.c
@@ -36,10 +36,18 @@ copy_read (struct store *store, store_offset_t addr, size_t index,
char *data = store->hook + (addr * store->block_size);
if (page_aligned (data) && page_aligned (amount))
- /* When reading whole pages, we can avoid any real copying. */
- return vm_read (mach_task_self (),
- (vm_address_t) data, amount,
- (pointer_t *) buf, len);
+ {
+ /* When reading whole pages, we can avoid any real copying. */
+ error_t err;
+ mach_msg_type_number_t nread;
+ err = vm_read (mach_task_self (),
+ (vm_address_t) data, amount,
+ (pointer_t *) buf, &nread);
+ if (err)
+ return err;
+ *len = nread;
+ return 0;
+ }
if (*len < amount)
/* Have to allocate memory for the return value. */