Lines Matching defs:g_files

75 static struct LogFile *g_files = NULL;
184 if (g_files[i].file != NULL || g_files[i].valid == FILE_VALID) {
188 rc = memcpy_s(g_files[i].logName, sizeof(g_files[i].logName), logName, strlen(logName) + 1);
194 rc = memcpy_s(&g_files[i].uuid, sizeof(g_files[i].uuid), uuid, sizeof(struct TeeUuid));
200 g_files[i].file = file;
201 g_files[i].fileLen = fileLen;
202 g_files[i].fileIndex = index;
203 g_files[i].valid = FILE_VALID;
205 return &g_files[i];
608 if (g_files[fileNum].fileIndex >= LOG_FILE_INDEX_MAX) {
609 tloge("the file index is overflow %u\n", g_files[fileNum].fileIndex);
613 bool isTa = IsTaUuid(&g_files[fileNum].uuid);
615 GetUuidStr(&g_files[fileNum].uuid, uuidAscii, sizeof(uuidAscii));
624 SetFileNameAttr(&nameAttr, uuidAscii, isTa, g_files[fileNum].fileIndex + 1);
627 tloge("snprintf log name2 error %d %s %s %u\n", rc, g_teePath, uuidAscii, g_files[fileNum].fileIndex + 1);
641 if (g_files[fileNum].fileLen >= LOG_FILE_LIMIT) {
642 (void)fclose(g_files[fileNum].file);
644 if (g_files[fileNum].fileIndex >= (LOG_FILE_INDEX_MAX - 1)) {
646 LogFilesCompress(&g_files[fileNum].uuid);
652 errno_t rc = memset_s(&g_files[fileNum], sizeof(g_files[fileNum]), 0, sizeof(struct LogFile));
668 if (memcmp(&g_files[i].uuid, uuid, sizeof(struct TeeUuid)) != 0) {
672 if (g_files[i].valid != FILE_VALID) {
676 if (g_files[i].file == NULL) {
678 (void)memset_s(&g_files[i], sizeof(g_files[i]), 0, sizeof(g_files[i]));
687 tlogd("get log file %s\n", g_files[i].logName);
688 return &g_files[i];
766 if (g_files == NULL) {
775 if (g_files[i].file == NULL) {
779 tlogd("close file %s, fileLen %ld\n", g_files[i].logName, g_files[i].fileLen);
780 (void)fflush(g_files[i].file);
781 (void)fclose(g_files[i].file);
783 if (g_files[i].fileLen >= LOG_FILE_LIMIT) {
784 if (g_files[i].fileIndex >= (LOG_FILE_INDEX_MAX - 1)) {
786 LogFilesCompress(&g_files[i].uuid);
793 (void)memset_s(&g_files[i], sizeof(g_files[i]), 0, sizeof(g_files[i]));
1107 g_files = malloc(sizeof(struct LogFile) * LOG_FILES_MAX);
1108 if (g_files == NULL) {
1113 (void)memset_s(g_files, (sizeof(struct LogFile) * LOG_FILES_MAX), 0, (sizeof(struct LogFile) * LOG_FILES_MAX));
1142 if (g_files != NULL) {
1143 free(g_files);
1144 g_files = NULL;