Lines Matching full:watch
168 int nextwatch; /* next watch ID to try */
366 inotify_unlink_watch_locked(struct inotify_softc *sc, struct inotify_watch *watch) in inotify_unlink_watch_locked() argument
370 vp = watch->vp; in inotify_unlink_watch_locked()
376 TAILQ_REMOVE(&vp->v_pollinfo->vpi_inotify, watch, vlink); in inotify_unlink_watch_locked()
382 inotify_free_watch(struct inotify_watch *watch) in inotify_free_watch() argument
384 vrele(watch->vp); in inotify_free_watch()
385 free(watch, M_INOTIFY); in inotify_free_watch()
389 * Assumes that the watch has already been removed from its softc.
392 inotify_remove_watch(struct inotify_watch *watch) in inotify_remove_watch() argument
397 sc = watch->sc; in inotify_remove_watch()
399 vp = watch->vp; in inotify_remove_watch()
401 inotify_unlink_watch_locked(sc, watch); in inotify_remove_watch()
403 inotify_free_watch(watch); in inotify_remove_watch()
410 struct inotify_watch *watch; in inotify_reap() local
414 while ((watch = TAILQ_FIRST(&sc->deadwatches)) != NULL) { in inotify_reap()
415 TAILQ_REMOVE(&sc->deadwatches, watch, vlink); in inotify_reap()
417 inotify_free_watch(watch); in inotify_reap()
428 struct inotify_watch *watch; in inotify_close() local
435 while ((watch = RB_MIN(inotify_watch_tree, &sc->watches)) != NULL) { in inotify_close()
436 RB_REMOVE(inotify_watch_tree, &sc->watches, watch); in inotify_close()
438 inotify_remove_watch(watch); in inotify_close()
604 inotify_log_one(struct inotify_watch *watch, const char *name, size_t namelen, in inotify_log_one() argument
612 mtx_assert(&watch->vp->v_pollinfo->vpi_lock, MA_OWNED); in inotify_log_one()
614 sc = watch->sc; in inotify_log_one()
615 rec = inotify_alloc_record(watch->wd, name, namelen, event, cookie, in inotify_log_one()
627 if ((watch->mask & IN_ONESHOT) != 0 || in inotify_log_one()
630 rec = inotify_alloc_record(watch->wd, NULL, 0, in inotify_log_one()
640 * Remove the watch, taking care to handle races with in inotify_log_one()
641 * inotify_close(). The thread that removes the watch is in inotify_log_one()
644 key.wd = watch->wd; in inotify_log_one()
646 RB_REMOVE(inotify_watch_tree, &sc->watches, watch); in inotify_log_one()
647 inotify_unlink_watch_locked(sc, watch); in inotify_log_one()
652 TAILQ_INSERT_TAIL(&sc->deadwatches, watch, vlink); in inotify_log_one()
663 struct inotify_watch *watch, *tmp; in inotify_log() local
669 TAILQ_FOREACH_SAFE(watch, &vp->v_pollinfo->vpi_inotify, vlink, tmp) { in inotify_log()
670 KASSERT(watch->vp == vp, in inotify_log()
671 ("inotify_log: watch %p vp != vp", watch)); in inotify_log()
672 if ((watch->mask & event) != 0 || event == IN_UNMOUNT) in inotify_log()
673 inotify_log_one(watch, name, namelen, event, cookie); in inotify_log()
758 struct inotify_watch *watch, *watch1; in vn_inotify_add_watch() local
819 watch = malloc(sizeof(*watch), M_INOTIFY, M_WAITOK | M_ZERO); in vn_inotify_add_watch()
820 watch->sc = sc; in vn_inotify_add_watch()
821 watch->vp = vp; in vn_inotify_add_watch()
822 watch->mask = mask; in vn_inotify_add_watch()
825 * Are we updating an existing watch? Search the vnode's list rather in vn_inotify_add_watch()
839 * We found an existing watch, update it based on our flags. in vn_inotify_add_watch()
844 free(watch, M_INOTIFY); in vn_inotify_add_watch()
854 free(watch, M_INOTIFY); in vn_inotify_add_watch()
859 * We're creating a new watch. Add it to the softc and vnode watch in vn_inotify_add_watch()
866 * Search for the next available watch descriptor. This is in vn_inotify_add_watch()
867 * implemented so as to avoid reusing watch descriptors for as in vn_inotify_add_watch()
873 watch->wd = wd; in vn_inotify_add_watch()
874 RB_INSERT(inotify_watch_tree, &sc->watches, watch); in vn_inotify_add_watch()
875 TAILQ_INSERT_TAIL(&vp->v_pollinfo->vpi_inotify, watch, vlink); in vn_inotify_add_watch()
976 /* We updated an existing watch, everything is ok. */ in kern_inotify_add_watch()
1005 struct inotify_watch key, *watch; in kern_inotify_rm_watch() local
1017 * associated with the watch. Watch descriptors are implemented so as in kern_inotify_rm_watch()
1019 * pending events from the removed watch descriptor will be removed in kern_inotify_rm_watch()
1020 * before the watch descriptor is recycled. in kern_inotify_rm_watch()
1024 watch = RB_FIND(inotify_watch_tree, &sc->watches, &key); in kern_inotify_rm_watch()
1025 if (watch == NULL) { in kern_inotify_rm_watch()
1029 RB_REMOVE(inotify_watch_tree, &sc->watches, watch); in kern_inotify_rm_watch()
1036 if (watch != NULL) in kern_inotify_rm_watch()
1037 inotify_remove_watch(watch); in kern_inotify_rm_watch()