All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Large image file support for grub-fstest
@ 2008-02-07 21:05 Christian Franke
  2008-02-07 22:14 ` Robert Millan
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Franke @ 2008-02-07 21:05 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 544 bytes --]

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  <franke@computer.org>

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



[-- Attachment #2: grub2-hostfs-largefile.patch --]
[-- Type: text/x-patch, Size: 668 bytes --]

--- 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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Large image file support for grub-fstest
  2008-02-07 21:05 [PATCH] Large image file support for grub-fstest Christian Franke
@ 2008-02-07 22:14 ` Robert Millan
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Millan @ 2008-02-07 22:14 UTC (permalink / raw)
  To: The development of GRUB 2

On Thu, Feb 07, 2008 at 10:05:56PM +0100, Christian Franke wrote:
> 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  <franke@computer.org>
> 
> 	* util/hostfs.c (grub_hostfs_open): Use fseeko and ftello
> 	instead of fseek and ftell to support large files.
> 	(grub_hostfs_read): Likewise.

Committed, thanks.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-07 22:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-07 21:05 [PATCH] Large image file support for grub-fstest Christian Franke
2008-02-07 22:14 ` Robert Millan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.