From: Christoph Hellwig <hch@lst.de>
To: James Bottomley <James.Bottomley@steeleye.com>
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH] remove sd_disks global array from sd.c
Date: Sun, 27 Oct 2002 17:09:49 +0100 [thread overview]
Message-ID: <20021027170949.B15779@lst.de> (raw)
Add a pointer to struct scsi_disk instead. This also obsoletes
sd_dskname().
--- 1.77/drivers/scsi/sd.c Fri Oct 25 21:20:04 2002
+++ edited/drivers/scsi/sd.c Sun Oct 27 15:54:59 2002
@@ -85,6 +85,7 @@
struct scsi_disk {
struct scsi_device *device;
+ struct gendisk *disk;
sector_t capacity; /* size in 512-byte sectors */
u8 media_present;
u8 write_prot;
@@ -258,25 +259,6 @@
}
}
-static void sd_dskname(unsigned int dsk_nr, char *buffer)
-{
- if (dsk_nr < 26)
- sprintf(buffer, "sd%c", 'a' + dsk_nr);
- else {
- unsigned int min1;
- unsigned int min2;
- /*
- * For larger numbers of disks, we need to go to a new
- * naming scheme.
- */
- min1 = dsk_nr / 26;
- min2 = dsk_nr % 26;
- sprintf(buffer, "sd%c%c", 'a' + min1 - 1, 'a' + min2);
- }
-}
-
-static struct gendisk **sd_disks;
-
/**
* sd_init_command - build a scsi (read or write) command from
* information in the request structure.
@@ -1271,11 +1253,8 @@
sd_dsk_arr[k] = sdkp;
}
}
- init_mem_lth(sd_disks, sd_template.dev_max);
- if (sd_disks)
- zero_mem_lth(sd_disks, sd_template.dev_max);
- if (!sd_dsk_arr || !sd_disks)
+ if (!sd_dsk_arr)
goto cleanup_mem;
return 0;
@@ -1284,8 +1263,6 @@
#undef zero_mem_lth
cleanup_mem:
- vfree(sd_disks);
- sd_disks = NULL;
if (sd_dsk_arr) {
for (k = 0; k < sd_template.dev_max; ++k)
vfree(sd_dsk_arr[k]);
@@ -1394,8 +1371,7 @@
set_capacity(gd, sdkp->capacity);
add_disk(gd);
-
- sd_disks[dsk_nr] = gd;
+ sdkp->disk = gd;
printk(KERN_NOTICE "Attached scsi %sdisk %s at scsi%d, channel %d, "
"id %d, lun %d\n", sdp->removable ? "removable " : "",
@@ -1461,12 +1437,11 @@
sdkp->capacity = 0;
/* sdkp->detaching = 1; */
- del_gendisk(sd_disks[dsk_nr]);
+ del_gendisk(sdkp->disk);
sdp->attached--;
sd_template.dev_noticed--;
sd_template.nr_dev--;
- put_disk(sd_disks[dsk_nr]);
- sd_disks[dsk_nr] = NULL;
+ put_disk(sdkp->disk);
}
/**
@@ -1556,13 +1531,8 @@
if (!SDpnt->online)
return 0;
- if(verbose) {
- char buf[16];
-
- sd_dskname(index, buf);
-
- printk("%s ", buf);
- }
+ if (verbose)
+ printk("%s ", sdkp->disk->disk_name);
SRpnt = scsi_allocate_request(SDpnt);
if(!SRpnt) {
reply other threads:[~2002-10-27 16:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20021027170949.B15779@lst.de \
--to=hch@lst.de \
--cc=James.Bottomley@steeleye.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.