From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KDfs5-0004pV-AN for mharc-grub-devel@gnu.org; Tue, 01 Jul 2008 09:26:13 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KDfs2-0004pP-R9 for grub-devel@gnu.org; Tue, 01 Jul 2008 09:26:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KDfs1-0004pD-Ad for grub-devel@gnu.org; Tue, 01 Jul 2008 09:26:10 -0400 Received: from [199.232.76.173] (port=46129 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KDfs1-0004pA-3X for grub-devel@gnu.org; Tue, 01 Jul 2008 09:26:09 -0400 Received: from aybabtu.com ([69.60.117.155]:59946) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KDfs0-0001Ct-MD for grub-devel@gnu.org; Tue, 01 Jul 2008 09:26:08 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1KDfoH-00038t-Fi for grub-devel@gnu.org; Tue, 01 Jul 2008 15:22:17 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1KDfrQ-00059F-Gz for grub-devel@gnu.org; Tue, 01 Jul 2008 15:25:32 +0200 Date: Tue, 1 Jul 2008 15:25:32 +0200 From: Robert Millan To: grub-devel@gnu.org Message-ID: <20080701132532.GA19736@thorin> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="17pEHd4RhPHOinZp" Content-Disposition: inline Content-Transfer-Encoding: 8bit Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [PATCH] pc & gpt partmap iterators don't abort when their hook requests it X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jul 2008 13:26:11 -0000 --17pEHd4RhPHOinZp Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit See ChangeLog for description. I'd really like to receive some review on this one, since the code it touches is so fragile (although I tested it on a typical setup and it works). -- Robert Millan I know my rights; I want my phone call! What good is a phone call… if you are unable to speak? (as seen on /.) --17pEHd4RhPHOinZp Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="partmap_iterator_abortion.diff" 2008-07-01 Robert Millan This fixes a performance issue when pc & gpt partmap iterators didn't abort iteration even after our hook found what it was looking for (often causing expensive probes of non-existant drives). The probe functions relied on previous buggy behaviour, since they would rise an error when their own hook (find_func()) caused early abortion of its iteration. * kern/device.c (grub_device_open): Improve error message. * partmap/pc.c (pc_partition_map_iterate): Abort parent iteration when hook requests it, independently of grub_errno. (pc_partition_map_probe): Do not fail when find_func() caused early abortion of pc_partition_map_iterate(). * partmap/gpt.c (gpt_partition_map_iterate): Abort parent iteration when hook requests it, independently of grub_errno. (gpt_partition_map_probe): Do not fail when find_func() caused early abortion of gpt_partition_map_iterate(). diff -x debian -x ChangeLog -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/device.c ./kern/device.c --- ../grub2/kern/device.c 2008-01-10 00:25:54.000000000 +0100 +++ ./kern/device.c 2008-06-30 14:15:19.000000000 +0200 @@ -50,7 +50,7 @@ grub_device_open (const char *name) disk = grub_disk_open (name); if (! disk) { - grub_error (GRUB_ERR_BAD_DEVICE, "unknown device"); + grub_error (GRUB_ERR_BAD_DEVICE, "unknown device %s", name); goto fail; } diff -x debian -x ChangeLog -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/partmap/gpt.c ./partmap/gpt.c --- ../grub2/partmap/gpt.c 2008-02-23 21:33:32.000000000 +0100 +++ ./partmap/gpt.c 2008-07-01 15:06:31.000000000 +0200 @@ -102,7 +102,7 @@ gpt_partition_map_iterate (grub_disk_t d i, part.start, part.len); if (hook (disk, &part)) - return grub_errno; + return 1; } last_offset += grub_le_to_cpu32 (gpt.partentry_size); @@ -150,8 +150,7 @@ gpt_partition_map_probe (grub_disk_t dis return 0; } - if (gpt_partition_map_iterate (disk, find_func)) - goto fail; + gpt_partition_map_iterate (disk, find_func); return p; diff -x debian -x ChangeLog -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/partmap/pc.c ./partmap/pc.c --- ../grub2/partmap/pc.c 2007-07-22 01:32:30.000000000 +0200 +++ ./partmap/pc.c 2008-07-01 15:06:03.000000000 +0200 @@ -151,7 +151,7 @@ pc_partition_map_iterate (grub_disk_t di pcdata.dos_part++; if (hook (disk, &p)) - goto finish; + return 1; /* Check if this is a BSD partition. */ if (grub_pc_partition_is_bsd (e->type)) @@ -255,8 +255,7 @@ pc_partition_map_probe (grub_disk_t disk return 0; pcdata = p->data; - if (pc_partition_map_iterate (disk, find_func)) - goto fail; + pc_partition_map_iterate (disk, find_func); if (p->index < 0) { --17pEHd4RhPHOinZp--