Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Aug 2008 12:17:03 +0300
From:      Uladzislau Rezki <v.rezkii@sam-solutions.net>
To:        Roman Divacky <rdivacky@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: textvp_fullpath
Message-ID:  <200808151217.04626.v.rezkii@sam-solutions.net>
In-Reply-To: <20080814184329.GA60497@freebsd.org>
References:  <200808142120.13609.v.rezkii@sam-solutions.net> <20080814184329.GA60497@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808151217.04626.v.rezkii>