| 232 | } |
| 233 | |
| 234 | static int |
| 235 | get_seg_memfd(struct hugepage_info *hi __rte_unused, |
| 236 | unsigned int list_idx __rte_unused, |
| 237 | unsigned int seg_idx __rte_unused) |
| 238 | { |
| 239 | #ifdef MEMFD_SUPPORTED |
| 240 | int fd; |
| 241 | char segname[250]; /* as per manpage, limit is 249 bytes plus null */ |
| 242 | |
| 243 | int flags = RTE_MFD_HUGETLB | pagesz_flags(hi->hugepage_sz); |
| 244 | const struct internal_config *internal_conf = |
| 245 | eal_get_internal_configuration(); |
| 246 | |
| 247 | if (internal_conf->single_file_segments) { |
| 248 | fd = fd_list[list_idx].memseg_list_fd; |
| 249 | |
| 250 | if (fd < 0) { |
| 251 | snprintf(segname, sizeof(segname), "seg_%i", list_idx); |
| 252 | fd = memfd_create(segname, flags); |
| 253 | if (fd < 0) { |
| 254 | RTE_LOG(DEBUG, EAL, "%s(): memfd create failed: %s\n", |
| 255 | __func__, strerror(errno)); |
| 256 | return -1; |
| 257 | } |
| 258 | fd_list[list_idx].memseg_list_fd = fd; |
| 259 | } |
| 260 | } else { |
| 261 | fd = fd_list[list_idx].fds[seg_idx]; |
| 262 | |
| 263 | if (fd < 0) { |
| 264 | snprintf(segname, sizeof(segname), "seg_%i-%i", |
| 265 | list_idx, seg_idx); |
| 266 | fd = memfd_create(segname, flags); |
| 267 | if (fd < 0) { |
| 268 | RTE_LOG(DEBUG, EAL, "%s(): memfd create failed: %s\n", |
| 269 | __func__, strerror(errno)); |
| 270 | return -1; |
| 271 | } |
| 272 | fd_list[list_idx].fds[seg_idx] = fd; |
| 273 | } |
| 274 | } |
| 275 | return fd; |
| 276 | #endif |
| 277 | return -1; |
| 278 | } |
| 279 | |
| 280 | static int |
| 281 | get_seg_fd(char *path, int buflen, struct hugepage_info *hi, |
no test coverage detected