refactor: remove XFS specific code to use more portable code (#8289)

This commit is contained in:
Yat Ho
2026-01-30 22:56:26 +08:00
committed by GitHub
parent a61bdc24da
commit db08054522
2 changed files with 0 additions and 36 deletions

View File

@@ -234,10 +234,6 @@ target_compile_definitions(${TR_NAME}
$<$<STREQUAL:${CRYPTO_PKG},wolfssl>:WITH_WOLFSSL>
$<$<BOOL:${Intl_FOUND}>:ENABLE_GETTEXT>)
tr_target_compile_definitions_for_headers(${TR_NAME}
PRIVATE
xfs/xfs.h)
tr_target_compile_definitions_for_functions(${TR_NAME}
PRIVATE
copyfile

View File

@@ -27,10 +27,6 @@
#include <sys/file.h> /* flock() */
#endif
#ifdef HAVE_XFS_XFS_H
#include <xfs/xfs.h>
#endif
/* OS-specific file copy (copy_file_range, sendfile64, or copyfile). */
#if defined(__linux__)
#include <linux/version.h>
@@ -807,31 +803,6 @@ bool preallocate_fallocate64(tr_sys_file_t handle, uint64_t size)
}
#endif
#ifdef HAVE_XFS_XFS_H
bool full_preallocate_xfs(tr_sys_file_t handle, uint64_t size)
{
if (platform_test_xfs_fd(handle) == 0) // true if on xfs filesystem
{
return false;
}
xfs_flock64_t fl;
fl.l_whence = 0;
fl.l_start = 0;
fl.l_len = size;
// The blocks are allocated, but not zeroed, and the file size does not change
bool ok = xfsctl(nullptr, handle, XFS_IOC_RESVSP64, &fl) != -1;
if (ok)
{
ok = ftruncate(handle, size) == 0;
}
return ok;
}
#endif
#ifdef __APPLE__
bool full_preallocate_apple(tr_sys_file_t handle, uint64_t size)
{
@@ -889,9 +860,6 @@ bool tr_sys_file_preallocate(tr_sys_file_t handle, uint64_t size, int flags, tr_
approaches.insert(
std::end(approaches),
{
#ifdef HAVE_XFS_XFS_H
full_preallocate_xfs,
#endif
#ifdef __APPLE__
full_preallocate_apple,
#endif