write(2) to /dev/ad4 = EINVAL

Hans Petter Selasky hselasky at c2i.net
Mon Jan 26 09:08:03 PST 2009


On Monday 26 January 2009, Lukasz Jaroszewski wrote:
> 2009/1/26 Christoph Mallon <christoph.mallon at gmx.de>:
> > Lukasz Jaroszewski schrieb:
> >> 2009/1/26 Hans Petter Selasky <hselasky at c2i.net>:
> >>> On Monday 26 January 2009, Lukasz Jaroszewski wrote:

Hi,

> > It would be helpful, if you showed the actual code, instead of letting us
> > guess what you are doing.
>
> Ok, I solved that, I were trying to dd with bs correctly set, tho
> if=./s wasn't big enough plus I had code like below, where I didn't
> check write for errors, just called perror, which gave me wrong errno.
>
> So to change one byte, I need to read it, change it, and write it in
> 512 chunks? 

Yes! Maybe you should not write single bytes at a time in your design.

> or play with kernel and add smth like ``write_byte'' to 
> ata?

From my knowledge there is no standard harddisk command or SCSI command that 
can change only one byte at a time of the disk. It is all block based. And 
note that the block size can be different from 512 bytes.

--HPS


More information about the freebsd-hackers mailing list