#1474 closed defect (fixed)

read/write a logical disc is not transparent

Reported by: Oleg Owned by: thomas.doerfler
Priority: normal Milestone: 4.10
Component: fs Version: 4.10
Severity: minor Keywords:
Cc: joel.sherrill@…, chrisj@…, nbkolchin@…, sebastian.huber@… Blocked By:


According to sources read/write operations with logical disk without bdbuf library (i.e. not via file system, but as raw block devices) will not work.

This is because bdbuf read/write code uses absolute block offsets (related to physical device) when running RTEMS_BLKIO_REQUEST operations, and as the result generic ioctl code does not do this, but it seems to me that a requester should not know the details of disk organization, and should NOT use absolute value in rtems_blkdev_sg_buffer::block field!

But instead generic rtems_blkdev_generic_ioctl() function SHOULD add necessary offset.

I can see that Thomas modified rtems_blkdev_generic_ioctl() function a bit and now it passes pointer to a rtems_disk_device data structure instead of physical disk device identifier.

From my opinion this was not a good solution, and he should have done the following instead:

  • update bdbuf in a way that it uses relative block offsets in rtems_blkdev_sg_buffer::block field.
  • update rtems_blkdev_generic_ioctl() that it add necessary offset to rtems_blkdev_sg_buffer::block field, OR better this offset should be passed to a driver ioctl() handler.

Now you have not very good situation, because:

  • device drivers should know about logical/physical devices (at least ATA driver calls rtems_disk_physical_device_number(dd) function, which is BAD.
  • there is no generic support code for logical devices - each reader should take care of "start" of a logical device;
  • from application point of view read/write to/from logical/physical device should not differ in any detail, but right now this is not the case - an application should add "start" offset for logical device.

Thomas, what do you think?
You were a guy who modified it recently, even though it was incorrect before as well, but you might have fixed this if you started this work.

Attachments (1)

disk.patch (7.6 KB) - added by Sebastian Huber on Dec 7, 2009 at 2:35:52 PM.
Proposed changes

Download all attachments as: .zip

Change History (3)

comment:1 Changed on Nov 19, 2009 at 12:46:46 PM by Sebastian Huber

Cc: chrisj@… sebastian.huber@… added

Changed on Dec 7, 2009 at 2:35:52 PM by Sebastian Huber

Attachment: disk.patch added

Proposed changes

comment:2 Changed on Dec 18, 2009 at 2:57:27 PM by Sebastian Huber

Resolution: fixed
Status: newclosed

Fixed in CVS.

Note: See TracTickets for help on using tickets.