Add _generic_write to allow pass header in

Allow other operations pass "header" in and hold object all the lifecycle

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