rtc subsystem, use ENOIOCTLCMD where appropriate
PATCH 1/1 rtc subsystem, use ENOIOCTLCMD where appropriate
Appropriately use -ENOIOCTLCMD when
the ioctl is not implemented by a driver.
--- drivers/rtc/rtc-dev.c | 6 +++--- drivers/rtc/rtc-sa1100.c | 2 +- drivers/rtc/rtc-test.c | 2 +- drivers/rtc/rtc-vr41xx.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/rtc/rtc-test.c +1 -1
@@ -71,7 +71,7 @@ static int test_rtc_ioctl(struct devicereturn 0 ;default : -return -EINVAL ; +return -ENOIOCTLCMD ; } }
drivers/rtc/rtc-vr41xx.c +1 -1
@@ -270,7 +270,7 @@ static int vr41xx_rtc_ioctl(struct devic epoch = arg;break ;default : -return -EINVAL ; +return -ENOIOCTLCMD ; }return 0 ;
drivers/rtc/rtc-sa1100.c +1 -1
@@ -247,7 +247,7 @@ static int sa1100_rtc_ioctl(struct devic rtc_freq = arg;return 0 ; } -return -EINVAL ; +return -ENOIOCTLCMD ; }static int sa1100_rtc_read_time (struct device *dev,struct rtc_time *tm)
drivers/rtc/rtc-dev.c +3 -3
@@ -141,13 +141,13 @@ static int rtc_dev_ioctl(struct inode *i/* try the driver's ioctl interface */ if (ops->ioctl) { err = ops->ioctl (class_dev->dev, cmd, arg); -if (err != -EINVAL ) +if (err != -ENOIOCTLCMD )return err; }/* if the driver does not provide the ioctl interface * or if that particular ioctl was not implemented -* (-EINVAL), we will try to emulate here. +* (-ENOIOCTLCMD), we will try to emulate here. */ switch (cmd) {
@@ -233,7 +233,7 @@ static int rtc_dev_ioctl(struct inode *ibreak ;default : - err = -EINVAL ; + err = -ENOIOCTLCMD ;break ; }
Quoted 4 lines · On Wed, 17 May 2006 01:30:33 +0200 Alessandro Zummo wrote:
Appropriately use
-ENOIOCTLCMDwhen
the ioctl is not implemented by a driver.
so this return value does not go back to userspace? Comment in linux/errno.h says:
/* Should never be seen by user programs */
and ENOTTY is the return value for "Inappropriate ioctl for device":
http://marc.theaimsgroup.com/?l=linux-fsdevel&m=106739260707476&w=2
http://marc.theaimsgroup.com/?l=lustre-devel&m=106737825024915&w=2
Quoted 61 lines
Signed-off-by Alessandro Zummo <[email protected]>--- drivers/rtc/rtc-dev.c | 6 +++--- drivers/rtc/rtc-sa1100.c | 2 +- drivers/rtc/rtc-test.c | 2 +- drivers/rtc/rtc-vr41xx.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)drivers/rtc/rtc-test.c +1
-1@@ -71,7 +71,7 @@ static int test_rtc_ioctl(struct devicereturn 0 ;default : -return -EINVAL ; +return -ENOIOCTLCMD ; } }drivers/rtc/rtc-vr41xx.c +1
-1@@ -270,7 +270,7 @@ static int vr41xx_rtc_ioctl(struct devic epoch = arg;break ;default : -return -EINVAL ; +return -ENOIOCTLCMD ; }return 0 ;drivers/rtc/rtc-sa1100.c +1
-1@@ -247,7 +247,7 @@ static int sa1100_rtc_ioctl(struct devic rtc_freq = arg;return 0 ; } -return -EINVAL ; +return -ENOIOCTLCMD ; }static int sa1100_rtc_read_time (struct device *dev,struct rtc_time *tm)drivers/rtc/rtc-dev.c +2
-2@@ -141,13 +141,13 @@ static int rtc_dev_ioctl(struct inode *i/* try the driver's ioctl interface */ if (ops->ioctl) { err = ops->ioctl (class_dev->dev, cmd, arg); -if (err != -EINVAL ) +if (err != -ENOIOCTLCMD )return err; }/* if the driver does not provide the ioctl interface * or if that particular ioctl was not implemented -* (-EINVAL), we will try to emulate here. +* (-ENOIOCTLCMD), we will try to emulate here. */ switch (cmd) {
drivers/rtc/rtc-dev.c static int rtc_dev_ioctl(struct inode *i
Quoted 9 lines
drivers/rtc/rtc-dev.c +1
-2@@ -233,7 +233,7 @@ static int rtc_dev_ioctl(struct inode *ibreak ;default : - err = -EINVAL ; + err = -ENOIOCTLCMD ;break ; } -
---
~Randy
Quoted 4 lines · On Wed, 17 May 2006 14:25:10 -0700 "Randy.Dunlap" <[email protected]> wrote:
Quoted 2 lines · On Wed, 17 May 2006 01:30:33 +0200 Alessandro Zummo wrote:
Quoted 9 lines
Quoted 2 lines
Appropriately use
-ENOIOCTLCMDwhen
the ioctl is not implemented by a driver.so this return value does not go back to userspace? Comment in
linux/errno.hsays:
/* Should never be seen by user programs */and ENOTTY is the return value for "Inappropriate ioctl for device":
you're right. I'll go for ENOTTY. thanks.
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Turin, Italy http://www.towertech.it
Followup to: <20060517232742.2ac4ccaa@inspiron> By author: Alessandro Zummo <[email protected]> In newsgroup: linux.dev.kernel
Quoted 6 lines
Quoted 3 lines
and ENOTTY is the return value for "Inappropriate ioctl for device":
you're right. I'll go for ENOTTY. thanks.
ENOIOCTLCMD is right here, *except* in the very last hunk, because it's a request to the upper layers to emulate the operation:
Quoted 19 lines
drivers/rtc/rtc-dev.c +2
-2@@ -141,13 +141,13 @@ static int rtc_dev_ioctl(struct inode *i/* try the driver's ioctl interface */ if (ops->ioctl) { err = ops->ioctl (class_dev->dev, cmd, arg); -if (err != -EINVAL ) +if (err != -ENOIOCTLCMD )return err; }/* if the driver does not provide the ioctl interface * or if that particular ioctl was not implemented -* (-EINVAL), we will try to emulate here. +* (-ENOIOCTLCMD), we will try to emulate here. */ switch (cmd) {
drivers/rtc/rtc-dev.c static int rtc_dev_ioctl(struct inode *i · line 239
Quoted 8 lines
drivers/rtc/rtc-dev.c +1
-1@@ -233,7 +233,7 @@ static int rtc_dev_ioctl(struct inode *ibreak ;default : - err = -EINVAL ; + err = -ENOIOCTLCMD ;break ; }
The last hunk should be ENOTTY.
-hpa
---
~Randy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Hi Hans Peter,
H. Peter Anvin wrote
Quoted 2 lines
ENOIOCTLCMD is right here, *except* in the very last hunk, because it's a request to the upper layers to emulate the operation:
So would a patch like this be welcome and clear this up?
include/linux/errno.h +1 -1
@@ -9,7 +9,7 @@#define ERESTARTSYS 512#define ERESTARTNOINTR 513#define ERESTARTNOHAND 514/* restart if no handler.. */ -#define ENOIOCTLCMD 515/* No ioctl command */ +#define ENOIOCTLCMD 515/* No ioctl command, upper layer please emulate or pass ENOTTY to user space */ #define ERESTART_RESTARTBLOCK 516/* restart by calling sys_restart_syscall */ /* Defined for the NFSv3 protocol */
Regards
Ingo Oeser
Quoted 14 lines · Ingo Oeser
Hi Hans Peter,
H. Peter Anvin wrote
Quoted 2 lines
ENOIOCTLCMD is right here, *except* in the very last hunk, because it's a request to the upper layers to emulate the operation:
So would a patch like this be welcome and clear this up?
include/linux/errno.h +0
-0
include/linux/errno.h line 15
Quoted 8 lines
include/linux/errno.h +1
-1@@ -9,7 +9,7 @@#define ERESTARTSYS 512#define ERESTARTNOINTR 513#define ERESTARTNOHAND 514/* restart if no handler.. */ -#define ENOIOCTLCMD 515/* No ioctl command */ +#define ENOIOCTLCMD 515/* No ioctl command, upper layer please emulate or pass ENOTTY to user space */ #define ERESTART_RESTARTBLOCK 516/* restart by calling sys_restart_syscall */ /* Defined for the NFSv3 protocol */
Sure, if people feel it's necessary.
-hpa