Skip to content

Commit badf808

Browse files
author
Al Viro
committed
[PATCH] switch ide_disk_ops ->ioctl() to sane prototype
Signed-off-by: Al Viro <[email protected]>
1 parent 83ff6fe commit badf808

File tree

6 files changed

+13
-15
lines changed

6 files changed

+13
-15
lines changed

drivers/ide/ide-disk.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ide_decl_devset(wcache);
1313
ide_decl_devset(acoustic);
1414

1515
/* ide-disk_ioctl.c */
16-
int ide_disk_ioctl(ide_drive_t *, struct inode *, struct file *, unsigned int,
16+
int ide_disk_ioctl(ide_drive_t *, struct block_device *, fmode_t, unsigned int,
1717
unsigned long);
1818

1919
#ifdef CONFIG_IDE_PROC_FS

drivers/ide/ide-disk_ioctl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ static const struct ide_ioctl_devset ide_disk_ioctl_settings[] = {
1313
{ 0 }
1414
};
1515

16-
int ide_disk_ioctl(ide_drive_t *drive, struct inode *inode, struct file *file,
16+
int ide_disk_ioctl(ide_drive_t *drive, struct block_device *bdev, fmode_t mode,
1717
unsigned int cmd, unsigned long arg)
1818
{
19-
struct block_device *bdev = inode->i_bdev;
2019
int err;
2120

2221
err = ide_setting_ioctl(drive, bdev, cmd, arg, ide_disk_ioctl_settings);

drivers/ide/ide-floppy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ void ide_floppy_create_mode_sense_cmd(struct ide_atapi_pc *, u8);
2323
void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *);
2424

2525
/* ide-floppy_ioctl.c */
26-
int ide_floppy_ioctl(ide_drive_t *, struct inode *, struct file *, unsigned int,
27-
unsigned long);
26+
int ide_floppy_ioctl(ide_drive_t *, struct block_device *, fmode_t,
27+
unsigned int, unsigned long);
2828

2929
#ifdef CONFIG_IDE_PROC_FS
3030
/* ide-floppy_proc.c */

drivers/ide/ide-floppy_ioctl.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static int ide_floppy_lockdoor(ide_drive_t *drive, struct ide_atapi_pc *pc,
241241
return 0;
242242
}
243243

244-
static int ide_floppy_format_ioctl(ide_drive_t *drive, struct file *file,
244+
static int ide_floppy_format_ioctl(ide_drive_t *drive, fmode_t mode,
245245
unsigned int cmd, void __user *argp)
246246
{
247247
switch (cmd) {
@@ -250,7 +250,7 @@ static int ide_floppy_format_ioctl(ide_drive_t *drive, struct file *file,
250250
case IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY:
251251
return ide_floppy_get_format_capacities(drive, argp);
252252
case IDEFLOPPY_IOCTL_FORMAT_START:
253-
if (!(file->f_mode & FMODE_WRITE))
253+
if (!(mode & FMODE_WRITE))
254254
return -EPERM;
255255
return ide_floppy_format_unit(drive, (int __user *)argp);
256256
case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS:
@@ -260,18 +260,17 @@ static int ide_floppy_format_ioctl(ide_drive_t *drive, struct file *file,
260260
}
261261
}
262262

263-
int ide_floppy_ioctl(ide_drive_t *drive, struct inode *inode,
264-
struct file *file, unsigned int cmd, unsigned long arg)
263+
int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev,
264+
fmode_t mode, unsigned int cmd, unsigned long arg)
265265
{
266-
struct block_device *bdev = inode->i_bdev;
267266
struct ide_atapi_pc pc;
268267
void __user *argp = (void __user *)arg;
269268
int err;
270269

271270
if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR)
272271
return ide_floppy_lockdoor(drive, &pc, arg, cmd);
273272

274-
err = ide_floppy_format_ioctl(drive, file, cmd, argp);
273+
err = ide_floppy_format_ioctl(drive, mode, cmd, argp);
275274
if (err != -ENOTTY)
276275
return err;
277276

@@ -281,7 +280,7 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct inode *inode,
281280
*/
282281
if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND)
283282
err = scsi_cmd_ioctl(bdev->bd_disk->queue, bdev->bd_disk,
284-
file ? file->f_mode : 0, cmd, argp);
283+
mode, cmd, argp);
285284

286285
if (err == -ENOTTY)
287286
err = generic_ide_ioctl(drive, bdev, cmd, arg);

drivers/ide/ide-gd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static int ide_gd_ioctl(struct inode *inode, struct file *file,
293293
struct ide_disk_obj *idkp = ide_drv_g(bdev->bd_disk, ide_disk_obj);
294294
ide_drive_t *drive = idkp->drive;
295295

296-
return drive->disk_ops->ioctl(drive, inode, file, cmd, arg);
296+
return drive->disk_ops->ioctl(drive, bdev, file ? file->f_mode : 0, cmd, arg);
297297
}
298298

299299
static struct block_device_operations ide_gd_ops = {

include/linux/ide.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ struct ide_disk_ops {
474474
ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *,
475475
sector_t);
476476
int (*end_request)(struct ide_drive_s *, int, int);
477-
int (*ioctl)(struct ide_drive_s *, struct inode *,
478-
struct file *, unsigned int, unsigned long);
477+
int (*ioctl)(struct ide_drive_s *, struct block_device *,
478+
fmode_t, unsigned int, unsigned long);
479479
};
480480

481481
/* ATAPI device flags */

0 commit comments

Comments
 (0)