From owner-freebsd-hackers Thu Aug 16 10:26: 9 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from elvis.mu.org (elvis.mu.org [216.33.66.196]) by hub.freebsd.org (Postfix) with ESMTP id ED60437B405 for ; Thu, 16 Aug 2001 10:25:58 -0700 (PDT) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id D3C0381D0D; Thu, 16 Aug 2001 12:25:58 -0500 (CDT) Date: Thu, 16 Aug 2001 12:25:58 -0500 From: Alfred Perlstein To: Sansonetti Laurent Cc: freebsd-hackers@freebsd.org Subject: Re: Getting filename from descriptor or vnode struct Message-ID: <20010816122558.L38066@elvis.mu.org> References: <001501c12678$56cd2320$0201a8c0@teledisnet.be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <001501c12678$56cd2320$0201a8c0@teledisnet.be>; from lorenzo@linuxbe.org on Thu, Aug 16, 2001 at 07:24:43PM +0200 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Sansonetti Laurent [010816 12:22] wrote: > Hi hackers, > > I'm confronted to a problem when I try to hack getdirentries(2) in a kld > module : > > To summarize, getdirentries() filled in a buffer a series of dirent struct, > and the 'd_name' field represents the filename (without the full path). I > must recover the full path because I've on disk a list of files to hide ... > > The field 'fd' in getdirentries_args is the file descriptor of the > directory.. and I've discovered that the field 'p_fd' from struct proc is a > filedesc struct which contains a vnode struct representing the current > directory ('fd_cdir'). > > VOP_GETATTR() doesn't allow me to recover this.. > > If someone could help me, thanks in advance ! Since a vnode may be referenced by multiple hardlinks it can't have a name really. You could hack on struct file so that it keeps a copy of the filename passed to open(2). -- -Alfred Perlstein [alfred@freebsd.org] Ok, who wrote this damn function called '??'? And why do my programs keep crashing in it? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message