On Tue, Feb 21, 2012 at 01:25:40PM -0500, Kenneth R Westerback wrote:
> On Tue, Feb 21, 2012 at 12:55:36PM -0500, Ted Unangst wrote:
> > On Tue, Feb 21, 2012, Kenneth R Westerback wrote:
> > > On Tue, Feb 21, 2012 at 03:15:29PM +0200, Alexey Vatchenko wrote:
> > >> Reading 512 bytes from raw device with 2048 sector size fails. If i read
> > >> 512 bytes from block device the problem is not reproduced.
> > 
> > > This is intentional. You cannot read from a raw device fewer bytes
> > > at a time than the minimum the device provides per i/o. On block
> > > devices the buffer cache does the correct size i/o and extracts
> > > just the number of bytes you requested.
> > 
> > That's backwards from what I thought.  The raw device should let you
> > read byte by byte, the block device only lets you read block by block,
> > as it were.
> 
> Block/Sector based devices can only provide entire blocks/sectors,
> at block/sector addresses. The buffer cache and standard i/o routines
> provide the abstraction that you can start and stop at any byte.
> 
> Doing I/O to raw devices means you are taking full responsibility for
> paying attention to the boundaries and sizes of the i/o.

I thought that it was bug because it's a character device.

Anyway, the problem is fsck that execv fsck_msdos with raw device.
Maybe better to keep device name from the calling process (fsck)?

Reply via email to