patch-2.3.40 linux/drivers/block/paride/pd.c
Next file: linux/drivers/block/paride/pf.c
Previous file: linux/drivers/block/nbd.c
Back to the patch index
Back to the overall index
- Lines: 151
- Date:
Tue Jan 18 18:54:21 2000
- Orig file:
v2.3.39/linux/drivers/block/paride/pd.c
- Orig date:
Tue Jan 11 22:31:39 2000
diff -u --recursive --new-file v2.3.39/linux/drivers/block/paride/pd.c linux/drivers/block/paride/pd.c
@@ -263,7 +263,6 @@
#ifdef MODULE
void cleanup_module( void );
#endif
-static void pd_geninit(struct gendisk *ignored);
static int pd_open(struct inode *inode, struct file *file);
static void do_pd_request(request_queue_t * q);
static int pd_ioctl(struct inode *inode,struct file *file,
@@ -345,8 +344,6 @@
PD_NAME, /* Major name */
PD_BITS, /* Bits to shift to get real from partition */
PD_PARTNS, /* Number of partitions per real */
- PD_UNITS, /* maximum number of real */
- pd_geninit, /* init function */
pd_hd, /* hd struct */
pd_sizes, /* block sizes */
0, /* number */
@@ -401,26 +398,25 @@
pd_gendisk.major = major;
pd_gendisk.major_name = name;
pd_gendisk.next = gendisk_head;
- gendisk_head = &pd_gendisk;
+ gendisk_head = &pd_gendisk;
- for(i=0;i<PD_DEVS;i++) pd_blocksizes[i] = 1024;
- blksize_size[MAJOR_NR] = pd_blocksizes;
+ for(i=0;i<PD_DEVS;i++) pd_blocksizes[i] = 1024;
+ blksize_size[MAJOR_NR] = pd_blocksizes;
- printk("%s: %s version %s, major %d, cluster %d, nice %d\n",
- name,name,PD_VERSION,major,cluster,nice);
-
- return 0;
-}
-
-static void pd_geninit (struct gendisk *ignored)
-
-{ pd_init_units();
+ printk("%s: %s version %s, major %d, cluster %d, nice %d\n",
+ name,name,PD_VERSION,major,cluster,nice);
+ pd_init_units();
+ pd_valid = 0;
pd_gendisk.nr_real = pd_detect();
+ pd_valid = 1;
#ifdef MODULE
- if (!pd_gendisk.nr_real) cleanup_module();
+ if (!pd_gendisk.nr_real) {
+ cleanup_module();
+ return -1;
+ }
#endif
-
+ return 0;
}
static int pd_open (struct inode *inode, struct file *file)
@@ -502,8 +498,6 @@
{ kdev_t devp;
int unit;
- struct super_block *sb;
-
devp = inode->i_rdev;
unit = DEVICE_NR(devp);
@@ -566,8 +560,8 @@
pd_hd[minor].nr_sects = 0;
}
- pd_identify(unit);
- resetup_one_dev(&pd_gendisk,unit);
+ if (pd_identify(unit))
+ grok_partitions(&pd_gendisk,unit,1<<PD_BITS,PD.capacity);
pd_valid = 1;
wake_up(&pd_wait_open);
@@ -590,20 +584,7 @@
paride_init();
}
#endif
-
- err = pd_init();
- if (err) return err;
-
- pd_geninit(&pd_gendisk);
-
- if (!pd_gendisk.nr_real) return -1;
-
- pd_valid = 0;
- for (unit=0;unit<PD_UNITS;unit++)
- if (PD.present) resetup_one_dev(&pd_gendisk,unit);
- pd_valid = 1;
-
- return 0;
+ return pd_init();
}
void cleanup_module(void)
@@ -815,21 +796,19 @@
if (PD.capacity) pd_init_dev_parms(unit);
if (!PD.standby) pd_standby_off(unit);
-
- pd_hd[unit<<PD_BITS].nr_sects = PD.capacity;
- pd_hd[unit<<PD_BITS].start_sect = 0;
return 1;
}
static int pd_probe_drive( int unit )
-
-{ if (PD.drive == -1) {
- for (PD.drive=0;PD.drive<=1;PD.drive++)
- if (pd_identify(unit)) return 1;
- return 0;
- }
- else return pd_identify(unit);
+{
+ if (PD.drive == -1) {
+ for (PD.drive=0;PD.drive<=1;PD.drive++)
+ if (pd_identify(unit))
+ return 1;
+ return 0;
+ }
+ return pd_identify(unit);
}
static int pd_detect( void )
@@ -856,15 +835,18 @@
k = unit+1;
} else pi_release(PI);
}
+ for (unit=0;unit<PD_UNITS;unit++)
+ register_disk(&pd_gendisk,MKDEV(MAJOR_NR,unit<<PD_BITS),
+ PD_PARTNS,&pd_fops,
+ PD.present?PD.capacity:0);
/* We lie about the number of drives found, as the generic partition
scanner assumes that the drives are numbered sequentially from 0.
This can result in some bogus error messages if non-sequential
drive numbers are used.
*/
-
- if (k) return k;
-
+ if (k)
+ return k;
printk("%s: no valid drive found\n",name);
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)