summaryrefslogtreecommitdiff
path: root/libnetfs
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2013-11-06 11:22:50 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-01-12 19:17:00 +0100
commit4de65c4af42894f57b8b8c3a050260725a96b109 (patch)
tree9cc603cea3f25cf83888dd17e1c02893d5ab66ec /libnetfs
parent0033d20449b3bb558f2ea470983018db39b572aa (diff)
libfshelp: fix the api of fshelp_set_active_translator
To detect if an active translator goes away, we need to register for dead name notifications. Those notifications have to be sent to a port known to the ports library, as the ports library handles the dead name notifications. The most straight forward way is to use the port to the underlying node for that. To that end, a reference to the port_info struct is handed in and kept in the list of active translators. This commit also moves the registration of dead name notifications to libfshelp. * libfshelp/fshelp.h (fshelp_set_active_translator): Add port_info argument. * libfshelp/translator-list.c (struct translator): Add port_info pointer. (translator_ihash_cleanup): Dereference port_info object. (fshelp_set_active_translator): Register dead name notifications. * libdiskfs/file-set-trans.c (diskfs_S_file_set_translator): Update accordingly. * libnetfs/file-set-translator.c (netfs_S_file_set_translator): Likewise.
Diffstat (limited to 'libnetfs')
-rw-r--r--libnetfs/file-set-translator.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/libnetfs/file-set-translator.c b/libnetfs/file-set-translator.c
index a9883a3a..b46eb029 100644
--- a/libnetfs/file-set-translator.c
+++ b/libnetfs/file-set-translator.c
@@ -1,5 +1,6 @@
/*
- Copyright (C) 1996, 1997, 1999, 2001, 2013 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1999, 2001, 2013, 2014
+ Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -175,20 +176,8 @@ netfs_S_file_set_translator (struct protid *user,
}
}
- if (! err && user->po->path)
- err = fshelp_set_active_translator (user->po->path, active);
-
- if (! err && active != MACH_PORT_NULL)
- {
- mach_port_t old;
- err = mach_port_request_notification (mach_task_self (), active,
- MACH_NOTIFY_DEAD_NAME, 0,
- user->pi.port_right,
- MACH_MSG_TYPE_MAKE_SEND_ONCE,
- &old);
- if (old != MACH_PORT_NULL)
- mach_port_deallocate (mach_task_self (), old);
- }
+ if (! err && user->po->path && active_flags & FS_TRANS_SET)
+ err = fshelp_set_active_translator (&user->pi, user->po->path, active);
out:
pthread_mutex_unlock (&np->lock);