aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2007-03-09 18:56:28 -0500
committerMark Fasheh <mark.fasheh@oracle.com>2007-05-02 18:07:16 -0400
commit586d232b191b776a1c6d51c10c662b8b3e238fdf (patch)
tree8963261875e046d405d6e23b7ee67ff7c03f5c91 /fs
parent40caf5ea5a7d47f8a33e26b63ca81dea4b5109d2 (diff)
ocfs2: Implement compat_ioctl()
We need this to support 32 bit system calls on 64 bit kernels. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/file.c6
-rw-r--r--fs/ocfs2/ioctl.c23
-rw-r--r--fs/ocfs2/ioctl.h1
-rw-r--r--fs/ocfs2/ocfs2_fs.h2
4 files changed, 32 insertions, 0 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 520a2a6d7670..3b5a1576ae10 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1853,6 +1853,9 @@ const struct file_operations ocfs2_fops = {
1853 .aio_read = ocfs2_file_aio_read, 1853 .aio_read = ocfs2_file_aio_read,
1854 .aio_write = ocfs2_file_aio_write, 1854 .aio_write = ocfs2_file_aio_write,
1855 .ioctl = ocfs2_ioctl, 1855 .ioctl = ocfs2_ioctl,
1856#ifdef CONFIG_COMPAT
1857 .compat_ioctl = ocfs2_compat_ioctl,
1858#endif
1856 .splice_read = ocfs2_file_splice_read, 1859 .splice_read = ocfs2_file_splice_read,
1857 .splice_write = ocfs2_file_splice_write, 1860 .splice_write = ocfs2_file_splice_write,
1858}; 1861};
@@ -1862,4 +1865,7 @@ const struct file_operations ocfs2_dops = {
1862 .readdir = ocfs2_readdir, 1865 .readdir = ocfs2_readdir,
1863 .fsync = ocfs2_sync_file, 1866 .fsync = ocfs2_sync_file,
1864 .ioctl = ocfs2_ioctl, 1867 .ioctl = ocfs2_ioctl,
1868#ifdef CONFIG_COMPAT
1869 .compat_ioctl = ocfs2_compat_ioctl,
1870#endif
1865}; 1871};
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
index 4768be5f3086..7e59c93751f0 100644
--- a/fs/ocfs2/ioctl.c
+++ b/fs/ocfs2/ioctl.c
@@ -134,3 +134,26 @@ int ocfs2_ioctl(struct inode * inode, struct file * filp,
134 } 134 }
135} 135}
136 136
137#ifdef CONFIG_COMPAT
138long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
139{
140 struct inode *inode = file->f_path.dentry->d_inode;
141 int ret;
142
143 switch (cmd) {
144 case OCFS2_IOC32_GETFLAGS:
145 cmd = OCFS2_IOC_GETFLAGS;
146 break;
147 case OCFS2_IOC32_SETFLAGS:
148 cmd = OCFS2_IOC_SETFLAGS;
149 break;
150 default:
151 return -ENOIOCTLCMD;
152 }
153
154 lock_kernel();
155 ret = ocfs2_ioctl(inode, file, cmd, arg);
156 unlock_kernel();
157 return ret;
158}
159#endif
diff --git a/fs/ocfs2/ioctl.h b/fs/ocfs2/ioctl.h
index 4a7c82931dba..4d6c4f430d0d 100644
--- a/fs/ocfs2/ioctl.h
+++ b/fs/ocfs2/ioctl.h
@@ -12,5 +12,6 @@
12 12
13int ocfs2_ioctl(struct inode * inode, struct file * filp, 13int ocfs2_ioctl(struct inode * inode, struct file * filp,
14 unsigned int cmd, unsigned long arg); 14 unsigned int cmd, unsigned long arg);
15long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg);
15 16
16#endif /* OCFS2_IOCTL_H */ 17#endif /* OCFS2_IOCTL_H */
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index 71306479c68f..f0d9eb08547a 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -166,6 +166,8 @@
166 */ 166 */
167#define OCFS2_IOC_GETFLAGS _IOR('f', 1, long) 167#define OCFS2_IOC_GETFLAGS _IOR('f', 1, long)
168#define OCFS2_IOC_SETFLAGS _IOW('f', 2, long) 168#define OCFS2_IOC_SETFLAGS _IOW('f', 2, long)
169#define OCFS2_IOC32_GETFLAGS _IOR('f', 1, int)
170#define OCFS2_IOC32_SETFLAGS _IOW('f', 2, int)
169 171
170/* 172/*
171 * Journal Flags (ocfs2_dinode.id1.journal1.i_flags) 173 * Journal Flags (ocfs2_dinode.id1.journal1.i_flags)