Use rename operation to make colection_move atomic

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Add _generic_write to allow pass header in

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>