wiimms-iso-tools icon indicating copy to clipboard operation
wiimms-iso-tools copied to clipboard

Slightly more robust fallocate detection

Open TobiX opened this issue 3 years ago • 0 comments

This uses the compiler to try to detect if fallocate is available (should be on any Linux since 2.6.23). With the old check, fallocate is never found on modern systems, since the real header file where it is defined is somewhere at /usr/include/<ARCH>/bits/fcntl-linux.h.

Why is this useful? I noticed that wit is really slow (without showing progress) when copying images to an ntfs-3g-mounted partition. Since ntfs-3g doesn't implement fallocate, posix_fallocate falls back to a very slow "emulation" (manpage, source)

PS: It would probably make sense to check the return value of fallocate/posix_fallocate for at lease EOPNOTSUPP to show a warning that the target filesystem doesn't support preallocation.

PPS: Feel free to take this contribution under any license you like (consider it BSD-0/GPL2+ dual-licensed ;))

TobiX avatar Apr 24 '21 12:04 TobiX