Subject: Re: Understanding foo_open, foo_read, etc.
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 08/29/2006 18:39:43
> What mystifies me is that the cdevsw open routine on NetBSD fills in
> a struct file *, then "returns" it using fdclone (which actually does
> deep magic elsewhere in the kernel to drop the cdevsw-based file
> entry it had already created, and take the new one instead),

Yes, this is what I was referring to when I said I'd simplified away
the stuff done for /dev/fd.  (Cloning devices have magic of their own,
but it's different magic.)

> and the FreeBSD one just returns zero, letting the cdevsw structure
> do the work...

> Because the FreeBSD code is cloning the device, and the NetBSD code
> isn't.

Hmm, I too find that difference mysterious.

> The obvious thing I was missing was [...], and the subtle thing I was
> missing was [...].

Ah.  Yes, given your current explanation, I can see how you could get
confused - and I think you have probably managed to get unconfused.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B