rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] rust: kernel: ioctl returns ENOTTY if not implemented
@ 2021-08-19 20:44 Gioh Kim
  2021-08-21 15:34 ` Wei Liu
  2021-08-23 10:47 ` Miguel Ojeda
  0 siblings, 2 replies; 3+ messages in thread
From: Gioh Kim @ 2021-08-19 20:44 UTC (permalink / raw)
  To: rust-for-linux; +Cc: Gioh Kim

From: Gioh Kim <gurugio@gmail.com>

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 <gurugio@gmail.com>
---
 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 cad665c0016f..c6f03938de97 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<i32> {
-        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<i32> {
-        Err(Error::EINVAL)
+        Err(Error::ENOTTY)
     }
 
     /// Syncs pending changes to this file.
-- 
2.25.1


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

end of thread, other threads:[~2021-08-23 10:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 20:44 [RFC] rust: kernel: ioctl returns ENOTTY if not implemented Gioh Kim
2021-08-21 15:34 ` Wei Liu
2021-08-23 10:47 ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).