1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-29 08:08:37 +00:00

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
This commit is contained in:
Mitchell Horne 2022-05-13 10:40:05 -03:00
parent 489ba22236
commit db71383b88
11 changed files with 39 additions and 46 deletions

View File

@ -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;

View File

@ -70,7 +70,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);
}
@ -115,7 +115,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;

View File

@ -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;

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -1081,8 +1081,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 *
@ -1495,8 +1494,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;
@ -1512,7 +1511,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);
@ -1543,7 +1542,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);
}
@ -1553,7 +1552,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));
}
/*
@ -1602,7 +1601,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)
@ -1610,11 +1609,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);
}
@ -1703,18 +1702,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);
@ -1726,8 +1723,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;
@ -1739,15 +1735,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;
@ -1772,7 +1767,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;
@ -1796,7 +1791,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);
}

View File

@ -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;)

View File

@ -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;

View File

@ -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);