@@ -561,7 +561,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strd
strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \
setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
- strerror putenv iconv_open locale_charset nl_langinfo \
-- sigaction sigprocmask)
-+ sigaction sigprocmask posix_fallocate)
+ strerror putenv iconv_open locale_charset nl_langinfo getxattr \
+- extattr_get_link sigaction sigprocmask)
++ extattr_get_link sigaction sigprocmask posix_fallocate)
AC_CHECK_FUNCS(getpgrp tcgetpgrp)
if test $ac_cv_func_getpgrp = yes; then
int do_compression = 0;
int def_compress_level = Z_DEFAULT_COMPRESSION;
int am_root = 0; /* 0 = normal, 1 = root, 2 = --super, -1 = --fake-super */
-@@ -212,6 +213,7 @@ static void print_rsync_version(enum log
+@@ -220,6 +221,7 @@ static void print_rsync_version(enum log
char const *links = "no ";
char const *iconv = "no ";
char const *ipv6 = "no ";
STRUCT_STAT *dumstat;
#if SUBPROTOCOL_VERSION != 0
-@@ -241,6 +243,9 @@ static void print_rsync_version(enum log
+@@ -249,6 +251,9 @@ static void print_rsync_version(enum log
#ifdef ICONV_OPTION
iconv = "";
#endif
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -254,8 +259,8 @@ static void print_rsync_version(enum log
+@@ -262,8 +267,8 @@ static void print_rsync_version(enum log
(int)(sizeof (int64) * 8));
rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
got_socketpair, hardlinks, links, ipv6, have_inplace);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -341,6 +346,9 @@ void usage(enum logcode F)
+@@ -350,6 +355,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");
rprintf(F," -n, --dry-run show what would have been transferred\n");
rprintf(F," -W, --whole-file copy files whole (without rsync algorithm)\n");
rprintf(F," -x, --one-file-system don't cross filesystem boundaries\n");
-@@ -512,6 +520,7 @@ static struct poptOption long_options[]
+@@ -525,6 +533,7 @@ static struct poptOption long_options[]
{"max-size", 0, POPT_ARG_STRING, &max_size_arg, OPT_MAX_SIZE, 0, 0 },
{"min-size", 0, POPT_ARG_STRING, &min_size_arg, OPT_MIN_SIZE, 0, 0 },
{"sparse", 'S', POPT_ARG_NONE, &sparse_files, 0, 0, 0 },
+ {"preallocate", 0, POPT_ARG_NONE, &preallocate_files, 0, 0, 0},
{"inplace", 0, POPT_ARG_NONE, &inplace, 0, 0, 0 },
- {"append", 0, POPT_ARG_VAL, &append_mode, 1, 0, 0 },
- {"del", 0, POPT_ARG_NONE, &delete_during, 0, 0, 0 },
-@@ -1236,6 +1245,15 @@ int parse_arguments(int *argc, const cha
+ {"append", 0, POPT_ARG_NONE, 0, OPT_APPEND, 0, 0 },
+ {"append-verify", 0, POPT_ARG_VAL, &append_mode, 2, 0, 0 },
+@@ -1279,6 +1288,15 @@ int parse_arguments(int *argc_p, const c
}
#endif
if (write_batch && read_batch) {
snprintf(err_buf, sizeof err_buf,
"--write-batch and --read-batch can not be used together\n");
-@@ -1909,6 +1927,9 @@ void server_options(char **args,int *arg
+@@ -1978,6 +1996,9 @@ void server_options(char **args, int *ar
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
+ if (preallocate_files && am_sender)
+ args[ac++] = "--preallocate";
+
- *argc = ac;
+ *argc_p = ac;
return;
--- old/receiver.c
read_sum_head(f_in, &sum);
if (fd_r >= 0 && size_r > 0) {
-@@ -245,8 +259,18 @@ static int receive_data(int f_in, char *
+@@ -247,8 +261,18 @@ static int receive_data(int f_in, char *
goto report_write_error;
#ifdef HAVE_FTRUNCATE
if (do_progress)
--- old/rsync.h
+++ new/rsync.h
-@@ -563,6 +563,10 @@ struct idev_node {
+@@ -555,6 +555,10 @@ struct ht_int64_node {
#define ACLS_NEED_MASK 1
#endif
+#define SUPPORT_PREALLOCATION 1
+#endif
+
- #define GID_NONE ((gid_t)-1)
-
union file_extras {
+ int32 num;
+ uint32 unum;
--- old/rsync.yo
+++ new/rsync.yo
-@@ -335,6 +335,7 @@ to the detailed description below for a
+@@ -357,6 +357,7 @@ to the detailed description below for a
--super receiver attempts super-user activities
--fake-super store/recover privileged attrs using xattrs
-S, --sparse handle sparse files efficiently
-n, --dry-run show what would have been transferred
-W, --whole-file copy files whole (without rsync algorithm)
-x, --one-file-system don't cross filesystem boundaries
-@@ -956,6 +957,19 @@ NOTE: Don't use this option when the des
+@@ -993,6 +994,19 @@ NOTE: Don't use this option when the des
filesystem. It doesn't seem to handle seeks over null regions
correctly and ends up corrupting the files.
extern int module_id;
extern int modify_window;
extern int relative_paths;
-@@ -269,6 +270,10 @@ int copy_file(const char *source, const
+@@ -270,6 +271,10 @@ int copy_file(const char *source, const
int ofd;
char buf[1024 * 8];
int len; /* Number of bytes read into `buf'. */
ifd = do_open(source, O_RDONLY, 0);
if (ifd == -1) {
-@@ -288,7 +293,27 @@ int copy_file(const char *source, const
+@@ -289,7 +294,27 @@ int copy_file(const char *source, const
return -1;
}
if (full_write(ofd, buf, len) < 0) {
rsyserr(FERROR, errno, "write %s", full_fname(dest));
close(ifd);
-@@ -309,6 +334,16 @@ int copy_file(const char *source, const
+@@ -310,6 +335,16 @@ int copy_file(const char *source, const
full_fname(source));
}