From 06d49cdadd9e96361f3fe49b9c940b88bb869284 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Mon, 2 Sep 2013 11:37:05 +0200 Subject: libdiskfs: track file name in struct peropen Track the relative path used to obtain a file handle in the struct peropen. * libdiskfs/diskfs.h (struct peropen): New field path. * libdiskfs/peropen-make.c (diskfs_make_peropen): Initialize path. * libdiskfs/peropen-rele.c (diskfs_release_peropen): Free path. * libdiskfs/fsys-getroot.c (diskfs_S_fsys_getroot): Initialize path. * libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Preserve the path. --- libdiskfs/peropen-make.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libdiskfs/peropen-make.c') diff --git a/libdiskfs/peropen-make.c b/libdiskfs/peropen-make.c index d37516c1..b11b2ad6 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 { -- cgit v1.2.3