aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2020-12-07Remove sock_flags from struct vfu_ctx (#163)swapnili2-7/+5
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2020-12-04implement VFIO_USER_FLAG_NO_REPLY (#157)John Levon1-6/+14
Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-02don't spam logs when closing unexpected file descriptorThanos Makatos1-7/+3
A malicious client might take advantage of this behavior. Also, don't differentiate between failure and extraneous FD cases. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-02replace struct vfu_mmap_area with struct iovecThanos Makatos2-6/+6
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-02emit warning when receiving extraneous file descriptorsThanos Makatos1-1/+7
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-02rename VFU_REG_FLAG_* (#145)John Levon4-9/+9
We renamed other code to be "REGION" instead of "REG" so it's less ambiguous. Do the same for VFU_REG_FLAG_*. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-12-02use log level defines from syslogThanos Makatos10-170/+170
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-02Merge pull request #144 from tmakatos/issues/106Thanos2-14/+41
introduce device and PCI types
2020-12-02introduce PCI typesThanos Makatos2-13/+32
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-02introduce device typeThanos Makatos2-1/+9
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-01Check for truncated response in get_request_sock() (#142)swapnili1-0/+4
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2020-12-01drop unnecessary restore_fdThanos Makatos2-15/+7
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-01log when closing unused file descriptorThanos Makatos1-0/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-01remove obsolete commentThanos Makatos1-2/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-01make consume_fd to return the fd it consumesThanos Makatos3-12/+30
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-01introduce consume_fd to simplify tracking of passed file descriptorsThanos Makatos3-25/+29
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-01also closed unused file descriptors on successThanos Makatos1-3/+5
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-01remove obsolete FIXMEThanos Makatos1-1/+0
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-01don't leak passed file descriptors on failureThanos Makatos5-38/+77
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-30Misc cleanup (#138)swapnili2-40/+36
* Rename vfu_ctx_destroy() to vfu_destroy_ctx() * Remove unused function copy_sparse_mmap_area() * Coding style fixes Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2020-11-30Update API's to accept sparse mmap areas as array and its count (#134)swapnili2-12/+20
* Pass region mmap areas as array * Pass migration sparse mmap areas as array * Move struct vfu_sparse_mmap_areas to lib/priv.h Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-27refactor process_requestThanos Makatos1-61/+83
This patch refactors process_request to simplify code in the following way: 1. Failures before exec_command do not require a response to be sent and all passed descriptors must be released. 2. Failures after exec_command require a response. File descriptors must be released depending on how many file descriptors where successfully consumed. This refactoring makes it simpler to implement releasing file descriptors in the 2nd case. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-27rename to libvfio-user (#128)John Levon18-1088/+1041
The muser name no longer reflects the implementation, and will just serve to confuse. Bite the bullet now, and rename ourselves to reflect the actual implementation. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-11-27add unit tests for DMA regions without file descriptorThanos Makatos4-17/+29
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-27allow DMA regions without file descriptorThanos Makatos2-52/+58
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-27add assertThanos Makatos1-0/+2
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-25handle_dma_map_or_unmap(): correct fd handling (#118)John Levon1-14/+24
We shouldn't consume fd's for regions lacking VFIO_USER_F_DMA_REGION_MAPPABLE. In addition, we'll ignore such a region (this is a temporary hack). Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com> Signed-off-by: John Levon <john.levon@nutanix.com>
2020-11-25PCI regions idx enum renamed to start with LM_PCI (#125)swapnili3-14/+14
* PCI regions idx enum renamed to start with LM_PCI Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-11-25Split log setup from lm_create_ctx() to lm_setup_log() (#126)swapnili1-3/+15
* Split log setup from lm_create_ctx() to lm_setup_log() Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-11-25introduce cmocka unit test framework and first unit testThanos Makatos2-1/+6
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-25ignore DMA map/unmap if device isn't using DMA controllerThanos Makatos1-4/+4
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-24Api refactoring (#115)swapnili9-285/+415
API refactoring
2020-11-24clean up headersJohn Levon16-1468/+94
Introduce include/ dir for public headers, and clean up include guards etc.
2020-11-24get_request_sock: set nr_fds always (#116)John Levon1-0/+2
2020-11-24refactor sock send/recv functions (#114)John Levon5-72/+132
Use shorter, more readable, function names, add re-jig the wrappers such that the most common operations are shortest.
2020-11-24parse VFIO_USER_VERSION JSON stanzaJohn Levon7-66/+205
2020-11-23move IRQ into separate fileThanos Makatos4-390/+476
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-23don't attempt to close invalid file desriptorThanos Makatos1-1/+3
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-23don't dereference NULL pointerThanos Makatos1-1/+5
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-23fix printf argsThanos Makatos4-27/+29
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-23don't pass -1 to fstatThanos Makatos1-0/+10
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-23don't omit argument from printfThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-23silence false positive coverity about out-of-bounds writeThanos Makatos1-2/+2
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-23don't leak fd on failureThanos Makatos1-0/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-20don't expose migration as regionThanos Makatos5-64/+94
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-20don't attach before initializing the DMA controllerThanos Makatos1-12/+12
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-20drop pci_info from lm_ctxThanos Makatos2-34/+29
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-20silence false-positive -Wmaybe-uninitialized warning in GCC 7Thanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-20move migration into separate fileThanos Makatos6-419/+549
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-19enable assert() in release builds (#98)John Levon4-8/+9