Skip to contentSkip to conversation

Disable unsupported grub_util_get_fd_sectors in geli on MINGW32

PATCH In review Mario Limonciello 2 participants 3 messages Sep 21, 2011 – Sep 29, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Disable unsupported grub_util_get_fd_sectors in geli on MINGW32

=== modified file 'ChangeLog'

ChangeLog 2011-09-21 21:18:21 +0000 renamed from ChangeLog 2011-09-21 21:00:59 +0000 +2 -0
@@ -6,6 +6,8 @@
        Windows CreateFile calls.
        * Undefine GRUB_UTIL in grub-core/lib/crypto.c for MINGW32 as
        termios is not supported.
+       * Disable unsupported grub_util_get_fd_sectors in geli on
+       MINGW32.
 
 2011-09-17  Grégoire Sutre <[email protected]>
 

=== modified file 'grub-core/disk/geli.c'

disk/geli.c 2011-09-21 21:18:21 +0000 renamed from disk/geli.c 2011-04-25 12:52:07 +0000 +2 -0
@@ -189,8 +189,10 @@
   if (fd < 0)
     return NULL;
 
+#if !defined(__MINGW32__)
   s = grub_util_get_fd_sectors (fd, &log_secsize);
   grub_util_fd_seek (fd, dev, (s << log_secsize) - 512);
+#endif
 
   uuid = xmalloc (GRUB_MD_SHA256->mdlen * 2 + 1);
   if (grub_util_fd_read (fd, (void *) &hdr, 512) < 0)
#1 lore raw

disk/geli.c 2011-09-21 21:18:21 +0000 line 195

Quoted 4 lines · Mario Limonciello
disk/geli.c 2011-09-21 21:18:21 +0000 renamed from disk/geli.c 2011-04-25 12:52:07 +0000 +2 -0
+#if !defined(__MINGW32__)
   s = grub_util_get_fd_sectors (fd, &log_secsize);
   grub_util_fd_seek (fd, dev, (s << log_secsize) - 512);
+#endif

This would make GRUB behave erratically if this code is ever reached which is always a bad thing. While doing something like #if defined (GRUB_UTIL) && ! defined (__MINGW32__)
on whole function is a cheap and functionality-reducing way to port, correct way is to add a windows equivalent of this call (getting disk/file size)

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#2 lore raw
In reply to Mario Limonciello

Rejected. Better a compilation error than an eratic behaviour on runtime.

Quoted 35 lines · Mario Limonciello

=== modified file 'ChangeLog'

ChangeLog 2011-09-21 21:18:21 +0000 renamed from ChangeLog 2011-09-21 21:00:59 +0000 +2 -0
@@ -6,6 +6,8 @@
        Windows CreateFile calls.
        * Undefine GRUB_UTIL in grub-core/lib/crypto.c for MINGW32 as
        termios is not supported.
+       * Disable unsupported grub_util_get_fd_sectors in geli on
+       MINGW32.
 
 2011-09-17  Grégoire Sutre <[email protected]>
 

=== modified file 'grub-core/disk/geli.c'

disk/geli.c 2011-09-21 21:18:21 +0000 renamed from disk/geli.c 2011-04-25 12:52:07 +0000 +2 -0
@@ -189,8 +189,10 @@
   if (fd < 0)
     return NULL;
 
+#if !defined(__MINGW32__)
   s = grub_util_get_fd_sectors (fd, &log_secsize);
   grub_util_fd_seek (fd, dev, (s << log_secsize) - 512);
+#endif
 
   uuid = xmalloc (GRUB_MD_SHA256->mdlen * 2 + 1);
   if (grub_util_fd_read (fd, (void *) &hdr, 512) < 0)

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko