Applied to the trunk.
authorWayne Davison <wayned@samba.org>
Thu, 11 Nov 2004 01:45:40 +0000 (01:45 +0000)
committerWayne Davison <wayned@samba.org>
Thu, 11 Nov 2004 01:45:40 +0000 (01:45 +0000)
max-size.diff [deleted file]

diff --git a/max-size.diff b/max-size.diff
deleted file mode 100644 (file)
index 5f2da50..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
---- orig/generator.c   2004-11-03 20:30:45
-+++ generator.c        2004-07-03 20:20:46
-@@ -41,6 +41,7 @@ extern int make_backups;
- extern int csum_length;
- extern int ignore_times;
- extern int size_only;
-+extern OFF_T max_size;
- extern int io_timeout;
- extern int protocol_version;
- extern int always_checksum;
-@@ -340,6 +341,10 @@ static void recv_generator(char *fname, 
-                   && verbose && f_out != -1)
-                       rprintf(FINFO, "%s/\n", safe_fname(fname));
-               return;
-+      } else if (max_size && file->length > max_size) {
-+              if (verbose > 1)
-+                      rprintf(FINFO, "%s is over max-size\n", fname);
-+              return;
-       }
-       if (preserve_links && S_ISLNK(file->mode)) {
---- orig/options.c     2004-10-14 17:11:40
-+++ options.c  2004-11-11 01:15:01
-@@ -90,6 +90,7 @@ int delete_after = 0;
- int only_existing = 0;
- int opt_ignore_existing = 0;
- int max_delete = 0;
-+OFF_T max_size = 0;
- int ignore_errors = 0;
- int modify_window = 0;
- int blocking_io = -1;
-@@ -140,6 +141,7 @@ char *batch_name = NULL;
- static int daemon_opt;   /* sets am_daemon after option error-reporting */
- static int modify_window_set;
-+static char *max_size_arg;
- /** Local address to bind.  As a character string because it's
-  * interpreted by the IPv6 layer: should be a numeric IP4 or IP6
-@@ -268,6 +270,7 @@ void usage(enum logcode F)
-   rprintf(F,"     --delete-after          receiver deletes after transferring, not before\n");
-   rprintf(F,"     --ignore-errors         delete even if there are I/O errors\n");
-   rprintf(F,"     --max-delete=NUM        don't delete more than NUM files\n");
-+  rprintf(F,"     --max-size=SIZE         don't transfer any file larger 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,"     --force                 force deletion of directories even if not empty\n");
-@@ -312,7 +315,7 @@ void usage(enum logcode F)
- enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
-       OPT_DELETE_AFTER, OPT_DELETE_EXCLUDED, OPT_LINK_DEST,
-       OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW,
--      OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_TIMEOUT,
-+      OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_TIMEOUT, OPT_MAX_SIZE,
-       OPT_REFUSED_BASE = 9000};
- static struct poptOption long_options[] = {
-@@ -367,6 +370,7 @@ static struct poptOption long_options[] 
-   {"rsh",             'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 },
-   {"block-size",      'B', POPT_ARG_INT,    &block_size, 0, 0, 0 },
-   {"max-delete",       0,  POPT_ARG_INT,    &max_delete, 0, 0, 0 },
-+  {"max-size",         0,  POPT_ARG_STRING, &max_size_arg,  OPT_MAX_SIZE, 0, 0 },
-   {"timeout",          0,  POPT_ARG_INT,    &io_timeout, OPT_TIMEOUT, 0, 0 },
-   {"temp-dir",        'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
-   {"compare-dest",     0,  POPT_ARG_STRING, &compare_dest, 0, 0, 0 },
-@@ -667,6 +671,34 @@ int parse_arguments(int *argc, const cha
-                       read_batch = 1;
-                       break;
-+              case OPT_MAX_SIZE:
-+                      for (arg = max_size_arg; isdigit(*arg); arg++) {}
-+                      if (*arg == '.')
-+                              for (arg++; isdigit(*arg); arg++) {}
-+                      if (arg == max_size_arg)
-+                              arg = "?";
-+                      switch (*arg) {
-+                      case 'k': case 'K':
-+                              max_size = atof(max_size_arg) * 1024;
-+                              break;
-+                      case 'm': case 'M':
-+                              max_size = atof(max_size_arg) * 1024*1024;
-+                              break;
-+                      case 'g': case 'G':
-+                              max_size = atof(max_size_arg) * 1024*1024*1024;
-+                              break;
-+                      case '\0':
-+                              max_size = atof(max_size_arg);
-+                              break;
-+                      default:
-+                              rprintf(FERROR,
-+                                      "--max-size value is invalid: %s\n",
-+                                      max_size_arg);
-+                              exit_cleanup(RERR_SYNTAX);
-+                              break;
-+                      }
-+                      break;
-+
-               case OPT_TIMEOUT:
-                       if (io_timeout && io_timeout < select_timeout)
-                               select_timeout = io_timeout;
-@@ -1050,6 +1082,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;
-+      }
-+
-       if (io_timeout) {
-               if (asprintf(&arg, "--timeout=%d", io_timeout) < 0)
-                       goto oom;
---- orig/rsync.yo      2004-10-06 00:12:16
-+++ rsync.yo   2004-07-03 20:20:46
-@@ -345,6 +345,7 @@ verb(
-      --delete-after          receiver deletes after transfer, not before
-      --ignore-errors         delete even if there are I/O errors
-      --max-delete=NUM        don't delete more than NUM files
-+     --max-size=SIZE         don't transfer any file larger than SIZE
-      --partial               keep partially transferred files
-      --partial-dir=DIR       put a partially transferred file into DIR
-      --force                 force deletion of dirs even if not empty
-@@ -635,6 +636,11 @@ dit(bf(--max-delete=NUM)) This tells rsy
- files or directories. This is useful when mirroring very large trees
- to prevent disasters.
-+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. "--max-size=1.5m").
-+
- dit(bf(--delete)) This tells rsync to delete any files on the receiving
- side that aren't on the sending side.   Files that are excluded from
- transfer are excluded from being deleted unless you use --delete-excluded.