From f60d374d2cc88034385265d193a38e3f4a4b430c Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 4 Jan 2024 21:35:38 -0500 Subject: close_on_exec(): pass files_struct instead of fdtable both callers are happier that way... Reviewed-by: Christian Brauner Signed-off-by: Al Viro --- include/linux/fdtable.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/linux/fdtable.h') diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index 78c8326d74ae..cc060b20502b 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h @@ -33,11 +33,6 @@ struct fdtable { struct rcu_head rcu; }; -static inline bool close_on_exec(unsigned int fd, const struct fdtable *fdt) -{ - return test_bit(fd, fdt->close_on_exec); -} - static inline bool fd_is_open(unsigned int fd, const struct fdtable *fdt) { return test_bit(fd, fdt->open_fds); @@ -107,6 +102,11 @@ struct file *lookup_fdget_rcu(unsigned int fd); struct file *task_lookup_fdget_rcu(struct task_struct *task, unsigned int fd); struct file *task_lookup_next_fdget_rcu(struct task_struct *task, unsigned int *fd); +static inline bool close_on_exec(unsigned int fd, const struct files_struct *files) +{ + return test_bit(fd, files_fdtable(files)->close_on_exec); +} + struct task_struct; void put_files_struct(struct files_struct *fs); -- cgit v1.2.3-59-g8ed1b From c4aab26253cd1f302279b8d6b5b66ccf1b120520 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 4 Jan 2024 21:45:47 -0500 Subject: fd_is_open(): move to fs/file.c no users outside that... Reviewed-by: Christian Brauner Signed-off-by: Al Viro --- fs/file.c | 5 +++++ include/linux/fdtable.h | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'include/linux/fdtable.h') diff --git a/fs/file.c b/fs/file.c index eff5ce79f66a..ab38b005633c 100644 --- a/fs/file.c +++ b/fs/file.c @@ -271,6 +271,11 @@ static inline void __clear_open_fd(unsigned int fd, struct fdtable *fdt) __clear_bit(fd / BITS_PER_LONG, fdt->full_fds_bits); } +static inline bool fd_is_open(unsigned int fd, const struct fdtable *fdt) +{ + return test_bit(fd, fdt->open_fds); +} + static unsigned int count_open_files(struct fdtable *fdt) { unsigned int size = fdt->max_fds; diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index cc060b20502b..2944d4aa413b 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h @@ -33,11 +33,6 @@ struct fdtable { struct rcu_head rcu; }; -static inline bool fd_is_open(unsigned int fd, const struct fdtable *fdt) -{ - return test_bit(fd, fdt->open_fds); -} - /* * Open file table structure */ -- cgit v1.2.3-59-g8ed1b