summaryrefslogtreecommitdiff
path: root/libdiskfs
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 /libdiskfs
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 'libdiskfs')
-rw-r--r--libdiskfs/file-set-trans.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/libdiskfs/file-set-trans.c b/libdiskfs/file-set-trans.c
index 8de2e641..58f62550 100644
--- a/libdiskfs/file-set-trans.c
+++ b/libdiskfs/file-set-trans.c
@@ -1,5 +1,5 @@
/* libdiskfs implementation of fs.defs: file_set_translator
- Copyright (C) 1992,93,94,95,96,99,2001,02,13
+ Copyright (C) 1992,93,94,95,96,99,2001,02,13,14
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
@@ -208,20 +208,8 @@ diskfs_S_file_set_translator (struct protid *cred,
pthread_mutex_unlock (&np->lock);
- if (! error && cred->po->path)
- error = fshelp_set_active_translator (cred->po->path, active);
-
- if (! error && active != MACH_PORT_NULL)
- {
- mach_port_t old;
- error = mach_port_request_notification (mach_task_self (), active,
- MACH_NOTIFY_DEAD_NAME, 0,
- cred->pi.port_right,
- MACH_MSG_TYPE_MAKE_SEND_ONCE,
- &old);
- if (old != MACH_PORT_NULL)
- mach_port_deallocate (mach_task_self (), old);
- }
+ if (! error && cred->po->path && active_flags & FS_TRANS_SET)
+ error = fshelp_set_active_translator (&cred->pi, cred->po->path, active);
return error;
}