Skip to content

Instantly share code, notes, and snippets.

@jimparis
jimparis / punch.py
Created October 16, 2012 20:53 — forked from NicolasT/punch.py
Using FALLOC_FL_PUNCH_HOLE from Python to punch holes in files
#!/usr/bin/python
import ctypes
import ctypes.util
c_off_t = ctypes.c_int64
def make_fallocate():
libc_name = ctypes.util.find_library('c')
libc = ctypes.CDLL(libc_name)