On Sun, Jul 27, 2008 at 6:06 PM, Bean <[EMAIL PROTECTED]> wrote:
> Hi,
>
> This problem is caused by the previous patch, it expands the size of
> grub_xfs_dir_header:
>
> struct grub_xfs_dir_header
> {
>  grub_uint8_t count;
>  grub_uint8_t i8count;
>  union
>  {
>    grub_uint32_t i4;
>    grub_uint64_t i8;
>  } parent __attribute__ ((packed));
> } __attribute__ ((packed));
>
> The size is always 10 bytes, but in fact, when small inode is used, it
> should be 6 bytes. Then, in struct grub_xfs_inode, grub_xfs_dir_header
> cause subsequence fields to move.
>
> This patch revert the change, it should be ok now.
>
> --
> Bean
>

Hi,

This new patch avoids the warning message of xfs.c

-- 
Bean
diff --git a/fs/xfs.c b/fs/xfs.c
index 7da3e40..72d6a5f 100644
--- a/fs/xfs.c
+++ b/fs/xfs.c
@@ -56,7 +56,7 @@ struct grub_xfs_sblock
 struct grub_xfs_dir_header
 {
   grub_uint8_t count;
-  grub_uint8_t i8count;
+  grub_uint8_t smallno;
   union
   {
     grub_uint32_t i4;
@@ -423,7 +423,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
     case XFS_INODE_FORMAT_INO:
       {
 	struct grub_xfs_dir_entry *de = &diro->inode.data.dir.direntry[0];
-	int smallino = !diro->inode.data.dir.dirhead.i8count;
+	int smallino = !diro->inode.data.dir.dirhead.smallno;
 	int i;
 	grub_uint64_t parent;
 
@@ -433,12 +433,12 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
 	  {
 	    parent = grub_be_to_cpu32 (diro->inode.data.dir.dirhead.parent.i4);
 	    parent = grub_cpu_to_be64 (parent);
+            /* The header is a bit smaller than usual.  */
+	    de = (struct grub_xfs_dir_entry *) ((char *) de - 4);
 	  }
 	else
 	  {
-	    parent = diro->inode.data.dir.dirhead.parent.i8;
-	    /* The header is a bit bigger than usual.  */
-	    de = (struct grub_xfs_dir_entry *) ((char *) de + 4);
+	    parent = *(grub_uint64_t *) &diro->inode.data.dir.dirhead.parent.i8;
 	  }
 
 	/* Synthesize the direntries for `.' and `..'.  */
@@ -448,7 +448,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
 	if (call_hook (parent, ".."))
 	  return 1;
 
-	for (i = 0; i < diro->inode.data.dir.dirhead.count; i++)
+        for (i = 0; i < diro->inode.data.dir.dirhead.count; i++)
 	  {
 	    grub_uint64_t ino;
 	    void *inopos = (((char *) de)
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to