* [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
* Re: [RFC] rust: kernel: ioctl returns ENOTTY if not implemented
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
1 sibling, 0 replies; 3+ messages in thread
From: Wei Liu @ 2021-08-21 15:34 UTC (permalink / raw)
To: Gioh Kim; +Cc: rust-for-linux, Gioh Kim, Wei Liu
On Thu, Aug 19, 2021 at 10:44:22PM +0200, Gioh Kim wrote:
> 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>
FWIW:
Reviewed-by: Wei Liu <wei.liu@kernel.org>
> ---
> 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 [flat|nested] 3+ messages in thread
* Re: [RFC] rust: kernel: ioctl returns ENOTTY if not implemented
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
1 sibling, 0 replies; 3+ messages in thread
From: Miguel Ojeda @ 2021-08-23 10:47 UTC (permalink / raw)
To: Gioh Kim; +Cc: rust-for-linux, Gioh Kim
Hi Gioh,
On Thu, Aug 19, 2021 at 10:45 PM Gioh Kim <gi-oh.kim@ionos.com> wrote:
>
> 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>
Thanks! Applying it.
(By the way, always try to match the `From` -- I understand you are
sending this as a personal contribution vs. your other commits in the
kernel).
Cheers,
Miguel
^ permalink raw reply [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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.