void autofs_timeout_mp(am_node *mp) { autofs_fh_t *fh = mp->am_autofs_fh; time_t now = clocktime(NULL); /* update the ttl */ mp->am_autofs_ttl = now + gopt.am_timeo_w; if (fh->version < 4) { struct autofs_packet_expire pkt; while (ioctl(fh->ioctlfd, AUTOFS_IOC_EXPIRE, &pkt) == 0) autofs_handle_expire(mp, &pkt); return; } #if AUTOFS_MAX_VERSION >= 4 run_task(autofs_timeout_mp_task, mp, NULL, NULL); #endif /* AUTOFS_MAX_VERSION >= 4 */ }
void autofs_timeout_mp(am_node *mp) { autofs_fh_t *fh = mp->am_mnt->mf_autofs_fh; time_t now = clocktime(); /* update the ttl, but only if we're not going down */ if (mp->am_flags & AMF_NOTIMEOUT) mp->am_ttl = now + gopt.am_timeo_w; if (fh->version < 4) { struct autofs_packet_expire pkt; while (ioctl(fh->ioctlfd, AUTOFS_IOC_EXPIRE, &pkt) == 0) autofs_handle_expire(mp, &pkt); return; } #ifdef autofs_ptype_expire_multi run_task(autofs_timeout_mp_task, mp, NULL, NULL); #endif /* autofs_ptype_expire_multi */ }
int autofs_handle_fdset(fd_set *readfds, int nsel) { int i; union autofs_packet_union pkt; autofs_fh_t *fh; am_node *mp; for (i = 0; nsel && i < numfds; i++) { if (!FD_ISSET(list[i], readfds)) continue; nsel--; FD_CLR(list[i], readfds); mp = hash[list[i]]; fh = mp->am_autofs_fh; if (autofs_get_pkt(fh->fd, (char *) &pkt, sizeof(union autofs_packet_union))) continue; switch (pkt.hdr.type) { case autofs_ptype_missing: autofs_handle_missing(mp, &pkt.missing); break; case autofs_ptype_expire: autofs_handle_expire(mp, &pkt.expire); break; #if AUTOFS_MAX_VERSION >= 4 case autofs_ptype_expire_multi: autofs_handle_expire_multi(mp, &pkt.expire_multi); break; #endif /* AUTOFS_MAX_VERSION >= 4 */ default: plog(XLOG_ERROR, "Unknown autofs packet type %d", pkt.hdr.type); } } return nsel; }