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

>>>     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.

Then you will need to either go through and change all the tests such
as you describe or you will have to give up on using VCHR.  But see

>> specfs is not a filesystem in the sense of something mountable.
>> It's [...check out what (eg) ffs and nfs do...]
> 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?

Right.  The relevant device driver handles that.  That's one of the
things specfs mediates.

> 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.

Then a character special device is the wrong abstraction.  A character
special device is the glue to a device driver; a file descriptor
resulting from opening one should talk to the device driver, not to the
filesystem the node exists on.  That's what VCHR vnodes _are_.

If you want I/O requests to go to your filesystem rather than the
device driver, a VCHR is not what you want.  Normally, I'd suggest a
VREG, but you said you're doing a devfs, which leads me to suspect that
at least one of us is confused - probably me, since I've never worked
with a devfs.  Perhaps if you answer this is will help un-confuse me:
why do you want I/O to go to your filesystem code rather than to the
device driver appropriate for the device?  The latter is what I'd
expect based on what little I know of devfses.

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

Home | Main Index | Thread Index | Old Index