| 300 | } |
| 301 | |
| 302 | static int |
| 303 | trace_mkdir(void) |
| 304 | { |
| 305 | struct trace *trace = trace_obj_get(); |
| 306 | static bool already_done; |
| 307 | char *session; |
| 308 | int rc; |
| 309 | |
| 310 | if (already_done) |
| 311 | return 0; |
| 312 | |
| 313 | if (trace->dir == NULL) { |
| 314 | char *dir_path; |
| 315 | |
| 316 | rc = trace_dir_default_path_get(&dir_path); |
| 317 | if (rc < 0) { |
| 318 | trace_err("fail to get default path"); |
| 319 | return rc; |
| 320 | } |
| 321 | |
| 322 | rc = trace_dir_update(dir_path); |
| 323 | free(dir_path); |
| 324 | if (rc < 0) |
| 325 | return rc; |
| 326 | } |
| 327 | |
| 328 | /* Create the path if it t exist, no "mkdir -p" available here */ |
| 329 | rc = mkdir(trace->dir, 0700); |
| 330 | if (rc < 0 && errno != EEXIST) { |
| 331 | trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno)); |
| 332 | rte_errno = errno; |
| 333 | return -rte_errno; |
| 334 | } |
| 335 | |
| 336 | rc = trace_session_name_generate(&session); |
| 337 | if (rc < 0) |
| 338 | return rc; |
| 339 | rc = trace_dir_update(session); |
| 340 | free(session); |
| 341 | if (rc < 0) |
| 342 | return rc; |
| 343 | |
| 344 | rc = mkdir(trace->dir, 0700); |
| 345 | if (rc < 0) { |
| 346 | trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno)); |
| 347 | rte_errno = errno; |
| 348 | return -rte_errno; |
| 349 | } |
| 350 | |
| 351 | RTE_LOG(INFO, EAL, "Trace dir: %s\n", trace->dir); |
| 352 | already_done = true; |
| 353 | return 0; |
| 354 | } |
| 355 | |
| 356 | static int |
| 357 | trace_meta_save(struct trace *trace) |
no test coverage detected