bbusd: move some functions to separate .c files