Skip to content

Commit dc1b8b2

Browse files
committed
Revert "wrapper: introduce writev(3p) wrappers"
This reverts commit 1970fce; let's not use writev() for now.
1 parent 74fbd8a commit dc1b8b2

File tree

4 files changed

+0
-59
lines changed

4 files changed

+0
-59
lines changed

wrapper.c

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -323,47 +323,6 @@ ssize_t write_in_full(int fd, const void *buf, size_t count)
323323
return total;
324324
}
325325

326-
ssize_t writev_in_full(int fd, struct iovec *iov, int iovcnt)
327-
{
328-
ssize_t total_written = 0;
329-
330-
while (iovcnt) {
331-
ssize_t bytes_written = writev(fd, iov, iovcnt);
332-
if (bytes_written < 0) {
333-
if (errno == EINTR || errno == EAGAIN)
334-
continue;
335-
return -1;
336-
}
337-
if (!bytes_written) {
338-
errno = ENOSPC;
339-
return -1;
340-
}
341-
342-
total_written += bytes_written;
343-
344-
/*
345-
* We first need to discard any iovec entities that have been
346-
* fully written.
347-
*/
348-
while (iovcnt && (size_t)bytes_written >= iov->iov_len) {
349-
bytes_written -= iov->iov_len;
350-
iov++;
351-
iovcnt--;
352-
}
353-
354-
/*
355-
* Finally, we need to adjust the last iovec in case we have
356-
* performed a partial write.
357-
*/
358-
if (iovcnt && bytes_written) {
359-
iov->iov_base = (char *) iov->iov_base + bytes_written;
360-
iov->iov_len -= bytes_written;
361-
}
362-
}
363-
364-
return total_written;
365-
}
366-
367326
ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset)
368327
{
369328
char *p = buf;

wrapper.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@ ssize_t read_in_full(int fd, void *buf, size_t count);
4747
ssize_t write_in_full(int fd, const void *buf, size_t count);
4848
ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset);
4949

50-
/*
51-
* Try to write all iovecs. Returns -1 in case an error occurred with a proper
52-
* errno set, the number of bytes written otherwise.
53-
*
54-
* Note that the iovec will be modified as a result of this call to adjust for
55-
* partial writes!
56-
*/
57-
ssize_t writev_in_full(int fd, struct iovec *iov, int iovcnt);
58-
5950
static inline ssize_t write_str_in_full(int fd, const char *str)
6051
{
6152
return write_in_full(fd, str, strlen(str));

write-or-die.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,6 @@ void write_or_die(int fd, const void *buf, size_t count)
9696
}
9797
}
9898

99-
void writev_or_die(int fd, struct iovec *iov, int iovlen)
100-
{
101-
if (writev_in_full(fd, iov, iovlen) < 0) {
102-
check_pipe(errno);
103-
die_errno("writev error");
104-
}
105-
}
106-
10799
void fwrite_or_die(FILE *f, const void *buf, size_t count)
108100
{
109101
if (fwrite(buf, 1, count, f) != count)

write-or-die.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ void fprintf_or_die(FILE *, const char *fmt, ...);
77
void fwrite_or_die(FILE *f, const void *buf, size_t count);
88
void fflush_or_die(FILE *f);
99
void write_or_die(int fd, const void *buf, size_t count);
10-
void writev_or_die(int fd, struct iovec *iov, int iovlen);
1110

1211
/*
1312
* These values are used to help identify parts of a repository to fsync.

0 commit comments

Comments
 (0)