static int ipanic_write_android_buf(struct mtd_info *mtd, unsigned int off, int type) { struct mtd_ipanic_data *ctx = &mtd_drv_ctx; int saved_oip; int rc, rc2; unsigned int last_chunk = 0, copy_count = 0; while (!last_chunk) { saved_oip = oops_in_progress; oops_in_progress = 1; rc = panic_dump_android_log(ctx->bounce, mtd->writesize, type); BUG_ON(rc < 0); copy_count += rc; if (rc == 0) last_chunk = rc; oops_in_progress = saved_oip; if (rc <= 0) break; rc2 = mtd_ipanic_block_write(ctx, off, rc); if (rc2 <= 0) { xlog_printk(ANDROID_LOG_ERROR, IPANIC_LOG_TAG, "aee-ipanic: Flash write failed (%d)\n", rc2); return rc2; } off += rc2; } //xlog_printk(ANDROID_LOG_DEBUG, IPANIC_LOG_TAG, "dump droid log type %d, count %d\n", type, copy_count); return copy_count; }
static int ipanic_alog_buffer(void *data, unsigned char *buffer, size_t sz_buf) { int rc; rc = panic_dump_android_log(buffer, sz_buf, (unsigned long)data); if (rc < 0) rc = -1; return rc; }
static int ipanic_write_android_buf(unsigned int off, int type) { unsigned int copy_count = 0; while (1) { int rc = panic_dump_android_log(emmc_bounce, PAGE_SIZE, type); BUG_ON(rc < 0); if (rc <= 0) break; if (rc < PAGE_SIZE) { memset(emmc_bounce + rc, 0, PAGE_SIZE - rc); } ipanic_block_scramble(emmc_bounce, PAGE_SIZE); if (card_dump_func_write(emmc_bounce, PAGE_SIZE, off, EMMC_ID)) { xlog_printk(ANDROID_LOG_ERROR, IPANIC_LOG_TAG, "aee-ipanic-emmc(%s): android log %d write failed, offset %d\n", __FUNCTION__, type, off); return -1; } copy_count += rc; off += PAGE_SIZE; } xlog_printk(ANDROID_LOG_DEBUG, IPANIC_LOG_TAG, "%s: dump droid log type %d, count %d\n", __FUNCTION__, type, copy_count); return copy_count; }