<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div style="RIGHT: auto"><SPAN style="RIGHT: auto">Hi,</SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto"></SPAN> </div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto">Yes. I noticed that the length is an integral multiple of the media block size. </SPAN></div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN style="RIGHT: auto">So is this length field reliable enough to be used as a mesaure to determine how many blocks to read from the device. </SPAN></div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN style="RIGHT: auto">For e.g. if the media block size is 512 and the length field is 4096. Should i interpret in the device driver (ioctl) that the request is to read 8 blocks of data (4096/512)?</SPAN></div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN style="RIGHT: auto"></SPAN> </div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN style="RIGHT: auto">I was trying to read the block_size field of the struct rtems_disk_device. But the ioctl receives the pointer to the physical device and the block_size of the physical device is set to the media_block_size (512 in my case). There is no relation in the physical device pointer to the logical device (the partition on the disk).</SPAN></div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN style="RIGHT: auto"></SPAN> </div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN style="RIGHT: auto">Regards,</SPAN></div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN style="RIGHT: auto">Ali</SPAN><BR style="RIGHT: auto"></div>
<DIV style="FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; FONT-SIZE: 12pt">
<DIV style="FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; FONT-SIZE: 12pt">
<DIV style="RIGHT: auto" dir=ltr>
<DIV style="LINE-HEIGHT: 0; MARGIN: 5px 0px; HEIGHT: 0px; FONT-SIZE: 0px" contentEditable=false readonly="true"></DIV><FONT size=2 face=Arial><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Sebastian Huber <sebastian.huber@embedded-brains.de><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> ali nasir <supremenasir@yahoo.com> <BR><B><SPAN style="FONT-WEIGHT: bold">Cc:</SPAN></B> "rtems-users@rtems.org" <rtems-users@rtems.org> <BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Tuesday, April 22, 2014 11:52 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: Overwriting of device block size from fat_init_volume_info<BR></FONT></DIV>
<DIV style="RIGHT: auto"><BR style="RIGHT: auto">Hello Ali,<BR clear=none><BR clear=none>On 2014-04-20 04:18, ali nasir wrote:<BR clear=none>> Hi,<BR clear=none>><BR clear=none>> In the RTEMS4.11 i see that the block device's block size is overwritten in the<BR clear=none>> rtems_disk_device depending on the cluster size or the alignment of the block<BR clear=none>> device.<BR clear=none>> We are migrating from 4.10.2 to 4.11. The block device we use is SD card. The<BR clear=none>> ioctl just checks for the bufnum field and reads those number of blocks from<BR clear=none>> the device. However, in the rtems4.11, with one particular SD card, the fat<BR clear=none>> overwrites the block size to 4K from 512. But the ioctl is not aware of the<BR clear=none>> same. Hence when the FAT tries to read a single block, it assumes that it will<BR clear=none>> get 4K of data. But the ioctl just sends out 512 bytes to the FAT layer.<BR
clear=none>><BR clear=none>> How should i take care of the overwriting of the block size by FAT? The block<BR clear=none>> device is created,at start up, with a block size of 512. Should the ioctl check<BR clear=none>> the block size in the rtems_disk_device pointer which the ioctl receives?<BR clear=none><BR clear=none>the block device cache uses two block sizes. One is the media block size which <BR clear=none>is the minimum transfer unit of a particular device/driver. The other is the <BR clear=none>block size used by the cache. It must be an integral multiple of the media <BR clear=none>block size.<BR clear=none><BR clear=none>I guess your driver doesn't evaluate the block device transfer request correctly.<BR clear=none><BR clear=none>/**<BR clear=none> * @brief Block device scatter or gather buffer structure.<BR clear=none> */<BR clear=none>typedef struct rtems_blkdev_sg_buffer {<BR clear=none>
/**<BR clear=none> * Block index.<BR clear=none> */<BR clear=none> rtems_blkdev_bnum block;<BR clear=none><BR clear=none> /**<BR clear=none> * Buffer length.<BR clear=none> */<BR clear=none> uint32_t length;<BR clear=none><BR clear=none> /**<BR clear=none> * Buffer pointer.<BR clear=none> */<BR clear=none> void *buffer;<BR clear=none><BR clear=none> /**<BR clear=none> * User pointer.<BR clear=none> */<BR clear=none> void *user;<BR clear=none>} rtems_blkdev_sg_buffer;<BR clear=none><BR clear=none>Please note that the length here may be an integral multiple of the media block
<DIV id=yqtfd53160><BR clear=none>size.<BR clear=none><BR clear=none>><BR clear=none>> This change in the fat_init_volume_info (to rewrite the block size) should be<BR clear=none>> there in the release notes as there is a chance that the ioctl's, which were<BR clear=none>> working with 4.10, may fail with 4.11.</DIV><BR clear=none><BR clear=none>We will add something to the release notes.<BR clear=none><BR clear=none>-- <BR clear=none>Sebastian Huber, embedded brains GmbH<BR clear=none><BR clear=none>Address : Dornierstr. 4, D-82178 Puchheim, Germany<BR clear=none>Phone : +49 89 189 47 41-16<BR clear=none>Fax : +49 89 189 47 41-09<BR clear=none>E-Mail : <A href="mailto:sebastian.huber@embedded-brains.de" shape=rect ymailto="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</A><BR clear=none>PGP : Public key available on request.<BR clear=none><BR clear=none>Diese Nachricht ist
keine geschäftliche Mitteilung im Sinne des EHUG.
<DIV id=yqtfd19527><BR clear=none></DIV><BR><BR></DIV></DIV></DIV></div></body></html>