Commit c7633c22 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] (11/25) sr.c naming cleanup

	Global search'n'replace job - 'SCp' (Scsi_CD pointer - I'm not kidding;
and yes, they spell it "Scsi") replaced with 'cd' (sr.c, sr_ioctl.c,
sr_vendor.c).
parent e342ff2e
This diff is collapsed.
...@@ -194,25 +194,25 @@ int sr_do_ioctl(int target, unsigned char *sr_cmd, void *buffer, unsigned buflen ...@@ -194,25 +194,25 @@ int sr_do_ioctl(int target, unsigned char *sr_cmd, void *buffer, unsigned buflen
static int test_unit_ready(int minor) static int test_unit_ready(int minor)
{ {
Scsi_CD *SCp; Scsi_CD *cd;
u_char sr_cmd[10]; u_char sr_cmd[10];
SCp = &scsi_CDs[minor]; cd = &scsi_CDs[minor];
sr_cmd[0] = GPCMD_TEST_UNIT_READY; sr_cmd[0] = GPCMD_TEST_UNIT_READY;
sr_cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? sr_cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
((SCp->device->lun) << 5) : 0; ((cd->device->lun) << 5) : 0;
sr_cmd[2] = sr_cmd[3] = sr_cmd[4] = sr_cmd[5] = 0; sr_cmd[2] = sr_cmd[3] = sr_cmd[4] = sr_cmd[5] = 0;
return sr_do_ioctl(minor, sr_cmd, NULL, 0, 1, SCSI_DATA_NONE, NULL); return sr_do_ioctl(minor, sr_cmd, NULL, 0, 1, SCSI_DATA_NONE, NULL);
} }
int sr_tray_move(struct cdrom_device_info *cdi, int pos) int sr_tray_move(struct cdrom_device_info *cdi, int pos)
{ {
Scsi_CD *SCp = cdi->handle; Scsi_CD *cd = cdi->handle;
u_char sr_cmd[10]; u_char sr_cmd[10];
sr_cmd[0] = GPCMD_START_STOP_UNIT; sr_cmd[0] = GPCMD_START_STOP_UNIT;
sr_cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? sr_cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
((SCp->device->lun) << 5) : 0; ((cd->device->lun) << 5) : 0;
sr_cmd[2] = sr_cmd[3] = sr_cmd[5] = 0; sr_cmd[2] = sr_cmd[3] = sr_cmd[5] = 0;
sr_cmd[4] = (pos == 0) ? 0x03 /* close */ : 0x02 /* eject */ ; sr_cmd[4] = (pos == 0) ? 0x03 /* close */ : 0x02 /* eject */ ;
...@@ -221,9 +221,9 @@ int sr_tray_move(struct cdrom_device_info *cdi, int pos) ...@@ -221,9 +221,9 @@ int sr_tray_move(struct cdrom_device_info *cdi, int pos)
int sr_lock_door(struct cdrom_device_info *cdi, int lock) int sr_lock_door(struct cdrom_device_info *cdi, int lock)
{ {
Scsi_CD *SCp = cdi->handle; Scsi_CD *cd = cdi->handle;
return scsi_ioctl(SCp->device, lock ? SCSI_IOCTL_DOORLOCK : return scsi_ioctl(cd->device, lock ? SCSI_IOCTL_DOORLOCK :
SCSI_IOCTL_DOORUNLOCK, 0); SCSI_IOCTL_DOORUNLOCK, 0);
} }
...@@ -241,7 +241,7 @@ int sr_drive_status(struct cdrom_device_info *cdi, int slot) ...@@ -241,7 +241,7 @@ int sr_drive_status(struct cdrom_device_info *cdi, int slot)
int sr_disk_status(struct cdrom_device_info *cdi) int sr_disk_status(struct cdrom_device_info *cdi)
{ {
Scsi_CD *SCp = cdi->handle; Scsi_CD *cd = cdi->handle;
struct cdrom_tochdr toc_h; struct cdrom_tochdr toc_h;
struct cdrom_tocentry toc_e; struct cdrom_tocentry toc_e;
int i, rc, have_datatracks = 0; int i, rc, have_datatracks = 0;
...@@ -263,7 +263,7 @@ int sr_disk_status(struct cdrom_device_info *cdi) ...@@ -263,7 +263,7 @@ int sr_disk_status(struct cdrom_device_info *cdi)
if (!have_datatracks) if (!have_datatracks)
return CDS_AUDIO; return CDS_AUDIO;
if (SCp->xa_flag) if (cd->xa_flag)
return CDS_XA_2_1; return CDS_XA_2_1;
else else
return CDS_DATA_1; return CDS_DATA_1;
...@@ -272,24 +272,24 @@ int sr_disk_status(struct cdrom_device_info *cdi) ...@@ -272,24 +272,24 @@ int sr_disk_status(struct cdrom_device_info *cdi)
int sr_get_last_session(struct cdrom_device_info *cdi, int sr_get_last_session(struct cdrom_device_info *cdi,
struct cdrom_multisession *ms_info) struct cdrom_multisession *ms_info)
{ {
Scsi_CD *SCp = cdi->handle; Scsi_CD *cd = cdi->handle;
ms_info->addr.lba = SCp->ms_offset; ms_info->addr.lba = cd->ms_offset;
ms_info->xa_flag = SCp->xa_flag || SCp->ms_offset > 0; ms_info->xa_flag = cd->xa_flag || cd->ms_offset > 0;
return 0; return 0;
} }
int sr_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn) int sr_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn)
{ {
Scsi_CD *SCp = cdi->handle; Scsi_CD *cd = cdi->handle;
u_char sr_cmd[10]; u_char sr_cmd[10];
char buffer[32]; char buffer[32];
int result; int result;
sr_cmd[0] = GPCMD_READ_SUBCHANNEL; sr_cmd[0] = GPCMD_READ_SUBCHANNEL;
sr_cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? sr_cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
((SCp->device->lun) << 5) : 0; ((cd->device->lun) << 5) : 0;
sr_cmd[2] = 0x40; /* I do want the subchannel info */ sr_cmd[2] = 0x40; /* I do want the subchannel info */
sr_cmd[3] = 0x02; /* Give me medium catalog number info */ sr_cmd[3] = 0x02; /* Give me medium catalog number info */
sr_cmd[4] = sr_cmd[5] = 0; sr_cmd[4] = sr_cmd[5] = 0;
...@@ -314,7 +314,7 @@ int sr_reset(struct cdrom_device_info *cdi) ...@@ -314,7 +314,7 @@ int sr_reset(struct cdrom_device_info *cdi)
int sr_select_speed(struct cdrom_device_info *cdi, int speed) int sr_select_speed(struct cdrom_device_info *cdi, int speed)
{ {
Scsi_CD *SCp = cdi->handle; Scsi_CD *cd = cdi->handle;
u_char sr_cmd[MAX_COMMAND_SIZE]; u_char sr_cmd[MAX_COMMAND_SIZE];
if (speed == 0) if (speed == 0)
...@@ -324,8 +324,8 @@ int sr_select_speed(struct cdrom_device_info *cdi, int speed) ...@@ -324,8 +324,8 @@ int sr_select_speed(struct cdrom_device_info *cdi, int speed)
memset(sr_cmd, 0, MAX_COMMAND_SIZE); memset(sr_cmd, 0, MAX_COMMAND_SIZE);
sr_cmd[0] = GPCMD_SET_SPEED; /* SET CD SPEED */ sr_cmd[0] = GPCMD_SET_SPEED; /* SET CD SPEED */
sr_cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? sr_cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
((SCp->device->lun) << 5) : 0; ((cd->device->lun) << 5) : 0;
sr_cmd[2] = (speed >> 8) & 0xff; /* MSB for speed (in kbytes/sec) */ sr_cmd[2] = (speed >> 8) & 0xff; /* MSB for speed (in kbytes/sec) */
sr_cmd[3] = speed & 0xff; /* LSB */ sr_cmd[3] = speed & 0xff; /* LSB */
...@@ -342,7 +342,7 @@ int sr_select_speed(struct cdrom_device_info *cdi, int speed) ...@@ -342,7 +342,7 @@ int sr_select_speed(struct cdrom_device_info *cdi, int speed)
int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg) int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
{ {
Scsi_CD *SCp = cdi->handle; Scsi_CD *cd = cdi->handle;
u_char sr_cmd[10]; u_char sr_cmd[10];
int result, target = minor(cdi->dev); int result, target = minor(cdi->dev);
unsigned char buffer[32]; unsigned char buffer[32];
...@@ -355,8 +355,8 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg) ...@@ -355,8 +355,8 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
struct cdrom_tochdr *tochdr = (struct cdrom_tochdr *) arg; struct cdrom_tochdr *tochdr = (struct cdrom_tochdr *) arg;
sr_cmd[0] = GPCMD_READ_TOC_PMA_ATIP; sr_cmd[0] = GPCMD_READ_TOC_PMA_ATIP;
sr_cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? sr_cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
((SCp->device->lun) << 5) : 0; ((cd->device->lun) << 5) : 0;
sr_cmd[2] = sr_cmd[3] = sr_cmd[4] = sr_cmd[5] = 0; sr_cmd[2] = sr_cmd[3] = sr_cmd[4] = sr_cmd[5] = 0;
sr_cmd[8] = 12; /* LSB of length */ sr_cmd[8] = 12; /* LSB of length */
...@@ -373,8 +373,8 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg) ...@@ -373,8 +373,8 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
struct cdrom_tocentry *tocentry = (struct cdrom_tocentry *) arg; struct cdrom_tocentry *tocentry = (struct cdrom_tocentry *) arg;
sr_cmd[0] = GPCMD_READ_TOC_PMA_ATIP; sr_cmd[0] = GPCMD_READ_TOC_PMA_ATIP;
sr_cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? sr_cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
((SCp->device->lun) << 5) : 0; ((cd->device->lun) << 5) : 0;
sr_cmd[1] |= (tocentry->cdte_format == CDROM_MSF) ? 0x02 : 0; sr_cmd[1] |= (tocentry->cdte_format == CDROM_MSF) ? 0x02 : 0;
sr_cmd[2] = sr_cmd[3] = sr_cmd[4] = sr_cmd[5] = 0; sr_cmd[2] = sr_cmd[3] = sr_cmd[4] = sr_cmd[5] = 0;
sr_cmd[6] = tocentry->cdte_track; sr_cmd[6] = tocentry->cdte_track;
...@@ -400,8 +400,8 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg) ...@@ -400,8 +400,8 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
struct cdrom_ti* ti = (struct cdrom_ti*)arg; struct cdrom_ti* ti = (struct cdrom_ti*)arg;
sr_cmd[0] = GPCMD_PLAYAUDIO_TI; sr_cmd[0] = GPCMD_PLAYAUDIO_TI;
sr_cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? sr_cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(SCp->device->lun << 5) : 0; (cd->device->lun << 5) : 0;
sr_cmd[4] = ti->cdti_trk0; sr_cmd[4] = ti->cdti_trk0;
sr_cmd[5] = ti->cdti_ind0; sr_cmd[5] = ti->cdti_ind0;
sr_cmd[7] = ti->cdti_trk1; sr_cmd[7] = ti->cdti_trk1;
...@@ -443,17 +443,17 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg) ...@@ -443,17 +443,17 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
int sr_read_cd(int minor, unsigned char *dest, int lba, int format, int blksize) int sr_read_cd(int minor, unsigned char *dest, int lba, int format, int blksize)
{ {
unsigned char cmd[MAX_COMMAND_SIZE]; unsigned char cmd[MAX_COMMAND_SIZE];
Scsi_CD *SCp = &scsi_CDs[minor]; Scsi_CD *cd = &scsi_CDs[minor];
#ifdef DEBUG #ifdef DEBUG
printk("%s: sr_read_cd lba=%d format=%d blksize=%d\n", printk("%s: sr_read_cd lba=%d format=%d blksize=%d\n",
SCp->cdi.name, lba, format, blksize); cd->cdi.name, lba, format, blksize);
#endif #endif
memset(cmd, 0, MAX_COMMAND_SIZE); memset(cmd, 0, MAX_COMMAND_SIZE);
cmd[0] = GPCMD_READ_CD; /* READ_CD */ cmd[0] = GPCMD_READ_CD; /* READ_CD */
cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(SCp->device->lun << 5) : 0; (cd->device->lun << 5) : 0;
cmd[1] |= ((format & 7) << 2); cmd[1] |= ((format & 7) << 2);
cmd[2] = (unsigned char) (lba >> 24) & 0xff; cmd[2] = (unsigned char) (lba >> 24) & 0xff;
cmd[3] = (unsigned char) (lba >> 16) & 0xff; cmd[3] = (unsigned char) (lba >> 16) & 0xff;
...@@ -484,31 +484,31 @@ int sr_read_cd(int minor, unsigned char *dest, int lba, int format, int blksize) ...@@ -484,31 +484,31 @@ int sr_read_cd(int minor, unsigned char *dest, int lba, int format, int blksize)
int sr_read_sector(int minor, int lba, int blksize, unsigned char *dest) int sr_read_sector(int minor, int lba, int blksize, unsigned char *dest)
{ {
unsigned char cmd[MAX_COMMAND_SIZE]; /* the scsi-command */ unsigned char cmd[MAX_COMMAND_SIZE]; /* the scsi-command */
Scsi_CD *SCp = &scsi_CDs[minor]; Scsi_CD *cd = &scsi_CDs[minor];
int rc; int rc;
/* we try the READ CD command first... */ /* we try the READ CD command first... */
if (SCp->readcd_known) { if (cd->readcd_known) {
rc = sr_read_cd(minor, dest, lba, 0, blksize); rc = sr_read_cd(minor, dest, lba, 0, blksize);
if (-EDRIVE_CANT_DO_THIS != rc) if (-EDRIVE_CANT_DO_THIS != rc)
return rc; return rc;
SCp->readcd_known = 0; cd->readcd_known = 0;
printk("CDROM does'nt support READ CD (0xbe) command\n"); printk("CDROM does'nt support READ CD (0xbe) command\n");
/* fall & retry the other way */ /* fall & retry the other way */
} }
/* ... if this fails, we switch the blocksize using MODE SELECT */ /* ... if this fails, we switch the blocksize using MODE SELECT */
if (blksize != SCp->device->sector_size) { if (blksize != cd->device->sector_size) {
if (0 != (rc = sr_set_blocklength(minor, blksize))) if (0 != (rc = sr_set_blocklength(minor, blksize)))
return rc; return rc;
} }
#ifdef DEBUG #ifdef DEBUG
printk("%s: sr_read_sector lba=%d blksize=%d\n", SCp->cdi.name, lba, blksize); printk("%s: sr_read_sector lba=%d blksize=%d\n", cd->cdi.name, lba, blksize);
#endif #endif
memset(cmd, 0, MAX_COMMAND_SIZE); memset(cmd, 0, MAX_COMMAND_SIZE);
cmd[0] = GPCMD_READ_10; cmd[0] = GPCMD_READ_10;
cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(SCp->device->lun << 5) : 0; (cd->device->lun << 5) : 0;
cmd[2] = (unsigned char) (lba >> 24) & 0xff; cmd[2] = (unsigned char) (lba >> 24) & 0xff;
cmd[3] = (unsigned char) (lba >> 16) & 0xff; cmd[3] = (unsigned char) (lba >> 16) & 0xff;
cmd[4] = (unsigned char) (lba >> 8) & 0xff; cmd[4] = (unsigned char) (lba >> 8) & 0xff;
...@@ -527,7 +527,7 @@ int sr_read_sector(int minor, int lba, int blksize, unsigned char *dest) ...@@ -527,7 +527,7 @@ int sr_read_sector(int minor, int lba, int blksize, unsigned char *dest)
int sr_is_xa(int minor) int sr_is_xa(int minor)
{ {
unsigned char *raw_sector; unsigned char *raw_sector;
Scsi_CD *SCp = &scsi_CDs[minor]; Scsi_CD *cd = &scsi_CDs[minor];
int is_xa; int is_xa;
if (!xa_test) if (!xa_test)
...@@ -536,7 +536,7 @@ int sr_is_xa(int minor) ...@@ -536,7 +536,7 @@ int sr_is_xa(int minor)
raw_sector = (unsigned char *) kmalloc(2048, GFP_DMA | GFP_KERNEL); raw_sector = (unsigned char *) kmalloc(2048, GFP_DMA | GFP_KERNEL);
if (!raw_sector) if (!raw_sector)
return -ENOMEM; return -ENOMEM;
if (0 == sr_read_sector(minor, SCp->ms_offset + 16, if (0 == sr_read_sector(minor, cd->ms_offset + 16,
CD_FRAMESIZE_RAW1, raw_sector)) { CD_FRAMESIZE_RAW1, raw_sector)) {
is_xa = (raw_sector[3] == 0x02) ? 1 : 0; is_xa = (raw_sector[3] == 0x02) ? 1 : 0;
} else { } else {
...@@ -545,7 +545,7 @@ int sr_is_xa(int minor) ...@@ -545,7 +545,7 @@ int sr_is_xa(int minor)
} }
kfree(raw_sector); kfree(raw_sector);
#ifdef DEBUG #ifdef DEBUG
printk("%s: sr_is_xa: %d\n", SCp->cdi.name, is_xa); printk("%s: sr_is_xa: %d\n", cd->cdi.name, is_xa);
#endif #endif
return is_xa; return is_xa;
} }
...@@ -553,16 +553,16 @@ int sr_is_xa(int minor) ...@@ -553,16 +553,16 @@ int sr_is_xa(int minor)
int sr_dev_ioctl(struct cdrom_device_info *cdi, int sr_dev_ioctl(struct cdrom_device_info *cdi,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
Scsi_CD *SCp = cdi->handle; Scsi_CD *cd = cdi->handle;
switch (cmd) { switch (cmd) {
case BLKGETSIZE: case BLKGETSIZE:
return put_user(SCp->capacity, (unsigned long *) arg); return put_user(cd->capacity, (unsigned long *) arg);
case BLKGETSIZE64: case BLKGETSIZE64:
return put_user((u64)SCp->capacity << 9, (u64 *)arg); return put_user((u64)cd->capacity << 9, (u64 *)arg);
default: default:
return scsi_ioctl(SCp->device, cmd, (void *)arg); return scsi_ioctl(cd->device, cmd, (void *)arg);
} }
} }
......
...@@ -58,25 +58,25 @@ ...@@ -58,25 +58,25 @@
#define VENDOR_TOSHIBA 3 #define VENDOR_TOSHIBA 3
#define VENDOR_WRITER 4 /* pre-scsi3 writers */ #define VENDOR_WRITER 4 /* pre-scsi3 writers */
void sr_vendor_init(Scsi_CD *SCp) void sr_vendor_init(Scsi_CD *cd)
{ {
#ifndef CONFIG_BLK_DEV_SR_VENDOR #ifndef CONFIG_BLK_DEV_SR_VENDOR
SCp->vendor = VENDOR_SCSI3; cd->vendor = VENDOR_SCSI3;
#else #else
char *vendor = SCp->device->vendor; char *vendor = cd->device->vendor;
char *model = SCp->device->model; char *model = cd->device->model;
/* default */ /* default */
SCp->vendor = VENDOR_SCSI3; cd->vendor = VENDOR_SCSI3;
if (SCp->readcd_known) if (cd->readcd_known)
/* this is true for scsi3/mmc drives - no more checks */ /* this is true for scsi3/mmc drives - no more checks */
return; return;
if (SCp->device->type == TYPE_WORM) { if (cd->device->type == TYPE_WORM) {
SCp->vendor = VENDOR_WRITER; cd->vendor = VENDOR_WRITER;
} else if (!strncmp(vendor, "NEC", 3)) { } else if (!strncmp(vendor, "NEC", 3)) {
SCp->vendor = VENDOR_NEC; cd->vendor = VENDOR_NEC;
if (!strncmp(model, "CD-ROM DRIVE:25", 15) || if (!strncmp(model, "CD-ROM DRIVE:25", 15) ||
!strncmp(model, "CD-ROM DRIVE:36", 15) || !strncmp(model, "CD-ROM DRIVE:36", 15) ||
!strncmp(model, "CD-ROM DRIVE:83", 15) || !strncmp(model, "CD-ROM DRIVE:83", 15) ||
...@@ -88,10 +88,10 @@ void sr_vendor_init(Scsi_CD *SCp) ...@@ -88,10 +88,10 @@ void sr_vendor_init(Scsi_CD *SCp)
#endif #endif
) )
/* these can't handle multisession, may hang */ /* these can't handle multisession, may hang */
SCp->cdi.mask |= CDC_MULTI_SESSION; cd->cdi.mask |= CDC_MULTI_SESSION;
} else if (!strncmp(vendor, "TOSHIBA", 7)) { } else if (!strncmp(vendor, "TOSHIBA", 7)) {
SCp->vendor = VENDOR_TOSHIBA; cd->vendor = VENDOR_TOSHIBA;
} }
#endif #endif
...@@ -106,11 +106,11 @@ int sr_set_blocklength(int minor, int blocklength) ...@@ -106,11 +106,11 @@ int sr_set_blocklength(int minor, int blocklength)
unsigned char *buffer; /* the buffer for the ioctl */ unsigned char *buffer; /* the buffer for the ioctl */
unsigned char cmd[MAX_COMMAND_SIZE]; /* the scsi-command */ unsigned char cmd[MAX_COMMAND_SIZE]; /* the scsi-command */
struct ccs_modesel_head *modesel; struct ccs_modesel_head *modesel;
Scsi_CD *SCp = &scsi_CDs[minor]; Scsi_CD *cd = &scsi_CDs[minor];
int rc, density = 0; int rc, density = 0;
#ifdef CONFIG_BLK_DEV_SR_VENDOR #ifdef CONFIG_BLK_DEV_SR_VENDOR
if (SCp->vendor == VENDOR_TOSHIBA) if (cd->vendor == VENDOR_TOSHIBA)
density = (blocklength > 2048) ? 0x81 : 0x83; density = (blocklength > 2048) ? 0x81 : 0x83;
#endif #endif
...@@ -119,12 +119,12 @@ int sr_set_blocklength(int minor, int blocklength) ...@@ -119,12 +119,12 @@ int sr_set_blocklength(int minor, int blocklength)
return -ENOMEM; return -ENOMEM;
#ifdef DEBUG #ifdef DEBUG
printk("%s: MODE SELECT 0x%x/%d\n", SCp->cdi.name, density, blocklength); printk("%s: MODE SELECT 0x%x/%d\n", cd->cdi.name, density, blocklength);
#endif #endif
memset(cmd, 0, MAX_COMMAND_SIZE); memset(cmd, 0, MAX_COMMAND_SIZE);
cmd[0] = MODE_SELECT; cmd[0] = MODE_SELECT;
cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(SCp->device->lun << 5) : 0; (cd->device->lun << 5) : 0;
cmd[1] |= (1 << 4); cmd[1] |= (1 << 4);
cmd[4] = 12; cmd[4] = 12;
modesel = (struct ccs_modesel_head *) buffer; modesel = (struct ccs_modesel_head *) buffer;
...@@ -134,12 +134,12 @@ int sr_set_blocklength(int minor, int blocklength) ...@@ -134,12 +134,12 @@ int sr_set_blocklength(int minor, int blocklength)
modesel->block_length_med = (blocklength >> 8) & 0xff; modesel->block_length_med = (blocklength >> 8) & 0xff;
modesel->block_length_lo = blocklength & 0xff; modesel->block_length_lo = blocklength & 0xff;
if (0 == (rc = sr_do_ioctl(minor, cmd, buffer, sizeof(*modesel), 0, SCSI_DATA_WRITE, NULL))) { if (0 == (rc = sr_do_ioctl(minor, cmd, buffer, sizeof(*modesel), 0, SCSI_DATA_WRITE, NULL))) {
SCp->device->sector_size = blocklength; cd->device->sector_size = blocklength;
} }
#ifdef DEBUG #ifdef DEBUG
else else
printk("%s: switching blocklength to %d bytes failed\n", printk("%s: switching blocklength to %d bytes failed\n",
SCp->cdi.name, blocklength); cd->cdi.name, blocklength);
#endif #endif
kfree(buffer); kfree(buffer);
return rc; return rc;
...@@ -152,14 +152,14 @@ int sr_set_blocklength(int minor, int blocklength) ...@@ -152,14 +152,14 @@ int sr_set_blocklength(int minor, int blocklength)
int sr_cd_check(struct cdrom_device_info *cdi) int sr_cd_check(struct cdrom_device_info *cdi)
{ {
Scsi_CD *SCp = cdi->handle; Scsi_CD *cd = cdi->handle;
unsigned long sector; unsigned long sector;
unsigned char *buffer; /* the buffer for the ioctl */ unsigned char *buffer; /* the buffer for the ioctl */
unsigned char cmd[MAX_COMMAND_SIZE]; /* the scsi-command */ unsigned char cmd[MAX_COMMAND_SIZE]; /* the scsi-command */
int rc, no_multi, minor; int rc, no_multi, minor;
minor = minor(cdi->dev); minor = minor(cdi->dev);
if (SCp->cdi.mask & CDC_MULTI_SESSION) if (cd->cdi.mask & CDC_MULTI_SESSION)
return 0; return 0;
buffer = (unsigned char *) kmalloc(512, GFP_KERNEL | GFP_DMA); buffer = (unsigned char *) kmalloc(512, GFP_KERNEL | GFP_DMA);
...@@ -170,13 +170,13 @@ int sr_cd_check(struct cdrom_device_info *cdi) ...@@ -170,13 +170,13 @@ int sr_cd_check(struct cdrom_device_info *cdi)
no_multi = 0; /* flag: the drive can't handle multisession */ no_multi = 0; /* flag: the drive can't handle multisession */
rc = 0; rc = 0;
switch (SCp->vendor) { switch (cd->vendor) {
case VENDOR_SCSI3: case VENDOR_SCSI3:
memset(cmd, 0, MAX_COMMAND_SIZE); memset(cmd, 0, MAX_COMMAND_SIZE);
cmd[0] = READ_TOC; cmd[0] = READ_TOC;
cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(SCp->device->lun << 5) : 0; (cd->device->lun << 5) : 0;
cmd[8] = 12; cmd[8] = 12;
cmd[9] = 0x40; cmd[9] = 0x40;
rc = sr_do_ioctl(minor, cmd, buffer, 12, 1, SCSI_DATA_READ, NULL); rc = sr_do_ioctl(minor, cmd, buffer, 12, 1, SCSI_DATA_READ, NULL);
...@@ -184,7 +184,7 @@ int sr_cd_check(struct cdrom_device_info *cdi) ...@@ -184,7 +184,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
break; break;
if ((buffer[0] << 8) + buffer[1] < 0x0a) { if ((buffer[0] << 8) + buffer[1] < 0x0a) {
printk(KERN_INFO "%s: Hmm, seems the drive " printk(KERN_INFO "%s: Hmm, seems the drive "
"doesn't support multisession CD's\n", SCp->cdi.name); "doesn't support multisession CD's\n", cd->cdi.name);
no_multi = 1; no_multi = 1;
break; break;
} }
...@@ -201,8 +201,8 @@ int sr_cd_check(struct cdrom_device_info *cdi) ...@@ -201,8 +201,8 @@ int sr_cd_check(struct cdrom_device_info *cdi)
unsigned long min, sec, frame; unsigned long min, sec, frame;
memset(cmd, 0, MAX_COMMAND_SIZE); memset(cmd, 0, MAX_COMMAND_SIZE);
cmd[0] = 0xde; cmd[0] = 0xde;
cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(SCp->device->lun << 5) : 0; (cd->device->lun << 5) : 0;
cmd[1] |= 0x03; cmd[1] |= 0x03;
cmd[2] = 0xb0; cmd[2] = 0xb0;
rc = sr_do_ioctl(minor, cmd, buffer, 0x16, 1, SCSI_DATA_READ, NULL); rc = sr_do_ioctl(minor, cmd, buffer, 0x16, 1, SCSI_DATA_READ, NULL);
...@@ -210,7 +210,7 @@ int sr_cd_check(struct cdrom_device_info *cdi) ...@@ -210,7 +210,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
break; break;
if (buffer[14] != 0 && buffer[14] != 0xb0) { if (buffer[14] != 0 && buffer[14] != 0xb0) {
printk(KERN_INFO "%s: Hmm, seems the cdrom " printk(KERN_INFO "%s: Hmm, seems the cdrom "
"doesn't support multisession CD's\n", SCp->cdi.name); "doesn't support multisession CD's\n", cd->cdi.name);
no_multi = 1; no_multi = 1;
break; break;
} }
...@@ -228,13 +228,13 @@ int sr_cd_check(struct cdrom_device_info *cdi) ...@@ -228,13 +228,13 @@ int sr_cd_check(struct cdrom_device_info *cdi)
* where starts the last session ?) */ * where starts the last session ?) */
memset(cmd, 0, MAX_COMMAND_SIZE); memset(cmd, 0, MAX_COMMAND_SIZE);
cmd[0] = 0xc7; cmd[0] = 0xc7;
cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(SCp->device->lun << 5) : 0; (cd->device->lun << 5) : 0;
cmd[1] |= 0x03; cmd[1] |= 0x03;
rc = sr_do_ioctl(minor, cmd, buffer, 4, 1, SCSI_DATA_READ, NULL); rc = sr_do_ioctl(minor, cmd, buffer, 4, 1, SCSI_DATA_READ, NULL);
if (rc == -EINVAL) { if (rc == -EINVAL) {
printk(KERN_INFO "%s: Hmm, seems the drive " printk(KERN_INFO "%s: Hmm, seems the drive "
"doesn't support multisession CD's\n", SCp->cdi.name); "doesn't support multisession CD's\n", cd->cdi.name);
no_multi = 1; no_multi = 1;
break; break;
} }
...@@ -253,8 +253,8 @@ int sr_cd_check(struct cdrom_device_info *cdi) ...@@ -253,8 +253,8 @@ int sr_cd_check(struct cdrom_device_info *cdi)
case VENDOR_WRITER: case VENDOR_WRITER:
memset(cmd, 0, MAX_COMMAND_SIZE); memset(cmd, 0, MAX_COMMAND_SIZE);
cmd[0] = READ_TOC; cmd[0] = READ_TOC;
cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(SCp->device->lun << 5) : 0; (cd->device->lun << 5) : 0;
cmd[8] = 0x04; cmd[8] = 0x04;
cmd[9] = 0x40; cmd[9] = 0x40;
rc = sr_do_ioctl(minor, cmd, buffer, 0x04, 1, SCSI_DATA_READ, NULL); rc = sr_do_ioctl(minor, cmd, buffer, 0x04, 1, SCSI_DATA_READ, NULL);
...@@ -263,12 +263,12 @@ int sr_cd_check(struct cdrom_device_info *cdi) ...@@ -263,12 +263,12 @@ int sr_cd_check(struct cdrom_device_info *cdi)
} }
if ((rc = buffer[2]) == 0) { if ((rc = buffer[2]) == 0) {
printk(KERN_WARNING printk(KERN_WARNING
"%s: No finished session\n", SCp->cdi.name); "%s: No finished session\n", cd->cdi.name);
break; break;
} }
cmd[0] = READ_TOC; /* Read TOC */ cmd[0] = READ_TOC; /* Read TOC */
cmd[1] = (SCp->device->scsi_level <= SCSI_2) ? cmd[1] = (cd->device->scsi_level <= SCSI_2) ?
(SCp->device->lun << 5) : 0; (cd->device->lun << 5) : 0;
cmd[6] = rc & 0x7f; /* number of last session */ cmd[6] = rc & 0x7f; /* number of last session */
cmd[8] = 0x0c; cmd[8] = 0x0c;
cmd[9] = 0x40; cmd[9] = 0x40;
...@@ -285,17 +285,17 @@ int sr_cd_check(struct cdrom_device_info *cdi) ...@@ -285,17 +285,17 @@ int sr_cd_check(struct cdrom_device_info *cdi)
/* should not happen */ /* should not happen */
printk(KERN_WARNING printk(KERN_WARNING
"%s: unknown vendor code (%i), not initialized ?\n", "%s: unknown vendor code (%i), not initialized ?\n",
SCp->cdi.name, SCp->vendor); cd->cdi.name, cd->vendor);
sector = 0; sector = 0;
no_multi = 1; no_multi = 1;
break; break;
} }
SCp->ms_offset = sector; cd->ms_offset = sector;
SCp->xa_flag = 0; cd->xa_flag = 0;
if (CDS_AUDIO != sr_disk_status(cdi) && 1 == sr_is_xa(minor)) if (CDS_AUDIO != sr_disk_status(cdi) && 1 == sr_is_xa(minor))
SCp->xa_flag = 1; cd->xa_flag = 1;
if (2048 != SCp->device->sector_size) { if (2048 != cd->device->sector_size) {
sr_set_blocklength(minor, 2048); sr_set_blocklength(minor, 2048);
} }
if (no_multi) if (no_multi)
...@@ -304,7 +304,7 @@ int sr_cd_check(struct cdrom_device_info *cdi) ...@@ -304,7 +304,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
#ifdef DEBUG #ifdef DEBUG
if (sector) if (sector)
printk(KERN_DEBUG "%s: multisession offset=%lu\n", printk(KERN_DEBUG "%s: multisession offset=%lu\n",
SCp->cdi.name, sector); cd->cdi.name, sector);
#endif #endif
kfree(buffer); kfree(buffer);
return rc; return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment