X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_stream.c;h=c7a2e5127f7e6a582eeb57eff82c482dd3fee205;hb=b3e5aa263c35961c74e0b7ed96b8510e8c6d7d0d;hp=729c6611552339734406fdec71949cff86159336;hpb=8330d6bb32172ba7c50b4e242e0213c8a9e1424e;p=palacios.git diff --git a/palacios/src/palacios/vmm_stream.c b/palacios/src/palacios/vmm_stream.c index 729c661..c7a2e51 100644 --- a/palacios/src/palacios/vmm_stream.c +++ b/palacios/src/palacios/vmm_stream.c @@ -18,13 +18,40 @@ */ -#include #include #include #include +#include +#include + +static struct v3_stream_hooks * stream_hooks = NULL; + +// VM can be NULL +v3_stream_t v3_stream_open(struct v3_vm_info * vm, const char * name) { + V3_ASSERT(stream_hooks != NULL); + V3_ASSERT(stream_hooks->open != NULL); + + return stream_hooks->open(name, vm->host_priv_data); +} + +int v3_stream_write(v3_stream_t stream, uint8_t * buf, uint32_t len) { + V3_ASSERT(stream_hooks != NULL); + V3_ASSERT(stream_hooks->write != NULL); + + return stream_hooks->write(stream, buf, len); +} + +void v3_stream_close(v3_stream_t stream) { + V3_ASSERT(stream_hooks != NULL); + V3_ASSERT(stream_hooks->close != NULL); + + return stream_hooks->close(stream); +} + + + -struct v3_stream_hooks * stream_hooks = 0; void V3_Init_Stream(struct v3_stream_hooks * hooks) { stream_hooks = hooks;