From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 15 09:17:01 2008 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 EB73B106566B for ; Fri, 15 Aug 2008 09:17:01 +0000 (UTC) (envelope-from V.Rezkii@sam-solutions.net) Received: from c71.sam-solutions.net (c71.sam-solutions.net [217.21.35.67]) by mx1.freebsd.org (Postfix) with ESMTP id 6AC048FC1D for ; Fri, 15 Aug 2008 09:17:00 +0000 (UTC) (envelope-from V.Rezkii@sam-solutions.net) Received: from pc636.sam-solutions.net ([192.168.117.46]) by c71.sam-solutions.net over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 15 Aug 2008 12:16:36 +0300 From: Uladzislau Rezki Organization: SS To: Roman Divacky Date: Fri, 15 Aug 2008 12:17:03 +0300 User-Agent: KMail/1.9.9 References: <200808142120.13609.v.rezkii@sam-solutions.net> <20080814184329.GA60497@freebsd.org> In-Reply-To: <20080814184329.GA60497@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200808151217.04626.v.rezkii@sam-solutions.net> X-OriginalArrivalTime: 15 Aug 2008 09:16:36.0736 (UTC) FILETIME=[9E3D8000:01C8FEB7] Cc: freebsd-hackers@freebsd.org Subject: Re: textvp_fullpath 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: Fri, 15 Aug 2008 09:17:02 -0000 On 14 August 2008 21:43:29 Roman Divacky wrote: > On Thu, Aug 14, 2008 at 09:20:12PM +0300, Uladzislau Rezki wrote: > > Hello folks, > > > > I'm using "textvp_fullpath" function to get full path from vnode up to > > root dir. The problem is that, sometimes it works, sometimes no. > > > > I know that "textvp_fullpath" goes through the cache of the vnode and > > try to build full path. > > > > Are there any other ways to get full path? > > I haven't had any ideas yet, that is why I am asking you. > > no... the vnode->full_path lookup is unreliable by definition Yes , I've already got it. > in FreeBSD... what exactly are you trying to acomplish? I believe > there might be other way to do whatever you want to do.. > Well, I will try to describe it in more detail what i want to do, see below: The main task is, to pass information from the kernel space to user land about modification of file system via character device. For instance, we do something like that: echo 123 >> /etc/passwd we intercept the "write" system call and from this point we are within our own call: static int our_own_write_syscall (struct proc *p, struct write_args *uap) { struct vnode *vn = NULL; struct file *file; int sys_error; /* do system call */ sys_error = write(p, uap); if (sys_error != 0) goto leave_call; /* get the file */ file = p->p_fd->fd_ofiles[uap->fd]; /* get the vnode */ vn = (struct vnode *) file->f_data; ... } We have to to do a few thinks: 1) do original "write" sys call; 2) get full path (/etc/passwd); 3) put all this information to user land through the character device. I get stuck in point 2. I need to get full path, but how ... Thanks in advance. -- Uladzislau Rezki