Magnetohydrodynamic equilibrium and stability of field-reversed configurations