• Home
  • Raw
  • Download

Lines Matching refs:ih

86 static inline void get_inotify_handle(struct inotify_handle *ih)  in get_inotify_handle()  argument
88 atomic_inc(&ih->count); in get_inotify_handle()
91 static inline void put_inotify_handle(struct inotify_handle *ih) in put_inotify_handle() argument
93 if (atomic_dec_and_test(&ih->count)) { in put_inotify_handle()
94 idr_destroy(&ih->idr); in put_inotify_handle()
95 kfree(ih); in put_inotify_handle()
132 struct inotify_handle *ih = watch->ih; in put_inotify_watch() local
135 ih->in_ops->destroy_watch(watch); in put_inotify_watch()
136 put_inotify_handle(ih); in put_inotify_watch()
153 static int inotify_handle_get_wd(struct inotify_handle *ih, in inotify_handle_get_wd() argument
159 if (unlikely(!idr_pre_get(&ih->idr, GFP_NOFS))) in inotify_handle_get_wd()
161 ret = idr_get_new_above(&ih->idr, watch, ih->last_wd+1, &watch->wd); in inotify_handle_get_wd()
165 ih->last_wd = watch->wd; in inotify_handle_get_wd()
213 struct inotify_handle *ih) in inode_find_handle() argument
218 if (watch->ih == ih) in inode_find_handle()
231 struct inotify_handle *ih) in remove_watch_no_event() argument
239 idr_remove(&ih->idr, watch->wd); in remove_watch_no_event()
251 void inotify_remove_watch_locked(struct inotify_handle *ih, in inotify_remove_watch_locked() argument
254 remove_watch_no_event(watch, ih); in inotify_remove_watch_locked()
255 ih->in_ops->handle_event(watch, watch->wd, IN_IGNORED, 0, NULL, NULL); in inotify_remove_watch_locked()
312 struct inotify_handle *ih= watch->ih; in inotify_inode_queue_event() local
313 mutex_lock(&ih->mutex); in inotify_inode_queue_event()
315 remove_watch_no_event(watch, ih); in inotify_inode_queue_event()
316 ih->in_ops->handle_event(watch, watch->wd, mask, cookie, in inotify_inode_queue_event()
318 mutex_unlock(&ih->mutex); in inotify_inode_queue_event()
430 struct inotify_handle *ih= watch->ih; in inotify_unmount_inodes() local
432 mutex_lock(&ih->mutex); in inotify_unmount_inodes()
433 ih->in_ops->handle_event(watch, watch->wd, IN_UNMOUNT, 0, in inotify_unmount_inodes()
435 inotify_remove_watch_locked(ih, watch); in inotify_unmount_inodes()
436 mutex_unlock(&ih->mutex); in inotify_unmount_inodes()
457 struct inotify_handle *ih = watch->ih; in inotify_inode_is_dead() local
458 mutex_lock(&ih->mutex); in inotify_inode_is_dead()
459 inotify_remove_watch_locked(ih, watch); in inotify_inode_is_dead()
460 mutex_unlock(&ih->mutex); in inotify_inode_is_dead()
474 struct inotify_handle *ih; in inotify_init() local
476 ih = kmalloc(sizeof(struct inotify_handle), GFP_KERNEL); in inotify_init()
477 if (unlikely(!ih)) in inotify_init()
480 idr_init(&ih->idr); in inotify_init()
481 INIT_LIST_HEAD(&ih->watches); in inotify_init()
482 mutex_init(&ih->mutex); in inotify_init()
483 ih->last_wd = 0; in inotify_init()
484 ih->in_ops = ops; in inotify_init()
485 atomic_set(&ih->count, 0); in inotify_init()
486 get_inotify_handle(ih); in inotify_init()
488 return ih; in inotify_init()
562 static int pin_to_kill(struct inotify_handle *ih, struct inotify_watch *watch) in pin_to_kill() argument
572 mutex_unlock(&ih->mutex); in pin_to_kill()
577 mutex_unlock(&ih->mutex); /* can't grab ->s_umount under it */ in pin_to_kill()
585 mutex_lock(&ih->mutex); in pin_to_kill()
586 if (idr_find(&ih->idr, wd) != watch || watch->inode->i_sb != sb) { in pin_to_kill()
588 mutex_unlock(&ih->mutex); in pin_to_kill()
594 mutex_unlock(&ih->mutex); in pin_to_kill()
615 void inotify_destroy(struct inotify_handle *ih) in inotify_destroy() argument
632 mutex_lock(&ih->mutex); in inotify_destroy()
633 watches = &ih->watches; in inotify_destroy()
635 mutex_unlock(&ih->mutex); in inotify_destroy()
640 how = pin_to_kill(ih, watch); in inotify_destroy()
646 mutex_lock(&ih->mutex); in inotify_destroy()
649 if (likely(idr_find(&ih->idr, watch->wd))) { in inotify_destroy()
650 remove_watch_no_event(watch, ih); in inotify_destroy()
654 mutex_unlock(&ih->mutex); in inotify_destroy()
660 put_inotify_handle(ih); in inotify_destroy()
672 s32 inotify_find_watch(struct inotify_handle *ih, struct inode *inode, in inotify_find_watch() argument
679 mutex_lock(&ih->mutex); in inotify_find_watch()
681 old = inode_find_handle(inode, ih); in inotify_find_watch()
688 mutex_unlock(&ih->mutex); in inotify_find_watch()
703 s32 inotify_find_update_watch(struct inotify_handle *ih, struct inode *inode, in inotify_find_update_watch() argument
719 mutex_lock(&ih->mutex); in inotify_find_update_watch()
725 old = inode_find_handle(inode, ih); in inotify_find_update_watch()
737 mutex_unlock(&ih->mutex); in inotify_find_update_watch()
754 s32 inotify_add_watch(struct inotify_handle *ih, struct inotify_watch *watch, in inotify_add_watch() argument
767 mutex_lock(&ih->mutex); in inotify_add_watch()
770 ret = inotify_handle_get_wd(ih, watch); in inotify_add_watch()
776 get_inotify_handle(ih); in inotify_add_watch()
777 watch->ih = ih; in inotify_add_watch()
787 list_add(&watch->h_list, &ih->watches); in inotify_add_watch()
798 mutex_unlock(&ih->mutex); in inotify_add_watch()
814 struct inotify_handle *ih = old->ih; in inotify_clone_watch() local
818 new->ih = ih; in inotify_clone_watch()
820 mutex_lock(&ih->mutex); in inotify_clone_watch()
823 ret = inotify_handle_get_wd(ih, new); in inotify_clone_watch()
828 get_inotify_handle(ih); in inotify_clone_watch()
832 list_add(&new->h_list, &ih->watches); in inotify_clone_watch()
835 mutex_unlock(&ih->mutex); in inotify_clone_watch()
842 mutex_lock(&watch->ih->mutex); in inotify_evict_watch()
843 inotify_remove_watch_locked(watch->ih, watch); in inotify_evict_watch()
844 mutex_unlock(&watch->ih->mutex); in inotify_evict_watch()
854 int inotify_rm_wd(struct inotify_handle *ih, u32 wd) in inotify_rm_wd() argument
861 mutex_lock(&ih->mutex); in inotify_rm_wd()
862 watch = idr_find(&ih->idr, wd); in inotify_rm_wd()
864 mutex_unlock(&ih->mutex); in inotify_rm_wd()
868 how = pin_to_kill(ih, watch); in inotify_rm_wd()
875 mutex_lock(&ih->mutex); in inotify_rm_wd()
878 if (likely(idr_find(&ih->idr, wd) == watch)) in inotify_rm_wd()
879 inotify_remove_watch_locked(ih, watch); in inotify_rm_wd()
881 mutex_unlock(&ih->mutex); in inotify_rm_wd()
896 int inotify_rm_watch(struct inotify_handle *ih, in inotify_rm_watch() argument
899 return inotify_rm_wd(ih, watch->wd); in inotify_rm_watch()