All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 64-bit file sizes in NTFS
@ 2009-09-10 16:39 Colin Watson
  2009-09-10 19:17 ` Robert Millan
  0 siblings, 1 reply; 5+ messages in thread
From: Colin Watson @ 2009-09-10 16:39 UTC (permalink / raw)
  To: grub-devel; +Cc: Agostino Russo

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  <cjwatson@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                                       [cjwatson@ubuntu.com]



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

* Re: [PATCH] 64-bit file sizes in NTFS
  2009-09-10 16:39 [PATCH] 64-bit file sizes in NTFS Colin Watson
@ 2009-09-10 19:17 ` Robert Millan
  2009-09-10 19:24   ` Colin Watson
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Millan @ 2009-09-10 19:17 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: Agostino Russo

On Thu, Sep 10, 2009 at 05:39:14PM +0100, Colin Watson wrote:
> 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;

Would this change offsets in subsequent struct fields?  (I notice it's not
packed, but I always forget the alignment rules...)

-- 
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."



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

* Re: [PATCH] 64-bit file sizes in NTFS
  2009-09-10 19:17 ` Robert Millan
@ 2009-09-10 19:24   ` Colin Watson
  2009-09-11 13:14     ` Robert Millan
  0 siblings, 1 reply; 5+ messages in thread
From: Colin Watson @ 2009-09-10 19:24 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: Agostino Russo

On Thu, Sep 10, 2009 at 09:17:54PM +0200, Robert Millan wrote:
> On Thu, Sep 10, 2009 at 05:39:14PM +0100, Colin Watson wrote:
> > 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;
> 
> 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.

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



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

* Re: [PATCH] 64-bit file sizes in NTFS
  2009-09-10 19:24   ` Colin Watson
@ 2009-09-11 13:14     ` Robert Millan
  2009-09-11 14:26       ` Colin Watson
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Millan @ 2009-09-11 13:14 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: Agostino Russo

On Thu, Sep 10, 2009 at 08:24:44PM +0100, Colin Watson wrote:
> On Thu, Sep 10, 2009 at 09:17:54PM +0200, Robert Millan wrote:
> > On Thu, Sep 10, 2009 at 05:39:14PM +0100, Colin Watson wrote:
> > > 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;
> > 
> > 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.

Oh, right.  I thought it was some NTFS structure.

You can commit this.

-- 
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."



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

* Re: [PATCH] 64-bit file sizes in NTFS
  2009-09-11 13:14     ` Robert Millan
@ 2009-09-11 14:26       ` Colin Watson
  0 siblings, 0 replies; 5+ messages in thread
From: Colin Watson @ 2009-09-11 14:26 UTC (permalink / raw)
  To: The development of GRUB 2; +Cc: Agostino Russo

On Fri, Sep 11, 2009 at 03:14:53PM +0200, Robert Millan wrote:
> On Thu, Sep 10, 2009 at 08:24:44PM +0100, Colin Watson wrote:
> > 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.

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



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

end of thread, other threads:[~2009-09-11 14:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-10 16:39 [PATCH] 64-bit file sizes in NTFS Colin Watson
2009-09-10 19:17 ` Robert Millan
2009-09-10 19:24   ` Colin Watson
2009-09-11 13:14     ` Robert Millan
2009-09-11 14:26       ` Colin Watson

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.