From owner-freebsd-arch@FreeBSD.ORG Wed Apr 16 17:52:14 2008 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87E5A106564A; Wed, 16 Apr 2008 17:52:14 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.freebsd.org (Postfix) with ESMTP id 220D38FC1E; Wed, 16 Apr 2008 17:52:14 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 95F9F46B33; Wed, 16 Apr 2008 13:52:12 -0400 (EDT) Date: Wed, 16 Apr 2008 18:52:12 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Alfred Perlstein In-Reply-To: <20080416170341.GN95731@elvis.mu.org> Message-ID: <20080416184522.F1046@fledge.watson.org> References: <20071218092222.GA9695@freebsd.org> <200712201138.56423.jhb@freebsd.org> <20080412112019.GI45299@garage.freebsd.pl> <200804161014.41025.jhb@freebsd.org> <20080416165612.GA31094@garage.freebsd.pl> <20080416170341.GN95731@elvis.mu.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: kib@freebsd.org, Roman Divacky , Pawel Jakub Dawidek , freebsd-arch@freebsd.org Subject: Re: final decision about *at syscalls X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Apr 2008 17:52:14 -0000 On Wed, 16 Apr 2008, Alfred Perlstein wrote: >> File descriptor proposal works like this: >> >> userland >> openat(fd, path) >> kernel >> NDINIT_AT(&vp, path, fd); >> /* operate on vp */ >> >> Vnode proposal works this way: >> >> userland >> openat(fd, path) >> kernel >> dvp = file_descriptor_to_vnode(fd); >> NDINIT_AT(&vp, path, dvp); >> /* operate on vp */ > > My first impression is that passing fp to vp code is a layering > violation and bad news. I need to think about it more. NDINIT() is already aware of the file descriptor array because it uses that to get the current working and root directories. And what the *at() system calls are effectively doing is substituting another directory for the current working directory. The exact expression of all this doesn't matter all that much to me, but I think evaluating the file descriptor array for directory stuff all in one place, rather than spread over the caller and NDINIT(), is cleaner and avoids a lot of code everywhere. Nothing says you can't have: void NDINIT(struct nameidata *ndp, u_long op, u_long flags, enum uio_seg segflg, const char *namep, struct thread *td); void NDINIT_AT(struct nameidata *ndp, u_long op, u_long flags, enum uio_seg segflg, const char *namep, int fd, struct thread *td); NDINIT_DVP(struct nameidata *ndp, u_long op, u_long flags, enum uio_seg segflg, const char *namep, struct vnode *vp, struct thread *td); However, I think I wouldn't want NDINIT_AT() to be a wrapper for NDINIT_DVP(), because I'd like all that fdp following to occur together. Robert N M Watson Computer Laboratory University of Cambridge