grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add support for /dev/md/N style mdraid devices


From: Robert Millan
Subject: Re: [PATCH] Add support for /dev/md/N style mdraid devices
Date: Fri, 1 Aug 2008 15:12:01 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On Wed, Jul 30, 2008 at 09:11:22PM +0200, Felix Zielcke wrote:
> +      else if (os_dev[7] == '/' && os_dev[8] >= '0' && os_dev[8] <= '9')
> +     {
> +       memcpy (grub_dev, os_dev + 5, 2);
> +       memcpy (grub_dev + 2, os_dev + 8, 5);
> +       grub_dev[7] = '\0';
> +     }

This looks fine, but I'd suggest to avoid hardcoding numbers when possible.  So
if you're adding 5 because that's the size of "/dev/", I think it's a good idea
to use sizeof("/dev/")-1, and so on.  This way the code is much easier to
understand IMHO.

(yes, I know the existing code above yours doesn't do this, but i think it's
a good idea to push for higher quality standards anyway ;-))

-- 
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."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]