• Home
  • Raw
  • Download

Lines Matching refs:file

82 	cpy = ofdt->max_fds * sizeof(struct file *);  in copy_fdtable()
83 set = (nfdt->max_fds - ofdt->max_fds) * sizeof(struct file *); in copy_fdtable()
117 nr /= (1024 / sizeof(struct file *)); in alloc_fdtable()
119 nr *= (1024 / sizeof(struct file *)); in alloc_fdtable()
136 data = kvmalloc_array(nr, sizeof(struct file *), GFP_KERNEL_ACCOUNT); in alloc_fdtable()
319 struct file **old_fds, **new_fds; in dup_fd()
383 struct file *f = *old_fds++; in dup_fd()
400 memset(new_fds, 0, (new_fdt->max_fds - open_files) * sizeof(struct file *)); in dup_fd()
430 struct file * file = xchg(&fdt->fd[i], NULL); in close_files() local
431 if (file) { in close_files()
432 filp_close(file, files); in close_files()
637 struct file *file) in __fd_install() argument
648 rcu_assign_pointer(fdt->fd[fd], file); in __fd_install()
656 rcu_assign_pointer(fdt->fd[fd], file); in __fd_install()
664 void fd_install(unsigned int fd, struct file *file) in fd_install() argument
666 __fd_install(current->files, fd, file); in fd_install()
671 static struct file *pick_file(struct files_struct *files, unsigned fd) in pick_file()
673 struct file *file = NULL; in pick_file() local
680 file = fdt->fd[fd]; in pick_file()
681 if (!file) in pick_file()
688 return file; in pick_file()
696 struct file *file; in __close_fd() local
698 file = pick_file(files, fd); in __close_fd()
699 if (!file) in __close_fd()
702 return filp_close(file, files); in __close_fd()
760 struct file *file; in __close_range() local
762 file = pick_file(cur_fds, fd++); in __close_range()
763 if (!file) in __close_range()
766 filp_close(file, cur_fds); in __close_range()
788 int __close_fd_get_file(unsigned int fd, struct file **res) in __close_fd_get_file()
791 struct file *file; in __close_fd_get_file() local
797 file = fdt->fd[fd]; in __close_fd_get_file()
798 if (!file) in __close_fd_get_file()
802 get_file(file); in __close_fd_get_file()
803 *res = file; in __close_fd_get_file()
815 int close_fd_get_file(unsigned int fd, struct file **res) in close_fd_get_file()
845 struct file *file; in do_close_on_exec() local
848 file = fdt->fd[fd]; in do_close_on_exec()
849 if (!file) in do_close_on_exec()
854 filp_close(file, files); in do_close_on_exec()
863 static inline struct file *__fget_files_rcu(struct files_struct *files, in __fget_files_rcu()
867 struct file *file; in __fget_files_rcu() local
869 struct file __rcu **fdentry; in __fget_files_rcu()
875 file = rcu_dereference_raw(*fdentry); in __fget_files_rcu()
876 if (unlikely(!file)) in __fget_files_rcu()
879 if (unlikely(file->f_mode & mask)) in __fget_files_rcu()
893 if (unlikely(!get_file_rcu_many(file, refs))) in __fget_files_rcu()
905 unlikely(rcu_dereference_raw(*fdentry) != file)) { in __fget_files_rcu()
906 fput_many(file, refs); in __fget_files_rcu()
914 return file; in __fget_files_rcu()
918 static struct file *__fget_files(struct files_struct *files, unsigned int fd, in __fget_files()
921 struct file *file; in __fget_files() local
924 file = __fget_files_rcu(files, fd, mask, refs); in __fget_files()
927 return file; in __fget_files()
930 static inline struct file *__fget(unsigned int fd, fmode_t mask, in __fget()
936 struct file *fget_many(unsigned int fd, unsigned int refs) in fget_many()
941 struct file *fget(unsigned int fd) in fget()
947 struct file *fget_raw(unsigned int fd) in fget_raw()
953 struct file *fget_task(struct task_struct *task, unsigned int fd) in fget_task()
955 struct file *file = NULL; in fget_task() local
959 file = __fget_files(task->files, fd, 0, 1); in fget_task()
962 return file; in fget_task()
984 struct file *file; in __fget_light() local
987 file = __fcheck_files(files, fd); in __fget_light()
988 if (!file || unlikely(file->f_mode & mask)) in __fget_light()
990 return (unsigned long)file; in __fget_light()
992 file = __fget(fd, mask, 1); in __fget_light()
993 if (!file) in __fget_light()
995 return FDPUT_FPUT | (unsigned long)file; in __fget_light()
1012 struct file *file = (struct file *)(v & ~3); in __fdget_pos() local
1014 if (file && (file->f_mode & FMODE_ATOMIC_POS)) { in __fdget_pos()
1015 if (file_count(file) > 1) { in __fdget_pos()
1017 mutex_lock(&file->f_pos_lock); in __fdget_pos()
1023 void __f_unlock_pos(struct file *f) in __f_unlock_pos()
1060 struct file *file, unsigned fd, unsigned flags) in do_dup2() argument
1063 struct file *tofree; in do_dup2()
1084 get_file(file); in do_dup2()
1085 rcu_assign_pointer(fdt->fd[fd], file); in do_dup2()
1103 int replace_fd(unsigned fd, struct file *file, unsigned flags) in replace_fd() argument
1108 if (!file) in replace_fd()
1118 return do_dup2(files, file, fd, flags); in replace_fd()
1142 int __receive_fd(int fd, struct file *file, int __user *ufd, unsigned int o_flags) in __receive_fd() argument
1147 error = security_file_receive(file); in __receive_fd()
1169 fd_install(new_fd, get_file(file)); in __receive_fd()
1171 error = replace_fd(new_fd, file, o_flags); in __receive_fd()
1177 __receive_sock(file); in __receive_fd()
1184 struct file *file; in ksys_dup3() local
1198 file = fcheck(oldfd); in ksys_dup3()
1199 if (unlikely(!file)) in ksys_dup3()
1206 return do_dup2(files, file, newfd, flags); in ksys_dup3()
1238 struct file *file = fget_raw(fildes); in SYSCALL_DEFINE1() local
1240 if (file) { in SYSCALL_DEFINE1()
1243 fd_install(ret, file); in SYSCALL_DEFINE1()
1245 fput(file); in SYSCALL_DEFINE1()
1250 int f_dupfd(unsigned int from, struct file *file, unsigned flags) in f_dupfd() argument
1257 get_file(file); in f_dupfd()
1258 fd_install(err, file); in f_dupfd()
1264 int (*f)(const void *, struct file *, unsigned), in iterate_fd() argument
1273 struct file *file; in iterate_fd() local
1274 file = rcu_dereference_check_fdtable(files, fdt->fd[n]); in iterate_fd()
1275 if (!file) in iterate_fd()
1277 res = f(p, file, n); in iterate_fd()