[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dentry and vfsmount
"fred xvii" <fredxvii@hotmail.com> wrote:
>
> hi,
>
> I have a dentry pointer, and I'd like to get its canonical absolute path.
> I've noticed the function d_path (in include/linux/sched.h) but, it request
> a vfsmount argument. Unfortunatly, I only have a dentry. So where can I get
> the vfsmount arg ?
Little patch here (it's from Linus) will allow __d_path to take a NULL
vfsmount pointer.
===== fs/dcache.c 1.59 vs edited =====
--- 1.59/fs/dcache.c Wed Jun 25 16:30:53 2003
+++ edited/fs/dcache.c Sat Jul 5 12:39:32 2003
@@ -1309,10 +1309,12 @@
for (;;) {
struct dentry * parent;
- if (dentry == root && vfsmnt == rootmnt)
+ if (dentry == root && (vfsmnt == rootmnt || !vfsmnt))
break;
- if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
+ if ((vfsmnt && dentry == vfsmnt->mnt_root) || IS_ROOT(dentry)) {
/* Global root? */
+ if (!vfsmnt)
+ goto global_root;
if (vfsmnt->mnt_parent == vfsmnt)
goto global_root;
dentry = vfsmnt->mnt_mountpoint;
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/