On Mon, May 03, 2010 at 08:53:33PM -0400, Edward Ned Harvey wrote:
> I have a specific task at hand, but I'm feeling a little bit overwhelmed, so
> I'm looking for any guidance possible, to keep me on track, or otherwise,
> anything that can help me keep moving toward my goal. Hell, if you want to
> write 15 lines of code for me, I would sure be happy. ;-) But I'm not
> expecting that.
>
>
>
> I am not usually an opensolaris contributor. I don't need to become an
> expert (I hope.) I do have a degree in CS, so I'm plenty familiar with
> C/C++, but at work, I'm mostly an IT guy and less a software developer. So
> I should be considered an entry level (but basically qualified) programmer.
>
>
>
> Specifically, I want to reverse lookup, inode number --> absolute path. I
> understand this can only be done by root, and presents at least some
> security risk, and cannot be done for files (only directories) and many
> other limitations. But I want to do it anyway.
Under what circumstances are you doing this? Is this a kernel driver,
a /dev/kmem reader, etc? Do you want it for any possible file, a file open
in some process's file descriptor table, or what?
If you want to get this for a process' files, you can do:
# pfiles pid
^^^ pid of process of interest
If you want to do it for some filesystem, you can do:
# find /path/to/filesystem -xdev -inum NNN
^^ the inode number
If you've got a kernel virtual address for your vnode, you can use
MDB to get the path:
# mdb -k
...
> vnode_address::vnode2path
^^^^^^^^^^^^^
replace this with the address of the vnode
Basically, there are several different ways to do this, and without
knowing the intent and speed requirements, it's hard to know which approach
to suggest.
> The problem I'm facing is: When I look up vnode_t, it appears to be a huge
> struct, with all the variables etc having names and such, which I don't
> understand, and I don't know how to properly create this object. I don't
> see any documentation explaining what vrootp is, or vp, or how to construct
> those items correctly . And I haven't even come to the point of even
> *attempting* to figure out cred_t yet.
So are you writing a kernel driver? Why does it need to know the paths
of vnodes?
Cheers,
- jonathan
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code