summaryrefslogtreecommitdiff
path: root/libnetfs
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2017-08-22 13:07:54 +0200
committerJustus Winter <justus@gnupg.org>2017-09-12 10:41:35 +0200
commite08859424e01697fe556e277283e8e1905327ce7 (patch)
tree93bf0ad8e0af70cffa177c4271a31a5b15d533c8 /libnetfs
parent04aaffbd6353e7cec04073783cc8cbd22ac2f675 (diff)
libfshelp: Use node instead of name as key.
Previously, libfshelp used the name of an translator as key in the hash table. This however is flawed, because a translator is bound to a node, and a node can have zero or more links in the file system. Use the nodes address (or rather, the address of the transbox embedded in the node) as key instead. * libfshelp/fshelp.h (fshelp_set_active_translator): Instead of the control port, hand the whole transbox to the function. * libfshelp/translator-list.c (struct translator): New field 'locp'. (hash): Hash pointer. (compare): Compare pointer. (translator_ihash): Use an location pointer. (fshelp_set_active_translator): Use the address of the transbox as key. (fshelp_remove_active_translator): Remove using the location pointer. * libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Fix callsite. * libdiskfs/file-set-trans.c (diskfs_S_file_set_translator): Likewise. * libnetfs/dir-lookup.c (netfs_S_dir_lookup): Likewise. * libnetfs/file-set-translator.c (netfs_S_file_set_translator): Likewise.
Diffstat (limited to 'libnetfs')
-rw-r--r--libnetfs/dir-lookup.c2
-rw-r--r--libnetfs/file-set-translator.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/libnetfs/dir-lookup.c b/libnetfs/dir-lookup.c
index bfac2acd..a135917f 100644
--- a/libnetfs/dir-lookup.c
+++ b/libnetfs/dir-lookup.c
@@ -306,7 +306,7 @@ netfs_S_dir_lookup (struct protid *dircred,
err = fshelp_set_active_translator (&newpi->pi,
complete_path,
- np->transbox.active);
+ &np->transbox);
if (complete_path != translator_path)
free(complete_path);
if (err)
diff --git a/libnetfs/file-set-translator.c b/libnetfs/file-set-translator.c
index bac950e3..2b71848c 100644
--- a/libnetfs/file-set-translator.c
+++ b/libnetfs/file-set-translator.c
@@ -178,7 +178,7 @@ netfs_S_file_set_translator (struct protid *user,
}
if (! err && user->po->path && active_flags & FS_TRANS_SET)
- err = fshelp_set_active_translator (&user->pi, user->po->path, active);
+ err = fshelp_set_active_translator (&user->pi, user->po->path, &np->transbox);
out:
pthread_mutex_unlock (&np->lock);