git: 5a96b88f05d1 - stable/13 - kerneldump: remove physical from dump routines

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Mon, 27 Jun 2022 19:35:39 UTC
The branch stable/13 has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=5a96b88f05d1b16637dc6bd7a387f601981ff593

commit 5a96b88f05d1b16637dc6bd7a387f601981ff593
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2022-05-13 13:40:05 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2022-06-27 19:32:06 +0000

    kerneldump: remove physical from dump routines
    
    It is unused, especially now that the underlying d_dumper methods do not
    accept the argument.
    
    Reviewed by:    markj
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D35174
    
    (cherry picked from commit db71383b8836a586051b25c20992066d153c6941)
---
 sys/amd64/amd64/minidump_machdep.c     |  4 ++--
 sys/arm/arm/minidump_machdep.c         |  4 ++--
 sys/arm64/arm64/minidump_machdep.c     |  4 ++--
 sys/ddb/db_textdump.c                  |  4 ++--
 sys/geom/raid/g_raid.c                 |  6 ++----
 sys/i386/i386/minidump_machdep_base.c  |  4 ++--
 sys/kern/kern_dump.c                   |  8 +++----
 sys/kern/kern_shutdown.c               | 39 +++++++++++++++-------------------
 sys/powerpc/powerpc/minidump_machdep.c |  4 ++--
 sys/riscv/riscv/minidump_machdep.c     |  4 ++--
 sys/sys/conf.h                         |  4 ++--
 11 files changed, 39 insertions(+), 46 deletions(-)

diff --git a/sys/amd64/amd64/minidump_machdep.c b/sys/amd64/amd64/minidump_machdep.c
index de8433ae5a05..3b9c39ad58da 100644
--- a/sys/amd64/amd64/minidump_machdep.c
+++ b/sys/amd64/amd64/minidump_machdep.c
@@ -75,7 +75,7 @@ blk_flush(struct dumperinfo *di)
 	if (fragsz == 0)
 		return (0);
 
-	error = dump_append(di, dump_va, 0, fragsz);
+	error = dump_append(di, dump_va, fragsz);
 	fragsz = 0;
 	return (error);
 }
@@ -128,7 +128,7 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
 		}
 
 		if (ptr) {
-			error = dump_append(di, ptr, 0, len);
+			error = dump_append(di, ptr, len);
 			if (error)
 				return (error);
 			ptr += len;
diff --git a/sys/arm/arm/minidump_machdep.c b/sys/arm/arm/minidump_machdep.c
index ab3034237d17..9db111547aaa 100644
--- a/sys/arm/arm/minidump_machdep.c
+++ b/sys/arm/arm/minidump_machdep.c
@@ -72,7 +72,7 @@ blk_flush(struct dumperinfo *di)
 	if (fragsz == 0)
 		return (0);
 
-	error = dump_append(di, dump_va, 0, fragsz);
+	error = dump_append(di, dump_va, fragsz);
 	fragsz = 0;
 	return (error);
 }
@@ -118,7 +118,7 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
 		wdog_kern_pat(WD_LASTVAL);
 #endif
 		if (ptr) {
-			error = dump_append(di, ptr, 0, len);
+			error = dump_append(di, ptr, len);
 			if (error)
 				return (error);
 			ptr += len;
diff --git a/sys/arm64/arm64/minidump_machdep.c b/sys/arm64/arm64/minidump_machdep.c
index ac5a7b271b85..34ad5fd7dbfe 100644
--- a/sys/arm64/arm64/minidump_machdep.c
+++ b/sys/arm64/arm64/minidump_machdep.c
@@ -75,7 +75,7 @@ blk_flush(struct dumperinfo *di)
 	if (fragsz == 0)
 		return (0);
 
-	error = dump_append(di, dump_va, 0, fragsz);
+	error = dump_append(di, dump_va, fragsz);
 	fragsz = 0;
 	return (error);
 }
@@ -121,7 +121,7 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
 		wdog_kern_pat(WD_LASTVAL);
 
 		if (ptr) {
-			error = dump_append(di, ptr, 0, len);
+			error = dump_append(di, ptr, len);
 			if (error)
 				return (error);
 			ptr += len;
diff --git a/sys/ddb/db_textdump.c b/sys/ddb/db_textdump.c
index 539b51e58e1c..aad8b6965318 100644
--- a/sys/ddb/db_textdump.c
+++ b/sys/ddb/db_textdump.c
@@ -248,7 +248,7 @@ textdump_writeblock(struct dumperinfo *di, off_t offset, char *buffer)
 		return (EIO);
 	if (offset < SIZEOF_METADATA)
 		return (ENOSPC);
-	textdump_error = dump_write(di, buffer, 0, offset + di->mediaoffset,
+	textdump_error = dump_write(di, buffer, offset + di->mediaoffset,
 	    TEXTDUMP_BLOCKSIZE);
 	if (textdump_error)
 		printf("textdump_writeblock: offset %jd, error %d\n", (intmax_t)offset,
@@ -501,7 +501,7 @@ textdump_dumpsys(struct dumperinfo *di)
 	 * Terminate the dump, report any errors, and clear the pending flag.
 	 */
 	if (textdump_error == 0)
-		(void)dump_write(di, NULL, 0, 0, 0);
+		(void)dump_write(di, NULL, 0, 0);
 	if (textdump_error == ENOSPC)
 		printf("Textdump: Insufficient space on dump partition\n");
 	else if (textdump_error != 0)
diff --git a/sys/geom/raid/g_raid.c b/sys/geom/raid/g_raid.c
index 0fb9813fbbab..3b8f3974a495 100644
--- a/sys/geom/raid/g_raid.c
+++ b/sys/geom/raid/g_raid.c
@@ -1416,10 +1416,8 @@ g_raid_subdisk_kerneldump(struct g_raid_subdisk *sd, void *virtual,
 		return (ENXIO);
 	if (sd->sd_disk->d_kd.di.dumper == NULL)
 		return (EOPNOTSUPP);
-	return (dump_write(&sd->sd_disk->d_kd.di,
-	    virtual, 0,
-	    sd->sd_disk->d_kd.di.mediaoffset + sd->sd_offset + offset,
-	    length));
+	return (dump_write(&sd->sd_disk->d_kd.di, virtual,
+	    sd->sd_disk->d_kd.di.mediaoffset + sd->sd_offset + offset, length));
 }
 
 static void
diff --git a/sys/i386/i386/minidump_machdep_base.c b/sys/i386/i386/minidump_machdep_base.c
index ce26e339d2be..5072474b9f8a 100644
--- a/sys/i386/i386/minidump_machdep_base.c
+++ b/sys/i386/i386/minidump_machdep_base.c
@@ -69,7 +69,7 @@ blk_flush(struct dumperinfo *di)
 	if (fragsz == 0)
 		return (0);
 
-	error = dump_append(di, dump_va, 0, fragsz);
+	error = dump_append(di, dump_va, fragsz);
 	fragsz = 0;
 	return (error);
 }
@@ -112,7 +112,7 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
 		wdog_kern_pat(WD_LASTVAL);
 
 		if (ptr) {
-			error = dump_append(di, ptr, 0, len);
+			error = dump_append(di, ptr, len);
 			if (error)
 				return (error);
 			ptr += len;
diff --git a/sys/kern/kern_dump.c b/sys/kern/kern_dump.c
index 17ac4e418645..393c4983d08b 100644
--- a/sys/kern/kern_dump.c
+++ b/sys/kern/kern_dump.c
@@ -122,7 +122,7 @@ dumpsys_buf_seek(struct dumperinfo *di, size_t sz)
 	while (sz > 0) {
 		nbytes = MIN(sz, sizeof(buf));
 
-		error = dump_append(di, buf, 0, nbytes);
+		error = dump_append(di, buf, nbytes);
 		if (error)
 			return (error);
 		sz -= nbytes;
@@ -146,7 +146,7 @@ dumpsys_buf_write(struct dumperinfo *di, char *ptr, size_t sz)
 		ptr += len;
 		sz -= len;
 		if (fragsz == di->blocksize) {
-			error = dump_append(di, di->blockbuf, 0, di->blocksize);
+			error = dump_append(di, di->blockbuf, di->blocksize);
 			if (error)
 				return (error);
 			fragsz = 0;
@@ -163,7 +163,7 @@ dumpsys_buf_flush(struct dumperinfo *di)
 	if (fragsz == 0)
 		return (0);
 
-	error = dump_append(di, di->blockbuf, 0, di->blocksize);
+	error = dump_append(di, di->blockbuf, di->blocksize);
 	fragsz = 0;
 	return (error);
 }
@@ -209,7 +209,7 @@ dumpsys_cb_dumpdata(struct dump_pa *mdp, int seqnr, void *arg)
 		dumpsys_map_chunk(pa, chunk, &va);
 		wdog_kern_pat(WD_LASTVAL);
 
-		error = dump_append(di, va, 0, sz);
+		error = dump_append(di, va, sz);
 		dumpsys_unmap_chunk(pa, chunk, va);
 		if (error)
 			break;
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index d6053f24a746..aaa5c5a0243f 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -1036,8 +1036,7 @@ SYSCTL_PROC(_kern_shutdown, OID_AUTO, dumpdevname,
     dumpdevname_sysctl_handler, "A",
     "Device(s) for kernel dumps");
 
-static int	_dump_append(struct dumperinfo *di, void *virtual,
-		    vm_offset_t physical, size_t length);
+static int _dump_append(struct dumperinfo *di, void *virtual, size_t length);
 
 #ifdef EKCD
 static struct kerneldumpcrypto *
@@ -1450,8 +1449,8 @@ dump_encrypt(struct kerneldumpcrypto *kdc, uint8_t *buf, size_t size)
 
 /* Encrypt data and call dumper. */
 static int
-dump_encrypted_write(struct dumperinfo *di, void *virtual,
-    vm_offset_t physical, off_t offset, size_t length)
+dump_encrypted_write(struct dumperinfo *di, void *virtual, off_t offset,
+    size_t length)
 {
 	static uint8_t buf[KERNELDUMP_BUFFER_SIZE];
 	struct kerneldumpcrypto *kdc;
@@ -1467,7 +1466,7 @@ dump_encrypted_write(struct dumperinfo *di, void *virtual,
 		if (dump_encrypt(kdc, buf, nbytes) != 0)
 			return (EIO);
 
-		error = dump_write(di, buf, physical, offset, nbytes);
+		error = dump_write(di, buf, offset, nbytes);
 		if (error != 0)
 			return (error);
 
@@ -1498,7 +1497,7 @@ kerneldumpcomp_write_cb(void *base, size_t length, off_t offset, void *arg)
 		 */
 		rlength = rounddown(length, di->blocksize);
 		if (rlength != 0) {
-			error = _dump_append(di, base, 0, rlength);
+			error = _dump_append(di, base, rlength);
 			if (error != 0)
 				return (error);
 		}
@@ -1508,7 +1507,7 @@ kerneldumpcomp_write_cb(void *base, size_t length, off_t offset, void *arg)
 		di->kdcomp->kdc_resid = resid;
 		return (EAGAIN);
 	}
-	return (_dump_append(di, base, 0, length));
+	return (_dump_append(di, base, length));
 }
 
 /*
@@ -1557,7 +1556,7 @@ dump_write_headers(struct dumperinfo *di, struct kerneldumpheader *kdh)
 	extent = dtoh64(kdh->dumpextent);
 #ifdef EKCD
 	if (kdc != NULL) {
-		error = dump_write(di, kdc->kdc_dumpkey, 0,
+		error = dump_write(di, kdc->kdc_dumpkey,
 		    di->mediaoffset + di->mediasize - di->blocksize - extent -
 		    keysize, keysize);
 		if (error != 0)
@@ -1565,11 +1564,11 @@ dump_write_headers(struct dumperinfo *di, struct kerneldumpheader *kdh)
 	}
 #endif
 
-	error = dump_write(di, buf, 0,
+	error = dump_write(di, buf,
 	    di->mediaoffset + di->mediasize - 2 * di->blocksize - extent -
 	    keysize, di->blocksize);
 	if (error == 0)
-		error = dump_write(di, buf, 0, di->mediaoffset + di->mediasize -
+		error = dump_write(di, buf, di->mediaoffset + di->mediasize -
 		    di->blocksize, di->blocksize);
 	return (error);
 }
@@ -1658,18 +1657,16 @@ dump_start(struct dumperinfo *di, struct kerneldumpheader *kdh)
 }
 
 static int
-_dump_append(struct dumperinfo *di, void *virtual, vm_offset_t physical,
-    size_t length)
+_dump_append(struct dumperinfo *di, void *virtual, size_t length)
 {
 	int error;
 
 #ifdef EKCD
 	if (di->kdcrypto != NULL)
-		error = dump_encrypted_write(di, virtual, physical, di->dumpoff,
-		    length);
+		error = dump_encrypted_write(di, virtual, di->dumpoff, length);
 	else
 #endif
-		error = dump_write(di, virtual, physical, di->dumpoff, length);
+		error = dump_write(di, virtual, di->dumpoff, length);
 	if (error == 0)
 		di->dumpoff += length;
 	return (error);
@@ -1681,8 +1678,7 @@ _dump_append(struct dumperinfo *di, void *virtual, vm_offset_t physical,
  * when the compression stream's output buffer is full.
  */
 int
-dump_append(struct dumperinfo *di, void *virtual, vm_offset_t physical,
-    size_t length)
+dump_append(struct dumperinfo *di, void *virtual, size_t length)
 {
 	void *buf;
 
@@ -1694,15 +1690,14 @@ dump_append(struct dumperinfo *di, void *virtual, vm_offset_t physical,
 		memmove(buf, virtual, length);
 		return (compressor_write(di->kdcomp->kdc_stream, buf, length));
 	}
-	return (_dump_append(di, virtual, physical, length));
+	return (_dump_append(di, virtual, length));
 }
 
 /*
  * Write to the dump device at the specified offset.
  */
 int
-dump_write(struct dumperinfo *di, void *virtual, vm_offset_t physical,
-    off_t offset, size_t length)
+dump_write(struct dumperinfo *di, void *virtual, off_t offset, size_t length)
 {
 	int error;
 
@@ -1727,7 +1722,7 @@ dump_finish(struct dumperinfo *di, struct kerneldumpheader *kdh)
 		error = compressor_flush(di->kdcomp->kdc_stream);
 		if (error == EAGAIN) {
 			/* We have residual data in di->blockbuf. */
-			error = _dump_append(di, di->blockbuf, 0, di->blocksize);
+			error = _dump_append(di, di->blockbuf, di->blocksize);
 			if (error == 0)
 				/* Compensate for _dump_append()'s adjustment. */
 				di->dumpoff -= di->blocksize - di->kdcomp->kdc_resid;
@@ -1751,7 +1746,7 @@ dump_finish(struct dumperinfo *di, struct kerneldumpheader *kdh)
 	if (error != 0)
 		return (error);
 
-	(void)dump_write(di, NULL, 0, 0, 0);
+	(void)dump_write(di, NULL, 0, 0);
 	return (0);
 }
 
diff --git a/sys/powerpc/powerpc/minidump_machdep.c b/sys/powerpc/powerpc/minidump_machdep.c
index 396c6487823e..d713e11f2ab2 100644
--- a/sys/powerpc/powerpc/minidump_machdep.c
+++ b/sys/powerpc/powerpc/minidump_machdep.c
@@ -89,7 +89,7 @@ blk_flush(struct dumperinfo *di)
 	if (fragsz == 0)
 		return (0);
 
-	error = dump_append(di, crashdumpmap, 0, fragsz);
+	error = dump_append(di, crashdumpmap, fragsz);
 	DBG(dumptotal += fragsz;)
 	fragsz = 0;
 	return (error);
@@ -134,7 +134,7 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
 		dumpsys_pb_progress(len);
 
 		if (ptr) {
-			error = dump_append(di, ptr, 0, len);
+			error = dump_append(di, ptr, len);
 			if (error)
 				return (error);
 			DBG(dumptotal += len;)
diff --git a/sys/riscv/riscv/minidump_machdep.c b/sys/riscv/riscv/minidump_machdep.c
index ee6faaa6680f..9a47bb31a6f7 100644
--- a/sys/riscv/riscv/minidump_machdep.c
+++ b/sys/riscv/riscv/minidump_machdep.c
@@ -72,7 +72,7 @@ blk_flush(struct dumperinfo *di)
 	if (fragsz == 0)
 		return (0);
 
-	error = dump_append(di, dump_va, 0, fragsz);
+	error = dump_append(di, dump_va, fragsz);
 	fragsz = 0;
 	return (error);
 }
@@ -126,7 +126,7 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
 		wdog_kern_pat(WD_LASTVAL);
 
 		if (ptr) {
-			error = dump_append(di, ptr, 0, len);
+			error = dump_append(di, ptr, len);
 			if (error != 0)
 				return (error);
 			ptr += len;
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 37265c6988ce..9f60dcaf62fa 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -376,8 +376,8 @@ void dumper_ddb_insert(struct dumperinfo *);
 void dumper_ddb_remove(struct dumperinfo *);
 
 int dump_start(struct dumperinfo *di, struct kerneldumpheader *kdh);
-int dump_append(struct dumperinfo *, void *, vm_offset_t, size_t);
-int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t);
+int dump_append(struct dumperinfo *, void *, size_t);
+int dump_write(struct dumperinfo *, void *, off_t, size_t);
 int dump_finish(struct dumperinfo *di, struct kerneldumpheader *kdh);
 void dump_init_header(const struct dumperinfo *di, struct kerneldumpheader *kdh,
     const char *magic, uint32_t archver, uint64_t dumplen);