Subject: Re: README: changes to config, to support dump device configuration
To: Jonathan Stone <jonathan@dsg.stanford.edu>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: current-users
Date: 06/14/1997 17:46:27
On Sat, 14 Jun 1997 17:16:52 -0700 
 Jonathan Stone <jonathan@DSG.Stanford.EDU> wrote:

 > Does the kernel _really_ do a coredump dump on a b partition,
 > regardless of the partition type in the disklabel?
 > 
 > Since swap is now optional, reserving b partitions for swap is
 > presumably optional. Therefore reserving B partitions for _dumps_
 > (which is, historically, just a side-effect of them being swap
 > devices) should be optional too.
 > 
 > I think it'd be safer and more correct to only do wildcarded dumps
 > onto B partitions that are labelled as type `swap'.

...take a look at the code, and you'll find the following, in
various ports' cpu_dumpconf()s...

        if (bdevsw[maj].d_psize == NULL)
                return; 
        nblks = (*bdevsw[maj].d_psize)(dumpdev);
        if (nblks <= ctod(1))
                return;


...and, in e.g. sdsize():

int   
sdsize(dev)
        dev_t dev;
{
        struct sd_softc *sd;
        int part;
        int size;
 
        if (sdopen(dev, 0, S_IFBLK, NULL) != 0)
                return -1;
        sd = sd_cd.cd_devs[SDUNIT(dev)];
        part = SDPART(dev);
        if (sd->sc_dk.dk_label->d_partitions[part].p_fstype != FS_SWAP)
                size = -1;
        else
                size = sd->sc_dk.dk_label->d_partitions[part].p_size;
        if (sdclose(dev, 0, S_IFBLK, NULL) != 0)
                return -1;
        return size;
}

I.e. it's not a problem.

The disk driver is the appropriate place to check the partition type,
since it has the label first-hand.

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939