dm: virtio: refine header file

Reuse linux common virtio header file and remove the repetitive
definition.

Tracked-On: #2145
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Conghui Chen
2018-12-21 21:57:05 +00:00
committed by wenlingz
parent 738f2536fe
commit 5253ac7af5
12 changed files with 161 additions and 345 deletions

View File

@@ -67,7 +67,7 @@
(VIRTIO_BLK_F_SEG_MAX | \
VIRTIO_BLK_F_BLK_SIZE | \
VIRTIO_BLK_F_TOPOLOGY | \
ACRN_VIRTIO_RING_F_INDIRECT_DESC) /* indirect descriptors */
(1 << VIRTIO_RING_F_INDIRECT_DESC)) /* indirect descriptors */
/*
* Writeback cache bits
@@ -230,7 +230,7 @@ virtio_blk_proc(struct virtio_blk *blk, struct virtio_vq_info *vq)
assert(n >= 2 && n <= BLOCKIF_IOV_MAX + 2);
io = &blk->ios[idx];
assert((flags[0] & ACRN_VRING_DESC_F_WRITE) == 0);
assert((flags[0] & VRING_DESC_F_WRITE) == 0);
assert(iov[0].iov_len == sizeof(struct virtio_blk_hdr));
vbh = iov[0].iov_base;
memcpy(&io->req.iov, &iov[1], sizeof(struct iovec) * (n - 2));
@@ -238,7 +238,7 @@ virtio_blk_proc(struct virtio_blk *blk, struct virtio_vq_info *vq)
io->req.offset = vbh->sector * DEV_BSIZE;
io->status = iov[--n].iov_base;
assert(iov[n].iov_len == 1);
assert(flags[n] & ACRN_VRING_DESC_F_WRITE);
assert(flags[n] & VRING_DESC_F_WRITE);
/*
* XXX
@@ -257,7 +257,7 @@ virtio_blk_proc(struct virtio_blk *blk, struct virtio_vq_info *vq)
* therefore test the inverse of the descriptor bit
* to the op.
*/
assert(((flags[i] & ACRN_VRING_DESC_F_WRITE) == 0) == writeop);
assert(((flags[i] & VRING_DESC_F_WRITE) == 0) == writeop);
iolen += iov[i].iov_len;
}
io->req.resid = iolen;