textvp_fullpath
Uladzislau Rezki
v.rezkii at sam-solutions.net
Fri Aug 15 09:17:02 UTC 2008
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
More information about the freebsd-hackers
mailing list