• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/fs/

Lines Matching refs:watch

68  * inode: Pinned so long as the inode is associated with a watch, from
78 struct idr idr; /* idr mapping wd -> watch */
101 * @watch: watch to grab
103 void get_inotify_watch(struct inotify_watch *watch)
105 atomic_inc(&watch->count);
110 * put_inotify_watch - decrements the ref count on a given watch. cleans up
111 * watch references if the count reaches zero. inotify_watch is freed by
113 * @watch: watch to release
115 void put_inotify_watch(struct inotify_watch *watch)
117 if (atomic_dec_and_test(&watch->count)) {
118 struct inotify_handle *ih = watch->ih;
120 iput(watch->inode);
121 ih->in_ops->destroy_watch(watch);
133 struct inotify_watch *watch)
140 ret = idr_get_new_above(&ih->idr, watch, ih->last_wd+1, &watch->wd);
144 ih->last_wd = watch->wd;
192 * inotify_find_handle - find the watch associated with the given inode and
200 struct inotify_watch *watch;
202 list_for_each_entry(watch, &inode->inotify_watches, i_list) {
203 if (watch->ih == ih)
204 return watch;
211 * remove_watch_no_event - remove watch without the IN_IGNORED event.
215 static void remove_watch_no_event(struct inotify_watch *watch,
218 list_del(&watch->i_list);
219 list_del(&watch->h_list);
221 if (!inotify_inode_watched(watch->inode))
222 set_dentry_child_flags(watch->inode, 0);
224 idr_remove(&ih->idr, watch->wd);
228 * inotify_remove_watch_locked - Remove a watch from both the handle and the
231 * @ih: inotify handle associated with watch
232 * @watch: watch to remove
237 struct inotify_watch *watch)
239 remove_watch_no_event(watch, ih);
240 ih->in_ops->handle_event(watch, watch->wd, IN_IGNORED, 0, NULL, NULL);
289 struct inotify_watch *watch, *next;
295 list_for_each_entry_safe(watch, next, &inode->inotify_watches, i_list) {
296 u32 watch_mask = watch->mask;
298 struct inotify_handle *ih= watch->ih;
301 remove_watch_no_event(watch, ih);
302 ih->in_ops->handle_event(watch, watch->wd, mask, cookie,
364 struct inotify_watch *watch, *next_w;
412 /* for each watch, send IN_UNMOUNT and then remove it */
415 list_for_each_entry_safe(watch, next_w, watches, i_list) {
416 struct inotify_handle *ih= watch->ih;
418 ih->in_ops->handle_event(watch, watch->wd, IN_UNMOUNT, 0,
420 inotify_remove_watch_locked(ih, watch);
437 struct inotify_watch *watch, *next;
440 list_for_each_entry_safe(watch, next, &inode->inotify_watches, i_list) {
441 struct inotify_handle *ih = watch->ih;
443 inotify_remove_watch_locked(ih, watch);
477 * inotify_init_watch - initialize an inotify watch
478 * @watch: watch to initialize
480 void inotify_init_watch(struct inotify_watch *watch)
482 INIT_LIST_HEAD(&watch->h_list);
483 INIT_LIST_HEAD(&watch->i_list);
484 atomic_set(&watch->count, 0);
485 get_inotify_watch(watch); /* initial get */
498 * do not know the inode until we iterate to the watch. But we need to
502 struct inotify_watch *watch;
512 watch = list_first_entry(watches, struct inotify_watch, h_list);
513 get_inotify_watch(watch);
516 inode = watch->inode;
521 if (likely(idr_find(&ih->idr, watch->wd))) {
522 remove_watch_no_event(watch, ih);
523 put_inotify_watch(watch);
528 put_inotify_watch(watch);
537 * inotify_find_watch - find an existing watch for an (ih,inode) pair
539 * @inode: inode to watch
555 get_inotify_watch(old); /* caller must put watch */
568 * inotify_find_update_watch - find and update the mask of an existing watch
570 * @inode: inode's watch to update
571 * @mask: mask of events to watch
594 * Handle the case of re-adding a watch on an (inode,ih) pair that we
616 * inotify_add_watch - add a watch to an inotify instance
618 * @watch: caller allocated watch structure
619 * @inode: inode to watch
620 * @mask: mask of events to watch
623 * Caller must ensure it only calls inotify_add_watch() once per watch.
626 s32 inotify_add_watch(struct inotify_handle *ih, struct inotify_watch *watch,
635 watch->mask = mask;
640 /* Initialize a new watch */
641 ret = inotify_handle_get_wd(ih, watch);
644 ret = watch->wd;
648 watch->ih = ih;
654 watch->inode = igrab(inode);
659 /* Add the watch to the handle's and the inode's list */
660 list_add(&watch->h_list, &ih->watches);
661 list_add(&watch->i_list, &inode->inotify_watches);
670 * inotify_rm_wd - remove a watch from an inotify instance
672 * @wd: watch descriptor to remove
678 struct inotify_watch *watch;
682 watch = idr_find(&ih->idr, wd);
683 if (unlikely(!watch)) {
687 get_inotify_watch(watch);
688 inode = watch->inode;
695 if (likely(idr_find(&ih->idr, wd) == watch))
696 inotify_remove_watch_locked(ih, watch);
700 put_inotify_watch(watch);
707 * inotify_rm_watch - remove a watch from an inotify instance
709 * @watch: watch to remove
714 struct inotify_watch *watch)
716 return inotify_rm_wd(ih, watch->wd);