--- libnetfs/dir-lookup.c | 5 +++++ libnetfs/fsys-getroot.c | 6 +++++- libnetfs/make-peropen.c | 8 ++++++++ libnetfs/netfs.h | 2 ++ libnetfs/release-peropen.c | 1 + 5 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/libnetfs/dir-lookup.c b/libnetfs/dir-lookup.c index f1b6438..2ce8cda 100644 --- a/libnetfs/dir-lookup.c +++ b/libnetfs/dir-lookup.c @@ -74,6 +74,11 @@ netfs_S_dir_lookup (struct protid *diruser, goto gotit; } + free (diruser->po->path); + diruser->po->path = strdup (filename); /* XXX is this the right place? */ + if (! diruser->po->path) + return ENOMEM; + dnp = diruser->po->np; pthread_mutex_lock (&dnp->lock); diff --git a/libnetfs/fsys-getroot.c b/libnetfs/fsys-getroot.c index a1dd5e5..0d80111 100644 --- a/libnetfs/fsys-getroot.c +++ b/libnetfs/fsys-getroot.c @@ -43,7 +43,11 @@ netfs_S_fsys_getroot (mach_port_t cntl, error_t err; struct protid *newpi; mode_t type; - struct peropen peropen_context = { root_parent: dotdot }; + struct peropen peropen_context = + { + root_parent: dotdot, + path: NULL, + }; if (!pt) return EOPNOTSUPP; diff --git a/libnetfs/make-peropen.c b/libnetfs/make-peropen.c index 92f58da..0d46ea3 100644 --- a/libnetfs/make-peropen.c +++ b/libnetfs/make-peropen.c @@ -31,6 +31,7 @@ netfs_make_peropen (struct node *np, int flags, struct peropen *context) po->refcnt = 0; po->openstat = flags; po->np = np; + po->path = NULL; if (context) { @@ -47,6 +48,13 @@ netfs_make_peropen (struct node *np, int flags, struct peropen *context) if (po->shadow_root_parent != MACH_PORT_NULL) mach_port_mod_refs (mach_task_self (), po->shadow_root_parent, MACH_PORT_RIGHT_SEND, 1); + + if (context->path) + { + po->path = strdup (context->path); + if (! po->path) + return ENOMEM; + } } netfs_nref (np); diff --git a/libnetfs/netfs.h b/libnetfs/netfs.h index d1ebed0..2b9454a 100644 --- a/libnetfs/netfs.h +++ b/libnetfs/netfs.h @@ -63,6 +63,8 @@ struct peropen mach_port_t shadow_root_parent; /* If in a shadow tree, its root node in this translator. */ struct node *shadow_root; + + char *path; }; /* A unique one of these exists for each node currently in use. */ diff --git a/libnetfs/release-peropen.c b/libnetfs/release-peropen.c index 3e65099..d4d3574 100644 --- a/libnetfs/release-peropen.c +++ b/libnetfs/release-peropen.c @@ -41,6 +41,7 @@ netfs_release_peropen (struct peropen *po) netfs_nput (po->np); + free (po->path); free (po); } } -- 1.7.10.4