From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 13 21:37:36 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A94D6106564A for ; Wed, 13 Apr 2011 21:37:36 +0000 (UTC) (envelope-from jstuart@adaranet.com) Received: from barracuda.adaranet.com (smtp.adaranet.com [72.5.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id 888BF8FC12 for ; Wed, 13 Apr 2011 21:37:36 +0000 (UTC) X-ASG-Debug-ID: 1302730655-522b08af0001-P5m3U7 Received: from SJ-EXCH-1.adaranet.com ([10.10.1.29]) by barracuda.adaranet.com with ESMTP id bfW6k4jus5JEkIli; Wed, 13 Apr 2011 14:37:35 -0700 (PDT) X-Barracuda-Envelope-From: jstuart@adaranet.com Received: from SJ-EXCH-1.adaranet.com ([fe80::7042:d8c2:5973:c523]) by SJ-EXCH-1.adaranet.com ([fe80::7042:d8c2:5973:c523%14]) with mapi; Wed, 13 Apr 2011 14:37:35 -0700 From: Jonathan Stuart X-Barracuda-BBL-IP: fe80::7042:d8c2:5973:c523 X-Barracuda-RBL-IP: fe80::7042:d8c2:5973:c523 To: Matthew Fleming Date: Wed, 13 Apr 2011 14:37:54 -0700 X-ASG-Orig-Subj: RE: Getting vnode + credentials of a file from a struct mount and UFS inode # Thread-Topic: Getting vnode + credentials of a file from a struct mount and UFS inode # Thread-Index: Acv6IpZn2WoRJLb6QXSmaIzqbyZdzQAABssQ Message-ID: <32AB5C9615CC494997D9ABB1DB12783C024E929FDC@SJ-EXCH-1.adaranet.com> References: <32AB5C9615CC494997D9ABB1DB12783C024E929F93@SJ-EXCH-1.adaranet.com> <32AB5C9615CC494997D9ABB1DB12783C024E929FD0@SJ-EXCH-1.adaranet.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Barracuda-Connect: UNKNOWN[10.10.1.29] X-Barracuda-Start-Time: 1302730655 X-Barracuda-URL: http://172.16.10.203:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at adaranet.com X-Mailman-Approved-At: Wed, 13 Apr 2011 23:23:16 +0000 Cc: "freebsd-hackers@freebsd.org" Subject: RE: Getting vnode + credentials of a file from a struct mount and UFS inode # X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Apr 2011 21:37:36 -0000 Yes, however getvnode() does initialize a struct file *.. but f_cred seems = to not contain valid/correct entries. In my last post I probably should have pointed out that I have the inode st= ored from another operation. Jon -----Original Message----- From: Matthew Fleming [mailto:mdf356@gmail.com] Sent: Wednesday, April 13, 2011 2:35 PM To: Jonathan Stuart Cc: freebsd-hackers@freebsd.org Subject: Re: Getting vnode + credentials of a file from a struct mount and = UFS inode # On Wed, Apr 13, 2011 at 2:18 PM, Jonathan Stuart wro= te: > Hi Matthew, > > Thanks, I'll give it a shot.. for some reason f_cred off the vnode is ret= urning all zeros for uid/gid, and > pulling the VTOI does the same thing (using getvnode()).. do these not ge= t initialized properly? f_cred is a field in struct file, not struct vnode, so I'm confused as to what you're referring to. Cheers, matthew > -----Original Message----- > From: Matthew Fleming [mailto:mdf356@gmail.com] > Sent: Wednesday, April 13, 2011 1:48 PM > To: Jonathan Stuart > Cc: freebsd-hackers@freebsd.org > Subject: Re: Getting vnode + credentials of a file from a struct mount an= d UFS inode # > > On Wed, Apr 13, 2011 at 12:31 PM, Jonathan Stuart = wrote: >> Hi, >> >> I'd like to pull the owner/group ownership from a file (the information = I have about the file is it's UFS inode # and it's struct mount *). I'm su= re there's got to be a function that would return a vnode and I could VTOI(= ) to get this information from the inode.. but I'm having a brainfreeze. >> > > VFS_VGET(mp, ino, flags, &vp) is probably what you want. > > Cheers, > matthew >