Move truncate to new scheme.
Move file lock/unlock code.
Final steps of moving file I/O out.

With this, it's all now encapsulated in syncfile.c, and detangled from
everything else.