1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
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)
|