1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Backed out previous commit. It is invalid to call d_ioctl() on

possibly non-open devices, and we don't want to restrict dumping
to swap devices anwyay.  It is especially invalid to call d_ioctl()
in non-process context for panics.  d_psize() can be called on
non-open devices, at least on non-SLICED ones that support d_dump(),
and setdumpdev() has depended on this for a long time although it
is probably wrong, but even d_psize() can't be called in non-process
context - that's why dumpsys() depends on previously computed values
although these values may be stale.  The historical restriction to
devices with dkpart(dev) == SWAP_PART should go away.
This commit is contained in:
Bruce Evans 1998-05-12 17:34:02 +00:00
parent 56700fcbe6
commit b322fb5d76
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=35974
3 changed files with 7 additions and 18 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
* $Id: autoconf.c,v 1.95 1998/04/20 21:53:07 julian Exp $
* $Id: autoconf.c,v 1.96 1998/05/06 22:14:40 julian Exp $
*/
/*
@ -398,7 +398,6 @@ setdumpdev(dev)
{
int maj, psize;
long newdumplo;
struct partinfo pi;
if (dev == NODEV) {
dumpdev = dev;
@ -419,9 +418,7 @@ setdumpdev(dev)
* and nuke dodump sysctl (too many knobs), and move this to
* kern_shutdown.c...
*/
if (bdevsw[maj]->d_ioctl(dev, DIOCGPART, (caddr_t)&pi, 0, NULL) != 0)
return (ENODEV);
if (pi.part->p_fstype != FS_SWAP)
if (dkpart(dev) != SWAP_PART)
return (ENODEV);
newdumplo = psize - Maxmem * PAGE_SIZE / DEV_BSIZE;
if (newdumplo < 0)

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
* $Id: autoconf.c,v 1.95 1998/04/20 21:53:07 julian Exp $
* $Id: autoconf.c,v 1.96 1998/05/06 22:14:40 julian Exp $
*/
/*
@ -398,7 +398,6 @@ setdumpdev(dev)
{
int maj, psize;
long newdumplo;
struct partinfo pi;
if (dev == NODEV) {
dumpdev = dev;
@ -419,9 +418,7 @@ setdumpdev(dev)
* and nuke dodump sysctl (too many knobs), and move this to
* kern_shutdown.c...
*/
if (bdevsw[maj]->d_ioctl(dev, DIOCGPART, (caddr_t)&pi, 0, NULL) != 0)
return (ENODEV);
if (pi.part->p_fstype != FS_SWAP)
if (dkpart(dev) != SWAP_PART)
return (ENODEV);
newdumplo = psize - Maxmem * PAGE_SIZE / DEV_BSIZE;
if (newdumplo < 0)

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94
* $Id: kern_shutdown.c,v 1.29 1998/03/08 09:56:54 julian Exp $
* $Id: kern_shutdown.c,v 1.30 1998/05/06 22:14:48 julian Exp $
*/
#include "opt_ddb.h"
@ -55,7 +55,6 @@
#include <sys/sysctl.h>
#include <sys/conf.h>
#include <sys/sysproto.h>
#include <sys/disklabel.h>
#include <machine/pcb.h>
#include <machine/clock.h>
@ -359,21 +358,17 @@ SYSINIT(dump_conf, SI_SUB_DUMP_CONF, SI_ORDER_FIRST, dump_conf, NULL)
static void
dumpsys(void)
{
struct partinfo pi;
if (!dodump)
return;
if (dumpdev == NODEV)
return;
if ((minor(dumpdev)&07) != 1)
return;
if (!(bdevsw[major(dumpdev)]))
return;
if (!(bdevsw[major(dumpdev)]->d_dump))
return;
if ((*bdevsw[major(dumpdev)]->d_ioctl)(dumpdev, DIOCGPART,
(caddr_t)&pi, 0, NULL))
return;
if (pi.part->p_fstype != FS_SWAP)
return;
dumpsize = Maxmem;
printf("\ndumping to dev %lx, offset %ld\n", dumpdev, dumplo);
printf("dump ");