Date: Mon, 15 Feb 1999 16:46:19 -0500 (EST) From: Luoqi Chen <luoqi@watermarkgroup.com> To: dillon@apollo.backplane.com, hackers@FreeBSD.ORG Subject: Re: VOP_REMOVE() rules for freeing a_cnp ? Message-ID: <199902152146.QAA14975@lor.watermarkgroup.com>
next in thread | raw e-mail | index | archive | help
> I can't make heads or tails of the VOP_REMOVE() rules for freeing > a_cnp. > I guess you meant freeing a_cnp->cn_pnbuf. For VOP_REMOVE() shouldn't need to free pnbuf because it's already freed by namei itself (namei frees pnbuf unless SAVENAME or SAVESTART is set). > The man page doesn't say anything about having to free cnp. > > ufs_remove() doesn't bother. > This is correct. > nfs_remove() always frees it. > This is wrong. > And the unlink() system call seems to expect the cnp to be freed > by the VOP_REMOVE() function. > See above. > Typically the rule for freeing a struct componentname in a VOP > routine is 'free it if you return an error, otherwise only free > it if the SAVESTART flag is not set in cn_flags'. > Personally I feel it should be the caller's responsibility to free pnbuf, but not VOP routines', just as VOP routines shouldn't vrele any vnode arguments, otherwise implementation of stackable FS would be a nightmare. > I would appreciate it if a VFS guru could look at this junk and > tell me whos right. > > Matthew Dillon > <dillon@backplane.com> > -lq To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902152146.QAA14975>