cbufp: refactor code for mapping cbufps