[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/17] libnetfs: track file name in struct peropen
From: |
Justus Winter |
Subject: |
[PATCH 04/17] libnetfs: track file name in struct peropen |
Date: |
Thu, 11 Jul 2013 18:09:07 +0200 |
---
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
- RFC: get_translator_info, needed for a mtab translator, Justus Winter, 2013/07/03
- [PATCH] get_translator_info wip, Justus Winter, 2013/07/03
- Re: [PATCH] get_translator_info wip, Samuel Thibault, 2013/07/08
- [PATCH 02/17] libnetfs: fix consistency check, Justus Winter, 2013/07/11
- [PATCH 03/17] libdiskfs: track file name in struct peropen, Justus Winter, 2013/07/11
- [PATCH 04/17] libnetfs: track file name in struct peropen,
Justus Winter <=
- [PATCH 08/17] libtrivfs: add fsys_get_children, Justus Winter, 2013/07/11
- [PATCH 09/17] trans/symlink.c: add fsys_get_children, Justus Winter, 2013/07/11
- [PATCH 05/17] libfshelp: add translator-list.c, Justus Winter, 2013/07/11
- [PATCH 06/17] libdiskfs: add fsys_get_children, Justus Winter, 2013/07/11
- [PATCH 07/17] libnetfs: add fsys_get_children, Justus Winter, 2013/07/11
- [PATCH 10/17] hurd: add fsys_get_children, Justus Winter, 2013/07/11
- Re: [PATCH 10/17] hurd: add fsys_get_children, Neal H. Walfield, 2013/07/12
- Re: [PATCH 10/17] hurd: add fsys_get_children, Samuel Thibault, 2013/07/12
- Re: [PATCH 10/17] hurd: add fsys_get_children, Justus Winter, 2013/07/12
- Re: [PATCH 10/17] hurd: add fsys_get_children, Neal H. Walfield, 2013/07/12