Le 16 juil. 09 à 21:19, Pavel Roskin a écrit :

On Thu, 2009-07-16 at 19:45 +0200, Yves Blusseau wrote:
Hi,

here's a patch so grub-setup can be compiled and work on MacOSX.

# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
    if (ioctl (fd, DIOCGMEDIASIZE, &nr))
+# elif defined(__APPLE__)
+       if (ioctl (fd, DKIOCGETBLOCKCOUNT, &nr))
# else
...

+#if defined (__APPLE__)
+       disk->total_sectors = nr;
+#else
    disk->total_sectors = nr / 512;

This is misleading. The same variable "nr" is used for different values
that are obtained by different calls.

@@ -1047,11 +1063,10 @@ grub_util_biosdisk_get_grub_dev (const char
*os_dev)

    if (strncmp ("/dev/", os_dev, 5) == 0)
      {
-        const char *p;
-        char *q;
+        char *p, *q;
        long int n;

-        for (p = os_dev + 5; *p; ++p)
+        for (p = (char *) os_dev + 5; *p; ++p)

The change to grub_util_biosdisk_get_grub_dev() is not described.

The only problem remaining is trampoline (nested functions), because
OSX don't want
to execute code in the heap.

I think we should start an effort to eliminate the nested functions one
at a time.

it will be great !

I will rewrite a new patch with good indentation and no misleading variable

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to