summaryrefslogtreecommitdiffstats
path: root/drivers/ap1000
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ap1000')
-rw-r--r--drivers/ap1000/ap.c2
-rw-r--r--drivers/ap1000/ddv.c34
2 files changed, 15 insertions, 21 deletions
diff --git a/drivers/ap1000/ap.c b/drivers/ap1000/ap.c
index 66c37290c..6e05d7cb5 100644
--- a/drivers/ap1000/ap.c
+++ b/drivers/ap1000/ap.c
@@ -274,6 +274,8 @@ int ap_init(void)
blksize_size[MAJOR_NR] = ap_blocksizes;
read_ahead[MAJOR_NR] = 32; /* 16k read ahead */
+ for (i=0;i<NUM_APDEVS;i++)
+ register_disk(NILL, MKDEV(MAJOR_NR,i), 1, &ap_fops, 0);
return(0);
}
diff --git a/drivers/ap1000/ddv.c b/drivers/ap1000/ddv.c
index 4ab72a361..3e32c9c83 100644
--- a/drivers/ap1000/ddv.c
+++ b/drivers/ap1000/ddv.c
@@ -76,7 +76,7 @@ extern void ddv_load_kernel(char *opcodep);
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 @@ static struct gendisk ddv_gendisk = {
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 @@ static struct gendisk ddv_gendisk = {
NULL /* next */
};
-
struct ddv_geometry {
unsigned char heads;
unsigned char sectors;
@@ -166,7 +159,6 @@ static void ddv_release(struct inode * inode, struct file * filp)
#if DEBUG
printk("ddv_release started\n");
#endif
- sync_dev(inode->i_rdev);
#if DEBUG
printk("ddv_release done\n");
#endif
@@ -386,10 +378,11 @@ static int ddv_daemon(void *unused)
save_flags(flags); cli();
while (!rem_queue) {
- spin_lock_irq(&current->sigmask_lock);
+ spin_lock(&current->sigmask_lock);
flush_signals(current);
- spin_unlock_irq(&current->sigmask_lock);
+ spin_unlock(&current->sigmask_lock);
interruptible_sleep_on(&ddv_daemon_wait);
+ __sti(); cli();
}
rem = rem_queue;
@@ -695,6 +688,7 @@ static void ddv_open_reply(struct cap_request *creq)
wake_up(&busy_wait);
}
+extern struct block_device_operations ddv_fops;
static void ddv_load_opiu(void)
{
@@ -738,11 +732,10 @@ static void ddv_load_opiu(void)
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 @@ static int ddv_revalidate(kdev_t dev, struct gendisk *gdev)
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 @@ int ddv_init(void)
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 @@ static void ddv_geninit(struct gendisk *ignored)
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;
}