Lines Matching refs:file

77 	cpy = ofdt->max_fds * sizeof(struct file *);  in copy_fdtable()
78 set = (nfdt->max_fds - ofdt->max_fds) * sizeof(struct file *); in copy_fdtable()
97 nr /= (1024 / sizeof(struct file *)); in alloc_fdtable()
99 nr *= (1024 / sizeof(struct file *)); in alloc_fdtable()
115 data = kvmalloc_array(nr, sizeof(struct file *), GFP_KERNEL_ACCOUNT); in alloc_fdtable()
275 struct file **old_fds, **new_fds; in dup_fd()
339 struct file *f = *old_fds++; in dup_fd()
356 memset(new_fds, 0, (new_fdt->max_fds - open_files) * sizeof(struct file *)); in dup_fd()
386 struct file * file = xchg(&fdt->fd[i], NULL); in close_files() local
387 if (file) { in close_files()
388 filp_close(file, files); in close_files()
588 struct file *file) in __fd_install() argument
599 rcu_assign_pointer(fdt->fd[fd], file); in __fd_install()
607 rcu_assign_pointer(fdt->fd[fd], file); in __fd_install()
611 void fd_install(unsigned int fd, struct file *file) in fd_install() argument
613 __fd_install(current->files, fd, file); in fd_install()
623 struct file *file; in __close_fd() local
631 file = fdt->fd[fd]; in __close_fd()
632 if (!file) in __close_fd()
637 return filp_close(file, files); in __close_fd()
663 struct file *file; in do_close_on_exec() local
666 file = fdt->fd[fd]; in do_close_on_exec()
667 if (!file) in do_close_on_exec()
672 filp_close(file, files); in do_close_on_exec()
681 static inline struct file *__fget_files_rcu(struct files_struct *files, in __fget_files_rcu()
685 struct file *file; in __fget_files_rcu() local
687 struct file __rcu **fdentry; in __fget_files_rcu()
693 file = rcu_dereference_raw(*fdentry); in __fget_files_rcu()
694 if (unlikely(!file)) in __fget_files_rcu()
697 if (unlikely(file->f_mode & mask)) in __fget_files_rcu()
711 if (unlikely(!get_file_rcu_many(file, refs))) in __fget_files_rcu()
723 unlikely(rcu_dereference_raw(*fdentry) != file)) { in __fget_files_rcu()
724 fput_many(file, refs); in __fget_files_rcu()
732 return file; in __fget_files_rcu()
737 static struct file *__fget(unsigned int fd, fmode_t mask, unsigned int refs) in __fget()
740 struct file *file; in __fget() local
743 file = __fget_files_rcu(files, fd, mask, refs); in __fget()
746 return file; in __fget()
749 struct file *fget_many(unsigned int fd, unsigned int refs) in fget_many()
754 struct file *fget(unsigned int fd) in fget()
760 struct file *fget_raw(unsigned int fd) in fget_raw()
785 struct file *file; in __fget_light() local
788 file = __fcheck_files(files, fd); in __fget_light()
789 if (!file || unlikely(file->f_mode & mask)) in __fget_light()
791 return (unsigned long)file; in __fget_light()
793 file = __fget(fd, mask, 1); in __fget_light()
794 if (!file) in __fget_light()
796 return FDPUT_FPUT | (unsigned long)file; in __fget_light()
813 struct file *file = (struct file *)(v & ~3); in __fdget_pos() local
815 if (file && (file->f_mode & FMODE_ATOMIC_POS)) { in __fdget_pos()
816 if (file_count(file) > 1) { in __fdget_pos()
818 mutex_lock(&file->f_pos_lock); in __fdget_pos()
824 void __f_unlock_pos(struct file *f) in __f_unlock_pos()
861 struct file *file, unsigned fd, unsigned flags) in do_dup2() argument
864 struct file *tofree; in do_dup2()
885 get_file(file); in do_dup2()
886 rcu_assign_pointer(fdt->fd[fd], file); in do_dup2()
904 int replace_fd(unsigned fd, struct file *file, unsigned flags) in replace_fd() argument
909 if (!file) in replace_fd()
919 return do_dup2(files, file, fd, flags); in replace_fd()
929 struct file *file; in ksys_dup3() local
943 file = fcheck(oldfd); in ksys_dup3()
944 if (unlikely(!file)) in ksys_dup3()
951 return do_dup2(files, file, newfd, flags); in ksys_dup3()
983 struct file *file = fget_raw(fildes); in ksys_dup() local
985 if (file) { in ksys_dup()
988 fd_install(ret, file); in ksys_dup()
990 fput(file); in ksys_dup()
1000 int f_dupfd(unsigned int from, struct file *file, unsigned flags) in f_dupfd() argument
1007 get_file(file); in f_dupfd()
1008 fd_install(err, file); in f_dupfd()
1014 int (*f)(const void *, struct file *, unsigned), in iterate_fd() argument
1023 struct file *file; in iterate_fd() local
1024 file = rcu_dereference_check_fdtable(files, fdt->fd[n]); in iterate_fd()
1025 if (!file) in iterate_fd()
1027 res = f(p, file, n); in iterate_fd()