Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llfio/v2.0/detail/impl/posix/file_handle.ipp27
-rw-r--r--test/tests/clone_extents.cpp6
2 files changed, 18 insertions, 15 deletions
diff --git a/include/llfio/v2.0/detail/impl/posix/file_handle.ipp b/include/llfio/v2.0/detail/impl/posix/file_handle.ipp
index 8164463e..ef41f330 100644
--- a/include/llfio/v2.0/detail/impl/posix/file_handle.ipp
+++ b/include/llfio/v2.0/detail/impl/posix/file_handle.ipp
@@ -586,7 +586,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte
}
if(end >= extent.offset + extent.length)
{
- break; // done
+ break; // done
}
// hole goes from end to start. end is inclusive, start is exclusive.
if((end >= extent.offset && end < extent.offset + extent.length) || (start > extent.offset && start <= extent.offset + extent.length))
@@ -597,7 +597,7 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte
}
if(start >= extent.offset + extent.length)
{
- break; // done
+ break; // done
}
#ifdef __linux__
end = lseek64(_v.fd, start, SEEK_HOLE);
@@ -728,22 +728,25 @@ result<file_handle::extent_pair> file_handle::clone_extents_to(file_handle::exte
// This gets implemented in FreeBSD 13. See https://reviews.freebsd.org/D20584
return syscall(569 /*copy_file_range*/, intfd, inoffp, outfd, outoffp, len, flags);
#else
- if(!emulate_if_unsupported)
- {
- errno = EOPNOTSUPP;
- return -1;
- }
+ (void) infd;
+ (void) inoffp;
+ (void) outfd;
+ (void) outoffp;
+ (void) len;
+ (void) flags;
+ errno = EOPNOTSUPP;
+ return -1;
#endif
};
auto _zero_file_range = [&](int fd, off_t offset, size_t len) -> int {
#if defined(__linux__)
return fallocate(fd, 0x02 /*FALLOC_FL_PUNCH_HOLE*/ | 0x01 /*FALLOC_FL_KEEP_SIZE*/, offset, len);
#else
- if(!emulate_if_unsupported)
- {
- errno = EOPNOTSUPP;
- return -1;
- }
+ (void) fd;
+ (void) offset;
+ (void) len;
+ errno = EOPNOTSUPP;
+ return -1;
#endif
};
for(const workitem &item : todo)
diff --git a/test/tests/clone_extents.cpp b/test/tests/clone_extents.cpp
index eda574bd..652e719e 100644
--- a/test/tests/clone_extents.cpp
+++ b/test/tests/clone_extents.cpp
@@ -124,8 +124,8 @@ static inline void TestCloneExtents()
{
if(shouldbe.data()[n] != handles[1].fh.address()[n])
{
- std::cerr << "Byte at offset " << n << " is '" << (int) *(char *) &shouldbe.data()[n] << "' in source and is '" << (int) *(char *) &handles[1].fh.address()[n]
- << "' in destination." << std::endl;
+ std::cerr << "Byte at offset " << n << " is '" << (int) *(char *) &shouldbe.data()[n] << "' in source and is '"
+ << (int) *(char *) &handles[1].fh.address()[n] << "' in destination." << std::endl;
BOOST_REQUIRE(shouldbe.data()[n] == handles[1].fh.address()[n]);
break;
}
@@ -196,7 +196,7 @@ static inline void TestCloneOrCopyFileWhole()
dest_stat.fill(destfh).value();
std::cout << "Source file has " << src_stat.st_blocks << " blocks allocated. Destination file has " << dest_stat.st_blocks << " blocks allocated."
<< std::endl;
- BOOST_CHECK(src_stat.st_blocks <= dest_stat.st_blocks);
+ BOOST_CHECK(abs((long) src_stat.st_blocks - (long) dest_stat.st_blocks) < ((long) src_stat.st_blocks / 8));
for(size_t n = 0; n < maximum_extent; n++)
{