master, mount: Refactor communication between master and mount

Replace serialize/deserialize functions with macros generating them.

Change-Id: I466be4730b064bcf8385ffec84e60a71adfbde95