rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gioh Kim <gi-oh.kim@ionos.com>
To: rust-for-linux@vger.kernel.org
Cc: Gioh Kim <gurugio@gmail.com>
Subject: [RFC] rust: kernel: ioctl returns ENOTTY if not implemented
Date: Thu, 19 Aug 2021 22:44:22 +0200	[thread overview]
Message-ID: <20210819204422.64595-1-gi-oh.kim@ionos.com> (raw)

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


             reply	other threads:[~2021-08-19 20:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 20:44 Gioh Kim [this message]
2021-08-21 15:34 ` [RFC] rust: kernel: ioctl returns ENOTTY if not implemented Wei Liu
2021-08-23 10:47 ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210819204422.64595-1-gi-oh.kim@ionos.com \
    --to=gi-oh.kim@ionos.com \
    --cc=gurugio@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).