diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-04-26 23:39:17 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-04-26 23:39:17 +0000 |
commit | 06760f99a1a8c5ac83efd6f907185404f239485d (patch) | |
tree | fed55e7d81273767c7fd65b66908b0ecb89e8f99 /usr.bin/tar | |
parent | 736725bcabf6c72ac5bfda301f3aa3b447ac4c6b (diff) | |
download | FreeBSD-src-06760f99a1a8c5ac83efd6f907185404f239485d.zip FreeBSD-src-06760f99a1a8c5ac83efd6f907185404f239485d.tar.gz |
Update write.c to follow recent API changes to libarchive.
Also, bump up the default copy buffer from 8k to 64k
to improve performance.
Diffstat (limited to 'usr.bin/tar')
-rw-r--r-- | usr.bin/tar/write.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c index 2d097fa..dace199 100644 --- a/usr.bin/tar/write.c +++ b/usr.bin/tar/write.c @@ -117,7 +117,8 @@ static void write_archive(struct archive *, struct bsdtar *); static void write_entry(struct bsdtar *, struct archive *, struct stat *, const char *pathname, unsigned pathlen, const char *accpath); -static int write_file_data(struct archive *, int fd); +static int write_file_data(struct bsdtar *, struct archive *, + int fd); static void write_heirarchy(struct bsdtar *, struct archive *, const char *); @@ -727,10 +728,8 @@ write_entry(struct bsdtar *bsdtar, struct archive *a, struct stat *st, archive_entry_set_gname(entry, lookup_gname(bsdtar, st->st_gid)); #ifdef HAVE_CHFLAGS - if (st->st_flags != 0) { - fflags = fflagstostr(st->st_flags); - archive_entry_set_fflags(entry, fflags); - } + if (st->st_flags != 0) + archive_entry_set_fflags(entry, st->st_flags, 0); #endif archive_entry_copy_stat(entry, st); @@ -772,7 +771,7 @@ write_entry(struct bsdtar *bsdtar, struct archive *a, struct stat *st, * that case, just skip the write. */ if (fd >= 0 && archive_entry_size(entry) > 0) - write_file_data(a, fd); + write_file_data(bsdtar, a, fd); cleanup: if (fd >= 0) @@ -790,12 +789,16 @@ cleanup: /* Helper function to copy file to archive, with stack-allocated buffer. */ static int -write_file_data(struct archive *a, int fd) +write_file_data(struct bsdtar *bsdtar, struct archive *a, int fd) { - char buff[8192]; + char buff[64*1024]; ssize_t bytes_read; ssize_t bytes_written; + /* XXX TODO: Allocate buffer on heap and store pointer to + * it in bsdtar structure; arrange cleanup as well. XXX */ + (void)bsdtar; + bytes_read = read(fd, buff, sizeof(buff)); while (bytes_read > 0) { bytes_written = archive_write_data(a, buff, bytes_read); |