diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-05-16 19:13:47 -0400 |
---|---|---|
committer | OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> | 2010-05-16 19:16:12 -0400 |
commit | 7845bc3e132605e3e8a1f37748e29281164b65f5 (patch) | |
tree | a6437b673ed42e498fd89917ac3e0aa9a5fb678e /fs/fat | |
parent | 1bdb6f9199def1c3538c18089e499f5df5ff1747 (diff) |
fat: convert to unlocked_ioctl
FAT does not require the BKL in its ioctl function, which is already serialized
through a mutex. Since we're already touching the ioctl code, also fix the
missing handling of FAT_IOCTL_GET_ATTRIBUTES in the compat code.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Diffstat (limited to 'fs/fat')
-rw-r--r-- | fs/fat/dir.c | 11 | ||||
-rw-r--r-- | fs/fat/fat.h | 4 | ||||
-rw-r--r-- | fs/fat/file.c | 19 |
3 files changed, 24 insertions, 10 deletions
diff --git a/fs/fat/dir.c b/fs/fat/dir.c index 20a1b92e035e..ee42b9e0b16a 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c | |||
@@ -753,9 +753,10 @@ static int fat_ioctl_readdir(struct inode *inode, struct file *filp, | |||
753 | return ret; | 753 | return ret; |
754 | } | 754 | } |
755 | 755 | ||
756 | static int fat_dir_ioctl(struct inode *inode, struct file *filp, | 756 | static long fat_dir_ioctl(struct file *filp, unsigned int cmd, |
757 | unsigned int cmd, unsigned long arg) | 757 | unsigned long arg) |
758 | { | 758 | { |
759 | struct inode *inode = filp->f_path.dentry->d_inode; | ||
759 | struct __fat_dirent __user *d1 = (struct __fat_dirent __user *)arg; | 760 | struct __fat_dirent __user *d1 = (struct __fat_dirent __user *)arg; |
760 | int short_only, both; | 761 | int short_only, both; |
761 | 762 | ||
@@ -769,7 +770,7 @@ static int fat_dir_ioctl(struct inode *inode, struct file *filp, | |||
769 | both = 1; | 770 | both = 1; |
770 | break; | 771 | break; |
771 | default: | 772 | default: |
772 | return fat_generic_ioctl(inode, filp, cmd, arg); | 773 | return fat_generic_ioctl(filp, cmd, arg); |
773 | } | 774 | } |
774 | 775 | ||
775 | if (!access_ok(VERIFY_WRITE, d1, sizeof(struct __fat_dirent[2]))) | 776 | if (!access_ok(VERIFY_WRITE, d1, sizeof(struct __fat_dirent[2]))) |
@@ -809,7 +810,7 @@ static long fat_compat_dir_ioctl(struct file *filp, unsigned cmd, | |||
809 | both = 1; | 810 | both = 1; |
810 | break; | 811 | break; |
811 | default: | 812 | default: |
812 | return -ENOIOCTLCMD; | 813 | return fat_generic_ioctl(filp, cmd, (unsigned long)arg); |
813 | } | 814 | } |
814 | 815 | ||
815 | if (!access_ok(VERIFY_WRITE, d1, sizeof(struct compat_dirent[2]))) | 816 | if (!access_ok(VERIFY_WRITE, d1, sizeof(struct compat_dirent[2]))) |
@@ -831,7 +832,7 @@ const struct file_operations fat_dir_operations = { | |||
831 | .llseek = generic_file_llseek, | 832 | .llseek = generic_file_llseek, |
832 | .read = generic_read_dir, | 833 | .read = generic_read_dir, |
833 | .readdir = fat_readdir, | 834 | .readdir = fat_readdir, |
834 | .ioctl = fat_dir_ioctl, | 835 | .unlocked_ioctl = fat_dir_ioctl, |
835 | #ifdef CONFIG_COMPAT | 836 | #ifdef CONFIG_COMPAT |
836 | .compat_ioctl = fat_compat_dir_ioctl, | 837 | .compat_ioctl = fat_compat_dir_ioctl, |
837 | #endif | 838 | #endif |
diff --git a/fs/fat/fat.h b/fs/fat/fat.h index e6efdfa0f6db..eb821ee1a333 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h | |||
@@ -298,8 +298,8 @@ extern int fat_free_clusters(struct inode *inode, int cluster); | |||
298 | extern int fat_count_free_clusters(struct super_block *sb); | 298 | extern int fat_count_free_clusters(struct super_block *sb); |
299 | 299 | ||
300 | /* fat/file.c */ | 300 | /* fat/file.c */ |
301 | extern int fat_generic_ioctl(struct inode *inode, struct file *filp, | 301 | extern long fat_generic_ioctl(struct file *filp, unsigned int cmd, |
302 | unsigned int cmd, unsigned long arg); | 302 | unsigned long arg); |
303 | extern const struct file_operations fat_file_operations; | 303 | extern const struct file_operations fat_file_operations; |
304 | extern const struct inode_operations fat_file_inode_operations; | 304 | extern const struct inode_operations fat_file_inode_operations; |
305 | extern int fat_setattr(struct dentry * dentry, struct iattr * attr); | 305 | extern int fat_setattr(struct dentry * dentry, struct iattr * attr); |
diff --git a/fs/fat/file.c b/fs/fat/file.c index e8c159de236b..a14c2f6a489e 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/capability.h> | 9 | #include <linux/capability.h> |
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/compat.h> | ||
11 | #include <linux/mount.h> | 12 | #include <linux/mount.h> |
12 | #include <linux/time.h> | 13 | #include <linux/time.h> |
13 | #include <linux/buffer_head.h> | 14 | #include <linux/buffer_head.h> |
@@ -114,9 +115,9 @@ out: | |||
114 | return err; | 115 | return err; |
115 | } | 116 | } |
116 | 117 | ||
117 | int fat_generic_ioctl(struct inode *inode, struct file *filp, | 118 | long fat_generic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
118 | unsigned int cmd, unsigned long arg) | ||
119 | { | 119 | { |
120 | struct inode *inode = filp->f_path.dentry->d_inode; | ||
120 | u32 __user *user_attr = (u32 __user *)arg; | 121 | u32 __user *user_attr = (u32 __user *)arg; |
121 | 122 | ||
122 | switch (cmd) { | 123 | switch (cmd) { |
@@ -129,6 +130,15 @@ int fat_generic_ioctl(struct inode *inode, struct file *filp, | |||
129 | } | 130 | } |
130 | } | 131 | } |
131 | 132 | ||
133 | #ifdef CONFIG_COMPAT | ||
134 | static long fat_generic_compat_ioctl(struct file *filp, unsigned int cmd, | ||
135 | unsigned long arg) | ||
136 | |||
137 | { | ||
138 | return fat_generic_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); | ||
139 | } | ||
140 | #endif | ||
141 | |||
132 | static int fat_file_release(struct inode *inode, struct file *filp) | 142 | static int fat_file_release(struct inode *inode, struct file *filp) |
133 | { | 143 | { |
134 | if ((filp->f_mode & FMODE_WRITE) && | 144 | if ((filp->f_mode & FMODE_WRITE) && |
@@ -159,7 +169,10 @@ const struct file_operations fat_file_operations = { | |||
159 | .aio_write = generic_file_aio_write, | 169 | .aio_write = generic_file_aio_write, |
160 | .mmap = generic_file_mmap, | 170 | .mmap = generic_file_mmap, |
161 | .release = fat_file_release, | 171 | .release = fat_file_release, |
162 | .ioctl = fat_generic_ioctl, | 172 | .unlocked_ioctl = fat_generic_ioctl, |
173 | #ifdef CONFIG_COMPAT | ||
174 | .compat_ioctl = fat_generic_compat_ioctl, | ||
175 | #endif | ||
163 | .fsync = fat_file_fsync, | 176 | .fsync = fat_file_fsync, |
164 | .splice_read = generic_file_splice_read, | 177 | .splice_read = generic_file_splice_read, |
165 | }; | 178 | }; |