Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jan 2009 11:31:50 +0100
From:      Christoph Mallon <christoph.mallon@gmx.de>
To:        Lukasz Jaroszewski <lvj@nietykalni.org>
Cc:        freebsd-hackers@freebsd.org, Hans Petter Selasky <hselasky@c2i.net>
Subject:   Re: write(2) to /dev/ad4 = EINVAL
Message-ID:  <497D9116.1040408@gmx.de>
In-Reply-To: <3930e0780901260224ye4acbabx7a629ec8da195138@mail.gmail.com>
References:  <3930e0780901260135j1428e77fmfe7392770fcd31fc@mail.gmail.com>	<200901261109.43376.hselasky@c2i.net> <3930e0780901260224ye4acbabx7a629ec8da195138@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Lukasz Jaroszewski schrieb:
> 2009/1/26 Hans Petter Selasky <hselasky@c2i.net>:
>> On Monday 26 January 2009, Lukasz Jaroszewski wrote:
>>> Hi,
>>> after opening /dev/ad4 with success for O_RDWR, I am getting [EINVAL]
>>> from write(2), which according to man 2 write, means
>>>  ``     [EINVAL]           The pointer associated with d was
>>> negative.'', as you can see below it is not true, I have tried
>>> different block sizes, with same result.
>>>
>>> How can I write one byte to /dev/adN ?
>> Hi,
>>
>> You cannot write one byte to /dev/adN, I think. Harddisks are block based.
>> Please see:
>>
>> diskinfo -v ad4
>>
>> And especially the "sector size". When you seek and transfer data the offset
>> and length must be a factor of the "sector size" or "block size". See also
>> LBA, logical block address.
> 
> 
> Yes, I have tried with bs=512 and multiplies, no luck.
> 
> root@~(0)   diskinfo -v ad4
> ad4
>         512             # sectorsize
>         2029805568      # mediasize in bytes (1.9G)
>         3964464         # mediasize in sectors
>         3933            # Cylinders according to firmware.
>         16              # Heads according to firmware.
>         63              # Sectors according to firmware.
>         ad:CFx20CARDx200000190C # Disk ident.

It would be helpful, if you showed the actual code, instead of letting 
us guess what you are doing.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?497D9116.1040408>