Commit 535f8d65 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David S. Miller

[SPARC]: Fix RTC compat ioctl kernel log spam.

On Fri, Nov 11, 2005 at 12:58:40PM -0800, David S. Miller wrote:
> 
> This change:
> 
> diff-tree 8ca2bdc7 (from feee207e44d3643d19e648aAuthor: Christoph Hellwig <hch@lst.de>
> Date:   Wed Nov 9 12:07:18 2005 -0800
> 
>     [SPARC] sbus rtc: implement ->compat_ioctl
>     
>     Signed-off-by: Christoph Hellwig <hch@lst.de>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> results in the console now getting spewed on sparc64 systems
> with messages like:
> 
> [   11.968298] ioctl32(hwclock:464): Unknown cmd fd(3) cmd(401c7014){00} arg(efc
> What's happening is hwclock tries first the SBUS rtc device ioctls
> then the normal rtc driver ones.
> 
> So things actually worked better when we had the SBUS rtc compat ioctl
> directly handled via the generic compat ioctl code.
> 
> There are _so_ many rtc drivers in the kernel implementing the
> generic rtc ioctls that I don't think putting a ->compat_ioctl
> into all of them to fix this problem is feasible.  Unless we
> write a single rtc_compat_ioctl(), export it to modules, and hook
> it into all of those somehow.
> 
> But even that doesn't appear to have any pretty implementation.
> 
> Any better ideas?

We had similar problems with other ioctls where userspace did things
like that.  What we did there was to put the compat handler to generic
code.  The patch below does that, adding a big comment about what's
going on and removing the COMPAT_IOCTL entires for these on powerpc
that not only weren't ever useful but are duplicated now aswell.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4f005551
...@@ -40,10 +40,6 @@ IOCTL_TABLE_START ...@@ -40,10 +40,6 @@ IOCTL_TABLE_START
#define DECLARES #define DECLARES
#include "compat_ioctl.c" #include "compat_ioctl.c"
/* Little p (/dev/rtc, /dev/envctrl, etc.) */
COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */
COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */
IOCTL_TABLE_END IOCTL_TABLE_END
int ioctl_table_size = ARRAY_SIZE(ioctl_start); int ioctl_table_size = ARRAY_SIZE(ioctl_start);
...@@ -210,27 +210,6 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -210,27 +210,6 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
} }
} }
static long rtc_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
int rval = -ENOIOCTLCMD;
switch (cmd) {
/*
* These two are specific to this driver, the generic rtc ioctls
* are hanlded elsewhere.
*/
case RTCGET:
case RTCSET:
lock_kernel();
rval = rtc_ioctl(file->f_dentry->d_inode, file, cmd, arg);
unlock_kernel();
break;
}
return rval;
}
static int rtc_open(struct inode *inode, struct file *file) static int rtc_open(struct inode *inode, struct file *file)
{ {
int ret; int ret;
...@@ -258,7 +237,6 @@ static struct file_operations rtc_fops = { ...@@ -258,7 +237,6 @@ static struct file_operations rtc_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.llseek = no_llseek, .llseek = no_llseek,
.ioctl = rtc_ioctl, .ioctl = rtc_ioctl,
.compat_ioctl = rtc_compat_ioctl,
.open = rtc_open, .open = rtc_open,
.release = rtc_release, .release = rtc_release,
}; };
......
...@@ -259,6 +259,14 @@ COMPATIBLE_IOCTL(RTC_RD_TIME) ...@@ -259,6 +259,14 @@ COMPATIBLE_IOCTL(RTC_RD_TIME)
COMPATIBLE_IOCTL(RTC_SET_TIME) COMPATIBLE_IOCTL(RTC_SET_TIME)
COMPATIBLE_IOCTL(RTC_WKALM_SET) COMPATIBLE_IOCTL(RTC_WKALM_SET)
COMPATIBLE_IOCTL(RTC_WKALM_RD) COMPATIBLE_IOCTL(RTC_WKALM_RD)
/*
* These two are only for the sbus rtc driver, but
* hwclock tries them on every rtc device first when
* running on sparc. On other architectures the entries
* are useless but harmless.
*/
COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */
COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */
/* Little m */ /* Little m */
COMPATIBLE_IOCTL(MTIOCTOP) COMPATIBLE_IOCTL(MTIOCTOP)
/* Socket level stuff */ /* Socket level stuff */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment