Mercurial > nomad > experimental
changeset 1279:ea51bd7cb9f5
common: inform fscall_read callers about actual byte count read
READ may not fill the entire buffer and therefore the caller needs to know
how many bytes it is getting back.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sun, 18 Dec 2022 09:54:12 -0500 |
parents | e5b305913b1c |
children | 250aed8c967d |
files | src/common/fscall.c src/common/include/nomad/fscall.h src/fs/nomadfs.c |
diffstat | 3 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/common/fscall.c Sun Dec 18 09:45:56 2022 -0500 +++ b/src/common/fscall.c Sun Dec 18 09:54:12 2022 -0500 @@ -375,7 +375,7 @@ } int fscall_read(struct fscall_state *state, const uint32_t handle, - void *buf, size_t len, uint64_t off) + void *buf, size_t len, uint64_t off, size_t *len_r) { struct rpc_read_req read_req; struct rpc_read_res read_res; @@ -399,8 +399,8 @@ if (ret) return ret; - FIXME("NRPC_READ may return length != the requested length"); memcpy(buf, read_res.data.data_val, read_res.data.data_len); + *len_r = read_res.data.data_len; free(read_res.data.data_val);
--- a/src/common/include/nomad/fscall.h Sun Dec 18 09:45:56 2022 -0500 +++ b/src/common/include/nomad/fscall.h Sun Dec 18 09:54:12 2022 -0500 @@ -69,7 +69,7 @@ const char *name, const struct noid *desired, bool rmdir); extern int fscall_read(struct fscall_state *state, const uint32_t handle, - void *buf, size_t len, uint64_t off); + void *buf, size_t len, uint64_t off, size_t *len_r); extern int fscall_write(struct fscall_state *state, const uint32_t handle, const void *buf, size_t len, uint64_t off); extern int fscall_getdent(struct fscall_state *state, const uint32_t handle,