From 2ea00da3929b9b50c3860914249b3ea7691b63c8 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Mon, 2 Sep 2013 11:37:06 +0200 Subject: libnetfs: track file name in struct peropen Track the relative path used to obtain a file handle in the struct peropen. * libnetfs/netfs.h (struct peropen): New field path. * libnetfs/make-peropen.c (netfs_make_peropen): Initialize path. * libnetfs/release-peropen.c (netfs_release_peropen): Free path. * libnetfs/fsys-getroot.c (netfs_S_fsys_getroot): Initialize path. * libnetfs/dir-lookup.c (netfs_S_dir_lookup): Preserve the path. --- libnetfs/make-peropen.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libnetfs/make-peropen.c') diff --git a/libnetfs/make-peropen.c b/libnetfs/make-peropen.c index 92f58da0..733bfdcb 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); -- cgit v1.2.3