Date: Fri, 13 Dec 2002 22:48:57 -0800 (PST) From: Julian Elischer <julian@elischer.org> To: Nate Lawson <nate@root.org> Cc: FreeBSD current users <current@FreeBSD.ORG>, re@freebsd.org Subject: Re: 5.0 showstopper Message-ID: <Pine.BSF.4.21.0212132233001.14352-100000@InterJet.elischer.org> In-Reply-To: <Pine.BSF.4.21.0212131710440.37808-100000@root.org>
index | next in thread | previous in thread | raw e-mail
On Fri, 13 Dec 2002, Nate Lawson wrote:
> On Fri, 13 Dec 2002, Julian Elischer wrote:
> > On Fri, 13 Dec 2002, Peter Wemm wrote:
> > > Julian Elischer wrote:
> > > > looking at the code in src/sys/i386/i386/dump_machdep.c,
> > > >
> > > > we see:
> > > > 78 dumplo = di->mediaoffset + di->mediasize - Maxmem *
> > > > (off_t)PAGE_SIZE;
> > > > 79 dumplo -= sizeof kdh * 2;
> > > > 80 i = di->dumper(di->priv, &kdh, 0, dumplo, sizeof kdh);
> > > > 81 if (i)
> > > > 82 printf("\nDump failed writing header (%d)\n", i);
> > > > 83 dumplo += sizeof kdh;
> > > > 84 i = 0;
> > > >
> > > > It looks like the following test should go after line 77
> > > >
> > > > if (di->mediasize < ((Maxmem * (off_t)PAGE_SIZE) +
> > > > (sizeof kdh * 2) + (16*1024)) {
> > > > /* 16K is an arbitrary buffer
> > > > * in case the swap part is
> > > > * the first part
> > > > */
> > > > printf("\nDump failed. Partition too small.\n");
> > > > return;
> > > > }
> > >
> > > We used to force a 64K safety buffer for swapon, and I think we also did
> > > 64K for dump before the last MI dump code conversion. I'd feel a little
> > > happier if you used 64K here instead of 16K.
> >
> > I'm happy with 64k.. I just chose 16 arbitrarily because I remembered
> > that there was SOME safety value but I couldn't remember what it was..
>
> 1. Why 2 * kdh (the header size)? I thought there was just one.
because that is the space that is used
There is a header and a trailer..
> 2. Excessive parens before compare
that's just your opinion. I know I'm in a minority but
more parens is better for me.
especially to indicate the logical reasons for the various componets..
(Maxmem * (off_t)PAGE_SIZE)
(2 * sizeof(kdh))
(64 * 1024)
Each of which has a separate reason for existing.
3. Extra \n in printf
I do what the other printf's there do.
>
> So how about:
> /*
> * Minimum dumpdev size is Maxmem, dump header,
> * and 64k safety margin.
> */
> if (di->mediasize < Maxmem * (off_t)PAGE_SIZE + sizeof(kdh) +
> 64 * 1024) {
> printf("Dump failed. Partition too small.\n");
> return;
> }
>
> -Nate
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-current" in the body of the message
>
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0212132233001.14352-100000>
