On the structure of linearly compact rings and their dualities