Signed-off-by: Karel Zak <kzak@redhat.com>
#include "blkdev.h"
#include "pathnames.h"
#include "wholedisk.h"
+#include "writeall.h"
#ifdef HAVE_LIBUUID
# ifdef HAVE_UUID_UUID_H
return 1;
}
-
-static int
-write_all(int fd, const void *buf, size_t count) {
- while(count) {
- ssize_t tmp;
-
- errno = 0;
- tmp = write(fd, buf, count);
- if (tmp > 0) {
- count -= tmp;
- if (count)
- buf += tmp;
- } else if (errno != EINTR && errno != EAGAIN)
- return -1;
- }
- return 0;
-}
-
static void
zap_bootbits(int fd, const char *devname, int force)
{
crc32.h \
mangle.h \
strtosize.h \
- xstrncpy.h
+ xstrncpy.h \
+ writeall.h
--- /dev/null
+#ifndef UTIL_LINUX_WRITEALL_H
+#define UTIL_LINUX_WRITEALL_H
+
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+static inline int write_all(int fd, const void *buf, size_t count)
+{
+ while(count) {
+ ssize_t tmp;
+
+ errno = 0;
+ tmp = write(fd, buf, count);
+ if (tmp > 0) {
+ count -= tmp;
+ if (count)
+ buf += tmp;
+ } else if (errno != EINTR && errno != EAGAIN)
+ return -1;
+ }
+ return 0;
+}
+
+#endif /* UTIL_LINUX_WRITEALL_H */