packfile: define and use bsearch_pack()