Lines Matching refs:file

69 	cpy = ofdt->max_fds * sizeof(struct file *);  in copy_fdtable()
70 set = (nfdt->max_fds - ofdt->max_fds) * sizeof(struct file *); in copy_fdtable()
94 nr /= (1024 / sizeof(struct file *)); in alloc_fdtable()
96 nr *= (1024 / sizeof(struct file *)); in alloc_fdtable()
112 data = alloc_fdmem(nr * sizeof(struct file *)); in alloc_fdtable()
247 struct file **old_fds, **new_fds; in dup_fd()
309 struct file *f = *old_fds++; in dup_fd()
326 size = (new_fdt->max_fds - open_files) * sizeof(struct file *); in dup_fd()
367 struct file * file = xchg(&fdt->fd[i], NULL); in close_files() local
368 if (file) { in close_files()
369 filp_close(file, files); in close_files()
553 struct file *file) in __fd_install() argument
559 rcu_assign_pointer(fdt->fd[fd], file); in __fd_install()
563 void fd_install(unsigned int fd, struct file *file) in fd_install() argument
565 __fd_install(current->files, fd, file); in fd_install()
575 struct file *file; in __close_fd() local
582 file = fdt->fd[fd]; in __close_fd()
583 if (!file) in __close_fd()
589 return filp_close(file, files); in __close_fd()
614 struct file *file; in do_close_on_exec() local
617 file = fdt->fd[fd]; in do_close_on_exec()
618 if (!file) in do_close_on_exec()
623 filp_close(file, files); in do_close_on_exec()
632 static struct file *__fget(unsigned int fd, fmode_t mask) in __fget()
635 struct file *file; in __fget() local
638 file = fcheck_files(files, fd); in __fget()
639 if (file) { in __fget()
641 if ((file->f_mode & mask) || !get_file_rcu(file)) in __fget()
642 file = NULL; in __fget()
646 return file; in __fget()
649 struct file *fget(unsigned int fd) in fget()
655 struct file *fget_raw(unsigned int fd) in fget_raw()
680 struct file *file; in __fget_light() local
683 file = __fcheck_files(files, fd); in __fget_light()
684 if (!file || unlikely(file->f_mode & mask)) in __fget_light()
686 return (unsigned long)file; in __fget_light()
688 file = __fget(fd, mask); in __fget_light()
689 if (!file) in __fget_light()
691 return FDPUT_FPUT | (unsigned long)file; in __fget_light()
708 struct file *file = (struct file *)(v & ~3); in __fdget_pos() local
710 if (file && (file->f_mode & FMODE_ATOMIC_POS)) { in __fdget_pos()
711 if (file_count(file) > 1) { in __fdget_pos()
713 mutex_lock(&file->f_pos_lock); in __fdget_pos()
751 struct file *file, unsigned fd, unsigned flags) in do_dup2() argument
754 struct file *tofree; in do_dup2()
775 get_file(file); in do_dup2()
776 rcu_assign_pointer(fdt->fd[fd], file); in do_dup2()
794 int replace_fd(unsigned fd, struct file *file, unsigned flags) in replace_fd() argument
799 if (!file) in replace_fd()
809 return do_dup2(files, file, fd, flags); in replace_fd()
819 struct file *file; in SYSCALL_DEFINE3() local
833 file = fcheck(oldfd); in SYSCALL_DEFINE3()
834 if (unlikely(!file)) in SYSCALL_DEFINE3()
841 return do_dup2(files, file, newfd, flags); in SYSCALL_DEFINE3()
868 struct file *file = fget_raw(fildes); in SYSCALL_DEFINE1() local
870 if (file) { in SYSCALL_DEFINE1()
873 fd_install(ret, file); in SYSCALL_DEFINE1()
875 fput(file); in SYSCALL_DEFINE1()
880 int f_dupfd(unsigned int from, struct file *file, unsigned flags) in f_dupfd() argument
887 get_file(file); in f_dupfd()
888 fd_install(err, file); in f_dupfd()
894 int (*f)(const void *, struct file *, unsigned), in iterate_fd() argument
903 struct file *file; in iterate_fd() local
904 file = rcu_dereference_check_fdtable(files, fdt->fd[n]); in iterate_fd()
905 if (!file) in iterate_fd()
907 res = f(p, file, n); in iterate_fd()