Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
936fa865
Commit
936fa865
authored
Sep 01, 2007
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle the new --append and --append-verify options.
parent
2f188c8d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
33 deletions
+51
-33
match.c
match.c
+16
-14
options.c
options.c
+16
-4
receiver.c
receiver.c
+19
-15
No files found.
match.c
View file @
936fa865
...
@@ -315,6 +315,7 @@ void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len)
...
@@ -315,6 +315,7 @@ void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len)
sum_init
(
checksum_seed
);
sum_init
(
checksum_seed
);
if
(
append_mode
>
0
)
{
if
(
append_mode
>
0
)
{
if
(
append_mode
==
2
)
{
OFF_T
j
=
0
;
OFF_T
j
=
0
;
for
(
j
=
CHUNK_SIZE
;
j
<
s
->
flength
;
j
+=
CHUNK_SIZE
)
{
for
(
j
=
CHUNK_SIZE
;
j
<
s
->
flength
;
j
+=
CHUNK_SIZE
)
{
if
(
buf
&&
do_progress
)
if
(
buf
&&
do_progress
)
...
@@ -328,8 +329,9 @@ void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len)
...
@@ -328,8 +329,9 @@ void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len)
if
(
buf
&&
do_progress
)
if
(
buf
&&
do_progress
)
show_progress
(
last_match
,
buf
->
file_size
);
show_progress
(
last_match
,
buf
->
file_size
);
sum_update
(
map_ptr
(
buf
,
last_match
,
n
),
n
);
sum_update
(
map_ptr
(
buf
,
last_match
,
n
),
n
);
last_match
=
s
->
flength
;
}
}
}
last_match
=
s
->
flength
;
s
->
count
=
0
;
s
->
count
=
0
;
}
}
...
...
options.c
View file @
936fa865
...
@@ -319,6 +319,7 @@ void usage(enum logcode F)
...
@@ -319,6 +319,7 @@ void usage(enum logcode F)
rprintf
(
F
,
" -u, --update skip files that are newer on the receiver
\n
"
);
rprintf
(
F
,
" -u, --update skip files that are newer on the receiver
\n
"
);
rprintf
(
F
,
" --inplace update destination files in-place (SEE MAN PAGE)
\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 append data onto shorter files
\n
"
);
rprintf
(
F
,
" --append-verify like --append, but with old data in file checksum
\n
"
);
rprintf
(
F
,
" -d, --dirs transfer directories without recursing
\n
"
);
rprintf
(
F
,
" -d, --dirs transfer directories without recursing
\n
"
);
rprintf
(
F
,
" -l, --links copy symlinks as symlinks
\n
"
);
rprintf
(
F
,
" -l, --links copy symlinks as symlinks
\n
"
);
rprintf
(
F
,
" -L, --copy-links transform symlink into referent file/dir
\n
"
);
rprintf
(
F
,
" -L, --copy-links transform symlink into referent file/dir
\n
"
);
...
@@ -434,7 +435,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
...
@@ -434,7 +435,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
OPT_FILTER
,
OPT_COMPARE_DEST
,
OPT_COPY_DEST
,
OPT_LINK_DEST
,
OPT_HELP
,
OPT_FILTER
,
OPT_COMPARE_DEST
,
OPT_COPY_DEST
,
OPT_LINK_DEST
,
OPT_HELP
,
OPT_INCLUDE
,
OPT_INCLUDE_FROM
,
OPT_MODIFY_WINDOW
,
OPT_MIN_SIZE
,
OPT_CHMOD
,
OPT_INCLUDE
,
OPT_INCLUDE_FROM
,
OPT_MODIFY_WINDOW
,
OPT_MIN_SIZE
,
OPT_CHMOD
,
OPT_READ_BATCH
,
OPT_WRITE_BATCH
,
OPT_ONLY_WRITE_BATCH
,
OPT_MAX_SIZE
,
OPT_READ_BATCH
,
OPT_WRITE_BATCH
,
OPT_ONLY_WRITE_BATCH
,
OPT_MAX_SIZE
,
OPT_NO_D
,
OPT_NO_D
,
OPT_APPEND
,
OPT_SERVER
,
OPT_REFUSED_BASE
=
9000
};
OPT_SERVER
,
OPT_REFUSED_BASE
=
9000
};
static
struct
poptOption
long_options
[]
=
{
static
struct
poptOption
long_options
[]
=
{
...
@@ -521,7 +522,9 @@ static struct poptOption long_options[] = {
...
@@ -521,7 +522,9 @@ static struct poptOption long_options[] = {
{
"min-size"
,
0
,
POPT_ARG_STRING
,
&
min_size_arg
,
OPT_MIN_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
},
{
"sparse"
,
'S'
,
POPT_ARG_NONE
,
&
sparse_files
,
0
,
0
,
0
},
{
"inplace"
,
0
,
POPT_ARG_NONE
,
&
inplace
,
0
,
0
,
0
},
{
"inplace"
,
0
,
POPT_ARG_NONE
,
&
inplace
,
0
,
0
,
0
},
{
"append"
,
0
,
POPT_ARG_VAL
,
&
append_mode
,
1
,
0
,
0
},
{
"append"
,
0
,
POPT_ARG_NONE
,
0
,
OPT_APPEND
,
0
,
0
},
{
"append-verify"
,
0
,
POPT_ARG_VAL
,
&
append_mode
,
2
,
0
,
0
},
{
"no-append"
,
0
,
POPT_ARG_VAL
,
&
append_mode
,
0
,
0
,
0
},
{
"del"
,
0
,
POPT_ARG_NONE
,
&
delete_during
,
0
,
0
,
0
},
{
"del"
,
0
,
POPT_ARG_NONE
,
&
delete_during
,
0
,
0
,
0
},
{
"delete"
,
0
,
POPT_ARG_NONE
,
&
delete_mode
,
0
,
0
,
0
},
{
"delete"
,
0
,
POPT_ARG_NONE
,
&
delete_mode
,
0
,
0
,
0
},
{
"delete-before"
,
0
,
POPT_ARG_NONE
,
&
delete_before
,
0
,
0
,
0
},
{
"delete-before"
,
0
,
POPT_ARG_NONE
,
&
delete_before
,
0
,
0
,
0
},
...
@@ -1121,6 +1124,13 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
...
@@ -1121,6 +1124,13 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
}
}
break
;
break
;
case
OPT_APPEND
:
if
(
am_server
)
append_mode
++
;
else
append_mode
=
1
;
break
;
case
OPT_LINK_DEST
:
case
OPT_LINK_DEST
:
#ifdef SUPPORT_HARD_LINKS
#ifdef SUPPORT_HARD_LINKS
link_dest
=
1
;
link_dest
=
1
;
...
@@ -1912,9 +1922,11 @@ void server_options(char **args,int *argc)
...
@@ -1912,9 +1922,11 @@ void server_options(char **args,int *argc)
}
}
}
}
if
(
append_mode
)
if
(
append_mode
)
{
if
(
append_mode
>
1
)
args
[
ac
++
]
=
"--append"
;
args
[
ac
++
]
=
"--append"
;
args
[
ac
++
]
=
"--append"
;
else
if
(
inplace
)
}
else
if
(
inplace
)
args
[
ac
++
]
=
"--inplace"
;
args
[
ac
++
]
=
"--inplace"
;
if
(
files_from
&&
(
!
am_sender
||
filesfrom_host
))
{
if
(
files_from
&&
(
!
am_sender
||
filesfrom_host
))
{
...
...
receiver.c
View file @
936fa865
...
@@ -157,6 +157,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
...
@@ -157,6 +157,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
sum
.
flength
=
(
OFF_T
)
sum
.
count
*
sum
.
blength
;
sum
.
flength
=
(
OFF_T
)
sum
.
count
*
sum
.
blength
;
if
(
sum
.
remainder
)
if
(
sum
.
remainder
)
sum
.
flength
-=
sum
.
blength
-
sum
.
remainder
;
sum
.
flength
-=
sum
.
blength
-
sum
.
remainder
;
if
(
append_mode
==
2
)
{
for
(
j
=
CHUNK_SIZE
;
j
<
sum
.
flength
;
j
+=
CHUNK_SIZE
)
{
for
(
j
=
CHUNK_SIZE
;
j
<
sum
.
flength
;
j
+=
CHUNK_SIZE
)
{
if
(
do_progress
)
if
(
do_progress
)
show_progress
(
offset
,
total_size
);
show_progress
(
offset
,
total_size
);
...
@@ -169,8 +170,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
...
@@ -169,8 +170,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
if
(
do_progress
)
if
(
do_progress
)
show_progress
(
offset
,
total_size
);
show_progress
(
offset
,
total_size
);
sum_update
(
map_ptr
(
mapbuf
,
offset
,
len
),
len
);
sum_update
(
map_ptr
(
mapbuf
,
offset
,
len
),
len
);
offset
=
sum
.
flength
;
}
}
}
offset
=
sum
.
flength
;
if
(
fd
!=
-
1
&&
(
j
=
do_lseek
(
fd
,
offset
,
SEEK_SET
))
!=
offset
)
{
if
(
fd
!=
-
1
&&
(
j
=
do_lseek
(
fd
,
offset
,
SEEK_SET
))
!=
offset
)
{
rsyserr
(
FERROR
,
errno
,
"lseek of %s returned %.0f, not %.0f"
,
rsyserr
(
FERROR
,
errno
,
"lseek of %s returned %.0f, not %.0f"
,
full_fname
(
fname
),
(
double
)
j
,
(
double
)
offset
);
full_fname
(
fname
),
(
double
)
j
,
(
double
)
offset
);
...
@@ -426,8 +428,9 @@ int recv_files(int f_in, char *local_name)
...
@@ -426,8 +428,9 @@ int recv_files(int f_in, char *local_name)
if
(
csum_length
==
SHORT_SUM_LENGTH
)
{
if
(
csum_length
==
SHORT_SUM_LENGTH
)
{
if
(
keep_partial
&&
!
partial_dir
)
if
(
keep_partial
&&
!
partial_dir
)
make_backups
=
-
make_backups
;
/* prevents double backup */
make_backups
=
-
make_backups
;
/* prevents double backup */
append_mode
=
-
append_mode
;
if
(
append_mode
)
sparse_files
=
-
sparse_files
;
sparse_files
=
-
sparse_files
;
append_mode
=
-
append_mode
;
csum_length
=
SUM_LENGTH
;
csum_length
=
SUM_LENGTH
;
redoing
=
1
;
redoing
=
1
;
}
}
...
@@ -435,8 +438,9 @@ int recv_files(int f_in, char *local_name)
...
@@ -435,8 +438,9 @@ int recv_files(int f_in, char *local_name)
if
(
csum_length
!=
SHORT_SUM_LENGTH
)
{
if
(
csum_length
!=
SHORT_SUM_LENGTH
)
{
if
(
keep_partial
&&
!
partial_dir
)
if
(
keep_partial
&&
!
partial_dir
)
make_backups
=
-
make_backups
;
make_backups
=
-
make_backups
;
append_mode
=
-
append_mode
;
if
(
append_mode
)
sparse_files
=
-
sparse_files
;
sparse_files
=
-
sparse_files
;
append_mode
=
-
append_mode
;
csum_length
=
SHORT_SUM_LENGTH
;
csum_length
=
SHORT_SUM_LENGTH
;
redoing
=
0
;
redoing
=
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment