Date: Thu, 1 Nov 2001 15:29:46 -0800 (PST) From: Kelly Yancey <kbyanc@posi.net> To: Garance A Drosihn <drosih@rpi.edu> Cc: Julian Elischer <julian@elischer.org>, Robert Watson <rwatson@FreeBSD.ORG>, arch@FreeBSD.ORG Subject: Re: Changes to suser() and friends Message-ID: <Pine.BSF.4.21.0111011522310.40755-100000@gateway.posi.net> In-Reply-To: <p05101006b8077cf25f07@[128.113.24.47]>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 1 Nov 2001, Garance A Drosihn wrote: > Hmm. It is nicer when fewer source files are mucking around in the > internals of a data structure. Still, it would be nice to collapse > to fewer routines. Would the following be any better? > > int suser __P((struct ucred *cred, struct proc *proc, int flag)); > int suser_td __P((struct ucred *cred, struct thread *thread, int flag)); > > and say that the current 'suser(struct proc *)' > be done as new 'suser(NULL, struct proc *, 0)', > and the current 'suser_td(struct thread *)' > be done as new 'suser_td(NULL, struct thread *, 0)' > or is that too stupid for words? Or maybe switch the positions of > 'cred' and 'proc/thread', just so the most common callers would just > have 'NULL, 0' as the last two parameters. Does that add too much > overhead? > I acknowledge I have no specific insight into suser(), but I would like to add that if you are going to have two different behaviours keyed off of whether a parameter is NULL or not, it is more logical to have two separate functions representing those behaviours. See realloc as an example of what happens when you overload a function with multiple behaviours keyed off of a parameter value. This is presumably the exact sort of overloading that the current (albeit poorly named) set of functions was intended to avoid. Kelly P.S. I like my bikesheds blue. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0111011522310.40755-100000>