All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Franke <Christian.Franke@t-online.de>
To: grub-devel@gnu.org
Subject: [PATCH] Large image file support for grub-fstest
Date: Thu, 07 Feb 2008 22:05:56 +0100	[thread overview]
Message-ID: <47AB72B4.2070909@t-online.de> (raw)

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

             reply	other threads:[~2008-02-07 21:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-07 21:05 Christian Franke [this message]
2008-02-07 22:14 ` [PATCH] Large image file support for grub-fstest Robert Millan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47AB72B4.2070909@t-online.de \
    --to=christian.franke@t-online.de \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.