r25568: move idmap related functions into their own file.