[PATCH] Batch-mode rewrite
Chris Shoemaker
c.shoemaker at cox.net
Wed Jul 21 19:57:33 GMT 2004
Geesh, I forgot the attachment, (again).
On Wed, Jul 21, 2004 at 03:54:11PM -0400, Chris Shoemaker wrote:
> On Tue, Jul 20, 2004 at 09:10:22AM -0700, Wayne Davison wrote:
> > On Mon, Jul 19, 2004 at 06:18:49PM -0400, Chris Shoemaker wrote:
>
> > avoid this and also to separate the post-generator processing (the
> > directory tweaks) would have to be delayed until after the receiver
> > post-processing had finished (the --delete-after handling). I think
> > I'd like to avoid that.
>
> Ah, I see what you mean about the directory tweaks. AFAICT, this is
> really easy to fix, though. I think it's nicer to break that tweaking
> loop into its own function anyway, (independent of solving the read-batch
> gen/recv sync problem.) I'm attaching a version of this gen/recv
> serialization concept patch with the directory tweak in its own
> function.
>
> -chris
>
-------------- next part --------------
Index: generator.c
===================================================================
RCS file: /cvsroot/rsync/generator.c,v
retrieving revision 1.102
diff -d -u -r1.102 generator.c
--- generator.c 21 Jul 2004 23:59:25 -0000 1.102
+++ generator.c 22 Jul 2004 00:21:23 -0000
@@ -596,6 +596,14 @@
if (preserve_hard_links)
do_hard_links();
+ if (verbose > 2)
+ rprintf(FINFO,"generate_files finished\n");
+}
+
+void restore_directory_perms(struct file_list *flist, char *local_name)
+{
+ int i;
+
/* now we need to fix any directory permissions that were
* modified during the transfer */
for (i = 0; i < flist->count; i++) {
@@ -606,6 +614,4 @@
file, i, -1);
}
- if (verbose > 2)
- rprintf(FINFO,"generate_files finished\n");
}
Index: main.c
===================================================================
RCS file: /cvsroot/rsync/main.c,v
retrieving revision 1.210
diff -d -u -r1.210 main.c
--- main.c 21 Jul 2004 23:59:31 -0000 1.210
+++ main.c 22 Jul 2004 00:21:24 -0000
@@ -473,6 +473,19 @@
io_flush(NORMAL_FLUSH);
+ if (read_batch) {
+ io_start_buffering_out();
+ set_msg_fd_in(error_pipe[0]);
+ set_msg_fd_out(error_pipe[1]);
+ send_msg(MSG_DONE, "", 0);
+ generate_files(f_out, flist, local_name);
+ recv_files(f_in, flist, local_name);
+ restore_directory_perms(flist, local_name);
+ io_flush(FULL_FLUSH);
+ report(f_in);
+ return 0;
+ }
+
if ((pid = do_fork()) == 0) {
close(error_pipe[0]);
if (f_in != f_out)
@@ -510,6 +523,7 @@
set_msg_fd_in(error_pipe[0]);
generate_files(f_out, flist, local_name);
+ restore_directory_perms(flist, local_name);
get_redo_num(); /* Read final MSG_DONE and any prior messages. */
report(-1);
More information about the rsync
mailing list