--- libdiskfs/dir-lookup.c | 5 +++++ libdiskfs/diskfs.h | 3 +++ libdiskfs/fsys-getroot.c | 3 ++- libdiskfs/peropen-make.c | 8 ++++++++ libdiskfs/peropen-rele.c | 1 + 5 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c index 923be03..4532d40 100644 --- a/libdiskfs/dir-lookup.c +++ b/libdiskfs/dir-lookup.c @@ -82,6 +82,11 @@ diskfs_S_dir_lookup (struct protid *dircred, goto gotit; } + free (dircred->po->path); + dircred->po->path = strdup (path); /* XXX is this the right place? */ + if (! dircred->po->path) + return ENOMEM; + dnp = dircred->po->np; pthread_mutex_lock (&dnp->lock); diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h index 0f9c1d3..2489517 100644 --- a/libdiskfs/diskfs.h +++ b/libdiskfs/diskfs.h @@ -69,6 +69,9 @@ struct peropen mach_port_t shadow_root_parent; /* If in a shadow tree, its root node in this translator. */ struct node *shadow_root; + + /* Path relative to the root of the translator. */ + char *path; }; /* A unique one of these exists for each node currently in use (and diff --git a/libdiskfs/fsys-getroot.c b/libdiskfs/fsys-getroot.c index 2e11da4..39973a8 100644 --- a/libdiskfs/fsys-getroot.c +++ b/libdiskfs/fsys-getroot.c @@ -51,7 +51,8 @@ diskfs_S_fsys_getroot (fsys_t controlport, { root_parent: dotdot, shadow_root_parent: MACH_PORT_NULL, - shadow_root: _diskfs_chroot_directory ? diskfs_root_node : NULL /* XXX */ + shadow_root: _diskfs_chroot_directory ? diskfs_root_node : NULL, /* XXX */ + path: NULL, }; if (!pt) diff --git a/libdiskfs/peropen-make.c b/libdiskfs/peropen-make.c index d37516c..d0ac698 100644 --- a/libdiskfs/peropen-make.c +++ b/libdiskfs/peropen-make.c @@ -34,6 +34,7 @@ diskfs_make_peropen (struct node *np, int flags, struct peropen *context, po->refcnt = 0; po->openstat = flags; po->np = np; + po->path = NULL; if (context) { @@ -50,6 +51,13 @@ diskfs_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; + } } else { diff --git a/libdiskfs/peropen-rele.c b/libdiskfs/peropen-rele.c index 08276ec..d3f7492 100644 --- a/libdiskfs/peropen-rele.c +++ b/libdiskfs/peropen-rele.c @@ -45,5 +45,6 @@ diskfs_release_peropen (struct peropen *po) diskfs_nput (po->np); + free (po->path); free (po); } -- 1.7.10.4