grub-devel
[Top][All Lists]
Advanced

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

Re: GRUB2: *BSD and more patch


From: Jeroen Dekkers
Subject: Re: GRUB2: *BSD and more patch
Date: Sat, 20 Mar 2004 11:29:29 +0100
User-agent: Mutt/1.5.5.1+cvs20040105i

On Sat, Mar 20, 2004 at 03:45:31AM +0300, Sergey Matveychuk wrote:
> +#endif
> +
> +    close (fd);
> +  }
> +    
> +    pupa_util_info ("the size of %s is %lu", name, disk->total_sectors);
> +    
> +    return PUPA_ERR_NONE;
>  
>   fail:

You removed the fail: label from the __linux__ code, please add it back.

> @@ -659,11 +711,12 @@ get_os_disk (const char *os_dev)
>  
>    return path;
>    
> -#elif defined(__GNU__)
> +#elif defined(__GNU__) || defined(__FreeBSD__) || defined(__NetBSD__) || 
> defined(__OpenBSD__)
>    path = xstrdup (os_dev);
> -  if (strncmp ("/dev/sd", path, 7) == 0 || strncmp ("/dev/hd", path, 7) == 0)
> +  if (strncmp ("/dev/sd", path, 7) == 0 || strncmp ("/dev/hd", path, 7) == 0
> +   || strncmp ("/dev/ad", path, 7) == 0 || strncmp ("/dev/wd", path, 7) == 0)

This is not correct. GNU doesn't use /dev/ad and /dev/wd. You should
do the check for /dev/ad and /dev/wd only when !__GNU__.

> @@ -194,7 +197,11 @@ pupa_memalign (pupa_size_t align, pupa_s
>  {
>    void *p;
>    
> +#ifdef HAVE_MEMALIGN
>    p = memalign (align, size);
> +#else
> +  p = malloc(size);
> +#endif
>    if (! p)
>      pupa_util_error ("out of memory");

I think it's better to just use 

pupa_util_error ("memalign not available")

instead of malloc(). pupa_memalign() isn't used now, so it's not
really a big problem, but when it is used, the memory must be
aligned. If the memory isn't aligned when it needs to be that can
cause subtle and hard to debug bugs. It is better to fail loudly.

-- 
Jeroen Dekkers




reply via email to

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