public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 vfs 0/2] Fix the return type of several functions from long to int
@ 2025-01-19  9:02 Yuichiro Tsuji
  2025-01-19  9:02 ` [PATCH v1 vfs 1/2] open: Fix " Yuichiro Tsuji
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Yuichiro Tsuji @ 2025-01-19  9:02 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Alexander Viro, Christian Brauner, Jan Kara, Kuniyuki Iwashima,
	Yuichiro Tsuji

These patches fix the return type of several functions from long to int to
match its actual behavior.

Yuichiro Tsuji (2):
  open: Fix return type of several functions from long to int
  ioctl: Fix return type of several functions from long to int

 fs/internal.h            |  4 ++--
 fs/ioctl.c               |  6 +++---
 fs/open.c                | 18 +++++++++---------
 include/linux/fs.h       |  6 +++---
 include/linux/syscalls.h |  4 ++--
 5 files changed, 19 insertions(+), 19 deletions(-)

-- 
2.43.5


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 vfs 1/2] open: Fix return type of several functions from long to int
  2025-01-19  9:02 [PATCH v1 vfs 0/2] Fix the return type of several functions from long to int Yuichiro Tsuji
@ 2025-01-19  9:02 ` Yuichiro Tsuji
  2025-01-19  9:02 ` [PATCH v1 vfs 2/2] ioctl: " Yuichiro Tsuji
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Yuichiro Tsuji @ 2025-01-19  9:02 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Alexander Viro, Christian Brauner, Jan Kara, Kuniyuki Iwashima,
	Yuichiro Tsuji

Fix the return type of several functions from long to int to match its actu
al behavior. These functions only return int values. This change improves
type consistency across the filesystem code and aligns the function signatu
re with its existing implementation and usage.
---
 fs/internal.h            |  4 ++--
 fs/open.c                | 18 +++++++++---------
 include/linux/fs.h       |  4 ++--
 include/linux/syscalls.h |  4 ++--
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/fs/internal.h b/fs/internal.h
index e7f02ae1e098..84607e7b05dc 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -187,8 +187,8 @@ extern struct open_how build_open_how(int flags, umode_t mode);
 extern int build_open_flags(const struct open_how *how, struct open_flags *op);
 struct file *file_close_fd_locked(struct files_struct *files, unsigned fd);
 
-long do_ftruncate(struct file *file, loff_t length, int small);
-long do_sys_ftruncate(unsigned int fd, loff_t length, int small);
+int do_ftruncate(struct file *file, loff_t length, int small);
+int do_sys_ftruncate(unsigned int fd, loff_t length, int small);
 int chmod_common(const struct path *path, umode_t mode);
 int do_fchownat(int dfd, const char __user *filename, uid_t user, gid_t group,
 		int flag);
diff --git a/fs/open.c b/fs/open.c
index e6911101fe71..f8d79a5912d7 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -67,11 +67,11 @@ int do_truncate(struct mnt_idmap *idmap, struct dentry *dentry,
 	return ret;
 }
 
-long vfs_truncate(const struct path *path, loff_t length)
+int vfs_truncate(const struct path *path, loff_t length)
 {
 	struct mnt_idmap *idmap;
 	struct inode *inode;
-	long error;
+	int error;
 
 	inode = path->dentry->d_inode;
 
@@ -119,7 +119,7 @@ long vfs_truncate(const struct path *path, loff_t length)
 }
 EXPORT_SYMBOL_GPL(vfs_truncate);
 
-long do_sys_truncate(const char __user *pathname, loff_t length)
+int do_sys_truncate(const char __user *pathname, loff_t length)
 {
 	unsigned int lookup_flags = LOOKUP_FOLLOW;
 	struct path path;
@@ -153,7 +153,7 @@ COMPAT_SYSCALL_DEFINE2(truncate, const char __user *, path, compat_off_t, length
 }
 #endif
 
-long do_ftruncate(struct file *file, loff_t length, int small)
+int do_ftruncate(struct file *file, loff_t length, int small)
 {
 	struct inode *inode;
 	struct dentry *dentry;
@@ -185,7 +185,7 @@ long do_ftruncate(struct file *file, loff_t length, int small)
 	return error;
 }
 
-long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
+int do_sys_ftruncate(unsigned int fd, loff_t length, int small)
 {
 	if (length < 0)
 		return -EINVAL;
@@ -240,7 +240,7 @@ COMPAT_SYSCALL_DEFINE3(ftruncate64, unsigned int, fd,
 int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 {
 	struct inode *inode = file_inode(file);
-	long ret;
+	int ret;
 	loff_t sum;
 
 	if (offset < 0 || len <= 0)
@@ -456,7 +456,7 @@ static const struct cred *access_override_creds(void)
 	return old_cred;
 }
 
-static long do_faccessat(int dfd, const char __user *filename, int mode, int flags)
+static int do_faccessat(int dfd, const char __user *filename, int mode, int flags)
 {
 	struct path path;
 	struct inode *inode;
@@ -1383,7 +1383,7 @@ struct file *file_open_root(const struct path *root,
 }
 EXPORT_SYMBOL(file_open_root);
 
-static long do_sys_openat2(int dfd, const char __user *filename,
+static int do_sys_openat2(int dfd, const char __user *filename,
 			   struct open_how *how)
 {
 	struct open_flags op;
@@ -1411,7 +1411,7 @@ static long do_sys_openat2(int dfd, const char __user *filename,
 	return fd;
 }
 
-long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
+int do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
 {
 	struct open_how how = build_open_how(flags, mode);
 	return do_sys_openat2(dfd, filename, &how);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e06ea7e9ca15..999ae4790a5a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2747,12 +2747,12 @@ static inline bool is_idmapped_mnt(const struct vfsmount *mnt)
 	return mnt_idmap(mnt) != &nop_mnt_idmap;
 }
 
-extern long vfs_truncate(const struct path *, loff_t);
+int vfs_truncate(const struct path *, loff_t);
 int do_truncate(struct mnt_idmap *, struct dentry *, loff_t start,
 		unsigned int time_attrs, struct file *filp);
 extern int vfs_fallocate(struct file *file, int mode, loff_t offset,
 			loff_t len);
-extern long do_sys_open(int dfd, const char __user *filename, int flags,
+int do_sys_open(int dfd, const char __user *filename, int flags,
 			umode_t mode);
 extern struct file *file_open_name(struct filename *, int, umode_t);
 extern struct file *filp_open(const char *, int, umode_t);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index c6333204d451..bae4490c1dda 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -1266,14 +1266,14 @@ static inline long ksys_lchown(const char __user *filename, uid_t user,
 			     AT_SYMLINK_NOFOLLOW);
 }
 
-extern long do_sys_ftruncate(unsigned int fd, loff_t length, int small);
+int do_sys_ftruncate(unsigned int fd, loff_t length, int small);
 
 static inline long ksys_ftruncate(unsigned int fd, loff_t length)
 {
 	return do_sys_ftruncate(fd, length, 1);
 }
 
-extern long do_sys_truncate(const char __user *pathname, loff_t length);
+int do_sys_truncate(const char __user *pathname, loff_t length);
 
 static inline long ksys_truncate(const char __user *pathname, loff_t length)
 {
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 vfs 2/2] ioctl: Fix return type of several functions from long to int
  2025-01-19  9:02 [PATCH v1 vfs 0/2] Fix the return type of several functions from long to int Yuichiro Tsuji
  2025-01-19  9:02 ` [PATCH v1 vfs 1/2] open: Fix " Yuichiro Tsuji
@ 2025-01-19  9:02 ` Yuichiro Tsuji
  2025-01-20 15:18 ` [PATCH v1 vfs 0/2] Fix the " Christian Brauner
  2025-01-20 15:31 ` Jan Kara
  3 siblings, 0 replies; 5+ messages in thread
From: Yuichiro Tsuji @ 2025-01-19  9:02 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Alexander Viro, Christian Brauner, Jan Kara, Kuniyuki Iwashima,
	Yuichiro Tsuji

Fix the return type of several functions from long to int to match its actu
al behavior. These functions only return int values. This change improves
type consistency across the filesystem code and aligns the function signatu
re with its existing implementation and usage.
---
 fs/ioctl.c         | 6 +++---
 include/linux/fs.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/ioctl.c b/fs/ioctl.c
index 638a36be31c1..502306499dfd 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -41,7 +41,7 @@
  *
  * Returns 0 on success, -errno on error.
  */
-long vfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+int vfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
 	int error = -ENOTTY;
 
@@ -228,7 +228,7 @@ static int ioctl_fiemap(struct file *filp, struct fiemap __user *ufiemap)
 	return error;
 }
 
-static long ioctl_file_clone(struct file *dst_file, unsigned long srcfd,
+static int ioctl_file_clone(struct file *dst_file, unsigned long srcfd,
 			     u64 off, u64 olen, u64 destoff)
 {
 	CLASS(fd, src_file)(srcfd);
@@ -248,7 +248,7 @@ static long ioctl_file_clone(struct file *dst_file, unsigned long srcfd,
 	return ret;
 }
 
-static long ioctl_file_clone_range(struct file *file,
+static int ioctl_file_clone_range(struct file *file,
 				   struct file_clone_range __user *argp)
 {
 	struct file_clone_range args;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 999ae4790a5a..1094fb0b601c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1992,7 +1992,7 @@ int vfs_fchown(struct file *file, uid_t user, gid_t group);
 int vfs_fchmod(struct file *file, umode_t mode);
 int vfs_utimes(const struct path *path, struct timespec64 *times);
 
-extern long vfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
+int vfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 
 #ifdef CONFIG_COMPAT
 extern long compat_ptr_ioctl(struct file *file, unsigned int cmd,
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 vfs 0/2] Fix the return type of several functions from long to int
  2025-01-19  9:02 [PATCH v1 vfs 0/2] Fix the return type of several functions from long to int Yuichiro Tsuji
  2025-01-19  9:02 ` [PATCH v1 vfs 1/2] open: Fix " Yuichiro Tsuji
  2025-01-19  9:02 ` [PATCH v1 vfs 2/2] ioctl: " Yuichiro Tsuji
@ 2025-01-20 15:18 ` Christian Brauner
  2025-01-20 15:31 ` Jan Kara
  3 siblings, 0 replies; 5+ messages in thread
From: Christian Brauner @ 2025-01-20 15:18 UTC (permalink / raw)
  To: Yuichiro Tsuji
  Cc: Christian Brauner, Alexander Viro, Jan Kara, Kuniyuki Iwashima,
	linux-fsdevel

On Sun, 19 Jan 2025 18:02:47 +0900, Yuichiro Tsuji wrote:
> These patches fix the return type of several functions from long to int to
> match its actual behavior.
> 
> Yuichiro Tsuji (2):
>   open: Fix return type of several functions from long to int
>   ioctl: Fix return type of several functions from long to int
> 
> [...]

Applied to the vfs-6.15.misc branch of the vfs/vfs.git tree.
Patches in the vfs-6.15.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.15.misc

[1/2] open: Fix return type of several functions from long to int
      https://git.kernel.org/vfs/vfs/c/70eaede6e05e
[2/2] ioctl: Fix return type of several functions from long to int
      https://git.kernel.org/vfs/vfs/c/ad0c4dc48f4e

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 vfs 0/2] Fix the return type of several functions from long to int
  2025-01-19  9:02 [PATCH v1 vfs 0/2] Fix the return type of several functions from long to int Yuichiro Tsuji
                   ` (2 preceding siblings ...)
  2025-01-20 15:18 ` [PATCH v1 vfs 0/2] Fix the " Christian Brauner
@ 2025-01-20 15:31 ` Jan Kara
  3 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2025-01-20 15:31 UTC (permalink / raw)
  To: Yuichiro Tsuji
  Cc: linux-fsdevel, Alexander Viro, Christian Brauner, Jan Kara,
	Kuniyuki Iwashima

On Sun 19-01-25 18:02:47, Yuichiro Tsuji wrote:
> These patches fix the return type of several functions from long to int to
> match its actual behavior.
> 
> Yuichiro Tsuji (2):
>   open: Fix return type of several functions from long to int
>   ioctl: Fix return type of several functions from long to int

The patches look good to me. Thanks! Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

but you will need to provide your Signed-off-by tag (see
Documentation/process/submitting-patches.rst, chapter "Sign your work - the
Developer's Certificate of Origin") so that these patches can be merged. 

								Honza

> 
>  fs/internal.h            |  4 ++--
>  fs/ioctl.c               |  6 +++---
>  fs/open.c                | 18 +++++++++---------
>  include/linux/fs.h       |  6 +++---
>  include/linux/syscalls.h |  4 ++--
>  5 files changed, 19 insertions(+), 19 deletions(-)
> 
> -- 
> 2.43.5
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-01-20 15:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-19  9:02 [PATCH v1 vfs 0/2] Fix the return type of several functions from long to int Yuichiro Tsuji
2025-01-19  9:02 ` [PATCH v1 vfs 1/2] open: Fix " Yuichiro Tsuji
2025-01-19  9:02 ` [PATCH v1 vfs 2/2] ioctl: " Yuichiro Tsuji
2025-01-20 15:18 ` [PATCH v1 vfs 0/2] Fix the " Christian Brauner
2025-01-20 15:31 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox