summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2013-07-16 10:28:01 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-08-28 23:20:25 +0200
commit82843893f464f258d31ea3a70977e8b82a72bbb5 (patch)
tree2f9302ca387e467d9cf6196d0dbf11c0987faab3
parenta2e7bbe6a98806d7749f6799abf42758c38c3f6b (diff)
libnetfs: properly respond to file_get_translator requests
Properly respond to file_get_translator requests for nodes with a passive translator record. * libnetfs/file-get-translator.c (netfs_S_file_get_translator): Handle passive translator records.
-rw-r--r--libnetfs/file-get-translator.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libnetfs/file-get-translator.c b/libnetfs/file-get-translator.c
index 59e61020..3e183c14 100644
--- a/libnetfs/file-get-translator.c
+++ b/libnetfs/file-get-translator.c
@@ -109,6 +109,20 @@ netfs_S_file_get_translator (struct protid *user,
*translen = len;
err = 0;
}
+ else if (np->nn_translated & S_IPTRANS)
+ {
+ char *string = NULL;
+ size_t len = 0;
+ err = netfs_get_translator (np, &string, &len);
+ if (!err)
+ {
+ if (len > *translen)
+ *trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
+ memmove (*trans, string, len);
+ *translen = len;
+ free (string);
+ }
+ }
else
err = EINVAL;