Subject: Re: mkdir with trailing / (patch proposed)
To: Bill Studenmund <wrstuden@netbsd.org>
From: enami tsugutomo <enami@sm.sony.co.jp>
List: tech-kern
Date: 04/30/2002 09:15:09
Bill Studenmund <wrstuden@netbsd.org> writes:

> > But this is also necessary for mkdir(2) case.  Currently, fs code
> > assumes that the last components is NUL terminated (but not always,
> > since lookup code works with trailing /).  I think just always trust
> > the length of component instead is consistient.  Of course, this
> > changes protocol between each fs and fs independent layer (but is it
> > well defined?)
> 
> Is it? I agree that the memcpy code is exactly the memcpy code you'd use
> for a NUL terminated string. But for example ufs only looks at cn_namelen
> characters. It copies cn_namelen + 1, but only ever looks at cn_namelen of
> them. While adding a trailing '\0' might make dumps look nice, I don't
> think we need it.

Sorry, I meant that either

	(1) replace trailing slash for last componet with NUL.
or
	(2) don't expect that the last componet doesn't have trailing
            slash.  instead, use the length of the componet.

is necessary, and I like (2).  Not saying that ``(2) is necessary
anyway''.

> either. It just seems a bit weird for RENAME to be adding CREATEDIR. :-)

Doesn't it create new directory entry?  Anyway, the name doesn't so
matter.

enami.