From owner-freebsd-arch Thu Nov 1 14:43: 1 2001 Delivered-To: freebsd-arch@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id 2FA8F37B405; Thu, 1 Nov 2001 14:42:58 -0800 (PST) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id fA1Mgip157396; Thu, 1 Nov 2001 17:42:44 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: References: Date: Thu, 1 Nov 2001 17:42:41 -0500 To: Julian Elischer , Robert Watson From: Garance A Drosihn Subject: Re: Changes to suser() and friends Cc: arch@FreeBSD.ORG Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 1:35 PM -0800 11/1/01, Julian Elischer wrote: >On Thu, 1 Nov 2001, Robert Watson wrote: > >> >> error = suser(p->p_ucred); >> or >> error = suser(td->td_proc->p_ucred); >> or >> error = suser(td->td_ucred); > >the reason for the existance of suser_td is so that it could be called >by functions for which 'thread *' was an opaque pointer.. i.e. there >are many places that use suser() and suser_td() that do not include >proc.h and thus do not know about any sub elements of the thread >structure. (or proc structure) 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? [disclaimer: this is clearly not my area of coding, so it may very well be that the above *is* too stupid for words... :-) ] -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message