[2309] 2009-06-11 Giuseppe Caizzone <[email protected]>

Vladimir Serbinenko <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2309
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2309
Author:   phcoder
Date:     2009-06-11 19:32:13 +0000 (Thu, 11 Jun 2009)
Log Message:
-----------
2009-06-11  Giuseppe Caizzone  <[email protected]>

	UDF fix

	* fs/udf.c (grub_udf_read_block): handle the fact that ad->length 
	is in bytes and not in blocks
	

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/fs/udf.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-06-11 19:11:25 UTC (rev 2308)
+++ trunk/grub2/ChangeLog	2009-06-11 19:32:13 UTC (rev 2309)
@@ -1,3 +1,10 @@
+2009-06-11  Giuseppe Caizzone  <[email protected]>
+
+	UDF fix
+
+	* fs/udf.c (grub_udf_read_block): handle the fact that ad->length 
+	is in bytes and not in blocks
+	
 2009-06-11  Pavel Roskin  <[email protected]>
 
 	* kern/i386/halt.c (grub_halt): Make `i' unsigned to fix a

Modified: trunk/grub2/fs/udf.c
===================================================================
--- trunk/grub2/fs/udf.c	2009-06-11 19:11:25 UTC (rev 2308)
+++ trunk/grub2/fs/udf.c	2009-06-11 19:32:13 UTC (rev 2309)
@@ -407,6 +407,7 @@
 {
   char *ptr;
   int len;
+  grub_disk_addr_t filebytes;
 
   if (U16 (node->fe.tag.tag_ident) == GRUB_UDF_TAG_IDENT_FE)
     {
@@ -425,16 +426,17 @@
       struct grub_udf_short_ad *ad = (struct grub_udf_short_ad *) ptr;
 
       len /= sizeof (struct grub_udf_short_ad);
+      filebytes = fileblock * GRUB_UDF_BLKSZ;
       while (len > 0)
 	{
-	  if (fileblock < U32 (ad->length))
+	  if (filebytes < U32 (ad->length))
 	    return ((U32 (ad->position) & GRUB_UDF_EXT_MASK) ? 0 :
                     (grub_udf_get_block (node->data,
                                          node->part_ref,
                                          ad->position)
-                     + fileblock));
+                     + (filebytes / GRUB_UDF_BLKSZ)));
 
-	  fileblock -= U32 (ad->length);
+	  filebytes -= U32 (ad->length);
 	  ad++;
 	  len--;
 	}
@@ -444,16 +446,17 @@
       struct grub_udf_long_ad *ad = (struct grub_udf_long_ad *) ptr;
 
       len /= sizeof (struct grub_udf_long_ad);
+      filebytes = fileblock * GRUB_UDF_BLKSZ;
       while (len > 0)
 	{
-	  if (fileblock < U32 (ad->length))
+	  if (filebytes < U32 (ad->length))
 	    return ((U32 (ad->block.block_num) & GRUB_UDF_EXT_MASK) ?  0 :
                     (grub_udf_get_block (node->data,
                                          ad->block.part_ref,
                                          ad->block.block_num)
-                    + fileblock));
+		     + (filebytes / GRUB_UDF_BLKSZ)));
 
-	  fileblock -= U32 (ad->length);
+	  filebytes -= U32 (ad->length);
 	  ad++;
 	  len--;
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.