- i = 0;
- /* Parsing each object and initiating them*/
- while ((dir = readdir(d)) != NULL) {
- if (dir->d_type != DT_LNK)
- continue;
- if (!strncmp("dprc", dir->d_name, 4) ||
- !strncmp("dpmcp", dir->d_name, 5))
- continue;
- dev_name = malloc(sizeof(dir->d_name));
- if (!dev_name) {
- FSLMC_VFIO_LOG(ERR, "name: Unable to allocate memory");
- goto FAILURE;
- }
- strcpy(dev_name, dir->d_name);
- object_type = strtok(dir->d_name, ".");
- temp_obj = strtok(NULL, ".");
- sscanf(temp_obj, "%d", &object_id);
-
- /* getting the device fd*/
- dev_fd = ioctl(group->fd, VFIO_GROUP_GET_DEVICE_FD, dev_name);
- if (dev_fd < 0) {
- FSLMC_VFIO_LOG(ERR,
- "GET_DEVICE_FD error fd: %s, Group: %d",
- dev_name, group->fd);
- free(dev_name);
- goto FAILURE;
- }
-
- free(dev_name);
- vdev = &group->vfio_device[group->object_index++];
- vdev->fd = dev_fd;
- vdev->index = i;
- i++;
- /* Get Device inofrmation */
- if (ioctl(vdev->fd, VFIO_DEVICE_GET_INFO, &device_info)) {
- FSLMC_VFIO_LOG(ERR, "DPAA2 VFIO_DEVICE_GET_INFO fail");
- goto FAILURE;
- }
- if (!strcmp(object_type, "dpni") ||
- !strcmp(object_type, "dpseci")) {
- struct rte_dpaa2_device *dev;