Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
[sfrench/cifs-2.6.git] / fs / compat_ioctl.c
index b9e3357bcc2ead562e138ea71b89d13120d03f41..da8cb3b3592c96ade1614ab8e553b5e16597b42a 100644 (file)
@@ -10,6 +10,8 @@
  * ioctls.
  */
 
+#include <linux/joystick.h>
+
 #include <linux/types.h>
 #include <linux/compat.h>
 #include <linux/kernel.h>
 #include <linux/dvb/dmx.h>
 #include <linux/dvb/frontend.h>
 #include <linux/dvb/video.h>
-#include <linux/lp.h>
 
 #ifdef CONFIG_SPARC
 #include <asm/fbio.h>
@@ -319,22 +320,21 @@ struct ifconf32 {
 
 static int dev_ifname32(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-       struct net_device *dev;
-       struct ifreq32 ifr32;
+       struct ifreq __user *uifr;
        int err;
 
-       if (copy_from_user(&ifr32, compat_ptr(arg), sizeof(ifr32)))
+       uifr = compat_alloc_user_space(sizeof(struct ifreq));
+       if (copy_in_user(uifr, compat_ptr(arg), sizeof(struct ifreq32)))
                return -EFAULT;
 
-       dev = dev_get_by_index(ifr32.ifr_ifindex);
-       if (!dev)
-               return -ENODEV;
+       err = sys_ioctl(fd, SIOCGIFNAME, (unsigned long)uifr);
+       if (err)
+               return err;
 
-       strlcpy(ifr32.ifr_name, dev->name, sizeof(ifr32.ifr_name));
-       dev_put(dev);
-       
-       err = copy_to_user(compat_ptr(arg), &ifr32, sizeof(ifr32));
-       return (err ? -EFAULT : 0);
+       if (copy_in_user(compat_ptr(arg), uifr, sizeof(struct ifreq32)))
+               return -EFAULT;
+
+       return 0;
 }
 
 static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg)
@@ -1956,6 +1956,12 @@ ULONG_IOCTL(TIOCSCTTY)
 COMPATIBLE_IOCTL(TIOCGPTN)
 COMPATIBLE_IOCTL(TIOCSPTLCK)
 COMPATIBLE_IOCTL(TIOCSERGETLSR)
+#ifdef TCGETS2
+COMPATIBLE_IOCTL(TCGETS2)
+COMPATIBLE_IOCTL(TCSETS2)
+COMPATIBLE_IOCTL(TCSETSW2)
+COMPATIBLE_IOCTL(TCSETSF2)
+#endif
 /* Little f */
 COMPATIBLE_IOCTL(FIOCLEX)
 COMPATIBLE_IOCTL(FIONCLEX)
@@ -2638,6 +2644,12 @@ COMPATIBLE_IOCTL(VIDEO_SET_ATTRIBUTES)
 COMPATIBLE_IOCTL(VIDEO_GET_SIZE)
 COMPATIBLE_IOCTL(VIDEO_GET_FRAME_RATE)
 
+/* joystick */
+COMPATIBLE_IOCTL(JSIOCGVERSION)
+COMPATIBLE_IOCTL(JSIOCGAXES)
+COMPATIBLE_IOCTL(JSIOCGBUTTONS)
+COMPATIBLE_IOCTL(JSIOCGNAME(0))
+
 /* now things that need handlers */
 HANDLE_IOCTL(MEMREADOOB32, mtd_rw_oob)
 HANDLE_IOCTL(MEMWRITEOOB32, mtd_rw_oob)
@@ -3003,7 +3015,7 @@ static int __init init_sys32_ioctl(void)
        int i;
 
        for (i = 0; i < ARRAY_SIZE(ioctl_start); i++) {
-               if (ioctl_start[i].next != 0) {
+               if (ioctl_start[i].next) {
                        printk("ioctl translation %d bad\n",i);
                        return -1;
                }