Lines Matching defs:path
84 static char *ReadFile(const char *path)
87 if (stat(path, &fileStat) != 0 || fileStat.st_size <= 0) {
88 PLUGIN_LOGE("Invalid file %s or buffer %zu", path, fileStat.st_size);
92 realpath(path, realPath);
94 PLUGIN_CHECK(fd != NULL, return NULL, "Failed to fopen path %s", path);
98 PLUGIN_CHECK(buffer != NULL, break, "Failed to alloc memory for path %s", path);
100 PLUGIN_LOGE("Failed to read file %s errno:%d", path, errno);
144 PLUGIN_CHECK(len > 0, return false, "Failed to format path %s", fsPath);
165 PLUGIN_CHECK(len > 0, return false, "Failed to format path %s", filename);
176 PLUGIN_CHECK(len > 0, return false, "Failed to format path %s", filename);
187 static bool SetTraceEnabled(const char *path, bool enabled)
189 return WriteStrToFile(path, enabled ? "1" : "0");
200 PLUGIN_LOGE("SetBufferSize path %s %s", TRACE_BUFFER_SIZE_KB, buffer);
283 char *path = cJSON_GetStringValue(cJSON_GetArrayItem(paths, j));
284 PLUGIN_CHECK(path != NULL, continue);
285 if (!IsWritableFile(path)) {
286 PLUGIN_LOGW("Path %s is not writable for %s", path, name);
289 result = result && SetTraceEnabled(path, enabled);
331 PLUGIN_CHECK(len > 0, return false, "Failed to format path %s", TRACE_PATH);
378 static void DumpTrace(const TraceWorkspace *workspace, int outFd, const char *path)
380 int len = sprintf_s((char *)workspace->buffer, sizeof(workspace->buffer), "%s%s", workspace->traceRootPath, path);
381 PLUGIN_CHECK(len > 0, return, "Failed to format path %s", path);
410 PLUGIN_CHECK(len > 0, return false, "Failed to format path %s", TRACE_MARKER_PATH);
453 return -1, "No trace root path or config");
488 const char *path = workspace->compress ? TRACE_OUTPUT_PATH_ZIP : TRACE_OUTPUT_PATH;
489 int outFd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
494 PLUGIN_LOGE("Failed to open file '%s', err=%d", path, errno);