Fix kdev_t in sr, st, sg (2.5.2-pre6)
Subsystems (3)
PATCH 1/1 Fix kdev_t in sr, st, sg (2.5.2-pre6)
Here's the 2.5.2-pre6 version of the simple patch fixing SCSI tape, CD, and generic compilation for the new kdev_t macros.
jon
Jonathan Corbet
Executive editor, LWN.net
[email protected]
drivers/scsi/sg.c +11 -11
@@ -254,7 +254,7 @@static int sg_open (struct inode * inode,struct file * filp) { -int dev =MINOR (inode->i_rdev); +int dev =minor (inode->i_rdev);int flags = filp->f_flags;Sg_device * sdp;Sg_fd * sfp;
@@ -340,7 +340,7 @@if ((! (sfp = (Sg_fd *)filp->private_data)) || (! (sdp = sfp->parentdp))) {return -ENXIO ; } -SCSI_LOG_TIMEOUT (3 ,printk ("sg_release: dev=%d\n" ,MINOR (sdp->i_rdev))); +SCSI_LOG_TIMEOUT (3 ,printk ("sg_release: dev=%d\n" ,minor (sdp->i_rdev)));sg_fasync (-1 , filp,0 );/* remove filp from async notification list */ if (0 ==sg_remove_sfp (sdp, sfp)) {/* Returns 1 when sdp gone */ if (! sdp->detached) {
@@ -369,7 +369,7 @@if ((! (sfp = (Sg_fd *)filp->private_data)) || (! (sdp = sfp->parentdp)))return -ENXIO ;SCSI_LOG_TIMEOUT (3 ,printk ("sg_read: dev=%d, count=%d\n" , -MINOR (sdp->i_rdev), (int )count)); +minor (sdp->i_rdev), (int )count));if (ppos != &filp->f_pos) ;/* FIXME: Hmm. Seek to the right place, or fail? */ if ((k =verify_area (VERIFY_WRITE , buf, count)))
@@ -514,7 +514,7 @@if ((! (sfp = (Sg_fd *)filp->private_data)) || (! (sdp = sfp->parentdp)))return -ENXIO ;SCSI_LOG_TIMEOUT (3 ,printk ("sg_write: dev=%d, count=%d\n" , -MINOR (sdp->i_rdev), (int )count)); +minor (sdp->i_rdev), (int )count));if (sdp->detached)return -ENODEV ; if (! ((filp->f_flags & O_NONBLOCK) ||
@@ -731,7 +731,7 @@if ((! (sfp = (Sg_fd *)filp->private_data)) || (! (sdp = sfp->parentdp)))return -ENXIO ;SCSI_LOG_TIMEOUT (3 ,printk ("sg_ioctl: dev=%d, cmd=0x%x\n" , -MINOR (sdp->i_rdev), (int )cmd_in)); +minor (sdp->i_rdev), (int )cmd_in)); read_only = (O_RDWR != (filp->f_flags &O_ACCMODE )); switch(cmd_in)
@@ -1011,7 +1011,7 @@else if (count <SG_MAX_QUEUE ) res |=POLLOUT |POLLWRNORM ;SCSI_LOG_TIMEOUT (3 ,printk ("sg_poll: dev=%d, res=0x%x\n" , -MINOR (sdp->i_rdev), (int )res)); +minor (sdp->i_rdev), (int )res));return res; }
@@ -1024,7 +1024,7 @@if ((! (sfp = (Sg_fd *)filp->private_data)) || (! (sdp = sfp->parentdp)))return -ENXIO ;SCSI_LOG_TIMEOUT (3 ,printk ("sg_fasync: dev=%d, mode=%d\n" , -MINOR (sdp->i_rdev), mode)); +minor (sdp->i_rdev), mode)); retval =fasync_helper (fd, filp, mode, &sfp->async_qp);return (retval <0 ) ? retval :0 ;
@@ -1035,7 +1035,7 @@static void sg_cmd_done_bh (Scsi_Cmnd * SCpnt) {Scsi_Request * SRpnt = SCpnt->sc_request; -int dev =MINOR (SRpnt->sr_request.rq_dev); +int dev =minor (SRpnt->sr_request.rq_dev);Sg_device * sdp =NULL ;Sg_fd * sfp;Sg_request * srp =NULL ;
@@ -1278,7 +1278,7 @@ sdp->sgdebug =0 ; sdp->detached =0 ; sdp->sg_tablesize = scsidp->host ? scsidp->host->sg_tablesize :0 ; - sdp->i_rdev =MKDEV (SCSI_GENERIC_MAJOR , k); + sdp->i_rdev =mk_kdev (SCSI_GENERIC_MAJOR , k); sdp->de = devfs_register (scsidp->de, "generic", DEVFS_FL_DEFAULT, SCSI_GENERIC_MAJOR, k, S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP,
@@ -2415,7 +2415,7 @@ SRpnt->sr_bufflen =0 ; SRpnt->sr_buffer =NULL ; SRpnt->sr_underflow =0 ; - SRpnt->sr_request.rq_dev =MKDEV (0 ,0 );/* "sg" _disowns_ command blk */ + SRpnt->sr_request.rq_dev =mk_kdev (0 ,0 );/* "sg" _disowns_ command blk */ }static int sg_ms_to_jif (unsigned int msecs)
@@ -2694,7 +2694,7 @@PRINT_PROC ("device %d detached ??\n" , j);continue ; } - dev =MINOR (sdp->i_rdev); + dev =minor (sdp->i_rdev);if (sg_get_nth_sfp (sdp,0 )) {PRINT_PROC (" >>> device=sg%d " , dev);
drivers/scsi/sr.c +26 -26
138 lines not on this page · raw message
drivers/scsi/sr_ioctl.c +18 -18
@@ -68,7 +68,7 @@ sr_cmd[6 ] = trk1_te.cdte_addr.msf.minute; sr_cmd[7 ] = trk1_te.cdte_addr.msf.second; sr_cmd[8 ] = trk1_te.cdte_addr.msf.frame; -return sr_do_ioctl (MINOR (cdi->dev), sr_cmd,NULL ,0 ,0 ,SCSI_DATA_NONE ,NULL ); +return sr_do_ioctl (minor (cdi->dev), sr_cmd,NULL ,0 ,0 ,SCSI_DATA_NONE ,NULL ); }/* We do our own retries because we want to know what the specific
@@ -206,17 +206,17 @@u_char sr_cmd[10 ]; sr_cmd[0 ] =GPCMD_START_STOP_UNIT ; - sr_cmd[1 ] = (scsi_CDs[MINOR (cdi->dev)].device->scsi_level <=SCSI_2 ) ? - ((scsi_CDs[MINOR (cdi->dev)].device->lun) <<5 ) :0 ; + sr_cmd[1 ] = (scsi_CDs[minor (cdi->dev)].device->scsi_level <=SCSI_2 ) ? + ((scsi_CDs[minor (cdi->dev)].device->lun) <<5 ) :0 ; sr_cmd[2 ] = sr_cmd[3 ] = sr_cmd[5 ] =0 ; sr_cmd[4 ] = (pos ==0 ) ?0x03 /* close */ :0x02 /* eject */ ; -return sr_do_ioctl (MINOR (cdi->dev), sr_cmd,NULL ,0 ,0 ,SCSI_DATA_NONE ,NULL ); +return sr_do_ioctl (minor (cdi->dev), sr_cmd,NULL ,0 ,0 ,SCSI_DATA_NONE ,NULL ); }int sr_lock_door (struct cdrom_device_info *cdi,int lock) { -return scsi_ioctl (scsi_CDs[MINOR (cdi->dev)].device, +return scsi_ioctl (scsi_CDs[minor (cdi->dev)].device, lock ?SCSI_IOCTL_DOORLOCK :SCSI_IOCTL_DOORUNLOCK ,0 ); }
@@ -227,7 +227,7 @@/* we have no changer support */ return -EINVAL ; } -if (0 ==test_unit_ready (MINOR (cdi->dev))) +if (0 ==test_unit_ready (minor (cdi->dev)))return CDS_DISC_OK ;return CDS_TRAY_OPEN ;
@@ -256,7 +256,7 @@if (!have_datatracks)return CDS_AUDIO ; -if (scsi_CDs[MINOR (cdi->dev)].xa_flag) +if (scsi_CDs[minor (cdi->dev)].xa_flag)return CDS_XA_2_1 ;else return CDS_DATA_1 ;
@@ -265,9 +265,9 @@int sr_get_last_session (struct cdrom_device_info *cdi,struct cdrom_multisession *ms_info) { - ms_info->addr.lba = scsi_CDs[MINOR (cdi->dev)].ms_offset; - ms_info->xa_flag = scsi_CDs[MINOR (cdi->dev)].xa_flag || - (scsi_CDs[MINOR (cdi->dev)].ms_offset >0 ); + ms_info->addr.lba = scsi_CDs[minor (cdi->dev)].ms_offset; + ms_info->xa_flag = scsi_CDs[minor (cdi->dev)].xa_flag || + (scsi_CDs[minor (cdi->dev)].ms_offset >0 );return 0 ; }
@@ -279,8 +279,8 @@int result; sr_cmd[0 ] =GPCMD_READ_SUBCHANNEL ; - sr_cmd[1 ] = (scsi_CDs[MINOR (cdi->dev)].device->scsi_level <=SCSI_2 ) ? - ((scsi_CDs[MINOR (cdi->dev)].device->lun) <<5 ) :0 ; + sr_cmd[1 ] = (scsi_CDs[minor (cdi->dev)].device->scsi_level <=SCSI_2 ) ? + ((scsi_CDs[minor (cdi->dev)].device->lun) <<5 ) :0 ; sr_cmd[2 ] =0x40 ;/* I do want the subchannel info */ sr_cmd[3 ] =0x02 ;/* Give me medium catalog number info */ sr_cmd[4 ] = sr_cmd[5 ] =0 ;
@@ -289,7 +289,7 @@ sr_cmd[8 ] =24 ; sr_cmd[9 ] =0 ; - result =sr_do_ioctl (MINOR (cdi->dev), sr_cmd, buffer,24 ,0 ,SCSI_DATA_READ ,NULL ); + result =sr_do_ioctl (minor (cdi->dev), sr_cmd, buffer,24 ,0 ,SCSI_DATA_READ ,NULL );memcpy (mcn->medium_catalog_number, buffer +9 ,13 ); mcn->medium_catalog_number[13 ] =0 ;
@@ -314,12 +314,12 @@memset (sr_cmd,0 ,MAX_COMMAND_SIZE ); sr_cmd[0 ] =GPCMD_SET_SPEED ;/* SET CD SPEED */ - sr_cmd[1 ] = (scsi_CDs[MINOR (cdi->dev)].device->scsi_level <=SCSI_2 ) ? - ((scsi_CDs[MINOR (cdi->dev)].device->lun) <<5 ) :0 ; + sr_cmd[1 ] = (scsi_CDs[minor (cdi->dev)].device->scsi_level <=SCSI_2 ) ? + ((scsi_CDs[minor (cdi->dev)].device->lun) <<5 ) :0 ; sr_cmd[2 ] = (speed >>8 ) &0xff ;/* MSB for speed (in kbytes/sec) */ sr_cmd[3 ] = speed &0xff ;/* LSB */ -if (sr_do_ioctl (MINOR (cdi->dev), sr_cmd,NULL ,0 ,0 ,SCSI_DATA_NONE ,NULL )) +if (sr_do_ioctl (minor (cdi->dev), sr_cmd,NULL ,0 ,0 ,SCSI_DATA_NONE ,NULL ))return -EIO ;return 0 ; }
@@ -333,7 +333,7 @@int sr_audio_ioctl (struct cdrom_device_info *cdi,unsigned int cmd,void *arg) {u_char sr_cmd[10 ]; -int result, target =MINOR (cdi->dev); +int result, target =minor (cdi->dev);unsigned char buffer[32 ];memset (sr_cmd,0 ,sizeof (sr_cmd));
@@ -541,7 +541,7 @@ {int target; - target =MINOR (cdi->dev); + target =minor (cdi->dev);switch (cmd) {case BLKGETSIZE :
drivers/scsi/sr_vendor.c +1 -1
@@ -158,7 +158,7 @@unsigned char cmd[MAX_COMMAND_SIZE ];/* the scsi-command */ int rc, no_multi, minor; - minor =MINOR (cdi->dev); + minor =minor (cdi->dev);if (scsi_CDs[minor].cdi.mask &CDC_MULTI_SESSION )return 0 ;
drivers/scsi/st.c +4 -4
@@ -133,8 +133,8 @@#define ST_TIMEOUT (900 * HZ)#define ST_LONG_TIMEOUT (14000 * HZ) -#define TAPE_NR (x) (MINOR(x) & ~(128 | ST_MODE_MASK)) -#define TAPE_MODE (x) ((MINOR(x) & ST_MODE_MASK) >> ST_MODE_SHIFT) +#define TAPE_NR (x) (minor(x) & ~(128 | ST_MODE_MASK)) +#define TAPE_MODE (x) ((minor(x) & ST_MODE_MASK) >> ST_MODE_SHIFT)/* Internal ioctl to set both density (uppermost 8 bits) and blocksize (lower 24 bits) */
@@ -878,7 +878,7 @@ } STp->in_use =1 ;write_unlock_irqrestore (&st_dev_arr_lock, flags); - STp->rew_at_close = STp->autorew_dev = (MINOR (inode->i_rdev) &0x80 ) ==0 ; + STp->rew_at_close = STp->autorew_dev = (minor (inode->i_rdev) &0x80 ) ==0 ;if (STp->device->host->hostt->module)__MOD_INC_USE_COUNT (STp->device->host->hostt->module);
@@ -3717,7 +3717,7 @@ tpnt->tape_type =MT_ISSCSI2 ; tpnt->inited =0 ; - tpnt->devt =MKDEV (SCSI_TAPE_MAJOR , i); + tpnt->devt =mk_kdev (SCSI_TAPE_MAJOR , i); tpnt->dirty =0 ; tpnt->in_use =0 ; tpnt->drv_buffer =1 ;/* Try buffering if no mode sense */