File_lock: add function with_lock
File_lock: rename do_with_lock to with_lock_gen
File_lock: rename do_with_locks to with_locks_gen
File_lock: add function with_locks