pagemap.h: move dir_pages() over there