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

Commit 3225beab authored by Rusty Russell's avatar Rusty Russell
Browse files

virtio_blk: Revert serial number support



This reverts "Add serial number support for virtio_blk, V4a".

Turns out that virtio_pci, lguest and s/390 all have an 8 bit limit
on virtio config space, so noone could ever use this.

This is coming back later in a cleaner form.

Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Cc: john cooper <john.cooper@redhat.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
parent e95646c3
Loading
Loading
Loading
Loading
+3 −34
Original line number Original line Diff line number Diff line
@@ -182,34 +182,6 @@ static void do_virtblk_request(struct request_queue *q)
		vblk->vq->vq_ops->kick(vblk->vq);
		vblk->vq->vq_ops->kick(vblk->vq);
}
}


/* return ATA identify data
 */
static int virtblk_identify(struct gendisk *disk, void *argp)
{
	struct virtio_blk *vblk = disk->private_data;
	void *opaque;
	int err = -ENOMEM;

	opaque = kmalloc(VIRTIO_BLK_ID_BYTES, GFP_KERNEL);
	if (!opaque)
		goto out;

	err = virtio_config_buf(vblk->vdev, VIRTIO_BLK_F_IDENTIFY,
		offsetof(struct virtio_blk_config, identify), opaque,
		VIRTIO_BLK_ID_BYTES);

	if (err)
		goto out_kfree;

	if (copy_to_user(argp, opaque, VIRTIO_BLK_ID_BYTES))
		err = -EFAULT;

out_kfree:
	kfree(opaque);
out:
	return err;
}

static void virtblk_prepare_flush(struct request_queue *q, struct request *req)
static void virtblk_prepare_flush(struct request_queue *q, struct request *req)
{
{
	req->cmd_type = REQ_TYPE_LINUX_BLOCK;
	req->cmd_type = REQ_TYPE_LINUX_BLOCK;
@@ -221,10 +193,6 @@ 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;
	void __user *argp = (void __user *)data;

	if (cmd == HDIO_GET_IDENTITY)
		return virtblk_identify(disk, argp);


	/*
	/*
	 * Only allow the generic SCSI ioctls if the host can support it.
	 * 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,
	if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI))
	if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI))
		return -ENOTTY;
		return -ENOTTY;


	return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp);
	return scsi_cmd_ioctl(disk->queue, disk, mode, cmd,
			      (void __user *)data);
}
}


/* We provide getgeo only to please some old bootloader/partitioning tools */
/* We provide getgeo only to please some old bootloader/partitioning tools */
@@ -443,7 +412,7 @@ static struct virtio_device_id id_table[] = {
static unsigned int features[] = {
static unsigned int features[] = {
	VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX,
	VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX,
	VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
	VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
	VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_IDENTIFY, VIRTIO_BLK_F_FLUSH
	VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_FLUSH
};
};


/*
/*
+0 −4
Original line number Original line Diff line number Diff line
@@ -14,11 +14,8 @@
#define VIRTIO_BLK_F_RO		5	/* Disk is read-only */
#define VIRTIO_BLK_F_RO		5	/* Disk is read-only */
#define VIRTIO_BLK_F_BLK_SIZE	6	/* Block size of disk is available*/
#define VIRTIO_BLK_F_BLK_SIZE	6	/* Block size of disk is available*/
#define VIRTIO_BLK_F_SCSI	7	/* Supports scsi command passthru */
#define VIRTIO_BLK_F_SCSI	7	/* Supports scsi command passthru */
#define VIRTIO_BLK_F_IDENTIFY	8	/* ATA IDENTIFY supported */
#define VIRTIO_BLK_F_FLUSH	9	/* Cache flush command support */
#define VIRTIO_BLK_F_FLUSH	9	/* Cache flush command support */


#define VIRTIO_BLK_ID_BYTES	(sizeof(__u16[256]))	/* IDENTIFY DATA */

struct virtio_blk_config {
struct virtio_blk_config {
	/* The capacity (in 512-byte sectors). */
	/* The capacity (in 512-byte sectors). */
	__u64 capacity;
	__u64 capacity;
@@ -34,7 +31,6 @@ struct virtio_blk_config {
	} geometry;
	} geometry;
	/* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
	/* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
	__u32 blk_size;
	__u32 blk_size;
	__u8 identify[VIRTIO_BLK_ID_BYTES];
} __attribute__((packed));
} __attribute__((packed));


/*
/*