Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 8767
b: refs/heads/master
c: 47922d0
h: refs/heads/master
i:
  8765: cf23762
  8763: 2132a56
  8759: dd2f6e8
  8751: 8f70608
  8735: 6f42687
  8703: c1fcf53
v: v3
  • Loading branch information
Mike Miller authored and Linus Torvalds committed Sep 13, 2005
1 parent 6355ba9 commit 67dce80
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bb2a37bf4131d64b76dcdb126e3ff5bf371b1842
refs/heads/master: 47922d068e90ed34c1336cdd39912d51e190f8a5
41 changes: 29 additions & 12 deletions trunk/drivers/block/cciss_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ cciss_scsi_interpret_error(CommandList_struct *cp)

static int
cciss_scsi_do_inquiry(ctlr_info_t *c, unsigned char *scsi3addr,
InquiryData_struct *buf)
unsigned char *buf, unsigned char bufsize)
{
int rc;
CommandList_struct *cp;
Expand All @@ -901,11 +901,10 @@ cciss_scsi_do_inquiry(ctlr_info_t *c, unsigned char *scsi3addr,
cdb[1] = 0;
cdb[2] = 0;
cdb[3] = 0;
cdb[4] = sizeof(*buf) & 0xff;
cdb[4] = bufsize;
cdb[5] = 0;
rc = cciss_scsi_do_simple_cmd(c, cp, scsi3addr, cdb,
6, (unsigned char *) buf,
sizeof(*buf), XFER_READ);
6, buf, bufsize, XFER_READ);

if (rc != 0) return rc; /* something went wrong */

Expand Down Expand Up @@ -1001,9 +1000,10 @@ cciss_update_non_disk_devices(int cntl_num, int hostno)
that though.
*/

#define OBDR_TAPE_INQ_SIZE 49
#define OBDR_TAPE_SIG "$DR-10"
ReportLunData_struct *ld_buff;
InquiryData_struct *inq_buff;
unsigned char *inq_buff;
unsigned char scsi3addr[8];
ctlr_info_t *c;
__u32 num_luns=0;
Expand All @@ -1021,7 +1021,7 @@ cciss_update_non_disk_devices(int cntl_num, int hostno)
return;
}
memset(ld_buff, 0, reportlunsize);
inq_buff = kmalloc(sizeof( InquiryData_struct), GFP_KERNEL);
inq_buff = kmalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL);
if (inq_buff == NULL) {
printk(KERN_ERR "cciss: out of memory\n");
kfree(ld_buff);
Expand Down Expand Up @@ -1052,19 +1052,36 @@ cciss_update_non_disk_devices(int cntl_num, int hostno)

/* for each physical lun, do an inquiry */
if (ld_buff->LUN[i][3] & 0xC0) continue;
memset(inq_buff, 0, sizeof(InquiryData_struct));
memset(inq_buff, 0, OBDR_TAPE_INQ_SIZE);
memcpy(&scsi3addr[0], &ld_buff->LUN[i][0], 8);

if (cciss_scsi_do_inquiry(hba[cntl_num],
scsi3addr, inq_buff) != 0)
{
if (cciss_scsi_do_inquiry(hba[cntl_num], scsi3addr, inq_buff,
(unsigned char) OBDR_TAPE_INQ_SIZE) != 0) {
/* Inquiry failed (msg printed already) */
devtype = 0; /* so we will skip this device. */
} else /* what kind of device is this? */
devtype = (inq_buff->data_byte[0] & 0x1f);
devtype = (inq_buff[0] & 0x1f);

switch (devtype)
{
case 0x05: /* CD-ROM */ {

/* We don't *really* support actual CD-ROM devices,
* just this "One Button Disaster Recovery" tape drive
* which temporarily pretends to be a CD-ROM drive.
* So we check that the device is really an OBDR tape
* device by checking for "$DR-10" in bytes 43-48 of
* the inquiry data.
*/
char obdr_sig[7];

strncpy(obdr_sig, &inq_buff[43], 6);
obdr_sig[6] = '\0';
if (strncmp(obdr_sig, OBDR_TAPE_SIG, 6) != 0)
/* Not OBDR device, ignore it. */
break;
}
/* fall through . . . */
case 0x01: /* sequential access, (tape) */
case 0x08: /* medium changer */
if (ncurrent >= CCISS_MAX_SCSI_DEVS_PER_HBA) {
Expand Down

0 comments on commit 67dce80

Please sign in to comment.