From owner-freebsd-current Fri Dec 13 17:16:31 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9E49F37B401 for ; Fri, 13 Dec 2002 17:16:29 -0800 (PST) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 0634443ED1 for ; Fri, 13 Dec 2002 17:16:25 -0800 (PST) (envelope-from nate@rootlabs.com) Received: (qmail 37846 invoked by uid 1000); 14 Dec 2002 01:16:26 -0000 Date: Fri, 13 Dec 2002 17:16:26 -0800 (PST) From: Nate Lawson To: Julian Elischer Cc: FreeBSD current users , re@freebsd.org Subject: Re: 5.0 showstopper In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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. 2. Excessive parens before compare 3. Extra \n in printf 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