From owner-freebsd-arch@FreeBSD.ORG Fri May 20 06:49:32 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 246E816A4CE for ; Fri, 20 May 2005 06:49:32 +0000 (GMT) Received: from mail25.sea5.speakeasy.net (mail25.sea5.speakeasy.net [69.17.117.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id 64FA743D72 for ; Fri, 20 May 2005 06:49:31 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: (qmail 26343 invoked from network); 20 May 2005 06:49:31 -0000 Received: from gate.funkthat.com (HELO hydrogen.funkthat.com) ([69.17.45.168]) (envelope-sender ) by mail25.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 20 May 2005 06:49:31 -0000 Received: from hydrogen.funkthat.com (tmlifo@localhost.funkthat.com [127.0.0.1])j4K6nT2g052171; Thu, 19 May 2005 23:49:30 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.12.10/8.12.10/Submit) id j4K6nTgg052170; Thu, 19 May 2005 23:49:29 -0700 (PDT) Date: Thu, 19 May 2005 23:49:29 -0700 From: John-Mark Gurney To: Colin Percival Message-ID: <20050520064929.GC959@funkthat.com> Mail-Followup-To: Colin Percival , freebsd-arch@freebsd.org References: <428D26C1.2020201@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <428D26C1.2020201@freebsd.org> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.2-RELEASE i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html cc: freebsd-arch@freebsd.org Subject: Re: RFC: Using fixed-length strings for version[] and osrelease[] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: John-Mark Gurney List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 May 2005 06:49:32 -0000 Colin Percival wrote this message on Thu, May 19, 2005 at 16:52 -0700: > Would anyone object to the following patch being applied? > > --- newvers.sh 15 Jan 2005 13:25:41 -0000 1.68 > +++ newvers.sh 19 May 2005 23:48:21 -0000 > @@ -87,9 +87,9 @@ cat << EOF > vers.c > $COPYRIGHT > char sccspad[32 - 4 /* sizeof(sccs) */] = { '\\0' }; > char sccs[4] = { '@', '(', '#', ')' }; > -char version[] = "${VERSION} #${v}: ${t}\\n ${u}@${h}:${d}\\n"; > +char version[512] = "${VERSION} #${v}: ${t}\\n ${u}@${h}:${d}\\n"; > char ostype[] = "${TYPE}"; > -char osrelease[] = "${RELEASE}"; > +char osrelease[64] = "${RELEASE}"; > int osreldate = ${RELDATE}; > char kern_ident[] = "${i}"; > EOF > > The lengths 512 and 64 are chosen as being considerably more than double the > likely lengths of these strings; on my system, these two strings are 12 bytes > and 134 bytes long respectively. Nope, but I would say make them just a bit larger than necessary right now, and add the necessary CTASSERT lines to make sure we don't overflow.. I'd say no more than 256 bytes for the VERSION string, since CTASSERT will prevent the overflow... Though you might want to make the fixed size dependent upon the release kernel and not for custom compiled kernels... No point in penalizing kernels that don't need this... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."