Overwriting of device block size from fat_init_volume_info

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Apr 22 06:22:00 UTC 2014


Hello Ali,

On 2014-04-20 04:18, ali nasir wrote:
> Hi,
>
> In the RTEMS4.11 i see that the block device's block size is overwritten in the
> rtems_disk_device depending on the cluster size or the alignment of the block
> device.
> We are migrating from 4.10.2 to 4.11. The block device we use is SD card. The
> ioctl just checks for the bufnum field and reads those number of blocks from
> the device. However, in the rtems4.11, with one particular SD card, the fat
> overwrites the block size to 4K from 512. But the ioctl is not aware of the
> same. Hence when the FAT tries to read a single block, it assumes that it will
> get 4K of data. But the ioctl just sends out 512 bytes to the FAT layer.
>
> How should i take care of the overwriting of the block size by FAT? The block
> device is created,at start up, with a block size of 512. Should the ioctl check
> the block size in the rtems_disk_device pointer which the ioctl receives?

the block device cache uses two block sizes.  One is the media block size which 
is the minimum transfer unit of a particular device/driver.  The other is the 
block size used by the cache.  It must be an integral multiple of the media 
block size.

I guess your driver doesn't evaluate the block device transfer request correctly.

/**
  * @brief Block device scatter or gather buffer structure.
  */
typedef struct rtems_blkdev_sg_buffer {
   /**
    * Block index.
    */
   rtems_blkdev_bnum block;

   /**
    * Buffer length.
    */
   uint32_t length;

   /**
    * Buffer pointer.
    */
   void *buffer;

   /**
    * User pointer.
    */
   void *user;
} rtems_blkdev_sg_buffer;

Please note that the length here may be an integral multiple of the media block 
size.

>
> This change in the fat_init_volume_info (to rewrite the block size) should be
> there in the release notes as there is a chance that the ioctl's, which were
> working with 4.10, may fail with 4.11.

We will add something to the release notes.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the users mailing list