device cloning on open

Matthew Dillon dillon at apollo.backplane.com
Fri Apr 6 11:48:48 PDT 2007


:Do you suppose adding a new D_MAKECLONE bit in the si_flags makes sense?
:That way devices can be explicit about whether they can/want to be cloned. 

    No, I'd rather the device open routine itself decide.  Upper layers
    shouldn't have to know.

:Unless VOP_OPEN is changed we'll still hit specfs, but only for spec_open().
:spec_open() should be modified when an fp is passed in so that fp->f_data
:is setup with the dev_data struct. If this is an initial open (hmm, how do
:I figure it out?), then dd_orig_vp->v_rdev is copied to dd_dev. Otherwise

    Right.  If a non-NULL fp is passed, it IS an initial open (always).

:create a clone of dd_orig_vp->v_rdev (using make_sub_dev() maybe?).
:spec_open() should also setup the fp->f_ops to a new set of fileops that
:uses the dev_d*() functions directly. Am I correct so far?

    Yes, that sounds right.

:Now, this might be a stupid question, does the higher level VFS system like
:the filesystem call the VOP_OPEN of the lower layer, like of the disk
:partitions? I'm just trying to figure out potential problems down stream.

    Yup, it sure does!

:Well, let me take a stab at it and see how that goes. Hmm, maybe I can use
:the vkernel...
:
:Cheers,
:Toby

    Please feel free to post patches and or questions!  Especially if you
    get stuck.  Use the virtual kernel facility to test your kernel code.

					-Matt
					Matthew Dillon 
					<dillon at backplane.com>





More information about the Kernel mailing list