X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fblock%2Fparide%2Fpd.c;h=2403721f9db107509cc4ff8b628795a70290597e;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=202a5a74ad37ba6e3aee1edcac7ffe1c0482e4cf;hpb=cee37fe97739d85991964371c1f3a745c00dd236;p=linux-2.6.git diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index 202a5a74a..2403721f9 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c @@ -151,6 +151,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_GEO, D_SBY, D_DLY, D_SLV}; #include /* for the eject ioctl */ #include #include +#include #include #include #include @@ -275,7 +276,7 @@ static void pd_print_error(struct pd_unit *disk, char *msg, int status) int i; printk("%s: %s: status = 0x%x =", disk->name, msg, status); - for (i = 0; i < 18; i++) + for (i = 0; i < ARRAY_SIZE(pd_errs); i++) if (status & (1 << i)) printk(" %s", pd_errs[i]); printk("\n"); @@ -723,7 +724,7 @@ static int pd_special_command(struct pd_unit *disk, rq.ref_count = 1; rq.waiting = &wait; rq.end_io = blk_end_sync_rq; - blk_insert_request(disk->gd->queue, &rq, 0, func, 0); + blk_insert_request(disk->gd->queue, &rq, 0, func); wait_for_completion(&wait); rq.waiting = NULL; if (rq.errors) @@ -747,32 +748,33 @@ static int pd_open(struct inode *inode, struct file *file) return 0; } +static int pd_getgeo(struct block_device *bdev, struct hd_geometry *geo) +{ + struct pd_unit *disk = bdev->bd_disk->private_data; + + if (disk->alt_geom) { + geo->heads = PD_LOG_HEADS; + geo->sectors = PD_LOG_SECTS; + geo->cylinders = disk->capacity / (geo->heads * geo->sectors); + } else { + geo->heads = disk->heads; + geo->sectors = disk->sectors; + geo->cylinders = disk->cylinders; + } + + return 0; +} + static int pd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { struct pd_unit *disk = inode->i_bdev->bd_disk->private_data; - struct hd_geometry __user *geo = (struct hd_geometry __user *) arg; - struct hd_geometry g; switch (cmd) { case CDROMEJECT: if (disk->access == 1) pd_special_command(disk, pd_eject); return 0; - case HDIO_GETGEO: - if (disk->alt_geom) { - g.heads = PD_LOG_HEADS; - g.sectors = PD_LOG_SECTS; - g.cylinders = disk->capacity / (g.heads * g.sectors); - } else { - g.heads = disk->heads; - g.sectors = disk->sectors; - g.cylinders = disk->cylinders; - } - g.start = get_start_sect(inode->i_bdev); - if (copy_to_user(geo, &g, sizeof(struct hd_geometry))) - return -EFAULT; - return 0; default: return -EINVAL; } @@ -815,6 +817,7 @@ static struct block_device_operations pd_fops = { .open = pd_open, .release = pd_release, .ioctl = pd_ioctl, + .getgeo = pd_getgeo, .media_changed = pd_check_media, .revalidate_disk= pd_revalidate };