Move ring-related rt functions to rt_ring; some cleanup.