Lines Matching defs:ifs

163 int fr_loginit(ifs)
164 ipf_stack_t *ifs;
169 ifs->ifs_iplt[i] = NULL;
170 ifs->ifs_ipll[i] = NULL;
171 ifs->ifs_iplh[i] = &ifs->ifs_iplt[i];
172 ifs->ifs_iplused[i] = 0;
173 bzero((char *)&ifs->ifs_iplcrc[i], sizeof(ifs->ifs_iplcrc[i]));
184 cv_init(&ifs->ifs_iplwait, "ipl condvar", CV_DRIVER, NULL);
186 MUTEX_INIT(&ifs->ifs_ipl_mutex, "ipf log mutex");
188 ifs->ifs_ipl_log_init = 1;
201 void fr_logunload(ifs)
202 ipf_stack_t *ifs;
206 if (ifs->ifs_ipl_log_init == 0)
210 (void) ipflog_clear(i, ifs);
213 cv_destroy(&ifs->ifs_iplwait);
215 MUTEX_DESTROY(&ifs->ifs_ipl_mutex);
217 ifs->ifs_ipl_log_init = 0;
254 ipf_stack_t *ifs = fin->fin_ifs;
324 nif = ifs->ifs_ipf_ipv4;
326 nif = ifs->ifs_ipf_ipv6;
357 if (!ifs->ifs_ipl_logall) {
420 int ipllog(dev, fin, items, itemsz, types, cnt, ifs)
426 ipf_stack_t *ifs;
439 if (ifs->ifs_ipl_suppress) {
440 MUTEX_ENTER(&ifs->ifs_ipl_mutex);
442 if ((ifs->ifs_ipll[dev] != NULL) &&
443 bcmp((char *)fin, (char *)&ifs->ifs_iplcrc[dev],
445 ifs->ifs_ipll[dev]->ipl_count++;
446 MUTEX_EXIT(&ifs->ifs_ipl_mutex);
449 bcopy((char *)fin, (char *)&ifs->ifs_iplcrc[dev],
452 bzero((char *)&ifs->ifs_iplcrc[dev], FI_CSIZE);
453 MUTEX_EXIT(&ifs->ifs_ipl_mutex);
470 MUTEX_ENTER(&ifs->ifs_ipl_mutex);
471 if ((ifs->ifs_iplused[dev] + len) > IPFILTER_LOGSIZE) {
472 MUTEX_EXIT(&ifs->ifs_ipl_mutex);
477 ifs->ifs_iplused[dev] += len;
478 MUTEX_EXIT(&ifs->ifs_ipl_mutex);
510 MUTEX_ENTER(&ifs->ifs_ipl_mutex);
511 ifs->ifs_ipll[dev] = ipl;
512 *ifs->ifs_iplh[dev] = ipl;
513 ifs->ifs_iplh[dev] = &ipl->ipl_next;
520 cv_signal(&ifs->ifs_iplwait);
521 MUTEX_EXIT(&ifs->ifs_ipl_mutex);
523 MUTEX_EXIT(&ifs->ifs_ipl_mutex);
524 WAKEUP(&ifs->ifs_iplh, dev);
546 int ipflog_read(unit, uio, ifs)
549 ipf_stack_t *ifs;
565 (uio->uio_resid > ifs->ifs_ipl_logsize))
573 MUTEX_ENTER(&ifs->ifs_ipl_mutex);
575 while (ifs->ifs_iplt[unit] == NULL) {
582 RWLOCK_EXIT(&ifs->ifs_ipf_global);
583 if (!cv_wait_sig(&ifs->ifs_iplwait, &ifs->ifs_ipl_mutex.ipf_lk)) {
584 READ_ENTER(&ifs->ifs_ipf_global);
585 MUTEX_EXIT(&ifs->ifs_ipl_mutex);
588 READ_ENTER(&ifs->ifs_ipf_global);
596 MUTEX_EXIT(&ifs->ifs_ipl_mutex);
601 MUTEX_EXIT(&ifs->ifs_ipl_mutex);
602 l = get_sleep_lock(&ifs->ifs_iplh[unit]);
603 error = sleep(&ifs->ifs_iplh[unit], PZERO+1);
607 error = mpsleep(&ifs->ifs_iplh[unit], PSUSP|PCATCH, "iplread", 0,
608 &ifs->ifs_ipl_mutex, MS_LOCK_SIMPLE);
610 MUTEX_EXIT(&ifs->ifs_ipl_mutex);
612 error = SLEEP(&ifs->ifs_iplh[unit], "ipl sleep");
618 MUTEX_ENTER(&ifs->ifs_ipl_mutex);
626 for (copied = 0; ((ipl = ifs->ifs_iplt[unit]) != NULL); copied += dlen) {
633 ifs->ifs_iplt[unit] = ipl->ipl_next;
634 ifs->ifs_iplused[unit] -= dlen;
635 if (ifs->ifs_iplt[unit] == NULL) {
636 ifs->ifs_iplh[unit] = &ifs->ifs_iplt[unit];
637 ifs->ifs_ipll[unit] = NULL;
639 MUTEX_EXIT(&ifs->ifs_ipl_mutex);
644 MUTEX_ENTER(&ifs->ifs_ipl_mutex);
645 ifs->ifs_iplused[unit] += dlen;
646 ipl->ipl_next = ifs->ifs_iplt[unit];
647 ifs->ifs_iplt[unit] = ipl;
648 ifs->ifs_ipll[unit] = ipl;
649 if (ifs->ifs_iplh[unit] == &ifs->ifs_iplt[unit]) {
650 *ifs->ifs_iplh[unit] = ipl;
651 ifs->ifs_iplh[unit] = &ipl->ipl_next;
655 MUTEX_ENTER(&ifs->ifs_ipl_mutex);
660 MUTEX_EXIT(&ifs->ifs_ipl_mutex);
673 int ipflog_clear(unit, ifs)
675 ipf_stack_t *ifs;
682 MUTEX_ENTER(&ifs->ifs_ipl_mutex);
683 while ((ipl = ifs->ifs_iplt[unit]) != NULL) {
684 ifs->ifs_iplt[unit] = ipl->ipl_next;
687 ifs->ifs_iplh[unit] = &ifs->ifs_iplt[unit];
688 ifs->ifs_ipll[unit] = NULL;
689 used = ifs->ifs_iplused[unit];
690 ifs->ifs_iplused[unit] = 0;
691 bzero((char *)&ifs->ifs_iplcrc[unit], FI_CSIZE);
692 MUTEX_EXIT(&ifs->ifs_ipl_mutex);