+int
+eal_trace_dir_args_save(char const *optarg)
+{
+ struct trace *trace = trace_obj_get();
+ uint32_t size = sizeof(trace->dir);
+ char *dir_path = NULL;
+ int rc;
+
+ if (optarg == NULL) {
+ trace_err("no optarg is passed");
+ return -EINVAL;
+ }
+
+ if (strlen(optarg) >= size) {
+ trace_err("input string is too big");
+ return -ENAMETOOLONG;
+ }
+
+ dir_path = (char *)calloc(1, size);
+ if (dir_path == NULL) {
+ trace_err("fail to allocate memory");
+ return -ENOMEM;
+ }
+
+ sprintf(dir_path, "%s/", optarg);
+ rc = trace_dir_update(dir_path);
+
+ free(dir_path);
+ return rc;
+}
+