int mntn_upadte_history_info(const char *ptimestr, const char *preason) { int iret = 0; char fullpath_arr[MNTN_FULLPATH_STRING_LEN + 1] = {0}; char countent_arr[MNTN_FULLPATH_STRING_LEN + 1] = {0}; int bytes = 0; uint ulen = 0; memset(fullpath_arr, 0, MNTN_FULLPATH_STRING_LEN); strncat(fullpath_arr, MNTN_AP_LOGDIR, strlen(MNTN_AP_LOGDIR)); strncat(fullpath_arr, MNTN_HISTORY_LOG, strlen(MNTN_HISTORY_LOG)); /*Write reset reason into history.log*/ memset(countent_arr, 0, sizeof(countent_arr)); strncat(countent_arr, ptimestr, strlen(ptimestr)); strncat(countent_arr, " : ", strlen(" : ")); strncat(countent_arr, preason, strlen(preason)); ulen = strlen(countent_arr); bytes = mntn_filesys_write_log((const char *)fullpath_arr, (void*)countent_arr, ulen, 0); if (bytes != ulen) { MNTN_FILESYS_PRINT(KERN_ERR"mntn_err: Fail to write all the data into the file, %d/%d\n", bytes, ulen); iret = -1; } iret += mntn_filesys_chown((const char *)fullpath_arr, MNTN_LOG_FILE_OWNER_UID, MNTN_LOG_FILE_OWNER_GID); if (0 != iret) { MNTN_FILESYS_PRINT(KERN_ERR"mntn_err: Fail to chown history.log!\n"); } return iret; }
/* work for rdr lpm3 */ static int rdr_lpm3_thread_body(void *arg) { char *lpmcu_ddr_base = NULL; while (1) { if (down_interruptible(&rdr_lpm3_sem)) { return -1; } pr_err(" %s %d pfn_cb_dumpdone:%p\n", __func__, __LINE__, pfn_cb_dumpdone); if (pfn_cb_dumpdone != NULL) { strncat(g_lpmcu_ddr_memory_path, "/lpmcu_log/lpmcu_ddr_memory.bin", LPMCU_DDR_MEM_PART_PATH_LEN); lpmcu_ddr_base = (char *)ioremap((phys_addr_t)HISI_RESERVED_LPMX_CORE_PHYMEM_BASE_UNIQUE, HISI_RESERVED_LPMX_CORE_PHYMEM_SIZE); if (lpmcu_ddr_base) { mntn_filesys_write_log(g_lpmcu_ddr_memory_path, lpmcu_ddr_base, HISI_RESERVED_LPMX_CORE_PHYMEM_SIZE, 0); iounmap(lpmcu_ddr_base); lpmcu_ddr_base = NULL; } pfn_cb_dumpdone(g_modid, current_core_id); pfn_cb_dumpdone = NULL; pr_err("modid:0x%x,coreid:0x%llx\n", g_modid, current_core_id); } } }