]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide-floppy_ioctl.c
Merge git://git.infradead.org/mtd-2.6
[linux-2.6-omap-h63xx.git] / drivers / ide / ide-floppy_ioctl.c
index a3a7a0809e2bdf5edba01c3c93c0f2b6cd467d8a..2bc51ff73fee35b3863aea03b7dc6e6bf09bfc9c 100644 (file)
@@ -33,7 +33,7 @@
 
 static int ide_floppy_get_format_capacities(ide_drive_t *drive, int __user *arg)
 {
-       struct ide_floppy_obj *floppy = drive->driver_data;
+       struct ide_disk_obj *floppy = drive->driver_data;
        struct ide_atapi_pc pc;
        u8 header_len, desc_cnt;
        int i, blocks, length, u_array_size, u_index;
@@ -113,7 +113,7 @@ static void ide_floppy_create_format_unit_cmd(struct ide_atapi_pc *pc, int b,
 
 static int ide_floppy_get_sfrp_bit(ide_drive_t *drive)
 {
-       idefloppy_floppy_t *floppy = drive->driver_data;
+       struct ide_disk_obj *floppy = drive->driver_data;
        struct ide_atapi_pc pc;
 
        drive->atapi_flags &= ~IDE_AFLAG_SRFP;
@@ -132,17 +132,17 @@ static int ide_floppy_get_sfrp_bit(ide_drive_t *drive)
 
 static int ide_floppy_format_unit(ide_drive_t *drive, int __user *arg)
 {
-       idefloppy_floppy_t *floppy = drive->driver_data;
+       struct ide_disk_obj *floppy = drive->driver_data;
        struct ide_atapi_pc pc;
        int blocks, length, flags, err = 0;
 
        if (floppy->openers > 1) {
                /* Don't format if someone is using the disk */
-               drive->atapi_flags &= ~IDE_AFLAG_FORMAT_IN_PROGRESS;
+               drive->dev_flags &= ~IDE_DFLAG_FORMAT_IN_PROGRESS;
                return -EBUSY;
        }
 
-       drive->atapi_flags |= IDE_AFLAG_FORMAT_IN_PROGRESS;
+       drive->dev_flags |= IDE_DFLAG_FORMAT_IN_PROGRESS;
 
        /*
         * Send ATAPI_FORMAT_UNIT to the drive.
@@ -174,7 +174,7 @@ static int ide_floppy_format_unit(ide_drive_t *drive, int __user *arg)
 
 out:
        if (err)
-               drive->atapi_flags &= ~IDE_AFLAG_FORMAT_IN_PROGRESS;
+               drive->dev_flags &= ~IDE_DFLAG_FORMAT_IN_PROGRESS;
        return err;
 }
 
@@ -190,7 +190,7 @@ out:
 
 static int ide_floppy_get_format_progress(ide_drive_t *drive, int __user *arg)
 {
-       idefloppy_floppy_t *floppy = drive->driver_data;
+       struct ide_disk_obj *floppy = drive->driver_data;
        struct ide_atapi_pc pc;
        int progress_indication = 0x10000;
 
@@ -226,7 +226,7 @@ static int ide_floppy_get_format_progress(ide_drive_t *drive, int __user *arg)
 static int ide_floppy_lockdoor(ide_drive_t *drive, struct ide_atapi_pc *pc,
                               unsigned long arg, unsigned int cmd)
 {
-       idefloppy_floppy_t *floppy = drive->driver_data;
+       struct ide_disk_obj *floppy = drive->driver_data;
        struct gendisk *disk = floppy->disk;
        int prevent = (arg && cmd != CDROMEJECT) ? 1 : 0;
 
@@ -241,7 +241,7 @@ static int ide_floppy_lockdoor(ide_drive_t *drive, struct ide_atapi_pc *pc,
        return 0;
 }
 
-static int ide_floppy_format_ioctl(ide_drive_t *drive, struct file *file,
+static int ide_floppy_format_ioctl(ide_drive_t *drive, fmode_t mode,
                                   unsigned int cmd, void __user *argp)
 {
        switch (cmd) {
@@ -250,7 +250,7 @@ static int ide_floppy_format_ioctl(ide_drive_t *drive, struct file *file,
        case IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY:
                return ide_floppy_get_format_capacities(drive, argp);
        case IDEFLOPPY_IOCTL_FORMAT_START:
-               if (!(file->f_mode & 2))
+               if (!(mode & FMODE_WRITE))
                        return -EPERM;
                return ide_floppy_format_unit(drive, (int __user *)argp);
        case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS:
@@ -260,13 +260,9 @@ static int ide_floppy_format_ioctl(ide_drive_t *drive, struct file *file,
        }
 }
 
-int ide_floppy_ioctl(struct inode *inode, struct file *file,
-                   unsigned int cmd, unsigned long arg)
+int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev,
+                    fmode_t mode, unsigned int cmd, unsigned long arg)
 {
-       struct block_device *bdev = inode->i_bdev;
-       struct ide_floppy_obj *floppy = ide_drv_g(bdev->bd_disk,
-                                                    ide_floppy_obj);
-       ide_drive_t *drive = floppy->drive;
        struct ide_atapi_pc pc;
        void __user *argp = (void __user *)arg;
        int err;
@@ -274,7 +270,7 @@ int ide_floppy_ioctl(struct inode *inode, struct file *file,
        if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR)
                return ide_floppy_lockdoor(drive, &pc, arg, cmd);
 
-       err = ide_floppy_format_ioctl(drive, file, cmd, argp);
+       err = ide_floppy_format_ioctl(drive, mode, cmd, argp);
        if (err != -ENOTTY)
                return err;
 
@@ -283,11 +279,11 @@ int ide_floppy_ioctl(struct inode *inode, struct file *file,
         * and CDROM_SEND_PACKET (legacy) ioctls
         */
        if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND)
-               err = scsi_cmd_ioctl(file, bdev->bd_disk->queue,
-                                       bdev->bd_disk, cmd, argp);
+               err = scsi_cmd_ioctl(bdev->bd_disk->queue, bdev->bd_disk,
+                               mode, cmd, argp);
 
        if (err == -ENOTTY)
-               err = generic_ide_ioctl(drive, file, bdev, cmd, arg);
+               err = generic_ide_ioctl(drive, bdev, cmd, arg);
 
        return err;
 }