Modified to work with the new parse_size_arg() code.
authorWayne Davison <wayned@samba.org>
Fri, 14 Oct 2005 19:16:09 +0000 (19:16 +0000)
committerWayne Davison <wayned@samba.org>
Fri, 14 Oct 2005 19:16:09 +0000 (19:16 +0000)
min-size.diff

index f32f70b..4c1926a 100644 (file)
        update_only = always_checksum = size_only = 0;
        ignore_times = 1;
        if (append_mode)  /* resend w/o append mode */
---- orig/options.c     2005-09-29 18:06:38
-+++ options.c  2005-09-29 18:09:56
-@@ -98,6 +98,7 @@ int ignore_existing = 0;
- int ignore_non_existing = 0;
+--- orig/options.c     2005-10-14 18:50:49
++++ options.c  2005-10-14 19:08:38
+@@ -99,6 +99,7 @@ int ignore_non_existing = 0;
  int need_messages_from_generator = 0;
  int max_delete = 0;
-+OFF_T min_size = 0;
  OFF_T max_size = 0;
++OFF_T min_size = 0;
  int ignore_errors = 0;
  int modify_window = 0;
+ int blocking_io = -1;
 @@ -167,7 +168,7 @@ static int itemize_changes = 0;
  static int refused_delete, refused_archive_part;
  static int refused_partial, refused_progress, refused_delete_before;
  static int refused_inplace;
 -static char *max_size_arg;
-+static char *min_size_arg, *max_size_arg;
++static char *max_size_arg, *min_size_arg;
  static char partialdir_for_delayupdate[] = ".~tmp~";
  
  /** Local address to bind.  As a character string because it's
-@@ -307,6 +308,7 @@ void usage(enum logcode F)
-   rprintf(F,"     --ignore-errors         delete even if there are I/O errors\n");
+@@ -308,6 +309,7 @@ void usage(enum logcode F)
    rprintf(F,"     --force                 force deletion of directories even if not empty\n");
    rprintf(F,"     --max-delete=NUM        don't delete more than NUM files\n");
-+  rprintf(F,"     --min-size=SIZE         don't transfer any file smaller than SIZE\n");
    rprintf(F,"     --max-size=SIZE         don't transfer any file larger than SIZE\n");
++  rprintf(F,"     --min-size=SIZE         don't transfer any file smaller than SIZE\n");
    rprintf(F,"     --partial               keep partially transferred files\n");
    rprintf(F,"     --partial-dir=DIR       put a partially transferred file into DIR\n");
+   rprintf(F,"     --delay-updates         put all updated files into place at transfer's end\n");
 @@ -361,7 +363,7 @@ void usage(enum logcode F)
  
  enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
        OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
        OPT_REFUSED_BASE = 9000};
  
-@@ -418,6 +420,7 @@ static struct poptOption long_options[] 
-   {"existing",         0,  POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
+@@ -419,6 +421,7 @@ static struct poptOption long_options[] 
    {"ignore-existing",  0,  POPT_ARG_NONE,   &ignore_existing, 0, 0, 0 },
    {"ignore-non-existing",0,POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
+   {"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 },
-   {"max-size",         0,  POPT_ARG_STRING, &max_size_arg,  OPT_MAX_SIZE, 0, 0 },
    {"sparse",          'S', POPT_ARG_NONE,   &sparse_files, 0, 0, 0 },
    {"inplace",          0,  POPT_ARG_NONE,   &inplace, 0, 0, 0 },
-@@ -886,6 +889,15 @@ int parse_arguments(int *argc, const cha
-                       read_batch = 1;
+   {"append",           0,  POPT_ARG_VAL,    &append_mode, 1, 0, 0 },
+@@ -919,6 +922,15 @@ int parse_arguments(int *argc, const cha
+                       }
                        break;
  
 +              case OPT_MIN_SIZE:
-+                      if ((min_size = parse_size_arg(min_size_arg)) <= 0) {
++                      if ((min_size = parse_size_arg(&min_size_arg)) <= 0) {
 +                              snprintf(err_buf, sizeof err_buf,
 +                                      "--min-size value is invalid: %s\n",
 +                                      min_size_arg);
 +                      }
 +                      break;
 +
-               case OPT_MAX_SIZE:
-                       if ((max_size = parse_size_arg(max_size_arg)) <= 0) {
-                               snprintf(err_buf, sizeof err_buf,
-@@ -1415,6 +1427,11 @@ void server_options(char **args,int *arg
+               case OPT_LINK_DEST:
+ #ifdef HAVE_LINK
+                       link_dest = 1;
+@@ -1439,6 +1451,11 @@ void server_options(char **args,int *arg
                args[ac++] = arg;
        }
  
        if (max_size && am_sender) {
                args[ac++] = "--max-size";
                args[ac++] = max_size_arg;
---- orig/rsync.yo      2005-09-29 17:02:16
-+++ rsync.yo   2005-05-06 19:12:35
-@@ -340,6 +340,7 @@ to the detailed description below for a 
-      --ignore-errors         delete even if there are I/O errors
+--- orig/rsync.yo      2005-10-14 18:58:31
++++ rsync.yo   2005-10-14 19:09:25
+@@ -341,6 +341,7 @@ to the detailed description below for a 
       --force                 force deletion of dirs even if not empty
       --max-delete=NUM        don't delete more than NUM files
-+     --min-size=SIZE         don't transfer any file smaller than SIZE
       --max-size=SIZE         don't transfer any file larger than SIZE
++     --min-size=SIZE         don't transfer any file smaller than SIZE
       --partial               keep partially transferred files
       --partial-dir=DIR       put a partially transferred file into DIR
-@@ -797,10 +798,16 @@ dit(bf(--max-delete=NUM)) This tells rsy
- files or directories (NUM must be non-zero).
- This is useful when mirroring very large trees to prevent disasters.
+      --delay-updates         put all updated files into place at end
+@@ -812,6 +813,11 @@ be offset by one byte in the indicated d
+ Examples: --max-size=1.5mt-1 is 1499999 bytes, and --max-size=2g+1 is
+ 2147483649 bytes.
  
 +dit(bf(--min-size=SIZE)) This tells rsync to avoid transferring any
 +file that is smaller than the specified SIZE, which can help in not
 +transferring small, junk files.
++See the bf(--max-size) option for a description of SIZE.
 +
-+The SIZE value can be suffixed with a letter to indicate a size multiplier
-+(K, M, or G) and may be a fractional value (e.g. "bf(--min-size=2.5k)").
-+
- dit(bf(--max-size=SIZE)) This tells rsync to avoid transferring any
--file that is larger than the specified SIZE. The SIZE value can be
--suffixed with a letter to indicate a size multiplier (K, M, or G) and
--may be a fractional value (e.g. "bf(--max-size=1.5m)").
-+file that is larger than the specified SIZE. See the bf(--min-size)
-+option for a description of SIZE.
  dit(bf(-B, --block-size=BLOCKSIZE)) This forces the block size used in
  the rsync algorithm to a fixed value.  It is normally selected based on
+ the size of each file being updated.  See the technical report for details.