files: Add fast file type detection

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
files: Convert file locks

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>