From owner-freebsd-current@FreeBSD.ORG Mon Aug 10 13:05:51 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B492F1065674 for ; Mon, 10 Aug 2009 13:05:51 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: from zibbi.meraka.csir.co.za (zibbi.meraka.csir.co.za [IPv6:2001:4200:7000:2::1]) by mx1.freebsd.org (Postfix) with ESMTP id 0AFCE8FC2B for ; Mon, 10 Aug 2009 13:05:51 +0000 (UTC) Received: by zibbi.meraka.csir.co.za (Postfix, from userid 3973) id 35CF13981A; Mon, 10 Aug 2009 15:05:38 +0200 (SAST) Date: Mon, 10 Aug 2009 15:05:38 +0200 From: John Hay To: freebsd-current@freebsd.org Message-ID: <20090810130538.GA62008@zibbi.meraka.csir.co.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Subject: gptboot parse error X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2009 13:05:52 -0000 Hi, When experimenting with gptboot to boot different partitions, I found that its parse() function was broken. Using 'p' to seperate the units from the partition did not work, neither did a ','. Here is a fix to make it work with 'p' like it is suggested in main(). Any comments? Should we try to get it in before 8.0? This allows me to use boot.config to select different partitions to boot from. Something like "ad(0p3)/boot/loader" for instance. John -- John Hay -- jhay@meraka.csir.co.za / jhay@FreeBSD.org Index: gptboot.c =================================================================== RCS file: /home/ncvs/src/sys/boot/i386/gptboot/gptboot.c,v retrieving revision 1.86.2.3 diff -u -r1.86.2.3 gptboot.c --- gptboot.c 15 Aug 2008 19:31:12 -0000 1.86.2.3 +++ gptboot.c 7 Aug 2009 10:27:09 -0000 @@ -466,16 +466,13 @@ dsk.type = i; arg += 3; dsk.unit = *arg - '0'; - if (arg[1] != ',' || dsk.unit > 9) + if (arg[1] != 'p' || dsk.unit > 9) return -1; arg += 2; - dsk.part = -1; - if (arg[1] == ',') { - dsk.part = *arg - '0'; - if (dsk.part < 1 || dsk.part > 9) - return -1; - arg += 2; - } + dsk.part = *arg - '0'; + if (dsk.part < 1 || dsk.part > 9) + return -1; + arg++; if (arg[0] != ')') return -1; arg++;