Subject: Re: eliminating veriexec #ifdefs in vfs_vnops.c
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Elad Efrat <elad@NetBSD.org>
List: tech-kern
Date: 12/30/2006 16:35:04
YAMAMOTO Takashi wrote:

> in the case of UIO_USERSPACE, currently namei() does copyinstr().
> ie. one copy.
> with your change, pathname_get() does copyinstr, and then namei() does
> copystr().  ie. two copies.
> don't you consider it as an additional cost at all?

did you measure it?

how about we add a new namei flag, HASNAME, that if set, namei() will
not do any of the allocation/copy:

	if ((cnp->cn_flags & HASNAME) == 0) {
		/* PNBUF_GET() */
		/* copyin/copyinstr... */
	} else {
		cnp->cn_pnbuf = ndp->ni_dirp;
	}

	/* PNBUF_PUT() -> if (!HASNAME) PNBUF_PUT() */

and then, in vn_open(), just call namei() with that flag after
pathname_get()? would that work? otherwise we still have to have
loads of #ifdefs in vn_open() and it's staying ugly.

-e.