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

Function trace_mkdir

dpdk/lib/eal/common/eal_common_trace_utils.c:302–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302static int
303trace_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
356static int
357trace_meta_save(struct trace *trace)

Callers 1

rte_trace_saveFunction · 0.85

Calls 5

trace_obj_getFunction · 0.85
trace_dir_updateFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected