aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/virtio_blk.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/virtio_blk.c')
-rw-r--r--drivers/block/virtio_blk.c37
1 files changed, 3 insertions, 34 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 55635d1f697d..51042f0ba7e1 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -182,34 +182,6 @@ static void do_virtblk_request(struct request_queue *q)
182 vblk->vq->vq_ops->kick(vblk->vq); 182 vblk->vq->vq_ops->kick(vblk->vq);
183} 183}
184 184
185/* return ATA identify data
186 */
187static int virtblk_identify(struct gendisk *disk, void *argp)
188{
189 struct virtio_blk *vblk = disk->private_data;
190 void *opaque;
191 int err = -ENOMEM;
192
193 opaque = kmalloc(VIRTIO_BLK_ID_BYTES, GFP_KERNEL);
194 if (!opaque)
195 goto out;
196
197 err = virtio_config_buf(vblk->vdev, VIRTIO_BLK_F_IDENTIFY,
198 offsetof(struct virtio_blk_config, identify), opaque,
199 VIRTIO_BLK_ID_BYTES);
200
201 if (err)
202 goto out_kfree;
203
204 if (copy_to_user(argp, opaque, VIRTIO_BLK_ID_BYTES))
205 err = -EFAULT;
206
207out_kfree:
208 kfree(opaque);
209out:
210 return err;
211}
212
213static void virtblk_prepare_flush(struct request_queue *q, struct request *req) 185static void virtblk_prepare_flush(struct request_queue *q, struct request *req)
214{ 186{
215 req->cmd_type = REQ_TYPE_LINUX_BLOCK; 187 req->cmd_type = REQ_TYPE_LINUX_BLOCK;
@@ -221,10 +193,6 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode,
221{ 193{
222 struct gendisk *disk = bdev->bd_disk; 194 struct gendisk *disk = bdev->bd_disk;
223 struct virtio_blk *vblk = disk->private_data; 195 struct virtio_blk *vblk = disk->private_data;
224 void __user *argp = (void __user *)data;
225
226 if (cmd == HDIO_GET_IDENTITY)
227 return virtblk_identify(disk, argp);
228 196
229 /* 197 /*
230 * Only allow the generic SCSI ioctls if the host can support it. 198 * Only allow the generic SCSI ioctls if the host can support it.
@@ -232,7 +200,8 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode,
232 if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI)) 200 if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI))
233 return -ENOTTY; 201 return -ENOTTY;
234 202
235 return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp); 203 return scsi_cmd_ioctl(disk->queue, disk, mode, cmd,
204 (void __user *)data);
236} 205}
237 206
238/* We provide getgeo only to please some old bootloader/partitioning tools */ 207/* We provide getgeo only to please some old bootloader/partitioning tools */
@@ -443,7 +412,7 @@ static struct virtio_device_id id_table[] = {
443static unsigned int features[] = { 412static unsigned int features[] = {
444 VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, 413 VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX,
445 VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, 414 VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
446 VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_IDENTIFY, VIRTIO_BLK_F_FLUSH 415 VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_FLUSH
447}; 416};
448 417
449/* 418/*