From 0804a80954bf9b8c11392d77a4933ec0a4ff635b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 8 Apr 2017 23:02:48 +0200 Subject: Add blind-translate and fix errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/util/io.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/util/io.h') diff --git a/src/util/io.h b/src/util/io.h index 81b8f51..44e222d 100644 --- a/src/util/io.h +++ b/src/util/io.h @@ -1,8 +1,9 @@ /* See LICENSE file for copyright and license details. */ -#define ewriteall(...) enwriteall(1, __VA_ARGS__) -#define ereadall(...) enreadall(1, __VA_ARGS__) -#define epwriteall(...) enpwriteall(1, __VA_ARGS__) +#define ewriteall(...) enwriteall(1, __VA_ARGS__) +#define ereadall(...) enreadall(1, __VA_ARGS__) +#define epwriteall(...) enpwriteall(1, __VA_ARGS__) +#define ewritezeroes(...) enwritezeroes(1, __VA_ARGS__) int writeall(int fd, void *buf, size_t n); @@ -32,3 +33,12 @@ enpwriteall(int status, int fd, void *buf, size_t n, size_t ptr, const char *fna if (pwriteall(fd, buf, n, ptr)) enprintf(status, "pwrite %s:", fname); } + +int writezeroes(int fd, void *buf, size_t bufsize, size_t n); + +static inline void +enwritezeroes(int status, int fd, void *buf, size_t bufsize, size_t n, const char *fname) +{ + if (writezeroes(fd, buf, bufsize, n)) + enprintf(status, "write %s:", fname); +} -- cgit v1.2.3-70-g09d2