MCPcopy Create free account
hub / github.com/F-Stack/f-stack / textdump_dumpsys

Function textdump_dumpsys

freebsd/ddb/db_textdump.c:430–517  ·  view source on GitHub ↗

* Commit text dump to disk. */

Source from the content-addressed store, hash-verified

428 * Commit text dump to disk.
429 */
430void
431textdump_dumpsys(struct dumperinfo *di)
432{
433 struct kerneldumpcrypto *kdc;
434 off_t dumplen, trailer_offset;
435
436 if (di->blocksize != TEXTDUMP_BLOCKSIZE) {
437 printf("Dump partition block size (%ju) not textdump "
438 "block size (%ju)", (uintmax_t)di->blocksize,
439 (uintmax_t)TEXTDUMP_BLOCKSIZE);
440 return;
441 }
442
443 /*
444 * We don't know a priori how large the dump will be, but we do know
445 * that we need to reserve space for metadata and that we need two
446 * dump headers. Also leave room for one ustar header and one block
447 * of data.
448 */
449 if (di->mediasize < SIZEOF_METADATA + 2 * sizeof(kdh)) {
450 printf("Insufficient space on dump partition for minimal textdump.\n");
451 return;
452 }
453 textdump_error = 0;
454
455 /*
456 * Disable EKCD because we don't provide encrypted textdumps.
457 */
458 kdc = di->kdcrypto;
459 di->kdcrypto = NULL;
460
461 /*
462 * Position the start of the dump so that we'll write the kernel dump
463 * trailer immediately before the end of the partition, and then work
464 * our way back. We will rewrite this header later to reflect the
465 * true size if things go well.
466 */
467 textdump_offset = di->mediasize - sizeof(kdh);
468 textdump_saveoff(&trailer_offset);
469 dump_init_header(di, &kdh, TEXTDUMPMAGIC, KERNELDUMP_TEXT_VERSION, 0);
470 (void)textdump_writenextblock(di, (char *)&kdh);
471
472 /*
473 * Write a series of files in ustar format.
474 */
475 if (textdump_do_ddb)
476 db_capture_dump(di);
477#ifdef INCLUDE_CONFIG_FILE
478 if (textdump_do_config)
479 textdump_dump_config(di);
480#endif
481 if (textdump_do_msgbuf)
482 textdump_dump_msgbuf(di);
483 if (textdump_do_panic && KERNEL_PANICKED())
484 textdump_dump_panic(di);
485 if (textdump_do_version)
486 textdump_dump_version(di);
487

Callers 1

doadumpFunction · 0.85

Calls 11

textdump_saveoffFunction · 0.85
dump_init_headerFunction · 0.85
textdump_writenextblockFunction · 0.85
db_capture_dumpFunction · 0.85
textdump_dump_configFunction · 0.85
textdump_dump_msgbufFunction · 0.85
textdump_dump_panicFunction · 0.85
textdump_dump_versionFunction · 0.85
textdump_restoreoffFunction · 0.85
dump_writeFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected