Use SFINAE to only cast away volatile when necessary.

Also clean up namespace and symbol exposure.

Change-Id: Ic32e0181e1a293998361667db1c5461026f8d3a4