Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 May 2001 13:58:20 +0100
From:      Brian Somers <brian@Awfulhak.org>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc:        Brian Somers <brian@Awfulhak.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, brian@Awfulhak.org
Subject:   Re: cvs commit: src/sys/fs/devfs devfs_vnops.c 
Message-ID:  <200105171258.f4HCwKb63116@hak.lan.Awfulhak.org>
In-Reply-To: Message from Poul-Henning Kamp <phk@critter.freebsd.dk>  of "Tue, 15 May 2001 10:25:30 %2B0200." <30165.989915130@critter> 

next in thread | previous in thread | raw e-mail | index | archive | help
> >>   Revision  Changes    Path
> >>   1.23      +7 -15     src/sys/fs/devfs/devfs_vnops.c
> >
> >Does this mean that I can catch ``open("/dev/tun")'' and clone (say) 
> >/dev/tun100, returning that ?
> 
> yes :-)

I think the only thing that's missing is that you can't have the 
clone handler called for an existing device node.

I'd like to be able to make_dev() /dev/tun during attach and allow 
the sysadmin (or whatever) to change it's permissions.  Then, when an 
attempt to open it is made, have my clone handler called.  My clone 
handler make_dev()s /dev/tunN and returns that.  When /dev/tunN's 
final close is done, I destroy_dev() it.

Unfortunately, I don't think this can be done very easily.  We'd need 
to allocate a new vnode only at open time - probably in vn_open.  
It'd probably be convenient if devfs was able to set some new vnode 
flag in vnodes returned from it's lookup based on some flag passed 
into make_dev() (oops, there are no flags there).  When vn_open() 
sees the flag, it calls some registered handler that goes off and 
returns either the original vnode or (if successfully cloned) a new 
vnode.

Does any of that make sense ?

> -- 
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk@FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe    
> Never attribute to malice what can adequately be explained by incompetence.

-- 
Brian <brian@Awfulhak.org>                        <brian@[uk.]FreeBSD.org>
      <http://www.Awfulhak.org>;                   <brian@[uk.]OpenBSD.org>
Don't _EVER_ lose your sense of humour !



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105171258.f4HCwKb63116>