]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ocfs2: Implement compat_ioctl()
authorMark Fasheh <mark.fasheh@oracle.com>
Fri, 9 Mar 2007 23:56:28 +0000 (15:56 -0800)
committerMark Fasheh <mark.fasheh@oracle.com>
Wed, 2 May 2007 22:07:16 +0000 (15:07 -0700)
We need this to support 32 bit system calls on 64 bit kernels.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
fs/ocfs2/file.c
fs/ocfs2/ioctl.c
fs/ocfs2/ioctl.h
fs/ocfs2/ocfs2_fs.h

index 520a2a6d7670641db08d10c2f57143ea8c752d28..3b5a1576ae105197b2c356fb1aff8868808e4626 100644 (file)
@@ -1853,6 +1853,9 @@ const struct file_operations ocfs2_fops = {
        .aio_read       = ocfs2_file_aio_read,
        .aio_write      = ocfs2_file_aio_write,
        .ioctl          = ocfs2_ioctl,
+#ifdef CONFIG_COMPAT
+       .compat_ioctl   = ocfs2_compat_ioctl,
+#endif
        .splice_read    = ocfs2_file_splice_read,
        .splice_write   = ocfs2_file_splice_write,
 };
@@ -1862,4 +1865,7 @@ const struct file_operations ocfs2_dops = {
        .readdir        = ocfs2_readdir,
        .fsync          = ocfs2_sync_file,
        .ioctl          = ocfs2_ioctl,
+#ifdef CONFIG_COMPAT
+       .compat_ioctl   = ocfs2_compat_ioctl,
+#endif
 };
index 4768be5f3086f00414718f246f5eae0774bf5421..7e59c93751f03e8266e7a314f3bfdcea6c784df9 100644 (file)
@@ -134,3 +134,26 @@ int ocfs2_ioctl(struct inode * inode, struct file * filp,
        }
 }
 
+#ifdef CONFIG_COMPAT
+long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
+{
+       struct inode *inode = file->f_path.dentry->d_inode;
+       int ret;
+
+       switch (cmd) {
+       case OCFS2_IOC32_GETFLAGS:
+               cmd = OCFS2_IOC_GETFLAGS;
+               break;
+       case OCFS2_IOC32_SETFLAGS:
+               cmd = OCFS2_IOC_SETFLAGS;
+               break;
+       default:
+               return -ENOIOCTLCMD;
+       }
+
+       lock_kernel();
+       ret = ocfs2_ioctl(inode, file, cmd, arg);
+       unlock_kernel();
+       return ret;
+}
+#endif
index 4a7c82931dbaeb9ce298eecd256536b8ada7f715..4d6c4f430d0d14e174bf89c490128014421c14f4 100644 (file)
@@ -12,5 +12,6 @@
 
 int ocfs2_ioctl(struct inode * inode, struct file * filp,
        unsigned int cmd, unsigned long arg);
+long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg);
 
 #endif /* OCFS2_IOCTL_H */
index 71306479c68f29f79f0368f25d1df809db6abfcc..f0d9eb08547a0fbc8ccd2d23e6d71f0dee92327b 100644 (file)
  */
 #define OCFS2_IOC_GETFLAGS     _IOR('f', 1, long)
 #define OCFS2_IOC_SETFLAGS     _IOW('f', 2, long)
+#define OCFS2_IOC32_GETFLAGS   _IOR('f', 1, int)
+#define OCFS2_IOC32_SETFLAGS   _IOW('f', 2, int)
 
 /*
  * Journal Flags (ocfs2_dinode.id1.journal1.i_flags)