From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LtRZI-0003ok-4J for mharc-grub-devel@gnu.org; Mon, 13 Apr 2009 15:11:44 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LtRZF-0003oK-S4 for grub-devel@gnu.org; Mon, 13 Apr 2009 15:11:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LtRZA-0003o8-9o for grub-devel@gnu.org; Mon, 13 Apr 2009 15:11:40 -0400 Received: from [199.232.76.173] (port=43262 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LtRZA-0003o5-6B for grub-devel@gnu.org; Mon, 13 Apr 2009 15:11:36 -0400 Received: from aybabtu.com ([69.60.117.155]:57325) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LtRZ9-0003g7-Tl for grub-devel@gnu.org; Mon, 13 Apr 2009 15:11:36 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtp (Exim 4.69) (envelope-from ) id 1LtRNh-0007Zk-6G for grub-devel@gnu.org; Mon, 13 Apr 2009 20:59:45 +0200 Received: from rmh by thorin with local (Exim 4.69) (envelope-from ) id 1LtRZ6-0006ID-Jb for grub-devel@gnu.org; Mon, 13 Apr 2009 21:11:32 +0200 Date: Mon, 13 Apr 2009 21:11:32 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20090413191132.GC24072@thorin> References: <1239629520.3747.28.camel@fz.local> <1239632779.3747.32.camel@fz.local> <20090413144902.GB22165@thorin> <1239635464.3747.42.camel@fz.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1239635464.3747.42.camel@fz.local> 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.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH] fix grub-setup on kfreebsd by adding 0x10 to the sysctl ("kern.geom.debugflags") flags 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: Mon, 13 Apr 2009 19:11:42 -0000 On Mon, Apr 13, 2009 at 05:11:04PM +0200, Felix Zielcke wrote: > > Btw you can avoid the two subsequent calls if sysctl_flags == sysctl_oldflags. > > Right and actually it can be even avoided if 0x10 is already set. It's the same thing (if and only if 0x10 was set, old and new flags will be the same). I'm not sure which check is cheaper, but it doesn't matter much anyway. > Is it correct that I used now `[__FreeBSD__]: Likewise.' in the > Changelog? > The GCS unfortunately doestn't tell anything about the case that a > change applies to 2 or more marcros and I couldn't find an example in > the existing Changelog for this. How about [__FreeBSD__ || __FreeBSD_kernel__] ? > + if (sysctlbyname ("kern.geom.debugflags", &sysctl_oldflags, &sysctl_size, NULL, 0)) > + grub_util_error ("cannot get current flags of sysctl kern.geom.debugflags"); I'd just return grub_error instead. Otherwise we abort the program even if failure to read a drive is not critical (e.g. lvm.mod scannning all drives, grub-emu, etc). > + if (! sysctl_oldflags & 0x10 && sysctlbyname ("kern.geom.debugflags", NULL , 0, &sysctl_flags, sysctl_size)) > + grub_util_error ("cannot set flags of sysctl kern.geom.debugflags"); Just a matter of taste, I'd suggest nested ifs to make it more readable. -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."