@@ -973,7 +973,7 @@ static int cdrom_close_write(struct cdrom_device_info *cdi)
973973 * is in their own interest: device control becomes a lot easier
974974 * this way.
975975 */
976- int cdrom_open (struct cdrom_device_info * cdi , struct inode * ip , struct file * fp )
976+ int cdrom_open (struct cdrom_device_info * cdi , struct block_device * bdev , fmode_t mode )
977977{
978978 int ret ;
979979
@@ -982,14 +982,14 @@ int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp)
982982 /* if this was a O_NONBLOCK open and we should honor the flags,
983983 * do a quick open without drive/disc integrity checks. */
984984 cdi -> use_count ++ ;
985- if ((fp -> f_mode & FMODE_NDELAY ) && (cdi -> options & CDO_USE_FFLAGS )) {
985+ if ((mode & FMODE_NDELAY ) && (cdi -> options & CDO_USE_FFLAGS )) {
986986 ret = cdi -> ops -> open (cdi , 1 );
987987 } else {
988988 ret = open_for_data (cdi );
989989 if (ret )
990990 goto err ;
991991 cdrom_mmc3_profile (cdi );
992- if (fp -> f_mode & FMODE_WRITE ) {
992+ if (mode & FMODE_WRITE ) {
993993 ret = - EROFS ;
994994 if (cdrom_open_write (cdi ))
995995 goto err_release ;
@@ -1007,7 +1007,7 @@ int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp)
10071007 cdi -> name , cdi -> use_count );
10081008 /* Do this on open. Don't wait for mount, because they might
10091009 not be mounting, but opening with O_NONBLOCK */
1010- check_disk_change (ip -> i_bdev );
1010+ check_disk_change (bdev );
10111011 return 0 ;
10121012err_release :
10131013 if (CDROM_CAN (CDC_LOCK ) && cdi -> options & CDO_LOCK ) {
@@ -1184,7 +1184,7 @@ static int check_for_audio_disc(struct cdrom_device_info * cdi,
11841184 return 0 ;
11851185}
11861186
1187- int cdrom_release (struct cdrom_device_info * cdi , struct file * fp )
1187+ void cdrom_release (struct cdrom_device_info * cdi , fmode_t mode )
11881188{
11891189 struct cdrom_device_ops * cdo = cdi -> ops ;
11901190 int opened_for_data ;
@@ -1205,7 +1205,7 @@ int cdrom_release(struct cdrom_device_info *cdi, struct file *fp)
12051205 }
12061206
12071207 opened_for_data = !(cdi -> options & CDO_USE_FFLAGS ) ||
1208- !(fp && fp -> f_mode & FMODE_NDELAY );
1208+ !(mode & FMODE_NDELAY );
12091209
12101210 /*
12111211 * flush cache on last write release
@@ -1219,7 +1219,6 @@ int cdrom_release(struct cdrom_device_info *cdi, struct file *fp)
12191219 cdi -> options & CDO_AUTO_EJECT && CDROM_CAN (CDC_OPEN_TRAY ))
12201220 cdo -> tray_move (cdi , 1 );
12211221 }
1222- return 0 ;
12231222}
12241223
12251224static int cdrom_read_mech_status (struct cdrom_device_info * cdi ,
@@ -2662,17 +2661,17 @@ static int cdrom_ioctl_audioctl(struct cdrom_device_info *cdi,
26622661 * these days.
26632662 * ATAPI / SCSI specific code now mainly resides in mmc_ioctl().
26642663 */
2665- int cdrom_ioctl (struct file * file , struct cdrom_device_info * cdi ,
2666- struct inode * ip , unsigned int cmd , unsigned long arg )
2664+ int cdrom_ioctl (struct cdrom_device_info * cdi , struct block_device * bdev ,
2665+ fmode_t mode , unsigned int cmd , unsigned long arg )
26672666{
26682667 void __user * argp = (void __user * )arg ;
26692668 int ret ;
2670- struct gendisk * disk = ip -> i_bdev -> bd_disk ;
2669+ struct gendisk * disk = bdev -> bd_disk ;
26712670
26722671 /*
26732672 * Try the generic SCSI command ioctl's first.
26742673 */
2675- ret = scsi_cmd_ioctl (disk -> queue , disk , file ? file -> f_mode : 0 , cmd , argp );
2674+ ret = scsi_cmd_ioctl (disk -> queue , disk , mode , cmd , argp );
26762675 if (ret != - ENOTTY )
26772676 return ret ;
26782677
@@ -2696,7 +2695,7 @@ int cdrom_ioctl(struct file * file, struct cdrom_device_info *cdi,
26962695 case CDROM_SELECT_DISC :
26972696 return cdrom_ioctl_select_disc (cdi , arg );
26982697 case CDROMRESET :
2699- return cdrom_ioctl_reset (cdi , ip -> i_bdev );
2698+ return cdrom_ioctl_reset (cdi , bdev );
27002699 case CDROM_LOCKDOOR :
27012700 return cdrom_ioctl_lock_door (cdi , arg );
27022701 case CDROM_DEBUG :
0 commit comments