DragonFly kernel List (threaded) for 2007-04
DragonFly BSD
DragonFly kernel List (threaded) for 2007-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: device cloning on open

From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 6 Apr 2007 11:44:53 -0700 (PDT)

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

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

					Matthew Dillon 

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