summaryrefslogtreecommitdiff
path: root/src/shared/util.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-03-09 21:23:53 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-03-09 22:10:54 -0400
commita6dcc7e5924f9c27d3e9c6560a448b02ec28b65f (patch)
tree694aa3c7b5b2f4e61fb8c25d5bd8d1f023cf511e /src/shared/util.h
parentad7bcf526d5ec54838bc9411a0e09a293845a015 (diff)
Introduce loop_read_exact helper
Usually when using loop_read(), we want to read the full buffer. Add a helper that mirrors loop_write(), and returns 0 when full buffer was read, and an error otherwise. Use -ENODATA for the short read, to distinguish it from a read error.
Diffstat (limited to 'src/shared/util.h')
-rw-r--r--src/shared/util.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/shared/util.h b/src/shared/util.h
index 2de654f4c..d2da3e289 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -432,6 +432,7 @@ int sigaction_many(const struct sigaction *sa, ...);
int fopen_temporary(const char *path, FILE **_f, char **_temp_path);
ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll);
+int loop_read_exact(int fd, void *buf, size_t nbytes, bool do_poll);
int loop_write(int fd, const void *buf, size_t nbytes, bool do_poll);
bool is_device_path(const char *path);