Cleanup copy functions (#1500)
Some checks failed
CodeQL / Analyze (push) Has been cancelled
mkdocs / deploy (push) Has been cancelled

This commit is contained in:
trapexit 2025-07-27 16:23:45 -05:00 • committed by GitHub
parent e8cd74cab0
commit 33fc26f81f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 164 additions and 151 deletions

View file

@ -27,7 +27,7 @@ static
s64
_copydata_copy_file_range(const int src_fd_,
const int dst_fd_,
const u64 size_)
const u64 count_)
{
s64 rv;
u64 nleft;
@ -36,24 +36,27 @@ _copydata_copy_file_range(const int src_fd_,
src_off = 0;
dst_off = 0;
nleft = size_;
do
nleft = count_;
while(nleft > 0)
{
rv = fs::copy_file_range(src_fd_,&src_off,dst_fd_,&dst_off,nleft,0);
if(rv == -EINTR)
continue;
if(rv == -EAGAIN)
continue;
if(rv == 0)
break;
if(rv < 0)
return rv;
switch(rv)
{
case -EINTR:
case -EAGAIN:
continue;
case 0:
break;
default:
if(rv < 0)
return rv;
break;
}
nleft -= rv;
}
while(nleft > 0);
return (size_ - nleft);
return (count_ - nleft);
}
s64