aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/io.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/util/io.h16
1 files changed, 13 insertions, 3 deletions
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);
+}