tech-kern archive

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

Re: factoring out the change_root() and making exporting change_{root,dir}() as interface



On Wed, Jul 29, 2009 at 06:13:19PM +0200, Christoph Badura wrote:
 > On Wed, Jul 29, 2009 at 04:15:54AM +0000, David Holland wrote:
 > > On Wed, Jul 29, 2009 at 12:36:37AM +0200, Christoph Badura wrote:
 > >  > -       if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0)
 > >  > +       if ((error = fd_getvnode(fd, &fp)) != 0)
 > > that doesn't look right.
 > 
 > That is actually preceded by
 >         int              error, fd = SCARG(uap, fd);
 > it just fetch SCARG(uap, fd) a second time.

Ah, didn't see that properly.

 > >  > -static int
 > >  > +int
 > >  >  change_dir(struct nameidata *ndp, struct lwp *l)
 > >  >  {
 > > 
 > > Is it feasible to adjust this to pass a vnode instead of nameidata?
 > 
 > change_dir() actually does the namei() lookup currently.

Yeah, and not the chdir, as Elad pointed out.

 > I suppose it's possible to change the interface by moving a small bit
 > of common code out of it.

Probably better would be to move the common nameidata initialization
into it, and return a vnode out.

But in any event its name needs to be changed. :-|

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index