[haiku-development] Re: iPod on Haiku

  • From: "Michael Lotz" <mmlr@xxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 10 Apr 2009 21:43:44

Hi

First of all please don't top post and don't include useless prior 
communication in your mails.

> After more investigation, mine has a MBR which is close to a Intel/
> MBR except it assumes that the LBA values are sectors of 2048-bytes  
instead of 512 bytes !
> 
> So what Apple uses is some kind of specific MBR, definitely not 
> standard at all.

Not really. LBA means logical block addressing and is just that. You 
address the device by logical blocks of a certain size. In this case 
it's just not the traditional 512 bytes usually used with disk/mass 
storage devices. However this is not an error or non-standard behaviour
. The device block size is an attribute that can be retrieved using the 
right commands (SCSI read capacity in this case). The usb_disk module, 
that is responsible for USB mass storage in Haiku, does exactly that 
and provides this info to the system through the device geometry 
structure.

It's possible that the partitioning add-on does it's calculation based 
on hardcoded values instead of using the provided info. That'd be a bug 
in the partitioning add-on that can be fixed however. It's also 
possible that for some reason the usb_disk module fails to execute said 
command and then falls back to the default 512 bytes. Again this would 
be a bug that can be fixed. We certainly don't want/have to provide 
hacks to support those devices if there are standard means to correctly 
handle them.

> Can anyone confirm that Haiku assumes (and it is right) that Intel-
> MBR sectors are 512-byte long to calculate LBA offsets ?

It's never correct to assume 512 bytes if you have means to retrieve 
the actual block size. After all the MBR fields are logical block 
addresses, so to correctly convert them to byte offsets you are 
required to multiply them by the actual block size (and not hardcoded 
by 512).

Regards
Michael

Other related posts: