NTFS "non-resident" files (i.e. ones for which pa[8] is true) may have
64-bit sizes. This patch updates GRUB's NTFS driver to understand this.

(I ran into this when helping out one of the Wubi developers who was
trying to use 'loopback' to look inside an ext3 filesystem image stored
on an NTFS filesystem, and wondering why he was getting "out of disk"
errors. Also, obviously, I didn't refer to Microsoft code in the process
of fixing this.)

2009-09-10  Colin Watson  <cjwat...@ubuntu.com>

        * include/grub/ntfs.h (struct grub_fshelp_node): Change `size'
        to grub_uint64_t.
        * fs/ntfs.c (init_file): Understand 64-bit sizes for
        non-resident files.

Index: include/grub/ntfs.h
===================================================================
--- include/grub/ntfs.h (revision 2584)
+++ include/grub/ntfs.h (working copy)
@@ -133,7 +133,7 @@ struct grub_fshelp_node
 {
   struct grub_ntfs_data *data;
   char *buf;
-  grub_uint32_t size;
+  grub_uint64_t size;
   grub_uint32_t ino;
   int inode_read;
   struct grub_ntfs_attr attr;
Index: fs/ntfs.c
===================================================================
--- fs/ntfs.c   (revision 2584)
+++ fs/ntfs.c   (working copy)
@@ -543,7 +543,7 @@ init_file (struct grub_ntfs_file *mft, grub_uint32
       if (!pa[8])
        mft->size = u32at (pa, 0x10);
       else
-       mft->size = u32at (pa, 0x30);
+       mft->size = u64at (pa, 0x30);
 
       if ((mft->attr.flags & AF_ALST) == 0)
        mft->attr.attr_end = 0; /*  Don't jump to attribute list */

-- 
Colin Watson                                       [cjwat...@ubuntu.com]


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to