dump(D2DK) —
.IX \f4dump\fP(D2DK)
NAME
dump − gain access to a device crash dump routine
SYNOPSIS
#include <sys/types.h>
#include <sys/file.h>
#include <sys/errno.h>
#include <sys/open.h>
#include <sys/cred.h>
#include <sys/crash.h>
int prefixdump(dev_t dev, int memsize, int ∗seqflag, int ∗startblk, int ∗blkcnt,
int ∗ptrblk, int ∗chunksize, int (∗∗dumpfunc)());
ARGUMENTS
devA device number.
memsizeAmount of physical memory to be dumped.
seqflagPointer to a flag which the driver sets to indicate whether the device is sequential or random access. The settings are defined in crash.h. Valid settings are:
CRASH_RAND_DEVICE
the device is random access
CRASH_SEQ_DEVICE the device is sequential access
startblkPointer which returns where the first block should be written for random access or returns 0 for sequential access.
blkcntPointer which returns the number of blocks which should be written to the device.
ptrblkPointer which returns where the pointer block should be written for random access or returns 0 for sequential access.
chunksizePointer which returns the number of blocks the device can accept per call to dumpfunc.
dumpfuncPointer which returns the address of the routine which will do the writing for the crash dump. The routine’s interface is as follows: int dumpfunc(dev_t dev, int blkno, paddr_t phys_addr, int cmd, int nblocks);
dev A device number.
blkno The block number to write to.
phys_addr The physical memory address to read from.
cmd The command to perform; valid commands are:
CRASH_DOIO_RD read from device
CRASH_DOIO_WR write to device
CRASH_DOIO_EOT do device specific action(s) at end of crash dump
nblocks The number of blocks to transfer.
This routine returns 0 for success and -1 if an error occurred.
DESCRIPTION
The kernel calls the driver’s dump routine through the cdevsw or bdevsw entry for the device during a panic via cmn_err(D3DK). The routine should verify that the minor number component of dev is valid, that dumping to this device is still valid, and that the device is ready to perform a crash dump. Then, it should set the various parameters depending on whether it is accessed sequentially or by random access. If the device is a disk, only dumping to a slice tagged with V_SWAP is allowed.
The routine returned by dump to do the I/O should transfer the data to the device and return when finished. If the device transfers by sequential access, this routine must also accept the command CRASH_DOIO_EOT to write the EOT mark(s) or take other device-specific actions to finish the crash dump.
All blocks are specified as 512 bytes, and the device is responsible for converting to the appropriate logical block size.
RETURN VALUES
The dump routine returns 0 for success, or -1 for failure.
SEE ALSO
close(D2DK), cmn_err(D3DK), open(D2DK)
DDI/DKI