Add the buf_transfer() function