Change mode permission fields to be its own types instead of using Int.

Also provide simple conversion function to extract part of the meaning.