A general process for in situ formation of functional surface layers on ceramics