Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 234f2725 authored by john cooper's avatar john cooper Committed by Rusty Russell
Browse files

Add virtio disk identification ioctl



Return serial string to the guest application via
ioctl driver call.

Note this form of interface to the guest userland
was the consensus when the prior version using
the ATA_IDENTIFY came under dispute.

Signed-off-by: default avatarjohn cooper <john.cooper@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 4cb2ea28
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -225,6 +225,16 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode,
	struct gendisk *disk = bdev->bd_disk;
	struct gendisk *disk = bdev->bd_disk;
	struct virtio_blk *vblk = disk->private_data;
	struct virtio_blk *vblk = disk->private_data;


	if (cmd == 'VBID') {
		void __user *usr_data = (void __user *)data;
		char id_str[VIRTIO_BLK_ID_BYTES];
		int err;

		err = virtblk_get_id(disk, id_str);
		if (!err && copy_to_user(usr_data, id_str, VIRTIO_BLK_ID_BYTES))
			err = -EFAULT;
		return err;
	}
	/*
	/*
	 * Only allow the generic SCSI ioctls if the host can support it.
	 * Only allow the generic SCSI ioctls if the host can support it.
	 */
	 */