Lines Matching refs:fhp
357 _nss_files_hash_destroy(files_hash_t *fhp) in _nss_files_hash_destroy() argument
359 free(fhp->fh_table); in _nss_files_hash_destroy()
360 fhp->fh_table = NULL; in _nss_files_hash_destroy()
361 free(fhp->fh_line); in _nss_files_hash_destroy()
362 fhp->fh_line = NULL; in _nss_files_hash_destroy()
363 free(fhp->fh_file_start); in _nss_files_hash_destroy()
364 fhp->fh_file_start = NULL; in _nss_files_hash_destroy()
388 int netdb, files_hash_t *fhp, int hashop, files_XY_check_func check) in _nss_files_XY_hash() argument
410 mutex_lock(&fhp->fh_lock);
421 if (fhp->fh_table == NULL || --retries == 0)
426 if (st.st_mtim.tv_sec == fhp->fh_mtime.tv_sec &&
427 st.st_mtim.tv_nsec == fhp->fh_mtime.tv_nsec &&
428 fhp->fh_table != NULL) {
429 htab = &fhp->fh_table[hashop * fhp->fh_size];
430 hash = fhp->fh_hash_func[hashop](args, 1, NULL, 0);
431 for (hp = htab[hash % fhp->fh_size].h_first; hp != NULL;
436 if ((*check)(args, fhp->fh_line[line].l_start,
437 fhp->fh_line[line].l_len) == 0)
444 fhp->fh_line[line].l_start,
445 &fhp->fh_line[line].l_len,
446 fhp->fh_line[line].l_len + 1,
450 fhp->fh_line[line].l_start,
451 &fhp->fh_line[line].l_len,
452 fhp->fh_line[line].l_len + 1,
461 if ((*args->str2ent)(fhp->fh_line[line].l_start,
462 fhp->fh_line[line].l_len, args->buf.result,
467 args->returnlen = fhp->fh_line[line].l_len;
468 mutex_unlock(&fhp->fh_lock);
476 mutex_unlock(&fhp->fh_lock);
480 _nss_files_hash_destroy(fhp);
485 if ((fhp->fh_file_start = malloc((ssize_t)st.st_size + 1)) == NULL)
491 if (read(fd, fhp->fh_file_start, (ssize_t)st.st_size) !=
499 fhp->fh_file_end = fhp->fh_file_start + (off_t)st.st_size;
500 *fhp->fh_file_end = '\n';
501 fhp->fh_mtime = st.st_mtim;
517 st.st_mtim.tv_sec != fhp->fh_mtime.tv_sec ||
518 st.st_mtim.tv_nsec != fhp->fh_mtime.tv_nsec ||
525 for (cp = fhp->fh_file_start; cp < fhp->fh_file_end; cp++)
536 fhp->fh_size = line;
537 fhp->fh_line = malloc(line * sizeof (files_linetab_t));
538 fhp->fh_table = calloc(line * fhp->fh_nhtab, sizeof (files_hashent_t));
539 if (fhp->fh_line == NULL || fhp->fh_table == NULL)
543 cp = fhp->fh_file_start;
544 while (cp < fhp->fh_file_end) {
567 for (ht = 0; ht < fhp->fh_nhtab; ht++) {
568 hp = &fhp->fh_table[ht * fhp->fh_size + line];
569 hp->h_hash = fhp->fh_hash_func[ht](&xargs, 0, first,
572 fhp->fh_line[line].l_start = first;
573 fhp->fh_line[line++].l_len = last - first;
584 for (ht = 0; ht < fhp->fh_nhtab; ht++) {
585 htab = &fhp->fh_table[ht * fhp->fh_size];
587 uint_t bucket = hp->h_hash % fhp->fh_size;
596 _nss_files_hash_destroy(fhp);
597 mutex_unlock(&fhp->fh_lock);
644 _nss_files_constr(ops, n_ops, filename, min_bufsize, fhp) in _nss_files_constr() argument
649 files_hash_t *fhp;
662 be->hashinfo = fhp;
664 if (fhp != NULL) {
665 (void) mutex_lock(&fhp->fh_lock);
666 fhp->fh_refcnt++;
667 (void) mutex_unlock(&fhp->fh_lock);