From owner-freebsd-hackers Sun Aug 15 15:33:19 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from cygnus.rush.net (cygnus.rush.net [209.45.245.133]) by hub.freebsd.org (Postfix) with ESMTP id 6838314CF3 for ; Sun, 15 Aug 1999 15:33:14 -0700 (PDT) (envelope-from bright@rush.net) Received: from localhost (bright@localhost) by cygnus.rush.net (8.9.3/8.9.3) with SMTP id SAA24677; Sun, 15 Aug 1999 18:40:04 -0400 (EDT) Date: Sun, 15 Aug 1999 18:40:00 -0400 (EDT) From: Alfred Perlstein To: John Polstra Cc: hackers@FreeBSD.ORG Subject: Re: Getting device and inode number from a vnode In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 15 Aug 1999, John Polstra wrote: > I have two VFS-related questions which are probably pretty basic. > > 1. I have a pointer to a vnode and I want to get the corresponding > dev_t and inode number. Is there a non-sleazy way to do that other > than calling vn_stat? use vn_todev from "vfs_subr.c" ~line 2970 of 2976 if you just need the dev_t. but you may wind up needing the GETATTR call for the inode lookup. > 2. The first action of vn_stat is to call VOP_GETATTR. VOP_GETATTR(9) > says, "The file should not be locked on entry." But when stat calls > vn_stat, the vnode is locked. Which is correct -- or doesn't it > matter? the lookup at the begininngin of the stat() call's side-effect is to lock the vnode it returns but kern/vnode.src seems to indicate that the vnode's locking state doesn't matter... so does the various states that vnodes are in when called from vfs_syscalls, such as the lseek syscall. it's slighly confusing, if the vnode is locked for "access" calls why is it not locked for attribute calls? -Alfred Perlstein - [bright@rush.net|alfred@freebsd.org] Wintelcom systems administrator and programmer - http://www.wintelcom.net/ [bright@wintelcom.net] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message