Adding filter-attribute-mods patch; updating patches.
[rsync/rsync-patches.git] / drop-cache.diff
index 6803125..e4639e2 100644 (file)
@@ -56,19 +56,26 @@ You can get the latest edition of the patch from
 cheers
 tobi
 
 cheers
 tobi
 
-Changes: 
+Changes:
 
  2007-04-23
 
 * pass --drop-cache on to the remote server
 * make test works now
 
 
  2007-04-23
 
 * pass --drop-cache on to the remote server
 * make test works now
 
+To use this patch, run these commands for a successful build:
+
+    patch -p1 <patches/drop-cache.diff
+    ./configure                         (optional if already run)
+    make
+
+based-on: 181c9faf928faad08ef095f4667afe460ec3bef6
 diff --git a/checksum.c b/checksum.c
 --- a/checksum.c
 +++ b/checksum.c
 diff --git a/checksum.c b/checksum.c
 --- a/checksum.c
 +++ b/checksum.c
-@@ -26,6 +26,10 @@ extern int protocol_version;
- int csum_length = SHORT_SUM_LENGTH; /* initial value */
+@@ -24,6 +24,10 @@
+ extern int checksum_seed;
+ extern int protocol_version;
  
 +#ifdef HAVE_POSIX_FADVISE64
 +#define close(fd) fadv_close(fd)
  
 +#ifdef HAVE_POSIX_FADVISE64
 +#define close(fd) fadv_close(fd)
@@ -80,7 +87,7 @@ diff --git a/checksum.c b/checksum.c
 diff --git a/cleanup.c b/cleanup.c
 --- a/cleanup.c
 +++ b/cleanup.c
 diff --git a/cleanup.c b/cleanup.c
 --- a/cleanup.c
 +++ b/cleanup.c
-@@ -46,7 +46,13 @@ void close_all(void)
+@@ -47,7 +47,13 @@ void close_all(void)
        int fd;
        int ret;
        STRUCT_STAT st;
        int fd;
        int ret;
        STRUCT_STAT st;
@@ -97,21 +104,21 @@ diff --git a/cleanup.c b/cleanup.c
 diff --git a/configure.in b/configure.in
 --- a/configure.in
 +++ b/configure.in
 diff --git a/configure.in b/configure.in
 --- a/configure.in
 +++ b/configure.in
-@@ -552,7 +552,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
-     strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \
+@@ -553,7 +553,7 @@ 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 \
      setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
      strerror putenv iconv_open locale_charset nl_langinfo getxattr \
--    extattr_get_link sigaction sigprocmask setattrlist)
-+    extattr_get_link sigaction sigprocmask setattrlist posix_fadvise64)
+     extattr_get_link sigaction sigprocmask setattrlist getgrouplist \
+-    initgroups)
++    initgroups posix_fadvise64)
  
  dnl cygwin iconv.h defines iconv_open as libiconv_open
  if test x"$ac_cv_func_iconv_open" != x"yes"; then
 diff --git a/fileio.c b/fileio.c
 --- a/fileio.c
 +++ b/fileio.c
  
  dnl cygwin iconv.h defines iconv_open as libiconv_open
  if test x"$ac_cv_func_iconv_open" != x"yes"; then
 diff --git a/fileio.c b/fileio.c
 --- a/fileio.c
 +++ b/fileio.c
-@@ -30,6 +30,12 @@ extern int sparse_files;
+@@ -31,6 +31,12 @@ extern int sparse_files;
  static char last_byte;
  static char last_byte;
- static size_t sparse_seek = 0;
+ static OFF_T sparse_seek = 0;
  
 +#ifdef HAVE_POSIX_FADVISE64
 +#define close(fd) fadv_close(fd)
  
 +#ifdef HAVE_POSIX_FADVISE64
 +#define close(fd) fadv_close(fd)
@@ -125,7 +132,7 @@ diff --git a/fileio.c b/fileio.c
 diff --git a/generator.c b/generator.c
 --- a/generator.c
 +++ b/generator.c
 diff --git a/generator.c b/generator.c
 --- a/generator.c
 +++ b/generator.c
-@@ -113,6 +113,10 @@ static int need_retouch_dir_times;
+@@ -112,6 +112,10 @@ static int need_retouch_dir_times;
  static int need_retouch_dir_perms;
  static const char *solo_file = NULL;
  
  static int need_retouch_dir_perms;
  static const char *solo_file = NULL;
  
@@ -133,13 +140,13 @@ diff --git a/generator.c b/generator.c
 +#define close(fd) fadv_close(fd)
 +#endif
 +
 +#define close(fd) fadv_close(fd)
 +#endif
 +
- /* For calling delete_item() and delete_dir_contents(). */
- #define DEL_OWNED_BY_US       (1<<0) /* file/dir has our uid */
- #define DEL_RECURSE           (1<<1) /* if dir, delete all contents */
+ enum nonregtype {
+     TYPE_DIR, TYPE_SPECIAL, TYPE_DEVICE, TYPE_SYMLINK
+ };
 diff --git a/options.c b/options.c
 --- a/options.c
 +++ b/options.c
 diff --git a/options.c b/options.c
 --- a/options.c
 +++ b/options.c
-@@ -59,6 +59,7 @@ int preserve_uid = 0;
+@@ -60,6 +60,7 @@ int preserve_uid = 0;
  int preserve_gid = 0;
  int preserve_times = 0;
  int update_only = 0;
  int preserve_gid = 0;
  int preserve_times = 0;
  int update_only = 0;
@@ -147,7 +154,7 @@ diff --git a/options.c b/options.c
  int cvs_exclude = 0;
  int dry_run = 0;
  int do_xfers = 1;
  int cvs_exclude = 0;
  int dry_run = 0;
  int do_xfers = 1;
-@@ -321,6 +322,9 @@ void usage(enum logcode F)
+@@ -670,6 +671,9 @@ void usage(enum logcode F)
    rprintf(F,"     --backup-dir=DIR        make backups into hierarchy based in DIR\n");
    rprintf(F,"     --suffix=SUFFIX         set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
    rprintf(F," -u, --update                skip files that are newer on the receiver\n");
    rprintf(F,"     --backup-dir=DIR        make backups into hierarchy based in DIR\n");
    rprintf(F,"     --suffix=SUFFIX         set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
    rprintf(F," -u, --update                skip files that are newer on the receiver\n");
@@ -157,9 +164,9 @@ diff --git a/options.c b/options.c
    rprintf(F,"     --inplace               update destination files in-place (SEE MAN PAGE)\n");
    rprintf(F,"     --append                append data onto shorter files\n");
    rprintf(F,"     --append-verify         like --append, but with old data in file checksum\n");
    rprintf(F,"     --inplace               update destination files in-place (SEE MAN PAGE)\n");
    rprintf(F,"     --append                append data onto shorter files\n");
    rprintf(F,"     --append-verify         like --append, but with old data in file checksum\n");
-@@ -525,6 +529,9 @@ static struct poptOption long_options[] = {
-   {"size-only",        0,  POPT_ARG_NONE,   &size_only, 0, 0, 0 },
-   {"one-file-system", 'x', POPT_ARG_NONE,   0, 'x', 0, 0 },
+@@ -891,6 +895,9 @@ static struct poptOption long_options[] = {
+   {"no-one-file-system",'x',POPT_ARG_VAL,   &one_file_system, 0, 0, 0 },
+   {"no-x",            'x', POPT_ARG_VAL,    &one_file_system, 0, 0, 0 },
    {"update",          'u', POPT_ARG_NONE,   &update_only, 0, 0, 0 },
 +#ifdef HAVE_POSIX_FADVISE64
 +  {"drop-cache",       0,  POPT_ARG_NONE,   &drop_cache, 0, 0, 0 },
    {"update",          'u', POPT_ARG_NONE,   &update_only, 0, 0, 0 },
 +#ifdef HAVE_POSIX_FADVISE64
 +  {"drop-cache",       0,  POPT_ARG_NONE,   &drop_cache, 0, 0, 0 },
@@ -167,7 +174,7 @@ diff --git a/options.c b/options.c
    {"existing",         0,  POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
    {"ignore-non-existing",0,POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
    {"ignore-existing",  0,  POPT_ARG_NONE,   &ignore_existing, 0, 0, 0 },
    {"existing",         0,  POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
    {"ignore-non-existing",0,POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
    {"ignore-existing",  0,  POPT_ARG_NONE,   &ignore_existing, 0, 0, 0 },
-@@ -1671,6 +1678,11 @@ void server_options(char **args, int *argc_p)
+@@ -2252,6 +2259,11 @@ void server_options(char **args, int *argc_p)
        if (!am_sender)
                args[ac++] = "--sender";
  
        if (!am_sender)
                args[ac++] = "--sender";
  
@@ -182,7 +189,7 @@ diff --git a/options.c b/options.c
 diff --git a/receiver.c b/receiver.c
 --- a/receiver.c
 +++ b/receiver.c
 diff --git a/receiver.c b/receiver.c
 --- a/receiver.c
 +++ b/receiver.c
-@@ -62,6 +62,10 @@ static int phase = 0, redoing = 0;
+@@ -64,6 +64,10 @@ static flist_ndx_list batch_redo_list;
  /* We're either updating the basis file or an identical copy: */
  static int updating_basis_or_equiv;
  
  /* We're either updating the basis file or an identical copy: */
  static int updating_basis_or_equiv;
  
@@ -196,7 +203,7 @@ diff --git a/receiver.c b/receiver.c
 diff --git a/rsync.yo b/rsync.yo
 --- a/rsync.yo
 +++ b/rsync.yo
 diff --git a/rsync.yo b/rsync.yo
 --- a/rsync.yo
 +++ b/rsync.yo
-@@ -352,6 +352,7 @@ to the detailed description below for a complete description.  verb(
+@@ -359,6 +359,7 @@ to the detailed description below for a complete description.  verb(
       --super                 receiver attempts super-user activities
       --fake-super            store/recover privileged attrs using xattrs
   -S, --sparse                handle sparse files efficiently
       --super                 receiver attempts super-user activities
       --fake-super            store/recover privileged attrs using xattrs
   -S, --sparse                handle sparse files efficiently
@@ -204,7 +211,7 @@ diff --git a/rsync.yo b/rsync.yo
   -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
   -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
-@@ -1036,6 +1037,10 @@ NOTE: Don't use this option when the destination is a Solaris "tmpfs"
+@@ -1127,6 +1128,10 @@ 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.
  
  filesystem. It doesn't seem to handle seeks over null regions
  correctly and ends up corrupting the files.
  
@@ -218,7 +225,7 @@ diff --git a/rsync.yo b/rsync.yo
 diff --git a/sender.c b/sender.c
 --- a/sender.c
 +++ b/sender.c
 diff --git a/sender.c b/sender.c
 --- a/sender.c
 +++ b/sender.c
-@@ -46,6 +46,10 @@ extern int write_batch;
+@@ -44,6 +44,10 @@ extern int write_batch;
  extern struct stats stats;
  extern struct file_list *cur_flist, *first_flist, *dir_flist;
  
  extern struct stats stats;
  extern struct file_list *cur_flist, *first_flist, *dir_flist;
  
@@ -232,26 +239,26 @@ diff --git a/sender.c b/sender.c
 diff --git a/t_unsafe.c b/t_unsafe.c
 --- a/t_unsafe.c
 +++ b/t_unsafe.c
 diff --git a/t_unsafe.c b/t_unsafe.c
 --- a/t_unsafe.c
 +++ b/t_unsafe.c
-@@ -28,6 +28,7 @@ int am_root = 0;
+@@ -27,6 +27,7 @@ int dry_run = 0;
+ int am_root = 0;
  int read_only = 0;
  int list_only = 0;
  int read_only = 0;
  int list_only = 0;
- int verbose = 0;
 +int drop_cache = 0;
 +int drop_cache = 0;
+ int human_readable = 0;
  int preserve_perms = 0;
  int preserve_executability = 0;
  int preserve_perms = 0;
  int preserve_executability = 0;
 diff --git a/util.c b/util.c
 --- a/util.c
 +++ b/util.c
 diff --git a/util.c b/util.c
 --- a/util.c
 +++ b/util.c
-@@ -26,6 +26,7 @@
- extern int verbose;
+@@ -27,6 +27,7 @@
  extern int dry_run;
  extern int module_id;
 +extern int drop_cache;
  extern int modify_window;
  extern int relative_paths;
  extern int dry_run;
  extern int module_id;
 +extern int drop_cache;
  extern int modify_window;
  extern int relative_paths;
- extern int human_readable;
-@@ -41,6 +42,131 @@ char curr_dir[MAXPATHLEN];
+ extern int preserve_xattrs;
+@@ -42,6 +43,131 @@ char curr_dir[MAXPATHLEN];
  unsigned int curr_dir_len;
  int curr_dir_depth; /* This is only set for a sanitizing daemon. */
  
  unsigned int curr_dir_len;
  int curr_dir_depth; /* This is only set for a sanitizing daemon. */
  
@@ -365,12 +372,12 @@ diff --git a/util.c b/util.c
 +              fadv_fd_init_func();
 +              fadv_close_buffer_size += pos - fadv_fd_pos[fd];
 +              fadv_close_ring[fadv_close_ring_head] = newfd;
 +              fadv_fd_init_func();
 +              fadv_close_buffer_size += pos - fadv_fd_pos[fd];
 +              fadv_close_ring[fadv_close_ring_head] = newfd;
-+              fadv_close_ring_head = (fadv_close_ring_head + 1) % fadv_max_fd;        
++              fadv_close_ring_head = (fadv_close_ring_head + 1) % fadv_max_fd;
 +              fadv_close_ring_size ++;
 +              if (fadv_close_ring_size == fadv_max_fd || fadv_close_buffer_size > 1024*1024 ){
 +                      /* it seems fastest to drop things 'in groups' */
 +                      fadv_close_all();
 +              fadv_close_ring_size ++;
 +              if (fadv_close_ring_size == fadv_max_fd || fadv_close_buffer_size > 1024*1024 ){
 +                      /* it seems fastest to drop things 'in groups' */
 +                      fadv_close_all();
-+              } 
++              }
 +      }
 +      return close(fd);
 +}
 +      }
 +      return close(fd);
 +}