[haiku-bugs] Re: [Haiku] #8460: ISO9660 can not read CDs bigger than 4.7G

  • From: "scdbackup" <trac@xxxxxxxxxxxx>
  • Date: Sat, 14 Apr 2012 19:26:59 -0000

#8460: ISO9660 can not read CDs bigger than 4.7G
-------------------------------------+----------------------------
   Reporter:  jahaiku                |      Owner:  nobody
       Type:  bug                    |     Status:  new
   Priority:  normal                 |  Milestone:  R1
  Component:  File Systems/ISO 9660  |    Version:  R1/Development
 Resolution:                         |   Keywords:
 Blocked By:                         |   Blocking:
Has a Patch:  0                      |   Platform:  All
-------------------------------------+----------------------------

Comment (by scdbackup):

 Replying to [comment:16 jahaiku]:
 > > {{{
 > >    TRACE(("JA - %d %d %d %d \n", (int)offset,
 (int)node->startLBN[FS_DATA_FORMAT],
 (int)node->volume->logicalBlkSize[FS_DATA_FORMAT], (int)vecs->offset ));
 > > and
 > >    TRACE(("JA - %d %d %d %d \n", (int)pos,
 (int)node->startLBN[FS_DATA_FORMAT],
 (int)volume->logicalBlkSize[FS_DATA_FORMAT], (int)fileVec.offset ));
 > > }}}

 We need more than 32 bit for printing the byte result.Further it would be
 good if both TRACE
 were distinguishable. E.g.
 {{{
 TRACE(("JA hook  - %d %d %d %.f \n", (int)offset,
 (int)node->startLBN[FS_DATA_FORMAT],
 (int)node->volume->logicalBlkSize[FS_DATA_FORMAT], (double)vecs->offset
 ));
 TRACE(("JA pages - %d %d %d %.f \n", (int)pos,
 (int)node->startLBN[FS_DATA_FORMAT],
 (int)volume->logicalBlkSize[FS_DATA_FORMAT], (double)fileVec.offset ));
 }}}


 > > 2012-04-14 13:22:10 KERN: JA - 0 2276862 2048 368046080

 The result should be 4,663,013,376 rather than 368,046,080.
 This is now of course an artefact by the %d formatter. But probably it
 is an omen about what happens to the correct result in the further
 course of processing.

 I understand from http://api.haiku-os.org/SupportDefs_8h.html
 that off_t is 64 bit.  The receiver object uses off_t :
 http://api.haiku-os.org/structfile__io__vec.html

 But if i do on my amd64 GNU/Linux box:

 {{{
 #include <stdio.h>
 #include <unistd.h>
 #include <stdint.h>

 int main()
 {
  off_t result, pos = 0;
  uint32_t lba = 2276862, bs = 2049;

  result = pos + lba * bs;
  printf("%.f\n", (double) result);

  result = pos + ((off_t) lba) * ((off_t) bs);
  printf("%.f\n", (double) result);
 }

 }}}

 I get this output:

 {{{
 370322942
 4665290238
 }}}

 So i expect to see 370 million even with TRACE formatting for large
 numbers.

 If so then, equip in iso9660/kernel_interface.cpp the occurences of
 {{{
 node->startLBN[FS_DATA_FORMAT] *
 node->volume->logicalBlkSize[FS_DATA_FORMAT]
 }}}
 with a generous amount of (off_t) casts and brackets.

 Then try whether it works better.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/8460#comment:17>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: