MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vmbus_uio_alloc_resource

Function vmbus_uio_alloc_resource

dpdk/drivers/bus/vmbus/linux/vmbus_uio.c:82–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82int
83vmbus_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
116error:
117 vmbus_uio_free_resource(dev, *uio_res);
118 return -1;
119}
120
121static int
122find_max_end_va(const struct rte_memseg_list *msl, void *arg)

Callers 1

vmbus_uio_map_primaryFunction · 0.85

Calls 7

snprintfFunction · 0.85
rte_intr_fd_setFunction · 0.85
rte_intr_type_setFunction · 0.85
rte_zmallocFunction · 0.85
rte_uuid_copyFunction · 0.85
vmbus_uio_free_resourceFunction · 0.85
strlcpyFunction · 0.50

Tested by

no test coverage detected