patch-2.3.40 linux/drivers/ap1000/ddv.c
Next file: linux/drivers/block/Config.in
Previous file: linux/drivers/ap1000/ap.c
Back to the patch index
Back to the overall index
- Lines: 90
- Date:
Tue Jan 18 18:54:20 2000
- Orig file:
v2.3.39/linux/drivers/ap1000/ddv.c
- Orig date:
Tue Jan 11 22:31:38 2000
diff -u --recursive --new-file v2.3.39/linux/drivers/ap1000/ddv.c linux/drivers/ap1000/ddv.c
@@ -76,7 +76,7 @@
extern int ddv_restart_cpu(void);
extern int ddv_mlist_available(void);
static int ddv_revalidate(kdev_t dev, struct gendisk *gdev);
-static void ddv_geninit(struct gendisk *ignored);
+static void ddv_geninit(void);
static void ddv_release(struct inode * inode, struct file * filp);
static void ddv_request1(void);
@@ -109,12 +109,6 @@
DEVICE_NAME, /* Major name */
PARTN_BITS, /* Bits to shift to get real from partition */
1 << PARTN_BITS, /* Number of partitions per real */
- 1, /* maximum number of real */
-#ifdef MODULE
- NULL, /* called from init_module */
-#else
- ddv_geninit, /* init function */
-#endif
partition_tables,/* hd struct */
ddv_blk_length, /* block sizes */
1, /* number */
@@ -122,7 +116,6 @@
NULL /* next */
};
-
struct ddv_geometry {
unsigned char heads;
unsigned char sectors;
@@ -695,6 +688,7 @@
wake_up(&busy_wait);
}
+extern struct block_device_operations ddv_fops;
static void ddv_load_opiu(void)
{
@@ -738,11 +732,10 @@
ddv_geometry.cylinders = ddv_sect_length[0] /
(ddv_geometry.heads*ddv_geometry.sectors);
- ddv_gendisk.part[0].start_sect = 0;
- ddv_gendisk.part[0].nr_sects = ddv_sect_length[0];
-
- resetup_one_dev(&ddv_gendisk, 0);
+ register_disk(&ddv_gendisk, MKDEV(MAJOR_NR,0), 1<<PARTN_BITS,
+ &ddv_fops, ddv_sect_length[0]);
+ /* FIXME. The crap below is, well, crap. Pseudo-RAID and unsafe one */
for (i=0;i<PARDISK_BASE;i++) {
ddv_sect_length[i] = ddv_gendisk.part[i].nr_sects;
ddv_blk_length[i] = ddv_gendisk.part[i].nr_sects >> 1;
@@ -794,8 +787,7 @@
ddv_sect_length[start] = DiskInfo->blocks;
ddv_blk_length[start] = DiskInfo->blocks >> 1;
- gdev->part[start].nr_sects = ddv_sect_length[start];
- resetup_one_dev(gdev, target);
+ grok_partitions(gdev, target, 1<<PARTN_BITS, ddv_sect_length[start]);
printk("sect_length[%d]=%d blk_length[%d]=%d\n",
start,ddv_sect_length[start],
@@ -936,11 +928,13 @@
kernel_thread(ddv_daemon, NULL, 0);
+ ddv_geninit();
+
return(0);
}
-static void ddv_geninit(struct gendisk *ignored)
+static void ddv_geninit(void)
{
int i;
static int done = 0;
@@ -981,10 +975,8 @@
int init_module(void)
{
int error = ddv_init();
- if (!error) {
- ddv_geninit(&(struct gendisk) { 0,0,0,0,0,0,0,0,0,0,0 });
+ if (!error)
printk(KERN_INFO "DDV: Loaded as module.\n");
- }
return error;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)