• Home
  • Raw
  • Download

Lines Matching refs:fdt

29 static void __free_fdtable(struct fdtable *fdt)  in __free_fdtable()  argument
31 kvfree(fdt->fd); in __free_fdtable()
32 kvfree(fdt->open_fds); in __free_fdtable()
33 kfree(fdt); in __free_fdtable()
87 struct fdtable *fdt; in alloc_fdtable() local
111 fdt = kmalloc(sizeof(struct fdtable), GFP_KERNEL_ACCOUNT); in alloc_fdtable()
112 if (!fdt) in alloc_fdtable()
114 fdt->max_fds = nr; in alloc_fdtable()
118 fdt->fd = data; in alloc_fdtable()
125 fdt->open_fds = data; in alloc_fdtable()
127 fdt->close_on_exec = data; in alloc_fdtable()
129 fdt->full_fds_bits = data; in alloc_fdtable()
131 return fdt; in alloc_fdtable()
134 kvfree(fdt->fd); in alloc_fdtable()
136 kfree(fdt); in alloc_fdtable()
177 rcu_assign_pointer(files->fdt, new_fdt); in expand_fdtable()
197 struct fdtable *fdt; in expand_files() local
201 fdt = files_fdtable(files); in expand_files()
204 if (nr < fdt->max_fds) in expand_files()
228 static inline void __set_close_on_exec(unsigned int fd, struct fdtable *fdt) in __set_close_on_exec() argument
230 __set_bit(fd, fdt->close_on_exec); in __set_close_on_exec()
233 static inline void __clear_close_on_exec(unsigned int fd, struct fdtable *fdt) in __clear_close_on_exec() argument
235 if (test_bit(fd, fdt->close_on_exec)) in __clear_close_on_exec()
236 __clear_bit(fd, fdt->close_on_exec); in __clear_close_on_exec()
239 static inline void __set_open_fd(unsigned int fd, struct fdtable *fdt) in __set_open_fd() argument
241 __set_bit(fd, fdt->open_fds); in __set_open_fd()
243 if (!~fdt->open_fds[fd]) in __set_open_fd()
244 __set_bit(fd, fdt->full_fds_bits); in __set_open_fd()
247 static inline void __clear_open_fd(unsigned int fd, struct fdtable *fdt) in __clear_open_fd() argument
249 __clear_bit(fd, fdt->open_fds); in __clear_open_fd()
250 __clear_bit(fd / BITS_PER_LONG, fdt->full_fds_bits); in __clear_open_fd()
253 static unsigned int count_open_files(struct fdtable *fdt) in count_open_files() argument
255 unsigned int size = fdt->max_fds; in count_open_files()
260 if (fdt->open_fds[--i]) in count_open_files()
358 rcu_assign_pointer(newf->fdt, new_fdt); in dup_fd()
375 struct fdtable *fdt = rcu_dereference_raw(files->fdt); in close_files() local
381 if (i >= fdt->max_fds) in close_files()
383 set = fdt->open_fds[j++]; in close_files()
386 struct file * file = xchg(&fdt->fd[i], NULL); in close_files()
397 return fdt; in close_files()
416 struct fdtable *fdt = close_files(files); in put_files_struct() local
419 if (fdt != &files->fdtab) in put_files_struct()
420 __free_fdtable(fdt); in put_files_struct()
451 .fdt = &init_files.fdtab,
463 static unsigned int find_next_fd(struct fdtable *fdt, unsigned int start) in find_next_fd() argument
465 unsigned int maxfd = fdt->max_fds; in find_next_fd()
469 bitbit = find_next_zero_bit(fdt->full_fds_bits, maxbit, bitbit) * BITS_PER_LONG; in find_next_fd()
474 return find_next_zero_bit(fdt->open_fds, maxfd, start); in find_next_fd()
485 struct fdtable *fdt; in __alloc_fd() local
489 fdt = files_fdtable(files); in __alloc_fd()
494 if (fd < fdt->max_fds) in __alloc_fd()
495 fd = find_next_fd(fdt, fd); in __alloc_fd()
519 __set_open_fd(fd, fdt); in __alloc_fd()
521 __set_close_on_exec(fd, fdt); in __alloc_fd()
523 __clear_close_on_exec(fd, fdt); in __alloc_fd()
527 if (rcu_access_pointer(fdt->fd[fd]) != NULL) { in __alloc_fd()
529 rcu_assign_pointer(fdt->fd[fd], NULL); in __alloc_fd()
551 struct fdtable *fdt = files_fdtable(files); in __put_unused_fd() local
552 __clear_open_fd(fd, fdt); in __put_unused_fd()
590 struct fdtable *fdt; in __fd_install() local
597 fdt = files_fdtable(files); in __fd_install()
598 BUG_ON(fdt->fd[fd] != NULL); in __fd_install()
599 rcu_assign_pointer(fdt->fd[fd], file); in __fd_install()
605 fdt = rcu_dereference_sched(files->fdt); in __fd_install()
606 BUG_ON(fdt->fd[fd] != NULL); in __fd_install()
607 rcu_assign_pointer(fdt->fd[fd], file); in __fd_install()
624 struct fdtable *fdt; in __close_fd() local
627 fdt = files_fdtable(files); in __close_fd()
628 if (fd >= fdt->max_fds) in __close_fd()
630 file = fdt->fd[fd]; in __close_fd()
633 rcu_assign_pointer(fdt->fd[fd], NULL); in __close_fd()
651 struct fdtable *fdt; in __close_fd_get_file() local
654 fdt = files_fdtable(files); in __close_fd_get_file()
655 if (fd >= fdt->max_fds) in __close_fd_get_file()
657 file = fdt->fd[fd]; in __close_fd_get_file()
660 rcu_assign_pointer(fdt->fd[fd], NULL); in __close_fd_get_file()
676 struct fdtable *fdt; in do_close_on_exec() local
683 fdt = files_fdtable(files); in do_close_on_exec()
684 if (fd >= fdt->max_fds) in do_close_on_exec()
686 set = fdt->close_on_exec[i]; in do_close_on_exec()
689 fdt->close_on_exec[i] = 0; in do_close_on_exec()
694 file = fdt->fd[fd]; in do_close_on_exec()
697 rcu_assign_pointer(fdt->fd[fd], NULL); in do_close_on_exec()
821 struct fdtable *fdt; in set_close_on_exec() local
823 fdt = files_fdtable(files); in set_close_on_exec()
825 __set_close_on_exec(fd, fdt); in set_close_on_exec()
827 __clear_close_on_exec(fd, fdt); in set_close_on_exec()
834 struct fdtable *fdt; in get_close_on_exec() local
837 fdt = files_fdtable(files); in get_close_on_exec()
838 res = close_on_exec(fd, fdt); in get_close_on_exec()
848 struct fdtable *fdt; in do_dup2() local
864 fdt = files_fdtable(files); in do_dup2()
865 tofree = fdt->fd[fd]; in do_dup2()
866 if (!tofree && fd_is_open(fd, fdt)) in do_dup2()
869 rcu_assign_pointer(fdt->fd[fd], file); in do_dup2()
870 __set_open_fd(fd, fdt); in do_dup2()
872 __set_close_on_exec(fd, fdt); in do_dup2()
874 __clear_close_on_exec(fd, fdt); in do_dup2()
1000 struct fdtable *fdt; in iterate_fd() local
1005 for (fdt = files_fdtable(files); n < fdt->max_fds; n++) { in iterate_fd()
1007 file = rcu_dereference_check_fdtable(files, fdt->fd[n]); in iterate_fd()