This is mostly a rewrite of src/afs/afs_cell.c, and associated changes