[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 7/7] trans: make the fakeroot environment more transparent
From: |
Justus Winter |
Subject: |
[PATCH 7/7] trans: make the fakeroot environment more transparent |
Date: |
Wed, 4 Dec 2013 12:11:56 +0100 |
Previously fakeroot did not explicitly proxy io_identity requests, so
the default implementation from libnetfs handled them. But as the fsys
identity port returned was always netfs_fsys_identity, this broke the
getcwd logic (assuming /media/scratch is a translator):
% cd /media/scratch/foo && fakeroot-hurd pwd
/foo
Fix this by proxying io_identity requests. Since then no-one is
handing out our netfs_fsys_identity port anymore, an optimization in
netfs_fsys_identity is made obsolete by this change.
* trans/fakeroot.c (netfs_S_dir_lookup): Adjust code accordingly.
(netfs_S_io_identity): New function.
---
trans/fakeroot.c | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index 24d3a4f..1342844 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -290,16 +290,7 @@ netfs_S_dir_lookup (struct protid *diruser,
{
/* Talking to ourselves! We just looked up one of our
own nodes. Find the node and return it. */
- struct protid *cred
- = ports_lookup_port (netfs_port_bucket, file,
- netfs_protid_class);
- mach_port_deallocate (mach_task_self (), idport);
- mach_port_deallocate (mach_task_self (), file);
- if (cred == 0)
- return EGRATUITOUS;
- np = cred->po->np;
- netfs_nref (np);
- ports_port_deref (cred);
+ assert (! "reached");
}
else
{
@@ -788,6 +779,27 @@ netfs_S_io_map_cntl (struct protid *user,
return err;
}
+error_t
+netfs_S_io_identity (struct protid *user,
+ mach_port_t *id,
+ mach_msg_type_name_t *idtype,
+ mach_port_t *fsys,
+ mach_msg_type_name_t *fsystype,
+ ino_t *fileno)
+{
+ error_t err;
+
+ if (!user)
+ return EOPNOTSUPP;
+
+ *idtype = *fsystype = MACH_MSG_TYPE_MOVE_SEND;
+
+ pthread_mutex_lock (&user->po->np->lock);
+ err = io_identity (user->po->np->nn->file, id, fsys, fileno);
+ pthread_mutex_unlock (&user->po->np->lock);
+ return err;
+}
+
#define NETFS_S_SIMPLE(name) \
error_t \
netfs_S_##name (struct protid *user) \
--
1.7.10.4
- [PATCH 1/7] auth: improve the auth_demuxer function, Justus Winter, 2013/12/04
- [PATCH 3/7] trans: remove unused declaration from fakeroot.c, Justus Winter, 2013/12/04
- [PATCH 4/7] trans: improve the netfs_demuxer function in fakeroot.c, Justus Winter, 2013/12/04
- [PATCH 5/7] trans: fix the creation of files in fakeroot, Justus Winter, 2013/12/04
- [PATCH 2/7] utils: improve the auth_demuxer function in fakeauth.c, Justus Winter, 2013/12/04
- [PATCH 7/7] trans: make the fakeroot environment more transparent,
Justus Winter <=
- [PATCH 6/7] trans: fix transparent reauthentication in fakeroot, Justus Winter, 2013/12/04
- Re: [PATCH 1/7] auth: improve the auth_demuxer function, Samuel Thibault, 2013/12/04