void bi_add(struct btinfo_common *what, int type, int size) { int idx; what->len = size; what->type = type; if (bootinfo) { idx = bi_find(type); if (idx < 0) { idx = bootinfo->nentries++; } bootinfo->entry[idx] = (u_long)what; } }
void bi_del(int type) { int idx; int i; if (bootinfo) { idx = bi_find(type); if (idx >= 0) { for (i = idx + 1; i < bootinfo->nentries; i++) { bootinfo->entry[i - 1] = bootinfo->entry[i]; } bootinfo->entry[--bootinfo->nentries] = 0L; } } }
void find_find (Lump_s key, Lump_s val, void *user) { BiTree_s *tree = user; Lump_s fval; int rc; rc = bi_find(tree, key, &fval); if (rc) { fatal("Didn't find %s : rc=%d", key.d, rc); } else if (cmplump(val, fval) != 0) { fatal("Val not the same %s!=%s", val.d, fval.d); } else { printf("%s:%s\n", key.d, fval.d); } freelump(fval); }