Commit 794d0601 authored by Mark Haverkamp's avatar Mark Haverkamp Committed by James Bottomley

[SCSI] aacraid: fix inquiry page

Received from Mark Salyzyn.

This patch uses the adapter supplemental information AdapterTypeText as
the default for the array name.
Signed-off-by: default avatarMark Haverkamp <markh@osdl.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 71e0f32f
...@@ -571,17 +571,43 @@ static char *container_types[] = { ...@@ -571,17 +571,43 @@ static char *container_types[] = {
* files instead of in OS dependant driver source. * files instead of in OS dependant driver source.
*/ */
static void setinqstr(int devtype, void *data, int tindex) static void setinqstr(struct aac_dev *dev, void *data, int tindex)
{ {
struct scsi_inq *str; struct scsi_inq *str;
struct aac_driver_ident *mp;
mp = aac_get_driver_ident(devtype);
str = (struct scsi_inq *)(data); /* cast data to scsi inq block */ str = (struct scsi_inq *)(data); /* cast data to scsi inq block */
memset(str, ' ', sizeof(*str));
if (dev->supplement_adapter_info.AdapterTypeText[0]) {
char * cp = dev->supplement_adapter_info.AdapterTypeText;
int c = sizeof(str->vid);
while (*cp && *cp != ' ' && --c)
++cp;
c = *cp;
*cp = '\0';
inqstrcpy (dev->supplement_adapter_info.AdapterTypeText,
str->vid);
*cp = c;
while (*cp && *cp != ' ')
++cp;
while (*cp == ' ')
++cp;
/* last six chars reserved for vol type */
c = 0;
if (strlen(cp) > sizeof(str->pid)) {
c = cp[sizeof(str->pid)];
cp[sizeof(str->pid)] = '\0';
}
inqstrcpy (cp, str->pid);
if (c)
cp[sizeof(str->pid)] = c;
} else {
struct aac_driver_ident *mp = aac_get_driver_ident(dev->cardtype);
inqstrcpy (mp->vname, str->vid); inqstrcpy (mp->vname, str->vid);
inqstrcpy (mp->model, str->pid); /* last six chars reserved for vol type */ /* last six chars reserved for vol type */
inqstrcpy (mp->model, str->pid);
}
if (tindex < (sizeof(container_types)/sizeof(char *))){ if (tindex < (sizeof(container_types)/sizeof(char *))){
char *findit = str->pid; char *findit = str->pid;
...@@ -590,6 +616,8 @@ static void setinqstr(int devtype, void *data, int tindex) ...@@ -590,6 +616,8 @@ static void setinqstr(int devtype, void *data, int tindex)
/* RAID is superfluous in the context of a RAID device */ /* RAID is superfluous in the context of a RAID device */
if (memcmp(findit-4, "RAID", 4) == 0) if (memcmp(findit-4, "RAID", 4) == 0)
*(findit -= 4) = ' '; *(findit -= 4) = ' ';
if (((findit - str->pid) + strlen(container_types[tindex]))
< (sizeof(str->pid) + sizeof(str->prl)))
inqstrcpy (container_types[tindex], findit + 1); inqstrcpy (container_types[tindex], findit + 1);
} }
inqstrcpy ("V1.0", str->prl); inqstrcpy ("V1.0", str->prl);
...@@ -1287,7 +1315,6 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) ...@@ -1287,7 +1315,6 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
struct Scsi_Host *host = scsicmd->device->host; struct Scsi_Host *host = scsicmd->device->host;
struct aac_dev *dev = (struct aac_dev *)host->hostdata; struct aac_dev *dev = (struct aac_dev *)host->hostdata;
struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev; struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev;
int cardtype = dev->cardtype;
int ret; int ret;
/* /*
...@@ -1385,14 +1412,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) ...@@ -1385,14 +1412,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
* see: <vendor>.c i.e. aac.c * see: <vendor>.c i.e. aac.c
*/ */
if (scsicmd->device->id == host->this_id) { if (scsicmd->device->id == host->this_id) {
setinqstr(cardtype, (void *) (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *))); setinqstr(dev, (void *) (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *)));
inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */ inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */
aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data));
scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
scsicmd->scsi_done(scsicmd); scsicmd->scsi_done(scsicmd);
return 0; return 0;
} }
setinqstr(cardtype, (void *) (inq_data.inqd_vid), fsa_dev_ptr[cid].type); setinqstr(dev, (void *) (inq_data.inqd_vid), fsa_dev_ptr[cid].type);
inq_data.inqd_pdt = INQD_PDT_DA; /* Direct/random access device */ inq_data.inqd_pdt = INQD_PDT_DA; /* Direct/random access device */
aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data));
return aac_get_container_name(scsicmd, cid); return aac_get_container_name(scsicmd, cid);
......
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