X-Git-Url: https://mattmccutchen.net/rsync/rsync-patches.git/blobdiff_plain/fc5573623194fab2a331d1ffc8d284c9e25e06e7..5214a41bbae94607b196b199b483710e1babf292:/preallocate.diff diff --git a/preallocate.diff b/preallocate.diff index 5f0980b..026c8f9 100644 --- a/preallocate.diff +++ b/preallocate.diff @@ -9,8 +9,8 @@ To use this patch, run these commands for a successful build: ./configure make +based-on: 24079e988fc31af4eba56cd2701fdc5a4154980d diff --git a/compat.c b/compat.c -index 6e00072..c9590cc 100644 --- a/compat.c +++ b/compat.c @@ -32,6 +32,7 @@ extern int inplace; @@ -38,15 +38,14 @@ index 6e00072..c9590cc 100644 if (append_mode == 1) append_mode = 2; diff --git a/configure.in b/configure.in -index bc7d4a7..61f9b05 100644 --- a/configure.in +++ b/configure.in -@@ -553,13 +553,40 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \ +@@ -583,13 +583,40 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \ setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \ - strerror putenv iconv_open locale_charset nl_langinfo getxattr \ + seteuid strerror putenv iconv_open locale_charset nl_langinfo getxattr \ extattr_get_link sigaction sigprocmask setattrlist getgrouplist \ -- initgroups) -+ initgroups fallocate posix_fallocate) +- initgroups utimensat) ++ initgroups utimensat fallocate posix_fallocate) dnl cygwin iconv.h defines iconv_open as libiconv_open if test x"$ac_cv_func_iconv_open" != x"yes"; then @@ -84,7 +83,6 @@ index bc7d4a7..61f9b05 100644 if test $ac_cv_func_getpgrp = yes; then AC_FUNC_GETPGRP diff --git a/options.c b/options.c -index e7c6c61..6f848f1 100644 --- a/options.c +++ b/options.c @@ -73,6 +73,7 @@ int remove_source_files = 0; @@ -95,7 +93,7 @@ index e7c6c61..6f848f1 100644 int do_compression = 0; int def_compress_level = Z_DEFAULT_COMPRESSION; int am_root = 0; /* 0 = normal, 1 = root, 2 = --super, -1 = --fake-super */ -@@ -566,6 +567,7 @@ static void print_rsync_version(enum logcode f) +@@ -567,6 +568,7 @@ static void print_rsync_version(enum logcode f) char const *links = "no "; char const *iconv = "no "; char const *ipv6 = "no "; @@ -103,8 +101,8 @@ index e7c6c61..6f848f1 100644 STRUCT_STAT *dumstat; #if SUBPROTOCOL_VERSION != 0 -@@ -599,6 +601,9 @@ static void print_rsync_version(enum logcode f) - #if defined HAVE_LUTIMES && defined HAVE_UTIMES +@@ -600,6 +602,9 @@ static void print_rsync_version(enum logcode f) + #ifdef CAN_SET_SYMLINK_TIMES symtimes = ""; #endif +#ifdef SUPPORT_PREALLOCATION @@ -113,7 +111,7 @@ index e7c6c61..6f848f1 100644 rprintf(f, "%s version %s protocol version %d%s\n", RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol); -@@ -612,8 +617,8 @@ static void print_rsync_version(enum logcode f) +@@ -613,8 +618,8 @@ static void print_rsync_version(enum logcode f) (int)(sizeof (int64) * 8)); rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n", got_socketpair, hardlinks, links, ipv6, have_inplace); @@ -124,7 +122,7 @@ index e7c6c61..6f848f1 100644 #ifdef MAINTAINER_MODE rprintf(f, "Panic Action: \"%s\"\n", get_panic_action()); -@@ -703,6 +708,9 @@ void usage(enum logcode F) +@@ -704,6 +709,9 @@ void usage(enum logcode F) rprintf(F," --fake-super store/recover privileged attrs using xattrs\n"); #endif rprintf(F," -S, --sparse handle sparse files efficiently\n"); @@ -134,7 +132,7 @@ index e7c6c61..6f848f1 100644 rprintf(F," -n, --dry-run perform a trial run with no changes made\n"); rprintf(F," -W, --whole-file copy files whole (without delta-xfer algorithm)\n"); rprintf(F," -x, --one-file-system don't cross filesystem boundaries\n"); -@@ -899,6 +907,7 @@ static struct poptOption long_options[] = { +@@ -900,6 +908,7 @@ static struct poptOption long_options[] = { {"sparse", 'S', POPT_ARG_VAL, &sparse_files, 1, 0, 0 }, {"no-sparse", 0, POPT_ARG_VAL, &sparse_files, 0, 0, 0 }, {"no-S", 0, POPT_ARG_VAL, &sparse_files, 0, 0, 0 }, @@ -142,7 +140,7 @@ index e7c6c61..6f848f1 100644 {"inplace", 0, POPT_ARG_VAL, &inplace, 1, 0, 0 }, {"no-inplace", 0, POPT_ARG_VAL, &inplace, 0, 0, 0 }, {"append", 0, POPT_ARG_NONE, 0, OPT_APPEND, 0, 0 }, -@@ -2609,6 +2618,9 @@ void server_options(char **args, int *argc_p) +@@ -2646,6 +2655,9 @@ void server_options(char **args, int *argc_p) else if (remove_source_files) args[ac++] = "--remove-sent-files"; @@ -153,7 +151,6 @@ index e7c6c61..6f848f1 100644 rprintf(FERROR, "argc overflow in server_options().\n"); exit_cleanup(RERR_MALLOC); diff --git a/receiver.c b/receiver.c -index 4325e30..739a0ba 100644 --- a/receiver.c +++ b/receiver.c @@ -44,6 +44,7 @@ extern int cleanup_got_literal; @@ -164,7 +161,7 @@ index 4325e30..739a0ba 100644 extern int keep_partial; extern int checksum_len; extern int checksum_seed; -@@ -175,6 +176,18 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, +@@ -207,6 +208,18 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, char *data; int32 i; char *map = NULL; @@ -183,7 +180,7 @@ index 4325e30..739a0ba 100644 read_sum_head(f_in, &sum); -@@ -285,8 +298,14 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, +@@ -317,8 +330,14 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, goto report_write_error; #ifdef HAVE_FTRUNCATE @@ -201,10 +198,9 @@ index 4325e30..739a0ba 100644 full_fname(fname)); } diff --git a/rsync.h b/rsync.h -index be7cf8a..0ad3075 100644 --- a/rsync.h +++ b/rsync.h -@@ -634,6 +634,13 @@ struct ht_int64_node { +@@ -646,6 +646,13 @@ struct ht_int64_node { #define ACLS_NEED_MASK 1 #endif @@ -219,7 +215,6 @@ index be7cf8a..0ad3075 100644 int32 num; uint32 unum; diff --git a/rsync.yo b/rsync.yo -index 941f7a5..36a2077 100644 --- a/rsync.yo +++ b/rsync.yo @@ -359,6 +359,7 @@ to the detailed description below for a complete description. verb( @@ -230,9 +225,9 @@ index 941f7a5..36a2077 100644 -n, --dry-run perform a trial run with no changes made -W, --whole-file copy files whole (w/o delta-xfer algorithm) -x, --one-file-system don't cross filesystem boundaries -@@ -1120,6 +1121,18 @@ NOTE: Don't use this option when the destination is a Solaris "tmpfs" - filesystem. It doesn't seem to handle seeks over null regions - correctly and ends up corrupting the files. +@@ -1127,6 +1128,18 @@ NOTE: Don't use this option when the destination is a Solaris "tmpfs" + filesystem. It seems to have problems seeking over null regions, + and ends up corrupting the files. +dit(bf(--preallocate)) This tells the receiver to allocate each destination +file to its eventual size before writing data to the file. Rsync will only use @@ -250,7 +245,6 @@ index 941f7a5..36a2077 100644 make any changes (and produces mostly the same output as a real run). It is most commonly used in combination with the bf(-v, --verbose) and/or diff --git a/syscall.c b/syscall.c -index cfabc3e..81fb957 100644 --- a/syscall.c +++ b/syscall.c @@ -29,6 +29,10 @@ @@ -263,8 +257,8 @@ index cfabc3e..81fb957 100644 + extern int dry_run; extern int am_root; - extern int read_only; -@@ -282,3 +286,21 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence) + extern int am_sender; +@@ -325,3 +329,21 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence) return lseek(fd, offset, whence); #endif } @@ -287,7 +281,6 @@ index cfabc3e..81fb957 100644 +} +#endif diff --git a/t_stub.c b/t_stub.c -index 02cfa69..52a7f02 100644 --- a/t_stub.c +++ b/t_stub.c @@ -22,6 +22,7 @@ @@ -299,7 +292,6 @@ index 02cfa69..52a7f02 100644 int relative_paths = 0; int module_dirlen = 0; diff --git a/util.c b/util.c -index 0cafed6..20dd0d3 100644 --- a/util.c +++ b/util.c @@ -26,6 +26,7 @@ @@ -310,7 +302,7 @@ index 0cafed6..20dd0d3 100644 extern int module_id; extern int modify_window; extern int relative_paths; -@@ -276,6 +277,10 @@ int copy_file(const char *source, const char *dest, int ofd, +@@ -332,6 +333,10 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode) int ifd; char buf[1024 * 8]; int len; /* Number of bytes read into `buf'. */ @@ -321,7 +313,7 @@ index 0cafed6..20dd0d3 100644 if ((ifd = do_open(source, O_RDONLY, 0)) < 0) { int save_errno = errno; -@@ -309,7 +314,27 @@ int copy_file(const char *source, const char *dest, int ofd, +@@ -357,7 +362,27 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode) } } @@ -349,7 +341,7 @@ index 0cafed6..20dd0d3 100644 if (full_write(ofd, buf, len) < 0) { int save_errno = errno; rsyserr(FERROR_XFER, errno, "write %s", full_fname(dest)); -@@ -334,6 +359,16 @@ int copy_file(const char *source, const char *dest, int ofd, +@@ -382,6 +407,16 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode) full_fname(source)); }