--- ubd.c~ Mon May 6 10:42:56 2002 +++ ubd.c Mon May 6 10:49:11 2002 @@ -888,33 +888,26 @@ /* If it already has been opened we can check the partitions * directly */ - if(dev->count){ - part->start_sect = 0; - register_disk(&ubd_gendisk, MKDEV(MAJOR_NR, offset), pcount, - &ubd_blops, part->nr_sects); - } - else if(dev->file){ - if(ubd_open_dev(dev) < 0){ - printk(KERN_ERR "unable to open %s for validation\n", - dev->file); - return 1; - } - + part->start_sect = 0; + if(!dev->count) { + if (dev->file) { + if(ubd_open_dev(dev) < 0){ + printk(KERN_ERR "unable to open %s for validation\n", + dev->file); + return 1; + } + } else return 1; + /* have to recompute sizes since we opened it */ err = ubd_file_size(dev, &dev->size); if(err) { ubd_close(dev); return 1; } - part->start_sect = 0; part->nr_sects = dev->size / hardsect_sizes[offset]; - register_disk(&ubd_gendisk, MKDEV(MAJOR_NR, offset), pcount, - &ubd_blops, part->nr_sects); - - /* we are done so close it */ - ubd_close(dev); - } - else return(1); + } + register_disk(&ubd_gendisk, MKDEV(MAJOR_NR, offset), pcount, + &ubd_blops, part->nr_sects); return(0); }