diff options
author | Thomas Huth <thuth@redhat.com> | 2016-11-15 14:02:51 +0100 |
---|---|---|
committer | Alexey Kardashevskiy <aik@ozlabs.ru> | 2016-11-24 23:24:23 +1100 |
commit | 264553932ba3cee4b7472838daaecfaaa61c91da (patch) | |
tree | 0181e5cedf18fe482f0905509601b5ffb61f0459 /lib/libvirtio/virtio.code | |
parent | eee0d12dc541dd345d7931976e352ea5a6494155 (diff) | |
download | SLOF-264553932ba3cee4b7472838daaecfaaa61c91da.zip SLOF-264553932ba3cee4b7472838daaecfaaa61c91da.tar.gz SLOF-264553932ba3cee4b7472838daaecfaaa61c91da.tar.bz2 |
virtio: Implement block write support
Refactor the virtio-block code a little bit to provide block write access,
too. Write access to the first 34 sectors is not allowed, though, to avoid
that the user / client program accidentially destroys the partition table.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'lib/libvirtio/virtio.code')
-rw-r--r-- | lib/libvirtio/virtio.code | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libvirtio/virtio.code b/lib/libvirtio/virtio.code index 971a3cf..b8262ad 100644 --- a/lib/libvirtio/virtio.code +++ b/lib/libvirtio/virtio.code @@ -70,7 +70,16 @@ PRIM(virtio_X2d_blk_X2d_read) long cnt = TOS.n; POP; long blkno = TOS.n; POP; void *buf = TOS.a; - TOS.n = virtioblk_read(dev, buf, blkno, cnt); + TOS.n = virtioblk_transfer(dev, buf, blkno, cnt, VIRTIO_BLK_T_IN); +MIRP + +// : virtio-blk-write ( buf blkno cnt dev -- #written ) +PRIM(virtio_X2d_blk_X2d_write) + void *dev = TOS.a; POP; + long cnt = TOS.n; POP; + long blkno = TOS.n; POP; + void *buf = TOS.a; + TOS.n = virtioblk_transfer(dev, buf, blkno, cnt, VIRTIO_BLK_T_OUT); MIRP /******** virtio-fs ********/ |