fs: pipe: Add code to actually write to the buffer

Signed-off-by: Bart Kuivenhoven <bemkuivenhoven@gmail.com>
lib: tree: Add callback to tree cleanup

In the old situation the data would be freed, or not. This has some
problems.

The new situation solves those problems by adding in a callback to deal
with the data in a much more elegant way. Basically this clean up code
now is responsible for cleaning up the data.

Signed-off-by: Bart Kuivenhoven <bemkuivenhoven@gmail.com>