64-bit file sizes in NTFS
PATCH 1/1 64-bit file sizes in NTFS
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 <[email protected]>
* 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.
grub/ntfs.h +1 -1
@@ -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;
ntfs.c +1 -1
@@ -543,7 +543,7 @@ init_file (struct grub_ntfs_file *mft, grub_uint32if (!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 */
Signature · 1 line
Colin Watson [[email protected]]
grub/ntfs.h struct grub_fshelp_node · line 139
Quoted 13 lines · Colin Watson
Index:
include/grub/ntfs.h
===================================================================grub/ntfs.h +1
-1@@ -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;
Would this change offsets in subsequent struct fields? (I notice it's not packed, but I always forget the alignment rules...)
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Quoted 17 lines · Robert Millan
grub/ntfs.h struct grub_fshelp_node · line 139
Quoted 13 lines · Colin Watson
Index:
include/grub/ntfs.h
===================================================================grub/ntfs.h +1
-1@@ -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;Would this change offsets in subsequent struct fields? (I notice it's not packed, but I always forget the alignment rules...)
It probably would, but I don't think anything cares, does it? This data structure is purely internal - it isn't read from disk in a way that expects structures to line up.
Signature · 1 line
Colin Watson [[email protected]]
Quoted 19 lines · Colin Watson
Quoted 17 lines · Robert Millan
grub/ntfs.h struct grub_fshelp_node · line 139
Quoted 13 lines · Colin Watson
Index:
include/grub/ntfs.h
===================================================================grub/ntfs.h +1
-1@@ -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;Would this change offsets in subsequent struct fields? (I notice it's not packed, but I always forget the alignment rules...)
Quoted 3 lines
It probably would, but I don't think anything cares, does it? This data structure is purely internal - it isn't read from disk in a way that expects structures to line up.
Oh, right. I thought it was some NTFS structure.
You can commit this.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Quoted 8 lines · Robert Millan
Quoted 3 lines · Colin Watson
It probably would, but I don't think anything cares, does it? This data structure is purely internal - it isn't read from disk in a way that expects structures to line up.
Oh, right. I thought it was some NTFS structure.
You can commit this.
Thanks for the review. Committed.
Signature · 1 line
Colin Watson [[email protected]]