patch-2.3.40 linux/drivers/scsi/sd.c
Next file: linux/drivers/scsi/seagate.c
Previous file: linux/drivers/scsi/scsi_queue.c
Back to the patch index
Back to the overall index
- Lines: 116
- Date:
Tue Jan 18 18:54:21 2000
- Orig file:
v2.3.39/linux/drivers/scsi/sd.c
- Orig date:
Tue Jan 11 22:31:41 2000
diff -u --recursive --new-file v2.3.39/linux/drivers/scsi/sd.c linux/drivers/scsi/sd.c
@@ -21,16 +21,6 @@
#include <linux/config.h>
#include <linux/module.h>
-#ifdef MODULE
-/*
- * This is a variable in scsi.c that is set when we are processing something
- * after boot time. By definition, this is true when we are a loadable module
- * ourselves.
- */
-#define MODULE_FLAG 1
-#else
-#define MODULE_FLAG scsi_loadable_module_flag
-#endif /* MODULE */
#include <linux/fs.h>
#include <linux/kernel.h>
@@ -469,8 +459,6 @@
return 0;
}
-static void sd_geninit(struct gendisk *);
-
static struct block_device_operations sd_fops =
{
open: sd_open,
@@ -491,8 +479,6 @@
"sd", /* Major name */
4, /* Bits to shift to get real from partition */
1 << 4, /* Number of partitions per real */
- 0, /* maximum number of real */
- sd_geninit, /* init function */
NULL, /* hd struct */
NULL, /* block sizes */
0, /* number */
@@ -505,15 +491,6 @@
#define SD_GENDISK(i) sd_gendisks[(i) / SCSI_DISKS_PER_MAJOR]
#define LAST_SD_GENDISK sd_gendisks[N_USED_SD_MAJORS - 1]
-static void sd_geninit(struct gendisk *ignored)
-{
- int i;
-
- for (i = 0; i < sd_template.dev_max; ++i)
- if (rscsi_disks[i].device)
- sd[i << 4].nr_sects = rscsi_disks[i].capacity;
-}
-
/*
* rw_intr is the interrupt routine for the device driver.
* It will be notified on the end of a SCSI read / write, and
@@ -1018,8 +995,6 @@
sd_gendisks[i].major_name = "sd";
sd_gendisks[i].minor_shift = 4;
sd_gendisks[i].max_p = 1 << 4;
- sd_gendisks[i].max_nr = SCSI_DISKS_PER_MAJOR;
- sd_gendisks[i].init = sd_geninit;
sd_gendisks[i].part = sd + (i * SCSI_DISKS_PER_MAJOR << 4);
sd_gendisks[i].sizes = sd_sizes + (i * SCSI_DISKS_PER_MAJOR << 4);
sd_gendisks[i].nr_real = 0;
@@ -1028,8 +1003,6 @@
(void *) (rscsi_disks + i * SCSI_DISKS_PER_MAJOR);
}
- LAST_SD_GENDISK.max_nr =
- (sd_template.dev_max - 1) % SCSI_DISKS_PER_MAJOR + 1;
LAST_SD_GENDISK.next = NULL;
return 0;
}
@@ -1051,16 +1024,15 @@
gendisk_head = sd_gendisks;
}
for (i = 0; i < sd_template.dev_max; ++i)
- if (!rscsi_disks[i].capacity &&
- rscsi_disks[i].device) {
- if (MODULE_FLAG
- && !rscsi_disks[i].has_part_table) {
+ if (!rscsi_disks[i].capacity && rscsi_disks[i].device) {
+ sd_init_onedisk(i);
+ if (!rscsi_disks[i].has_part_table) {
sd_sizes[i << 4] = rscsi_disks[i].capacity;
- /* revalidate does sd_init_onedisk via MAYBE_REINIT */
- revalidate_scsidisk(MKDEV_SD(i), 0);
- } else
- i = sd_init_onedisk(i);
- rscsi_disks[i].has_part_table = 1;
+ register_disk(&SD_GENDISK(i), MKDEV_SD(i),
+ 1<<4, &sd_fops,
+ rscsi_disks[i].capacity);
+ rscsi_disks[i].has_part_table = 1;
+ }
}
/* If our host adapter is capable of scatter-gather, then we increase
* the read-ahead to 60 blocks (120 sectors). If not, we use
@@ -1175,11 +1147,8 @@
MAYBE_REINIT;
#endif
- sd_gendisks->part[start].nr_sects = CAPACITY;
- if (!rscsi_disks[target].device)
- return -EBUSY;
- resetup_one_dev(&SD_GENDISK(target),
- target % SCSI_DISKS_PER_MAJOR);
+ grok_partitions(&SD_GENDISK(target), target % SCSI_DISKS_PER_MAJOR,
+ 1<<4, CAPACITY);
DEVICE_BUSY = 0;
return 0;
@@ -1216,6 +1185,7 @@
sd_gendisks->part[index].nr_sects = 0;
sd_sizes[index] = 0;
}
+ /* unregister_disk() */
dpnt->has_part_table = 0;
dpnt->device = NULL;
dpnt->capacity = 0;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)