Skip to content

Commit

Permalink
ocfs2: Implement compat_ioctl()
Browse files Browse the repository at this point in the history
We need this to support 32 bit system calls on 64 bit kernels.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
  • Loading branch information
Mark Fasheh committed May 2, 2007
1 parent 40caf5e commit 586d232
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/ocfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand All @@ -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
};
23 changes: 23 additions & 0 deletions fs/ocfs2/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions fs/ocfs2/ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
2 changes: 2 additions & 0 deletions fs/ocfs2/ocfs2_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@
*/
#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)
Expand Down

0 comments on commit 586d232

Please sign in to comment.