diff options
author | peter <peter@FreeBSD.org> | 2008-10-01 22:08:53 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2008-10-01 22:08:53 +0000 |
commit | ed8d07f23214ae559c4d1e24298f7334368c1fa5 (patch) | |
tree | 63a9bf6e972762df141963f82c26829a6b8cb9b8 /sys/kern/kern_shutdown.c | |
parent | 17415143e3ea50776074328a4bc9b5e9aa942dba (diff) | |
download | FreeBSD-src-ed8d07f23214ae559c4d1e24298f7334368c1fa5.zip FreeBSD-src-ed8d07f23214ae559c4d1e24298f7334368c1fa5.tar.gz |
Collect N identical (or near identical) mkdumpheader() implementations into
one, as threatened in the comment. Textdump magic can be passed in.
Diffstat (limited to 'sys/kern/kern_shutdown.c')
-rw-r--r-- | sys/kern/kern_shutdown.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index e6d4f44..238abc7 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include <sys/eventhandler.h> #include <sys/kdb.h> #include <sys/kernel.h> +#include <sys/kerneldump.h> #include <sys/kthread.h> #include <sys/malloc.h> #include <sys/mount.h> @@ -64,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include <sys/smp.h> /* smp_active */ #include <sys/sysctl.h> #include <sys/sysproto.h> +#include <sys/vimage.h> #include <ddb/ddb.h> @@ -686,3 +688,23 @@ dumpsys(struct dumperinfo *di __unused) printf("Kernel dumps not implemented on this architecture\n"); } #endif + +void +mkdumpheader(struct kerneldumpheader *kdh, char *magic, uint32_t archver, + uint64_t dumplen, uint32_t blksz) +{ + + bzero(kdh, sizeof(*kdh)); + strncpy(kdh->magic, magic, sizeof(kdh->magic)); + strncpy(kdh->architecture, MACHINE_ARCH, sizeof(kdh->architecture)); + kdh->version = htod32(KERNELDUMPVERSION); + kdh->architectureversion = htod32(archver); + kdh->dumplength = htod64(dumplen); + kdh->dumptime = htod64(time_second); + kdh->blocksize = htod32(blksz); + strncpy(kdh->hostname, G_hostname, sizeof(kdh->hostname)); + strncpy(kdh->versionstring, version, sizeof(kdh->versionstring)); + if (panicstr != NULL) + strncpy(kdh->panicstring, panicstr, sizeof(kdh->panicstring)); + kdh->parity = kerneldump_parity(kdh); +} |