From cda2ed05aade303b7d89844a0333168c3484634a Mon Sep 17 00:00:00 2001 From: Christoph Hellwig <hch@lst.de> Date: Mon, 31 Oct 2022 13:46:26 +0100 Subject: fs: simplify vfs_get_super Remove the pointless keying argument and associated enum and pass the fill_super callback and a "bool reconf" instead. Also mark the function static given that there are no users outside of super.c. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> --- include/linux/fs_context.h | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'include') diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h index 13fa6f3df8e4..87a34f2fa68d 100644 --- a/include/linux/fs_context.h +++ b/include/linux/fs_context.h @@ -145,20 +145,6 @@ extern void fc_drop_locked(struct fs_context *fc); int reconfigure_single(struct super_block *s, int flags, void *data); -/* - * sget() wrappers to be called from the ->get_tree() op. - */ -enum vfs_get_super_keying { - vfs_get_single_super, /* Only one such superblock may exist */ - vfs_get_single_reconf_super, /* As above, but reconfigure if it exists */ - vfs_get_keyed_super, /* Superblocks with different s_fs_info keys may exist */ - vfs_get_independent_super, /* Multiple independent superblocks may exist */ -}; -extern int vfs_get_super(struct fs_context *fc, - enum vfs_get_super_keying keying, - int (*fill_super)(struct super_block *sb, - struct fs_context *fc)); - extern int get_tree_nodev(struct fs_context *fc, int (*fill_super)(struct super_block *sb, struct fs_context *fc)); -- cgit v1.2.3 From ea258f159da14a710f9cb88656558538b5ba5b76 Mon Sep 17 00:00:00 2001 From: Zhen Lei <thunder.leizhen@huawei.com> Date: Fri, 25 Nov 2022 17:13:58 +0800 Subject: get rid of INT_LIMIT, use type_max() instead INT_LIMIT() tries to do what type_max() does, except that type_max() doesn't rely upon undefined behaviour[*], might as well use type_max() instead. [*] if T is an N-bit signed integer type, the maximal value in T is pow(2, N - 1) - 1, all right, but naive expression for that value ends up with a couple of wraparounds and as usual for wraparounds in signed types, that's an undefined behaviour. type_max() takes care to avoid those... Caught-by: UBSAN Suggested-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Reviewed-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> --- include/linux/fs.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/linux/fs.h b/include/linux/fs.h index e654435f1651..a384741b1449 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1131,9 +1131,8 @@ struct file_lock_context { /* The following constant reflects the upper bound of the file/locking space */ #ifndef OFFSET_MAX -#define INT_LIMIT(x) (~((x)1 << (sizeof(x)*8 - 1))) -#define OFFSET_MAX INT_LIMIT(loff_t) -#define OFFT_OFFSET_MAX INT_LIMIT(off_t) +#define OFFSET_MAX type_max(loff_t) +#define OFFT_OFFSET_MAX type_max(off_t) #endif extern void send_sigio(struct fown_struct *fown, int fd, int band); -- cgit v1.2.3