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

[PATCH] ->rq_dev in aacraid

	* eliminated, since we actually wanted the name, not device number
(BTW, that had also killed calculation of name that used to duplicate sd.c
one)
parent e09824be
......@@ -220,7 +220,6 @@ struct sense_data {
static struct fsa_scsi_hba *fsa_dev[MAXIMUM_NUM_ADAPTERS]; /* SCSI Device Instance Pointers */
static struct sense_data sense_data[MAXIMUM_NUM_CONTAINERS];
static void get_sd_devname(int disknum, char *buffer);
static unsigned long aac_build_sg(Scsi_Cmnd* scsicmd, struct sgmap* sgmap);
static unsigned long aac_build_sg64(Scsi_Cmnd* scsicmd, struct sgmap64* psg);
static int aac_send_srb_fib(Scsi_Cmnd* scsicmd);
......@@ -1061,8 +1060,10 @@ int aac_scsi_cmd(Scsi_Cmnd * scsicmd)
*/
spin_unlock_irq(scsicmd->host->host_lock);
fsa_dev_ptr->devno[cid] =
DEVICE_NR(scsicmd->request->rq_dev);
if (scsicmd->request->rq_disk)
memcpy(fsa_dev_ptr->devname[cid],
scsicmd->request->rq_disk->disk_name,
8);
ret = aac_read(scsicmd, cid);
spin_lock_irq(scsicmd->host->host_lock);
return ret;
......@@ -1112,40 +1113,18 @@ static int query_disk(struct aac_dev *dev, void *arg)
qd.locked = fsa_dev_ptr->locked[qd.cnum];
qd.deleted = fsa_dev_ptr->deleted[qd.cnum];
if (fsa_dev_ptr->devno[qd.cnum] == -1)
if (fsa_dev_ptr->devno[qd.cnum][0] == '\0')
qd.unmapped = 1;
else
qd.unmapped = 0;
get_sd_devname(fsa_dev_ptr->devno[qd.cnum], qd.name);
strncpy(dq.name, fsa_dev_ptr->devname[qd.cnum], 8);
if (copy_to_user(arg, &qd, sizeof (struct aac_query_disk)))
return -EFAULT;
return 0;
}
static void get_sd_devname(int disknum, char *buffer)
{
if (disknum < 0) {
sprintf(buffer, "%s", "");
return;
}
if (disknum < 26)
sprintf(buffer, "sd%c", 'a' + disknum);
else {
unsigned int min1;
unsigned int min2;
/*
* For larger numbers of disks, we need to go to a new
* naming scheme.
*/
min1 = disknum / 26;
min2 = disknum % 26;
sprintf(buffer, "sd%c%c", 'a' + min1 - 1, 'a' + min2);
}
}
static int force_delete_disk(struct aac_dev *dev, void *arg)
{
struct aac_delete_disk dd;
......@@ -1191,7 +1170,7 @@ static int delete_disk(struct aac_dev *dev, void *arg)
* Mark the container as no longer being valid.
*/
fsa_dev_ptr->valid[dd.cnum] = 0;
fsa_dev_ptr->devno[dd.cnum] = -1;
fsa_dev_ptr->devno[dd.cnum][0] = '\0';
return 0;
}
}
......
......@@ -639,7 +639,7 @@ struct fsa_scsi_hba {
u8 ro[MAXIMUM_NUM_CONTAINERS];
u8 locked[MAXIMUM_NUM_CONTAINERS];
u8 deleted[MAXIMUM_NUM_CONTAINERS];
u32 devno[MAXIMUM_NUM_CONTAINERS];
char devname[MAXIMUM_NUM_CONTAINERS][8];
};
struct fib {
......
......@@ -237,7 +237,7 @@ static int aac_detect(Scsi_Host_Template *template)
/* Initialize the ordinal number of the device to -1 */
fsa_dev_ptr = &(aac->fsa_dev);
for( container = 0; container < MAXIMUM_NUM_CONTAINERS; container++ )
fsa_dev_ptr->devno[container] = -1;
fsa_dev_ptr->devname[container][0] = '\0';
dprintk((KERN_DEBUG "Initializing Hardware...\n"));
if((*aac_drivers[index].init)(aac , host_ptr->unique_id) != 0)
......
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