/* resetTab() */ static void resetTab (hTab * tabPtr) { int lastSize; int slot; struct hLinks *lastSlotPtr; struct hLinks *lastList; hEnt *hEntPtr; lastSlotPtr = tabPtr->slotPtr; lastSize = tabPtr->size; h_initTab_ (tabPtr, tabPtr->size * RESETFACTOR); for (lastList = lastSlotPtr; lastSize > 0; lastSize--, lastList++) { while (lastList != lastList->bwPtr) { hEntPtr = (hEnt *) lastList->bwPtr; remList_ ((struct hLinks *) hEntPtr); slot = getAddr (tabPtr, (char *) hEntPtr->keyname); insList_ ((struct hLinks *) hEntPtr, (struct hLinks *) (&(tabPtr->slotPtr[slot]))); tabPtr->numEnts++; } } free (lastSlotPtr); }
static int getMap_(void) { char *domain; struct ypall_callback incallback; int i; h_initTab_(&hashTab, 64); incallback.foreach = putin_; if ((i = yp_get_default_domain(&domain)) != 0) return(i); return (yp_all(domain, "auto.master", &incallback)); }
/* initParse() */ void initParse(struct lsInfo *lsInfo) { static char fname[] = "initParse()"; int i; int *indx; hEnt *hashEntPtr; if (logclass & (LC_TRACE | LC_SCHED)) ls_syslog(LOG_DEBUG1, "%s: Entering this routine...", fname); if (!h_TabEmpty_(&resNameTbl)) { h_freeRefTab_(&resNameTbl); } h_initTab_(&resNameTbl, lsInfo->nRes); /* We firmly believe those calloc() will * succeed. */ indx = calloc(lsInfo->nRes, sizeof(int)); for (i = 0; i < lsInfo->nRes; i++) { hashEntPtr = h_addEnt_(&resNameTbl, lsInfo->resTable[i].name, NULL); indx[i] = i; hashEntPtr->hData = &indx[i]; } /* login, swap, idle and cpu are more human * readable aliases for ls, swp,it and ut (?). */ indx = calloc(4, sizeof(int)); hashEntPtr = h_addEnt_(&resNameTbl, "login", NULL); indx[0] = LS; hashEntPtr->hData = &indx[0]; hashEntPtr = h_addEnt_(&resNameTbl, "swap", NULL); indx[1] = SWP; hashEntPtr->hData = &indx[1]; hashEntPtr = h_addEnt_(&resNameTbl, "idle", NULL); indx[2] = IT; hashEntPtr->hData = &indx[2]; hashEntPtr = h_addEnt_(&resNameTbl, "cpu", NULL); indx[3] = R1M; hashEntPtr->hData = &indx[3]; if (h_TabEmpty_(&keyNameTbl)) { int *key; key = calloc(NUM_KEYS, sizeof(int)); h_initTab_(&keyNameTbl, NUM_KEYS); hashEntPtr = h_addEnt_(&keyNameTbl, "duration", NULL); key[0] = KEY_DURATION; hashEntPtr->hData = &key[0]; hashEntPtr = h_addEnt_(&keyNameTbl, "decay", NULL); key[1] = KEY_DECAY; hashEntPtr->hData = &key[1]; hashEntPtr = h_addEnt_(&keyNameTbl, "hosts", NULL); key[2] = KEY_HOSTS; hashEntPtr->hData = &key[2]; hashEntPtr = h_addEnt_(&keyNameTbl, "ptile", NULL); key[3] = KEY_PTILE; hashEntPtr->hData = &key[3]; } }
void initconntbl_(void) { h_initTab_(&conn_table, 3); }