binman: Move state information into a new module