tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: How to make character devices in non spec-fs file systems



On Thursday 29 October 2009 12:17:53 der Mouse wrote:
> >> Eh?  I don't understand.  Your character devices should be VCHR.
> >
> > Yes, but if I do that, the VFS code in the kernel will call specfs
> > functions on my vnode, because there are hardcoded checks like:
> >
> >     if (vn->v_type == VCHR)
> >             call into specfs code(vn);
>
> Yes.  That's how device special files work.

Yes, but I am not using specfs. I want to redirect the VCHR vnops directly to 
my devfs.

>
> > And because my vnode is not initialised by specfs, it panics.  I am
> > not using specfs for my character device.  I am using a separately
> > mounted filesystem called "FreeBSD devfs".
>
> specfs is not a filesystem in the sense of something mountable.  It's a
> collection of code for implementing various special things, such as
> device special files, which othewise would mean a bunch of relatively
> complicated code duplicated in every device-supporting filesystem.  I'd
> suggest you look at how existing filesystems, like ffs and nfs,
> implement VCHR and VBLK vnodes; that should be able to guide you in
> when and how you need to make calls into the specfs code.

From what I understand ffs and nfs only allow node creation. ffs and nfs does 
not handle any read/write requests, for example, on a character device, right? 
That is where the difference is. I've implemented something similar to ffs, 
only that when the character device file residing in my devfs is opened the 
ffs [example] gets the read/write and not specfs. Do you see?

--HPS



Home | Main Index | Thread Index | Old Index