Ringbuffer and Pipe

misc refactor and enhancement on ringbuffer. Non-blocking mode pipe device.

I fount that to get the FinSh work on pipe, I have to implement bidirectional pipe first...