static int ipanic_write_all_android_buf(struct mtd_ipanic_data *ctx, int offset, struct ipanic_header *hdr)
{
	int rc;
	
	// main buffer:
	offset = ALIGN(offset, ctx->mtd->writesize);
	rc = ipanic_write_android_buf(ctx->mtd, offset, 1);
	if (rc < 0) {
		xlog_printk(ANDROID_LOG_ERROR, IPANIC_LOG_TAG, "Error writing android log(1) to panic log (%d)\n", rc);
		rc = 0;
	}
	hdr->android_main_offset = offset;
	hdr->android_main_length = rc;
	offset += rc;

#if 0
	// event buffer:
	offset = ALIGN(offset, ctx->mtd->writesize);
	rc = ipanic_write_android_buf(ctx->mtd, offset, 2);
	if (rc < 0) {
		xlog_printk(ANDROID_LOG_ERROR, IPANIC_LOG_TAG, "Error writing android log(2) to panic log (%d)\n", rc);
		rc = 0;
	}
	hdr->android_event_offset = offset;
	hdr->android_event_length = rc;
	offset += rc;
#endif

	// radio buffer:
	offset = ALIGN(offset, ctx->mtd->writesize);
	rc = ipanic_write_android_buf(ctx->mtd, offset, 3);
	if (rc < 0) {
		xlog_printk(ANDROID_LOG_ERROR, IPANIC_LOG_TAG, "Error writing android log(3) to panic log (%d)\n", rc);
		rc = 0;
	}
	hdr->android_radio_offset = offset;
	hdr->android_radio_length = rc;
	offset += rc;

	// system buffer:
	offset = ALIGN(offset, ctx->mtd->writesize);
	rc = ipanic_write_android_buf(ctx->mtd, offset, 4);
	if (rc < 0) {
		xlog_printk(ANDROID_LOG_ERROR, IPANIC_LOG_TAG, "Error writing android log(4) to panic log! (%d)\n", rc);
		rc = 0;
	}
	hdr->android_system_offset = offset;
	hdr->android_system_length = rc;
	offset += rc;

	return offset;
}
예제 #2
0
static int ipanic_write_all_android_buf(int offset, struct ipanic_header *hdr)
{
	int rc;

	// main buffer:
	offset = ALIGN(offset, EMMC_BLOCK_SIZE);
	rc = ipanic_write_android_buf(offset, 1);
	if (rc > 0) {
		hdr->android_main_offset = offset;
		hdr->android_main_length = rc;
		offset += rc;
	}
	else {
		xlog_printk(ANDROID_LOG_ERROR, IPANIC_LOG_TAG, "%s: Failed to write android main buffer\n", __func__);
	}

	// radio buffer:
	offset = ALIGN(offset, EMMC_BLOCK_SIZE);
	rc = ipanic_write_android_buf(offset, 3);
	if (rc > 0) {
		hdr->android_radio_offset = offset;
		hdr->android_radio_length = rc;
		offset += rc;
	}
	else {
		xlog_printk(ANDROID_LOG_ERROR, IPANIC_LOG_TAG, "%s: Failed to write android radio buffer\n", __func__);
	}

	// system buffer:
	offset = ALIGN(offset, EMMC_BLOCK_SIZE);
	rc = ipanic_write_android_buf(offset, 4) ; // system buffer.
	if (rc > 0) {
		hdr->android_system_offset = offset;
		hdr->android_system_length = rc;
		offset += rc;
	}
	else {
		xlog_printk(ANDROID_LOG_ERROR, IPANIC_LOG_TAG, "%s: Failed to write android system buffer\n", __func__);
	}
	return offset;
}