Document write_buf.

Fix up read_buf docs.

Change order of arguments for write_buf, to make it more consistent
with read_buf.

Fix up loopback.pl to use the new argument order for write_buf.