Ferromagnetic effects in the theory of slow and fast resistive wall modes in tokamaks