Changeset View
Changeset View
Standalone View
Standalone View
sys/ddb/db_textdump.c
Show First 20 Lines • Show All 451 Lines • ▼ Show 20 Lines | textdump_dumpsys(struct dumperinfo *di) | ||||
/* | /* | ||||
* Position the start of the dump so that we'll write the kernel dump | * Position the start of the dump so that we'll write the kernel dump | ||||
* trailer immediately before the end of the partition, and then work | * trailer immediately before the end of the partition, and then work | ||||
* our way back. We will rewrite this header later to reflect the | * our way back. We will rewrite this header later to reflect the | ||||
* true size if things go well. | * true size if things go well. | ||||
*/ | */ | ||||
textdump_offset = di->mediasize - sizeof(kdh); | textdump_offset = di->mediasize - sizeof(kdh); | ||||
textdump_saveoff(&trailer_offset); | textdump_saveoff(&trailer_offset); | ||||
mkdumpheader(&kdh, TEXTDUMPMAGIC, KERNELDUMP_TEXT_VERSION, 0, 0, | dump_init_header(di, &kdh, TEXTDUMPMAGIC, KERNELDUMP_TEXT_VERSION, 0); | ||||
TEXTDUMP_BLOCKSIZE); | |||||
(void)textdump_writenextblock(di, (char *)&kdh); | (void)textdump_writenextblock(di, (char *)&kdh); | ||||
/* | /* | ||||
* Write a series of files in ustar format. | * Write a series of files in ustar format. | ||||
*/ | */ | ||||
if (textdump_do_ddb) | if (textdump_do_ddb) | ||||
db_capture_dump(di); | db_capture_dump(di); | ||||
#ifdef INCLUDE_CONFIG_FILE | #ifdef INCLUDE_CONFIG_FILE | ||||
if (textdump_do_config) | if (textdump_do_config) | ||||
textdump_dump_config(di); | textdump_dump_config(di); | ||||
#endif | #endif | ||||
if (textdump_do_msgbuf) | if (textdump_do_msgbuf) | ||||
textdump_dump_msgbuf(di); | textdump_dump_msgbuf(di); | ||||
if (textdump_do_panic && panicstr != NULL) | if (textdump_do_panic && panicstr != NULL) | ||||
textdump_dump_panic(di); | textdump_dump_panic(di); | ||||
if (textdump_do_version) | if (textdump_do_version) | ||||
textdump_dump_version(di); | textdump_dump_version(di); | ||||
/* | /* | ||||
* Now that we know the true size, we can write out the header, then | * Now that we know the true size, we can write out the header, then | ||||
* seek back to the end and rewrite the trailer with the correct | * seek back to the end and rewrite the trailer with the correct | ||||
* size. | * size. | ||||
*/ | */ | ||||
dumplen = trailer_offset - (textdump_offset + TEXTDUMP_BLOCKSIZE); | dumplen = trailer_offset - (textdump_offset + TEXTDUMP_BLOCKSIZE); | ||||
mkdumpheader(&kdh, TEXTDUMPMAGIC, KERNELDUMP_TEXT_VERSION, dumplen, 0, | dump_init_header(di, &kdh, TEXTDUMPMAGIC, KERNELDUMP_TEXT_VERSION, | ||||
TEXTDUMP_BLOCKSIZE); | dumplen); | ||||
(void)textdump_writenextblock(di, (char *)&kdh); | (void)textdump_writenextblock(di, (char *)&kdh); | ||||
textdump_restoreoff(trailer_offset); | textdump_restoreoff(trailer_offset); | ||||
(void)textdump_writenextblock(di, (char *)&kdh); | (void)textdump_writenextblock(di, (char *)&kdh); | ||||
/* | /* | ||||
* Terminate the dump, report any errors, and clear the pending flag. | * Terminate the dump, report any errors, and clear the pending flag. | ||||
*/ | */ | ||||
if (textdump_error == 0) | if (textdump_error == 0) | ||||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |