[PATCH v5 2/3] cabinet: fix style, move to separate file