ring: make struct and macros type agnostic