]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_data): New member
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 10 Apr 2011 14:08:58 +0000 (16:08 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 10 Apr 2011 14:08:58 +0000 (16:08 +0200)
is_disk.
(grub_util_biosdisk_open): Don't apply ioctl on non-disk devices.
(open_device) Likewise.
(grub_util_biosdisk_close): Likewise.
Reported by: Mark Korenberger.

ChangeLog
grub-core/kern/emu/hostdisk.c

index c86adedb01252543e73f5cdba8fc23cd81d71923..a7e73f4611d54fd7f1471d1b030ea0bb0859820b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-04-10  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_data): New member
+       is_disk.
+       (grub_util_biosdisk_open): Don't apply ioctl on non-disk devices.
+       (open_device) Likewise.
+       (grub_util_biosdisk_close): Likewise.
+       Reported by: Mark Korenberger.
+
 2011-04-10  Alexander Kurtz <kurtz.alex@googlemail.com>
 
        * util/grub-mkconfig_lib.in: Add missing quotes.
index 7b034e06b3be3f9eb48320de9b0bce8107847296..f01e21aa07f9c41da49287428654f33a3bf2abc5 100644 (file)
@@ -138,6 +138,7 @@ struct grub_util_biosdisk_data
   char *dev;
   int access_mode;
   int fd;
+  int is_disk;
 };
 
 #ifdef __linux__
@@ -239,6 +240,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
   data->dev = NULL;
   data->access_mode = 0;
   data->fd = -1;
+  data->is_disk = 0;
 
   /* Get the size.  */
 #if defined(__MINGW32__)
@@ -279,6 +281,7 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
        close (fd);
        goto fail;
       }
+    data->is_disk = 1;
 
 # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
     if (ioctl (fd, DIOCGMEDIASIZE, &nr))
@@ -669,7 +672,8 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
              {
                fsync (data->fd);
 #ifdef __linux__
-               ioctl (data->fd, BLKFLSBUF, 0);
+               if (data->is_disk)
+                 ioctl (data->fd, BLKFLSBUF, 0);
 #endif
              }
 
@@ -727,7 +731,8 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
              {
                fsync (data->fd);
 #ifdef __linux__
-               ioctl (data->fd, BLKFLSBUF, 0);
+               if (data->is_disk)
+                 ioctl (data->fd, BLKFLSBUF, 0);
 #endif
              }
            close (data->fd);
@@ -952,7 +957,8 @@ grub_util_biosdisk_close (struct grub_disk *disk)
        {
          fsync (data->fd);
 #ifdef __linux__
-         ioctl (data->fd, BLKFLSBUF, 0);
+         if (data->is_disk)
+           ioctl (data->fd, BLKFLSBUF, 0);
 #endif
        }
       close (data->fd);