Skip to content

Commit

Permalink
dsync: add --sparse option to copy sparse files
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Moody <moody20@llnl.gov>
  • Loading branch information
adammoody committed Jul 15, 2019
1 parent 2de9b30 commit 46b4e16
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/rst/dcp.1.rst
Expand Up @@ -49,7 +49,7 @@ OPTIONS


.. option:: -S, --sparse .. option:: -S, --sparse


Create sparse files when possible (non-functioning). Create sparse files when possible.


.. option:: --progress N .. option:: --progress N


Expand Down
4 changes: 4 additions & 0 deletions doc/rst/dsync.1.rst
Expand Up @@ -51,6 +51,10 @@ OPTIONS
# incremental backup of /src # incremental backup of /src
dsync --link-dest /src.bak /src /src.bak.inc dsync --link-dest /src.bak /src /src.bak.inc


.. option:: -S, --sparse

Create sparse files when possible.

.. option:: --progress N .. option:: --progress N


Print progress message to stdout approximately every N seconds. Print progress message to stdout approximately every N seconds.
Expand Down
7 changes: 6 additions & 1 deletion src/dsync/dsync.c
Expand Up @@ -53,6 +53,7 @@ static void print_usage(void)
printf(" -c, --contents - read and compare file contents rather than compare size and mtime\n"); printf(" -c, --contents - read and compare file contents rather than compare size and mtime\n");
printf(" -D, --delete - delete extraneous files from target\n"); printf(" -D, --delete - delete extraneous files from target\n");
printf(" --link-dest <DIR> - hardlink to files in DIR when unchanged\n"); printf(" --link-dest <DIR> - hardlink to files in DIR when unchanged\n");
printf(" -S, --sparse - create sparse files when possible\n");
printf(" --progress <N> - print progress every N seconds\n"); printf(" --progress <N> - print progress every N seconds\n");
printf(" -v, --verbose - verbose output\n"); printf(" -v, --verbose - verbose output\n");
printf(" -q, --quiet - quiet output\n"); printf(" -q, --quiet - quiet output\n");
Expand Down Expand Up @@ -2814,6 +2815,7 @@ int main(int argc, char **argv)
{"output", 1, 0, 'o'}, // undocumented {"output", 1, 0, 'o'}, // undocumented
{"debug", 0, 0, 'd'}, // undocumented {"debug", 0, 0, 'd'}, // undocumented
{"link-dest", 1, 0, 'l'}, {"link-dest", 1, 0, 'l'},
{"sparse", 0, 0, 'S'},
{"progress", 1, 0, 'P'}, {"progress", 1, 0, 'P'},
{"verbose", 0, 0, 'v'}, {"verbose", 0, 0, 'v'},
{"quiet", 0, 0, 'q'}, {"quiet", 0, 0, 'q'},
Expand All @@ -2832,7 +2834,7 @@ int main(int argc, char **argv)


while (1) { while (1) {
int c = getopt_long( int c = getopt_long(
argc, argv, "b:cDo:vqh", argc, argv, "b:cDo:Svqh",
long_options, &option_index long_options, &option_index
); );


Expand Down Expand Up @@ -2865,6 +2867,9 @@ int main(int argc, char **argv)
case 'd': case 'd':
options.debug++; options.debug++;
break; break;
case 'S':
mfu_copy_opts->sparse = 1;
break;
case 'P': case 'P':
mfu_progress_timeout = atoi(optarg); mfu_progress_timeout = atoi(optarg);
break; break;
Expand Down

0 comments on commit 46b4e16

Please sign in to comment.