]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Add support 32 bit FS_IOC32_{GET|SET}FLAGS compat ioctls
authorColin Ian King <colin.king@canonical.com>
Wed, 30 Mar 2016 22:00:23 +0000 (23:00 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 1 Apr 2016 00:56:12 +0000 (17:56 -0700)
We need 32 bit userspace FS_IOC32_GETFLAGS and FS_IOC32_SETFLAGS
compat ioctls for systems such as powerpc64.  We use the normal
compat ioctl idiom as used by a variety of file systems to provide
this support.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4477

module/zfs/zpl_file.c

index a23bc7d8dd41f3c5b3e365ebb27a116006ce7dd7..5c430c7ca801d1647b8103c1191b273f22582303 100644 (file)
@@ -24,6 +24,9 @@
  */
 
 
+#ifdef CONFIG_COMPAT
+#include <linux/compat.h>
+#endif
 #include <sys/dmu_objset.h>
 #include <sys/zfs_vfsops.h>
 #include <sys/zfs_vnops.h>
@@ -798,7 +801,17 @@ zpl_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 static long
 zpl_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 {
-       return (zpl_ioctl(filp, cmd, arg));
+       switch (cmd) {
+       case FS_IOC32_GETFLAGS:
+               cmd = FS_IOC_GETFLAGS;
+               break;
+       case FS_IOC32_SETFLAGS:
+               cmd = FS_IOC_SETFLAGS;
+               break;
+       default:
+               return (-ENOTTY);
+       }
+       return (zpl_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)));
 }
 #endif /* CONFIG_COMPAT */