From ed8d07f23214ae559c4d1e24298f7334368c1fa5 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 1 Oct 2008 22:08:53 +0000 Subject: Collect N identical (or near identical) mkdumpheader() implementations into one, as threatened in the comment. Textdump magic can be passed in. --- sys/ia64/ia64/dump_machdep.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'sys/ia64') diff --git a/sys/ia64/ia64/dump_machdep.c b/sys/ia64/ia64/dump_machdep.c index a2dfe45..db73271 100644 --- a/sys/ia64/ia64/dump_machdep.c +++ b/sys/ia64/ia64/dump_machdep.c @@ -60,27 +60,6 @@ static off_t dumplo, fileofs; static char buffer[DEV_BSIZE]; static size_t fragsz; -/* XXX should be MI */ -static void -mkdumpheader(struct kerneldumpheader *kdh, uint32_t archver, uint64_t dumplen, - uint32_t blksz) -{ - - bzero(kdh, sizeof(*kdh)); - strncpy(kdh->magic, KERNELDUMPMAGIC, 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); -} - static int buf_write(struct dumperinfo *di, char *ptr, size_t sz) { @@ -261,7 +240,7 @@ dumpsys(struct dumperinfo *di) dumplo = di->mediaoffset + di->mediasize - dumpsize; dumplo -= sizeof(kdh) * 2; - mkdumpheader(&kdh, KERNELDUMP_IA64_VERSION, dumpsize, di->blocksize); + mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_IA64_VERSION, dumpsize, di->blocksize); printf("Dumping %llu MB (%d chunks)\n", (long long)dumpsize >> 20, ehdr.e_phnum); -- cgit v1.1