grub-devel
[Top][All Lists]
Advanced

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

[PATCH] Large image file support for grub-fstest


From: Christian Franke
Subject: [PATCH] Large image file support for grub-fstest
Date: Thu, 07 Feb 2008 22:05:56 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071128 SeaMonkey/1.1.7

The new command "grub-fstest" may not work for large image files or /dev/sdX devices on 32-bit platforms.

Legacy C89 functions fseek() and ftell() always use "long" as offset type. The attached patch changes this to fseeko() and ftello() which use off_t. These are part of POSIX, so new ./configure stuff should be not necessary.

Christian

2008-02-07  Christian Franke  <address@hidden>

        * util/hostfs.c (grub_hostfs_open): Use fseeko and ftello
        instead of fseek and ftell to support large files.
        (grub_hostfs_read): Likewise.


--- grub2.orig/util/hostfs.c    2007-11-18 17:57:02.531250000 +0100
+++ grub2/util/hostfs.c 2008-02-07 21:44:25.531250000 +0100
@@ -100,9 +100,9 @@ grub_hostfs_open (struct grub_file *file
                       "can't open `%s'", name);
   file->data = f;
 
-  fseek (f, 0, SEEK_END);
-  file->size = ftell (f);
-  fseek (f, 0, SEEK_SET);
+  fseeko (f, 0, SEEK_END);
+  file->size = ftello (f);
+  fseeko (f, 0, SEEK_SET);
 
   return GRUB_ERR_NONE;
 }
@@ -113,7 +113,7 @@ grub_hostfs_read (grub_file_t file, char
   FILE *f;
 
   f = (FILE *) file->data;
-  fseek (f, file->offset, SEEK_SET);
+  fseeko (f, file->offset, SEEK_SET);
   int s = fread (buf, 1, len, f);
 
   return s;

reply via email to

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