Subject: Re: disklabel behaving badly (i386)
To: <>
From: David Laight <david@l8s.co.uk>
List: current-users
Date: 08/04/2003 15:47:52
On Sun, Aug 03, 2003 at 11:06:47PM -0700, walt wrote:
> I have NetBSD -current on wd1 and FreeBSD -current on wd0.
> 
> I can read the NetBSD disklabel from wd1 with no problems, but the
> FreeBSD disklabel seems to be causing a problem on wd0:  when I
> try 'disklabel wd0' the program lands in an infinite loop trying
> to read the same sector endlessly.

I believe sysinst gets equally confused....

> Here is part of 'ktruss disklabel wd0' :
> 
>   1366 disklabel open("/dev/rwd0d", 0, 0x64)       = 3
>   1366 disklabel pread(0x3, 0xbfbff95c, 0x200, 0, 0) = 512
>  
> "\M-kH\<90>\<D0>\<BC>\0|\M-{P\aP\^_\M-|\M->\^[|\<BF>\^[\^FPW\<B9>\M-e\^A\M-s\<A4>\M-K\<BD>\M->\a\<B1>\^D8n\0|\tu\^S\M^C\<C5>\^P\M-b\M-t\<CD>\^X\<8B>\M-u\M^C"

Mmmm gibberish...

> 
>   1366 disklabel pread(0x3, 0xbfbff95c, 0x200, 0, 0x6c1a7600) = 512
>        "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
 
> So why is disklabel trying to read the same sector over and over?
Because of a bug :-)


> And what is the number 0x6c1a7600 ?  Is that an offset?

Yes - the byte offset on the disk.

>  From the pread manpage:
> pread(int d, void *buf, size_t nbytes, off_t offset);
> 
> I'm confused about how many arguments pread needs -- is
> it four or five, and what is the fifth argument?

The 4th argument is 64bit, looks like ktrace is treating it as 2 32bit
arguments (not surprising really).

kdump -x might be more enlightening, or just an 'hexdump -C -n512 /dev/rwd0d'

	David

-- 
David Laight: david@l8s.co.uk