From e13574844299a90c79aeff4ce09e1fefa6d13cfb Mon Sep 17 00:00:00 2001 From: Gioh Kim Date: Thu, 19 Aug 2021 22:44:22 +0200 Subject: [PATCH] rust: kernel: ioctl returns ENOTTY if not implemented According to fs/ioctl.c, ioctl system call first test the cmd value with do_vfs_ioctl. If the cmd is not supported command, it calls vfs_ioctl. Then vfs_ioctl returns ENOTTY if ioctl is not implemented. Signed-off-by: Gioh Kim Reviewed-by: Wei Liu Signed-off-by: Miguel Ojeda --- rust/kernel/file_operations.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/kernel/file_operations.rs b/rust/kernel/file_operations.rs index cad665c0016f68..c6f03938de97df 100644 --- a/rust/kernel/file_operations.rs +++ b/rust/kernel/file_operations.rs @@ -662,7 +662,7 @@ pub trait FileOperations: Send + Sync + Sized { _file: &File, _cmd: &mut IoctlCommand, ) -> Result { - Err(Error::EINVAL) + Err(Error::ENOTTY) } /// Performs 32-bit IO control operations on that are specific to the file on 64-bit kernels. @@ -673,7 +673,7 @@ pub trait FileOperations: Send + Sync + Sized { _file: &File, _cmd: &mut IoctlCommand, ) -> Result { - Err(Error::EINVAL) + Err(Error::ENOTTY) } /// Syncs pending changes to this file.