• Home
  • Raw
  • Download

Lines Matching refs:dev

107 	struct inotify_device	*dev;	/* associated device */  member
152 static inline void get_inotify_dev(struct inotify_device *dev) in get_inotify_dev() argument
154 atomic_inc(&dev->count); in get_inotify_dev()
157 static inline void put_inotify_dev(struct inotify_device *dev) in put_inotify_dev() argument
159 if (atomic_dec_and_test(&dev->count)) { in put_inotify_dev()
160 atomic_dec(&dev->user->inotify_devs); in put_inotify_dev()
161 free_uid(dev->user); in put_inotify_dev()
162 kfree(dev); in put_inotify_dev()
172 struct inotify_device *dev; in free_inotify_user_watch() local
175 dev = watch->dev; in free_inotify_user_watch()
177 atomic_dec(&dev->user->inotify_watches); in free_inotify_user_watch()
178 put_inotify_dev(dev); in free_inotify_user_watch()
246 inotify_dev_get_event(struct inotify_device *dev) in inotify_dev_get_event() argument
248 return list_entry(dev->events.next, struct inotify_kernel_event, list); in inotify_dev_get_event()
257 inotify_dev_get_last_event(struct inotify_device *dev) in inotify_dev_get_last_event() argument
259 if (list_empty(&dev->events)) in inotify_dev_get_last_event()
261 return list_entry(dev->events.prev, struct inotify_kernel_event, list); in inotify_dev_get_last_event()
275 struct inotify_device *dev; in inotify_dev_queue_event() local
279 dev = watch->dev; in inotify_dev_queue_event()
281 mutex_lock(&dev->ev_mutex); in inotify_dev_queue_event()
290 last = inotify_dev_get_last_event(dev); in inotify_dev_queue_event()
302 if (unlikely(dev->event_count > dev->max_events)) in inotify_dev_queue_event()
306 if (unlikely(dev->event_count == dev->max_events)) in inotify_dev_queue_event()
315 dev->event_count++; in inotify_dev_queue_event()
316 dev->queue_size += sizeof(struct inotify_event) + kevent->event.len; in inotify_dev_queue_event()
317 list_add_tail(&kevent->list, &dev->events); in inotify_dev_queue_event()
318 wake_up_interruptible(&dev->wq); in inotify_dev_queue_event()
319 kill_fasync(&dev->fa, SIGIO, POLL_IN); in inotify_dev_queue_event()
322 mutex_unlock(&dev->ev_mutex); in inotify_dev_queue_event()
330 static void remove_kevent(struct inotify_device *dev, in remove_kevent() argument
335 dev->event_count--; in remove_kevent()
336 dev->queue_size -= sizeof(struct inotify_event) + kevent->event.len; in remove_kevent()
353 static void inotify_dev_event_dequeue(struct inotify_device *dev) in inotify_dev_event_dequeue() argument
355 if (!list_empty(&dev->events)) { in inotify_dev_event_dequeue()
357 kevent = inotify_dev_get_event(dev); in inotify_dev_event_dequeue()
358 remove_kevent(dev, kevent); in inotify_dev_event_dequeue()
386 static int create_watch(struct inotify_device *dev, struct inode *inode, in create_watch() argument
392 if (atomic_read(&dev->user->inotify_watches) >= in create_watch()
401 get_inotify_dev(dev); in create_watch()
402 watch->dev = dev; in create_watch()
404 atomic_inc(&dev->user->inotify_watches); in create_watch()
407 ret = inotify_add_watch(dev->ih, &watch->wdata, inode, mask); in create_watch()
418 struct inotify_device *dev = file->private_data; in inotify_poll() local
421 poll_wait(file, &dev->wq, wait); in inotify_poll()
422 mutex_lock(&dev->ev_mutex); in inotify_poll()
423 if (!list_empty(&dev->events)) in inotify_poll()
425 mutex_unlock(&dev->ev_mutex); in inotify_poll()
437 static struct inotify_kernel_event *get_one_event(struct inotify_device *dev, in get_one_event() argument
443 if (list_empty(&dev->events)) in get_one_event()
446 kevent = inotify_dev_get_event(dev); in get_one_event()
453 remove_kevent(dev, kevent); in get_one_event()
485 struct inotify_device *dev; in inotify_read() local
491 dev = file->private_data; in inotify_read()
496 prepare_to_wait(&dev->wq, &wait, TASK_INTERRUPTIBLE); in inotify_read()
498 mutex_lock(&dev->ev_mutex); in inotify_read()
499 kevent = get_one_event(dev, count); in inotify_read()
500 mutex_unlock(&dev->ev_mutex); in inotify_read()
528 finish_wait(&dev->wq, &wait); in inotify_read()
536 struct inotify_device *dev = file->private_data; in inotify_fasync() local
538 return fasync_helper(fd, file, on, &dev->fa) >= 0 ? 0 : -EIO; in inotify_fasync()
543 struct inotify_device *dev = file->private_data; in inotify_release() local
545 inotify_destroy(dev->ih); in inotify_release()
548 mutex_lock(&dev->ev_mutex); in inotify_release()
549 while (!list_empty(&dev->events)) in inotify_release()
550 inotify_dev_event_dequeue(dev); in inotify_release()
551 mutex_unlock(&dev->ev_mutex); in inotify_release()
554 put_inotify_dev(dev); in inotify_release()
562 struct inotify_device *dev; in inotify_ioctl() local
566 dev = file->private_data; in inotify_ioctl()
571 ret = put_user(dev->queue_size, (int __user *) p); in inotify_ioctl()
594 struct inotify_device *dev; in SYSCALL_DEFINE1() local
624 dev = kmalloc(sizeof(struct inotify_device), GFP_KERNEL); in SYSCALL_DEFINE1()
625 if (unlikely(!dev)) { in SYSCALL_DEFINE1()
635 dev->ih = ih; in SYSCALL_DEFINE1()
636 dev->fa = NULL; in SYSCALL_DEFINE1()
644 filp->private_data = dev; in SYSCALL_DEFINE1()
646 INIT_LIST_HEAD(&dev->events); in SYSCALL_DEFINE1()
647 init_waitqueue_head(&dev->wq); in SYSCALL_DEFINE1()
648 mutex_init(&dev->ev_mutex); in SYSCALL_DEFINE1()
649 mutex_init(&dev->up_mutex); in SYSCALL_DEFINE1()
650 dev->event_count = 0; in SYSCALL_DEFINE1()
651 dev->queue_size = 0; in SYSCALL_DEFINE1()
652 dev->max_events = inotify_max_queued_events; in SYSCALL_DEFINE1()
653 dev->user = user; in SYSCALL_DEFINE1()
654 atomic_set(&dev->count, 0); in SYSCALL_DEFINE1()
656 get_inotify_dev(dev); in SYSCALL_DEFINE1()
662 kfree(dev); in SYSCALL_DEFINE1()
680 struct inotify_device *dev; in SYSCALL_DEFINE3() local
707 dev = filp->private_data; in SYSCALL_DEFINE3()
709 mutex_lock(&dev->up_mutex); in SYSCALL_DEFINE3()
710 ret = inotify_find_update_watch(dev->ih, inode, mask); in SYSCALL_DEFINE3()
712 ret = create_watch(dev, inode, mask); in SYSCALL_DEFINE3()
713 mutex_unlock(&dev->up_mutex); in SYSCALL_DEFINE3()
724 struct inotify_device *dev; in SYSCALL_DEFINE2() local
737 dev = filp->private_data; in SYSCALL_DEFINE2()
740 ret = inotify_rm_wd(dev->ih, wd); in SYSCALL_DEFINE2()