mirror of
https://github.com/coreutils/coreutils.git
synced 2024-11-28 04:24:45 +08:00
5c3fd50a75
* tests/cp/fiemap-2: Enable the fiemap check for files, which will enable the test for files on ext3. * tests/cp/fiemap-perf: Comment why we're not enabling for ext3. * tests/cp/sparse-fiemap: Ditto. Also sync the files before doing a fiemap which was needed for ext4 loop back at least. Add a comment that FIEMAP_FLAG_SYNC is ineffective, thus requiring the explicit syncs. * tests/fiemap-capable: A new python script to determine if a specified path supports fiemap. * tests/init.cfg (fiemap_capable_): Use the new python script. * tests/Makefile.am (EXTRA_DIST): Include the new python script.
17 lines
512 B
Plaintext
17 lines
512 B
Plaintext
import struct, fcntl, sys, os
|
|
|
|
def sizeof(t): return struct.calcsize(t)
|
|
IOCPARM_MASK = 0x7f
|
|
IOC_OUT = 0x40000000
|
|
IOC_IN = 0x80000000
|
|
IOC_INOUT = (IOC_IN|IOC_OUT)
|
|
def _IOWR(x,y,t): return (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|y)
|
|
|
|
try:
|
|
fd = os.open (len (sys.argv) == 2 and sys.argv[1] or '.', os.O_RDONLY)
|
|
struct_fiemap = '=qqllll'
|
|
FS_IOC_FIEMAP = _IOWR (ord ('f'), 11, struct_fiemap)
|
|
fcntl.ioctl (fd, FS_IOC_FIEMAP, struct.pack(struct_fiemap, 0,~0,0,0,0,0))
|
|
except:
|
|
sys.exit (1)
|