Subject: Re: access to device fails after update
To: None <current-users@NetBSD.org>
From: Jukka Salmi <jukka-netbsd@2004.salmi.ch>
List: current-users
Date: 06/20/2004 18:55:19
Hi,

Michael Eriksson --> current-users (2004-06-20 15:11:09 +0200):
> Jukka Salmi wrote:
> > Jukka Salmi --> current-users (2004-06-16 09:35:33 +0200):
> > > since I updated my current NetBSD i386 system (sources from yesterday)
> > > I can't write images to CF cards anymore:
> > > 
> > > $ gzip -dc image.gz | wc -c                   
> > >  5242880
> > > $ gzip -dc image.gz | dd of=/dev/rwd0d bs=16k
> > > dd: /dev/rwd0d: Invalid argument
> > > 35+1 records in
> > > 35+0 records out
> > > 573440 bytes transferred in 1.712 secs (334953 bytes/sec)
> > > 
> > > This worked fine before, and still works fine when using NetBSD stable
> > > with the same hardware.
> > 
> > Tracing dd reveals the following:
> > 
> > [...]
> >    442 dd       CALL  read(0,0x804e000,0x4000)
> >    442 dd       GIO   fd 0 read 2084 bytes
> > [...]
> >    442 dd       RET   read 2084/0x824
> >    442 dd       CALL  __sigprocmask14(1,0x804c334,0xbfbfeaa0)
> >    442 dd       RET   __sigprocmask14 0
> >    442 dd       CALL  write(3,0x804e000,0x824)
> >    442 dd       RET   write -1 errno 22 Invalid argument
> > [...]
> 
> The raw device /dev/rwd0d can only do writes which are a multiple of
> the block size (512 bytes).

Yes, but the file I'm trying to write to /dev/rwd0d is 5242880
(== 16k * 320 == 10240 * 512) bytes, and I'm using bs=16k, so that
should work, shouldn't it?

I think gzip is the problem: using a gzip binary from a stable (1.6.2)
system works; using one from -current does not. Furhtermore, using

	$ gzip -dc image.gz >out; cat out | dd of=/dev/rwd0d bs=16k

works, but 

	$ gzip -dc image.gz | dd of=/dev/rwd0d bs=16k

does not; after reading and writing a certain amount of data, dd
all at once reads only 2084 instead of 16k bytes (see trace above)
if data is coming from gzip.


Any hints?

TIA, Jukka

-- 
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~