From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] fix grub-setup on kfreebsd by adding 0x10 to the sysctl ("kern.geom.debugflags") flags
Date: Mon, 13 Apr 2009 21:11:32 +0200 [thread overview]
Message-ID: <20090413191132.GC24072@thorin> (raw)
In-Reply-To: <1239635464.3747.42.camel@fz.local>
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."
next prev parent reply other threads:[~2009-04-13 19:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-13 13:32 [PATCH] fix grub-setup on kfreebsd by adding 0x10 to the sysctl ("kern.geom.debugflags") flags Felix Zielcke
2009-04-13 14:26 ` Felix Zielcke
2009-04-13 14:49 ` Robert Millan
2009-04-13 15:11 ` Felix Zielcke
2009-04-13 19:11 ` Robert Millan [this message]
2009-04-14 7:01 ` Felix Zielcke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090413191132.GC24072@thorin \
--to=rmh@aybabtu.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.