ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/AIO.pm
(Generate patch)

Comparing IO-AIO/AIO.pm (file contents):
Revision 1.146 by root, Tue Apr 21 20:06:05 2009 UTC vs.
Revision 1.147 by root, Wed Jun 3 12:24:49 2009 UTC

591 my $grp = aio_group $cb; 591 my $grp = aio_group $cb;
592 592
593 aioreq_pri $pri; 593 aioreq_pri $pri;
594 add $grp aio_open $src, O_RDONLY, 0, sub { 594 add $grp aio_open $src, O_RDONLY, 0, sub {
595 if (my $src_fh = $_[0]) { 595 if (my $src_fh = $_[0]) {
596 my @stat = stat $src_fh; 596 my @stat = stat $src_fh; # hmm, might bock over nfs?
597 597
598 aioreq_pri $pri; 598 aioreq_pri $pri;
599 add $grp aio_open $dst, O_CREAT | O_WRONLY | O_TRUNC, 0200, sub { 599 add $grp aio_open $dst, O_CREAT | O_WRONLY | O_TRUNC, 0200, sub {
600 if (my $dst_fh = $_[0]) { 600 if (my $dst_fh = $_[0]) {
601 aioreq_pri $pri; 601 aioreq_pri $pri;
602 add $grp aio_sendfile $dst_fh, $src_fh, 0, $stat[7], sub { 602 add $grp aio_sendfile $dst_fh, $src_fh, 0, $stat[7], sub {
603 if ($_[0] == $stat[7]) { 603 if ($_[0] == $stat[7]) {
604 $grp->result (0); 604 $grp->result (0);
605 close $src_fh; 605 close $src_fh;
606 606
607 # those should not normally block. should. should. 607 my $ch = sub {
608 utime $stat[8], $stat[9], $dst; 608 aioreq_pri $pri;
609 chmod $stat[2] & 07777, $dst_fh; 609 add $grp aio_chmod $dst_fh, $stat[2] & 07777, sub {
610 chown $stat[4], $stat[5], $dst_fh; 610 aioreq_pri $pri;
611 add $grp aio_chown $dst_fh, $stat[4], $stat[5], sub {
612 aioreq_pri $pri;
613 add $grp aio_close $dst_fh;
614 }
615 };
616 };
611 617
612 aioreq_pri $pri; 618 aioreq_pri $pri;
613 add $grp aio_close $dst_fh; 619 add $grp aio_utime $dst_fh, $stat[8], $stat[9], sub {
620 if ($_[0] < 0 && $! == ENOSYS) {
621 aioreq_pri $pri;
622 add $grp aio_utime $dst, $stat[8], $stat[9], $ch;
623 } else {
624 $ch->();
625 }
626 };
614 } else { 627 } else {
615 $grp->result (-1); 628 $grp->result (-1);
616 close $src_fh; 629 close $src_fh;
617 close $dst_fh; 630 close $dst_fh;
618 631

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines