aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:23:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:23:07 -0400
commit22484856402bfa1ff3defe47f6029ab0418240d9 (patch)
tree140c67bf59674da350a7b51765d6ff7eb101b597 /drivers/ide
parent5ed487bc2c44ca4e9668ef9cb54c830e2a9fac47 (diff)
parent56b26add02b4bdea81d5e0ebda60db1fe3311ad4 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev
* git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev: (66 commits) [PATCH] kill the rest of struct file propagation in block ioctls [PATCH] get rid of struct file use in blkdev_ioctl() BLKBSZSET [PATCH] get rid of blkdev_locked_ioctl() [PATCH] get rid of blkdev_driver_ioctl() [PATCH] sanitize blkdev_get() and friends [PATCH] remember mode of reiserfs journal [PATCH] propagate mode through swsusp_close() [PATCH] propagate mode through open_bdev_excl/close_bdev_excl [PATCH] pass fmode_t to blkdev_put() [PATCH] kill the unused bsize on the send side of /dev/loop [PATCH] trim file propagation in block/compat_ioctl.c [PATCH] end of methods switch: remove the old ones [PATCH] switch sr [PATCH] switch sd [PATCH] switch ide-scsi [PATCH] switch tape_block [PATCH] switch dcssblk [PATCH] switch dasd [PATCH] switch mtd_blkdevs [PATCH] switch mmc ...
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-cd.c22
-rw-r--r--drivers/ide/ide-disk.h2
-rw-r--r--drivers/ide/ide-disk_ioctl.c5
-rw-r--r--drivers/ide/ide-floppy.h4
-rw-r--r--drivers/ide/ide-floppy_ioctl.c17
-rw-r--r--drivers/ide/ide-gd.c20
-rw-r--r--drivers/ide/ide-ioctls.c3
-rw-r--r--drivers/ide/ide-tape.c17
8 files changed, 38 insertions, 52 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 13265a8827da..133afd09843c 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2089,17 +2089,15 @@ static ide_driver_t ide_cdrom_driver = {
2089#endif 2089#endif
2090}; 2090};
2091 2091
2092static int idecd_open(struct inode *inode, struct file *file) 2092static int idecd_open(struct block_device *bdev, fmode_t mode)
2093{ 2093{
2094 struct gendisk *disk = inode->i_bdev->bd_disk; 2094 struct cdrom_info *info = ide_cd_get(bdev->bd_disk);
2095 struct cdrom_info *info;
2096 int rc = -ENOMEM; 2095 int rc = -ENOMEM;
2097 2096
2098 info = ide_cd_get(disk);
2099 if (!info) 2097 if (!info)
2100 return -ENXIO; 2098 return -ENXIO;
2101 2099
2102 rc = cdrom_open(&info->devinfo, inode, file); 2100 rc = cdrom_open(&info->devinfo, bdev, mode);
2103 2101
2104 if (rc < 0) 2102 if (rc < 0)
2105 ide_cd_put(info); 2103 ide_cd_put(info);
@@ -2107,12 +2105,11 @@ static int idecd_open(struct inode *inode, struct file *file)
2107 return rc; 2105 return rc;
2108} 2106}
2109 2107
2110static int idecd_release(struct inode *inode, struct file *file) 2108static int idecd_release(struct gendisk *disk, fmode_t mode)
2111{ 2109{
2112 struct gendisk *disk = inode->i_bdev->bd_disk;
2113 struct cdrom_info *info = ide_drv_g(disk, cdrom_info); 2110 struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
2114 2111
2115 cdrom_release(&info->devinfo, file); 2112 cdrom_release(&info->devinfo, mode);
2116 2113
2117 ide_cd_put(info); 2114 ide_cd_put(info);
2118 2115
@@ -2158,10 +2155,9 @@ static int idecd_get_spindown(struct cdrom_device_info *cdi, unsigned long arg)
2158 return 0; 2155 return 0;
2159} 2156}
2160 2157
2161static int idecd_ioctl(struct inode *inode, struct file *file, 2158static int idecd_ioctl(struct block_device *bdev, fmode_t mode,
2162 unsigned int cmd, unsigned long arg) 2159 unsigned int cmd, unsigned long arg)
2163{ 2160{
2164 struct block_device *bdev = inode->i_bdev;
2165 struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info); 2161 struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info);
2166 int err; 2162 int err;
2167 2163
@@ -2174,9 +2170,9 @@ static int idecd_ioctl(struct inode *inode, struct file *file,
2174 break; 2170 break;
2175 } 2171 }
2176 2172
2177 err = generic_ide_ioctl(info->drive, file, bdev, cmd, arg); 2173 err = generic_ide_ioctl(info->drive, bdev, cmd, arg);
2178 if (err == -EINVAL) 2174 if (err == -EINVAL)
2179 err = cdrom_ioctl(file, &info->devinfo, inode, cmd, arg); 2175 err = cdrom_ioctl(&info->devinfo, bdev, mode, cmd, arg);
2180 2176
2181 return err; 2177 return err;
2182} 2178}
@@ -2201,7 +2197,7 @@ static struct block_device_operations idecd_ops = {
2201 .owner = THIS_MODULE, 2197 .owner = THIS_MODULE,
2202 .open = idecd_open, 2198 .open = idecd_open,
2203 .release = idecd_release, 2199 .release = idecd_release,
2204 .ioctl = idecd_ioctl, 2200 .locked_ioctl = idecd_ioctl,
2205 .media_changed = idecd_media_changed, 2201 .media_changed = idecd_media_changed,
2206 .revalidate_disk = idecd_revalidate_disk 2202 .revalidate_disk = idecd_revalidate_disk
2207}; 2203};
diff --git a/drivers/ide/ide-disk.h b/drivers/ide/ide-disk.h
index b234b0feaf7b..d511dab7c4aa 100644
--- a/drivers/ide/ide-disk.h
+++ b/drivers/ide/ide-disk.h
@@ -13,7 +13,7 @@ ide_decl_devset(wcache);
13ide_decl_devset(acoustic); 13ide_decl_devset(acoustic);
14 14
15/* ide-disk_ioctl.c */ 15/* ide-disk_ioctl.c */
16int ide_disk_ioctl(ide_drive_t *, struct inode *, struct file *, unsigned int, 16int ide_disk_ioctl(ide_drive_t *, struct block_device *, fmode_t, unsigned int,
17 unsigned long); 17 unsigned long);
18 18
19#ifdef CONFIG_IDE_PROC_FS 19#ifdef CONFIG_IDE_PROC_FS
diff --git a/drivers/ide/ide-disk_ioctl.c b/drivers/ide/ide-disk_ioctl.c
index a49698bcf966..7b783dd7c0be 100644
--- a/drivers/ide/ide-disk_ioctl.c
+++ b/drivers/ide/ide-disk_ioctl.c
@@ -13,15 +13,14 @@ static const struct ide_ioctl_devset ide_disk_ioctl_settings[] = {
13{ 0 } 13{ 0 }
14}; 14};
15 15
16int ide_disk_ioctl(ide_drive_t *drive, struct inode *inode, struct file *file, 16int ide_disk_ioctl(ide_drive_t *drive, struct block_device *bdev, fmode_t mode,
17 unsigned int cmd, unsigned long arg) 17 unsigned int cmd, unsigned long arg)
18{ 18{
19 struct block_device *bdev = inode->i_bdev;
20 int err; 19 int err;
21 20
22 err = ide_setting_ioctl(drive, bdev, cmd, arg, ide_disk_ioctl_settings); 21 err = ide_setting_ioctl(drive, bdev, cmd, arg, ide_disk_ioctl_settings);
23 if (err != -EOPNOTSUPP) 22 if (err != -EOPNOTSUPP)
24 return err; 23 return err;
25 24
26 return generic_ide_ioctl(drive, file, bdev, cmd, arg); 25 return generic_ide_ioctl(drive, bdev, cmd, arg);
27} 26}
diff --git a/drivers/ide/ide-floppy.h b/drivers/ide/ide-floppy.h
index c17124dd6079..6dd2beb48434 100644
--- a/drivers/ide/ide-floppy.h
+++ b/drivers/ide/ide-floppy.h
@@ -23,8 +23,8 @@ void ide_floppy_create_mode_sense_cmd(struct ide_atapi_pc *, u8);
23void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *); 23void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *);
24 24
25/* ide-floppy_ioctl.c */ 25/* ide-floppy_ioctl.c */
26int ide_floppy_ioctl(ide_drive_t *, struct inode *, struct file *, unsigned int, 26int ide_floppy_ioctl(ide_drive_t *, struct block_device *, fmode_t,
27 unsigned long); 27 unsigned int, unsigned long);
28 28
29#ifdef CONFIG_IDE_PROC_FS 29#ifdef CONFIG_IDE_PROC_FS
30/* ide-floppy_proc.c */ 30/* ide-floppy_proc.c */
diff --git a/drivers/ide/ide-floppy_ioctl.c b/drivers/ide/ide-floppy_ioctl.c
index 409e4c15f9b7..2bc51ff73fee 100644
--- a/drivers/ide/ide-floppy_ioctl.c
+++ b/drivers/ide/ide-floppy_ioctl.c
@@ -241,7 +241,7 @@ static int ide_floppy_lockdoor(ide_drive_t *drive, struct ide_atapi_pc *pc,
241 return 0; 241 return 0;
242} 242}
243 243
244static int ide_floppy_format_ioctl(ide_drive_t *drive, struct file *file, 244static int ide_floppy_format_ioctl(ide_drive_t *drive, fmode_t mode,
245 unsigned int cmd, void __user *argp) 245 unsigned int cmd, void __user *argp)
246{ 246{
247 switch (cmd) { 247 switch (cmd) {
@@ -250,7 +250,7 @@ static int ide_floppy_format_ioctl(ide_drive_t *drive, struct file *file,
250 case IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY: 250 case IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY:
251 return ide_floppy_get_format_capacities(drive, argp); 251 return ide_floppy_get_format_capacities(drive, argp);
252 case IDEFLOPPY_IOCTL_FORMAT_START: 252 case IDEFLOPPY_IOCTL_FORMAT_START:
253 if (!(file->f_mode & 2)) 253 if (!(mode & FMODE_WRITE))
254 return -EPERM; 254 return -EPERM;
255 return ide_floppy_format_unit(drive, (int __user *)argp); 255 return ide_floppy_format_unit(drive, (int __user *)argp);
256 case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS: 256 case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS:
@@ -260,10 +260,9 @@ static int ide_floppy_format_ioctl(ide_drive_t *drive, struct file *file,
260 } 260 }
261} 261}
262 262
263int ide_floppy_ioctl(ide_drive_t *drive, struct inode *inode, 263int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev,
264 struct file *file, unsigned int cmd, unsigned long arg) 264 fmode_t mode, unsigned int cmd, unsigned long arg)
265{ 265{
266 struct block_device *bdev = inode->i_bdev;
267 struct ide_atapi_pc pc; 266 struct ide_atapi_pc pc;
268 void __user *argp = (void __user *)arg; 267 void __user *argp = (void __user *)arg;
269 int err; 268 int err;
@@ -271,7 +270,7 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct inode *inode,
271 if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR) 270 if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR)
272 return ide_floppy_lockdoor(drive, &pc, arg, cmd); 271 return ide_floppy_lockdoor(drive, &pc, arg, cmd);
273 272
274 err = ide_floppy_format_ioctl(drive, file, cmd, argp); 273 err = ide_floppy_format_ioctl(drive, mode, cmd, argp);
275 if (err != -ENOTTY) 274 if (err != -ENOTTY)
276 return err; 275 return err;
277 276
@@ -280,11 +279,11 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct inode *inode,
280 * and CDROM_SEND_PACKET (legacy) ioctls 279 * and CDROM_SEND_PACKET (legacy) ioctls
281 */ 280 */
282 if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND) 281 if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND)
283 err = scsi_cmd_ioctl(file, bdev->bd_disk->queue, 282 err = scsi_cmd_ioctl(bdev->bd_disk->queue, bdev->bd_disk,
284 bdev->bd_disk, cmd, argp); 283 mode, cmd, argp);
285 284
286 if (err == -ENOTTY) 285 if (err == -ENOTTY)
287 err = generic_ide_ioctl(drive, file, bdev, cmd, arg); 286 err = generic_ide_ioctl(drive, bdev, cmd, arg);
288 287
289 return err; 288 return err;
290} 289}
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
index d44898f46c33..7b6662854374 100644
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -169,9 +169,9 @@ static ide_driver_t ide_gd_driver = {
169#endif 169#endif
170}; 170};
171 171
172static int ide_gd_open(struct inode *inode, struct file *filp) 172static int ide_gd_open(struct block_device *bdev, fmode_t mode)
173{ 173{
174 struct gendisk *disk = inode->i_bdev->bd_disk; 174 struct gendisk *disk = bdev->bd_disk;
175 struct ide_disk_obj *idkp; 175 struct ide_disk_obj *idkp;
176 ide_drive_t *drive; 176 ide_drive_t *drive;
177 int ret = 0; 177 int ret = 0;
@@ -197,12 +197,12 @@ static int ide_gd_open(struct inode *inode, struct file *filp)
197 * unreadable disk, so that we can get the format capacity 197 * unreadable disk, so that we can get the format capacity
198 * of the drive or begin the format - Sam 198 * of the drive or begin the format - Sam
199 */ 199 */
200 if (ret && (filp->f_flags & O_NDELAY) == 0) { 200 if (ret && (mode & FMODE_NDELAY) == 0) {
201 ret = -EIO; 201 ret = -EIO;
202 goto out_put_idkp; 202 goto out_put_idkp;
203 } 203 }
204 204
205 if ((drive->dev_flags & IDE_DFLAG_WP) && (filp->f_mode & 2)) { 205 if ((drive->dev_flags & IDE_DFLAG_WP) && (mode & FMODE_WRITE)) {
206 ret = -EROFS; 206 ret = -EROFS;
207 goto out_put_idkp; 207 goto out_put_idkp;
208 } 208 }
@@ -214,7 +214,7 @@ static int ide_gd_open(struct inode *inode, struct file *filp)
214 */ 214 */
215 drive->disk_ops->set_doorlock(drive, disk, 1); 215 drive->disk_ops->set_doorlock(drive, disk, 1);
216 drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED; 216 drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED;
217 check_disk_change(inode->i_bdev); 217 check_disk_change(bdev);
218 } else if (drive->dev_flags & IDE_DFLAG_FORMAT_IN_PROGRESS) { 218 } else if (drive->dev_flags & IDE_DFLAG_FORMAT_IN_PROGRESS) {
219 ret = -EBUSY; 219 ret = -EBUSY;
220 goto out_put_idkp; 220 goto out_put_idkp;
@@ -227,9 +227,8 @@ out_put_idkp:
227 return ret; 227 return ret;
228} 228}
229 229
230static int ide_gd_release(struct inode *inode, struct file *filp) 230static int ide_gd_release(struct gendisk *disk, fmode_t mode)
231{ 231{
232 struct gendisk *disk = inode->i_bdev->bd_disk;
233 struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); 232 struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
234 ide_drive_t *drive = idkp->drive; 233 ide_drive_t *drive = idkp->drive;
235 234
@@ -286,21 +285,20 @@ static int ide_gd_revalidate_disk(struct gendisk *disk)
286 return 0; 285 return 0;
287} 286}
288 287
289static int ide_gd_ioctl(struct inode *inode, struct file *file, 288static int ide_gd_ioctl(struct block_device *bdev, fmode_t mode,
290 unsigned int cmd, unsigned long arg) 289 unsigned int cmd, unsigned long arg)
291{ 290{
292 struct block_device *bdev = inode->i_bdev;
293 struct ide_disk_obj *idkp = ide_drv_g(bdev->bd_disk, ide_disk_obj); 291 struct ide_disk_obj *idkp = ide_drv_g(bdev->bd_disk, ide_disk_obj);
294 ide_drive_t *drive = idkp->drive; 292 ide_drive_t *drive = idkp->drive;
295 293
296 return drive->disk_ops->ioctl(drive, inode, file, cmd, arg); 294 return drive->disk_ops->ioctl(drive, bdev, mode, cmd, arg);
297} 295}
298 296
299static struct block_device_operations ide_gd_ops = { 297static struct block_device_operations ide_gd_ops = {
300 .owner = THIS_MODULE, 298 .owner = THIS_MODULE,
301 .open = ide_gd_open, 299 .open = ide_gd_open,
302 .release = ide_gd_release, 300 .release = ide_gd_release,
303 .ioctl = ide_gd_ioctl, 301 .locked_ioctl = ide_gd_ioctl,
304 .getgeo = ide_gd_getgeo, 302 .getgeo = ide_gd_getgeo,
305 .media_changed = ide_gd_media_changed, 303 .media_changed = ide_gd_media_changed,
306 .revalidate_disk = ide_gd_revalidate_disk 304 .revalidate_disk = ide_gd_revalidate_disk
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c
index a90945f49792..fcde16bb53a7 100644
--- a/drivers/ide/ide-ioctls.c
+++ b/drivers/ide/ide-ioctls.c
@@ -240,8 +240,7 @@ static int generic_drive_reset(ide_drive_t *drive)
240 return ret; 240 return ret;
241} 241}
242 242
243int generic_ide_ioctl(ide_drive_t *drive, struct file *file, 243int generic_ide_ioctl(ide_drive_t *drive, struct block_device *bdev,
244 struct block_device *bdev,
245 unsigned int cmd, unsigned long arg) 244 unsigned int cmd, unsigned long arg)
246{ 245{
247 int err; 246 int err;
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index b2b2e5e8d38e..a2d470eb2b55 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -2340,35 +2340,30 @@ static const struct file_operations idetape_fops = {
2340 .release = idetape_chrdev_release, 2340 .release = idetape_chrdev_release,
2341}; 2341};
2342 2342
2343static int idetape_open(struct inode *inode, struct file *filp) 2343static int idetape_open(struct block_device *bdev, fmode_t mode)
2344{ 2344{
2345 struct gendisk *disk = inode->i_bdev->bd_disk; 2345 struct ide_tape_obj *tape = ide_tape_get(bdev->bd_disk);
2346 struct ide_tape_obj *tape;
2347 2346
2348 tape = ide_tape_get(disk);
2349 if (!tape) 2347 if (!tape)
2350 return -ENXIO; 2348 return -ENXIO;
2351 2349
2352 return 0; 2350 return 0;
2353} 2351}
2354 2352
2355static int idetape_release(struct inode *inode, struct file *filp) 2353static int idetape_release(struct gendisk *disk, fmode_t mode)
2356{ 2354{
2357 struct gendisk *disk = inode->i_bdev->bd_disk;
2358 struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj); 2355 struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj);
2359 2356
2360 ide_tape_put(tape); 2357 ide_tape_put(tape);
2361
2362 return 0; 2358 return 0;
2363} 2359}
2364 2360
2365static int idetape_ioctl(struct inode *inode, struct file *file, 2361static int idetape_ioctl(struct block_device *bdev, fmode_t mode,
2366 unsigned int cmd, unsigned long arg) 2362 unsigned int cmd, unsigned long arg)
2367{ 2363{
2368 struct block_device *bdev = inode->i_bdev;
2369 struct ide_tape_obj *tape = ide_drv_g(bdev->bd_disk, ide_tape_obj); 2364 struct ide_tape_obj *tape = ide_drv_g(bdev->bd_disk, ide_tape_obj);
2370 ide_drive_t *drive = tape->drive; 2365 ide_drive_t *drive = tape->drive;
2371 int err = generic_ide_ioctl(drive, file, bdev, cmd, arg); 2366 int err = generic_ide_ioctl(drive, bdev, cmd, arg);
2372 if (err == -EINVAL) 2367 if (err == -EINVAL)
2373 err = idetape_blkdev_ioctl(drive, cmd, arg); 2368 err = idetape_blkdev_ioctl(drive, cmd, arg);
2374 return err; 2369 return err;
@@ -2378,7 +2373,7 @@ static struct block_device_operations idetape_block_ops = {
2378 .owner = THIS_MODULE, 2373 .owner = THIS_MODULE,
2379 .open = idetape_open, 2374 .open = idetape_open,
2380 .release = idetape_release, 2375 .release = idetape_release,
2381 .ioctl = idetape_ioctl, 2376 .locked_ioctl = idetape_ioctl,
2382}; 2377};
2383 2378
2384static int ide_tape_probe(ide_drive_t *drive) 2379static int ide_tape_probe(ide_drive_t *drive)