A Nuke like colorspace node for Mental Ray to take care of the conversion to linear.
You can choose between 4 different colorspaces as inputs (sRGB, rec709, gamma 2.2 and gamma 1.8) and let it make all the math for you, giving back a linear texture/color as output.
I also added a gain and an offset if you are converting existing shading networks and you need to map a different gain or offset on the file node.
The shader is really simple and fast, it has been used in production for more than 8 months without any problem and can be used to convert textures, colorswatches or whatever you need. It also work with Maya embedded pass system
The shader have been compiled for linux64 with Maya2011 and for win64 and mac64 with maya2013.
If anyone could compile it for other versions and platforms I would be really happy to add it to the archive and give credit.
A big thanks goes to Pixero (http://www.pixero.com/) for all the cool shaders he did and for releasing the source code.
It was a very good starting point.
Another big thanks goes to Andrew Hazelden (http://www.andrewhazelden.com/), for helping me with the compilers.
It was a huge help from you.