1 import struct, fcntl, sys, os
3 def sizeof(t): return struct.calcsize(t)
7 IOC_INOUT = (IOC_IN|IOC_OUT)
8 def _IOWR(x,y,t): return (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|y)
11 fd = os.open (len (sys.argv) == 2 and sys.argv[1] or '.', os.O_RDONLY)
12 struct_fiemap = '=qqllll'
13 FS_IOC_FIEMAP = _IOWR (ord ('f'), 11, struct_fiemap)
14 fcntl.ioctl (fd, FS_IOC_FIEMAP, struct.pack(struct_fiemap, 0,~0,0,0,0,0))