X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_usr%2Fv3_user_host_dev_example.c;h=043811bdca29d8bc92f37d621d71de853f932d3b;hb=8cd246c3830733c2850cef049a7ad153daf0dd13;hp=833f3c5fe91aa820774aa635bbdf5eea890e5125;hpb=5ac6ebe490fe6ebb948dd68736c693a3bb2f82dc;p=palacios.git diff --git a/linux_usr/v3_user_host_dev_example.c b/linux_usr/v3_user_host_dev_example.c index 833f3c5..043811b 100644 --- a/linux_usr/v3_user_host_dev_example.c +++ b/linux_usr/v3_user_host_dev_example.c @@ -17,7 +17,7 @@ void usage() int do_work(struct palacios_host_dev_host_request_response *req, struct palacios_host_dev_host_request_response **resp) { - uint64_t datasize; + uint64_t datasize=0; // // @@ -25,12 +25,17 @@ int do_work(struct palacios_host_dev_host_request_response *req, // // uint64_t v3_user_host_dev_read_guest_mem(int devfd, void *gpa, void *dest, uint64_t len); // uint64_t v3_user_host_dev_write_guest_mem(int devfd, void *gpa, void *src, uint64_t len); - // int v3_user_host_dev_inject_guest_irq(int devfd, uint8_t irq); + // int v3_user_host_dev_raise_irq(int devfd, uint8_t irq); + // int v3_user_host_dev_lower_irq(int devfd, uint8_t irq); // // determine datasize - # bytes to include in response // // now built a response *resp = malloc(sizeof(struct palacios_host_dev_host_request_response) + datasize); + if (!*resp) { + fprintf(stderr, "ERROR: could not allocate memory for response\n"); + return -1; + } (*resp)->data_len = sizeof(struct palacios_host_dev_host_request_response) + datasize; //