| 80 | } |
| 81 | |
| 82 | int |
| 83 | vmbus_uio_alloc_resource(struct rte_vmbus_device *dev, |
| 84 | struct mapped_vmbus_resource **uio_res) |
| 85 | { |
| 86 | char devname[PATH_MAX]; /* contains the /dev/uioX */ |
| 87 | int fd; |
| 88 | |
| 89 | /* save fd if in primary process */ |
| 90 | snprintf(devname, sizeof(devname), "/dev/uio%u", dev->uio_num); |
| 91 | fd = open(devname, O_RDWR); |
| 92 | if (fd < 0) { |
| 93 | VMBUS_LOG(ERR, "Cannot open %s: %s", |
| 94 | devname, strerror(errno)); |
| 95 | goto error; |
| 96 | } |
| 97 | |
| 98 | if (rte_intr_fd_set(dev->intr_handle, fd)) |
| 99 | goto error; |
| 100 | |
| 101 | if (rte_intr_type_set(dev->intr_handle, RTE_INTR_HANDLE_UIO_INTX)) |
| 102 | goto error; |
| 103 | |
| 104 | /* allocate the mapping details for secondary processes*/ |
| 105 | *uio_res = rte_zmalloc("UIO_RES", sizeof(**uio_res), 0); |
| 106 | if (*uio_res == NULL) { |
| 107 | VMBUS_LOG(ERR, "cannot store uio mmap details"); |
| 108 | goto error; |
| 109 | } |
| 110 | |
| 111 | strlcpy((*uio_res)->path, devname, PATH_MAX); |
| 112 | rte_uuid_copy((*uio_res)->id, dev->device_id); |
| 113 | |
| 114 | return 0; |
| 115 | |
| 116 | error: |
| 117 | vmbus_uio_free_resource(dev, *uio_res); |
| 118 | return -1; |
| 119 | } |
| 120 | |
| 121 | static int |
| 122 | find_max_end_va(const struct rte_memseg_list *msl, void *arg) |
no test coverage detected